5#ifndef RUNTIME_VM_REUSABLE_HANDLES_H_
6#define RUNTIME_VM_REUSABLE_HANDLES_H_
34#define REUSABLE_SCOPE(name) \
35 class Reusable##name##HandleScope : public StackResource { \
37 explicit Reusable##name##HandleScope(Thread* thread = Thread::Current()) \
38 : StackResource(thread), thread_(thread) { \
39 ASSERT(!thread->reusable_##name##_handle_scope_active()); \
40 thread->set_reusable_##name##_handle_scope_active(true); \
42 ~Reusable##name##HandleScope() { \
43 ASSERT(thread_->reusable_##name##_handle_scope_active()); \
44 thread_->set_reusable_##name##_handle_scope_active(false); \
45 Handle().ptr_ = name::null(); \
47 name& Handle() const { \
48 ASSERT(thread_->name##_handle_ != nullptr); \
49 return *thread_->name##_handle_; \
54 DISALLOW_COPY_AND_ASSIGN(Reusable##name##HandleScope); \
57#define REUSABLE_SCOPE(name) \
58 class Reusable##name##HandleScope : public ValueObject { \
60 explicit Reusable##name##HandleScope(Thread* thread = Thread::Current()) \
61 : handle_(thread->name##_handle_) {} \
62 ~Reusable##name##HandleScope() { \
63 handle_->ptr_ = name::null(); \
65 name& Handle() const { \
66 ASSERT(handle_ != nullptr); \
72 DISALLOW_COPY_AND_ASSIGN(Reusable##name##HandleScope); \
78#define REUSABLE_ABSTRACT_TYPE_HANDLESCOPE(thread) \
79 ReusableAbstractTypeHandleScope reused_abstract_type(thread);
80#define REUSABLE_ARRAY_HANDLESCOPE(thread) \
81 ReusableArrayHandleScope reused_array_handle(thread);
82#define REUSABLE_CLASS_HANDLESCOPE(thread) \
83 ReusableClassHandleScope reused_class_handle(thread);
84#define REUSABLE_CODE_HANDLESCOPE(thread) \
85 ReusableCodeHandleScope reused_code_handle(thread);
86#define REUSABLE_ERROR_HANDLESCOPE(thread) \
87 ReusableErrorHandleScope reused_error_handle(thread);
88#define REUSABLE_EXCEPTION_HANDLERS_HANDLESCOPE(thread) \
89 ReusableExceptionHandlersHandleScope reused_exception_handlers_handle(thread);
90#define REUSABLE_FIELD_HANDLESCOPE(thread) \
91 ReusableFieldHandleScope reused_field_handle(thread);
92#define REUSABLE_FUNCTION_HANDLESCOPE(thread) \
93 ReusableFunctionHandleScope reused_function_handle(thread);
94#define REUSABLE_GROWABLE_OBJECT_ARRAY_HANDLESCOPE(thread) \
95 ReusableGrowableObjectArrayHandleScope reused_growable_object_array_handle( \
97#define REUSABLE_INSTANCE_HANDLESCOPE(thread) \
98 ReusableInstanceHandleScope reused_instance_handle(thread);
99#define REUSABLE_LIBRARY_HANDLESCOPE(thread) \
100 ReusableLibraryHandleScope reused_library_handle(thread);
101#define REUSABLE_LOADING_UNIT_HANDLESCOPE(thread) \
102 ReusableLoadingUnitHandleScope reused_loading_unit_handle(thread);
103#define REUSABLE_OBJECT_HANDLESCOPE(thread) \
104 ReusableObjectHandleScope reused_object_handle(thread);
105#define REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(thread) \
106 ReusablePcDescriptorsHandleScope reused_pc_descriptors_handle(thread);
107#define REUSABLE_SMI_HANDLESCOPE(thread) \
108 ReusableSmiHandleScope reused_smi_handle(thread);
109#define REUSABLE_STRING_HANDLESCOPE(thread) \
110 ReusableStringHandleScope reused_string_handle(thread);
111#define REUSABLE_TYPE_PARAMETERS_HANDLESCOPE(thread) \
112 ReusableTypeParametersHandleScope reused_type_parameters_handle(thread);
113#define REUSABLE_TYPE_ARGUMENTS_HANDLESCOPE(thread) \
114 ReusableTypeArgumentsHandleScope reused_type_arguments_handle(thread);
115#define REUSABLE_TYPE_PARAMETER_HANDLESCOPE(thread) \
116 ReusableTypeParameterHandleScope reused_type_parameter(thread);
117#define REUSABLE_WEAK_ARRAY_HANDLESCOPE(thread) \
118 ReusableWeakArrayHandleScope reused_weak_array(thread);
#define REUSABLE_SCOPE(name)
#define REUSABLE_HANDLE_LIST(V)