Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2383)

Unified Diff: runtime/vm/reusable_handles.h

Issue 1394673002: Move reusable handles from isolate to thread. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix release build Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/reusable_handles.h
diff --git a/runtime/vm/reusable_handles.h b/runtime/vm/reusable_handles.h
index c1b530103f8f4e53c27a4b8a6ba7aad85160a7d3..8f057ea8c2fedb4da47ddad44d925658dde82103 100644
--- a/runtime/vm/reusable_handles.h
+++ b/runtime/vm/reusable_handles.h
@@ -30,41 +30,42 @@ namespace dart {
// }
//
+
#if defined(DEBUG)
#define REUSABLE_SCOPE(name) \
class Reusable##name##HandleScope : public ValueObject { \
- public: \
- explicit Reusable##name##HandleScope(Isolate* isolate) \
- : isolate_(isolate) { \
- ASSERT(!isolate->reusable_##name##_handle_scope_active()); \
- isolate->set_reusable_##name##_handle_scope_active(true); \
+ public: \
+ explicit Reusable##name##HandleScope(Thread* thread) \
+ : thread_(thread) { \
+ ASSERT(!thread->reusable_##name##_handle_scope_active()); \
+ thread->set_reusable_##name##_handle_scope_active(true); \
} \
- Reusable##name##HandleScope() : isolate_(Isolate::Current()) { \
- ASSERT(!isolate_->reusable_##name##_handle_scope_active()); \
- isolate_->set_reusable_##name##_handle_scope_active(true); \
+ Reusable##name##HandleScope() : thread_(Thread::Current()) { \
+ ASSERT(!thread_->reusable_##name##_handle_scope_active()); \
+ thread_->set_reusable_##name##_handle_scope_active(true); \
} \
~Reusable##name##HandleScope() { \
- ASSERT(isolate_->reusable_##name##_handle_scope_active()); \
- isolate_->set_reusable_##name##_handle_scope_active(false); \
+ ASSERT(thread_->reusable_##name##_handle_scope_active()); \
+ thread_->set_reusable_##name##_handle_scope_active(false); \
Handle().raw_ = name::null(); \
} \
name& Handle() const { \
- ASSERT(isolate_->name##_handle_ != NULL); \
- return *isolate_->name##_handle_; \
+ ASSERT(thread_->name##_handle_ != NULL); \
+ return *thread_->name##_handle_; \
} \
- private: \
- Isolate* isolate_; \
+ private: \
+ Thread* thread_; \
DISALLOW_COPY_AND_ASSIGN(Reusable##name##HandleScope); \
};
#else
#define REUSABLE_SCOPE(name) \
class Reusable##name##HandleScope : public ValueObject { \
- public: \
- explicit Reusable##name##HandleScope(Isolate* isolate) \
- : handle_(isolate->name##_handle_) { \
+ public: \
+ explicit Reusable##name##HandleScope(Thread* thread) \
+ : handle_(thread->name##_handle_) { \
} \
Reusable##name##HandleScope() \
- : handle_(Isolate::Current()->name##_handle_) { \
+ : handle_(Thread::Current()->name##_handle_) { \
} \
~Reusable##name##HandleScope() { \
handle_->raw_ = name::null(); \
@@ -73,7 +74,7 @@ namespace dart {
ASSERT(handle_ != NULL); \
return *handle_; \
} \
- private: \
+ private: \
name* handle_; \
DISALLOW_COPY_AND_ASSIGN(Reusable##name##HandleScope); \
};
@@ -81,41 +82,40 @@ namespace dart {
REUSABLE_HANDLE_LIST(REUSABLE_SCOPE)
#undef REUSABLE_SCOPE
-#define REUSABLE_ABSTRACT_TYPE_HANDLESCOPE(isolate) \
- ReusableAbstractTypeHandleScope reused_abstract_type(isolate);
-#define REUSABLE_ARRAY_HANDLESCOPE(isolate) \
- ReusableArrayHandleScope reused_array_handle(isolate);
-#define REUSABLE_CLASS_HANDLESCOPE(isolate) \
- ReusableClassHandleScope reused_class_handle(isolate);
-#define REUSABLE_CODE_HANDLESCOPE(isolate) \
- ReusableCodeHandleScope reused_code_handle(isolate);
-#define REUSABLE_ERROR_HANDLESCOPE(isolate) \
- ReusableErrorHandleScope reused_error_handle(isolate);
-#define REUSABLE_EXCEPTION_HANDLERS_HANDLESCOPE(isolate) \
+#define REUSABLE_ABSTRACT_TYPE_HANDLESCOPE(thread) \
+ ReusableAbstractTypeHandleScope reused_abstract_type(thread);
+#define REUSABLE_ARRAY_HANDLESCOPE(thread) \
+ ReusableArrayHandleScope reused_array_handle(thread);
+#define REUSABLE_CLASS_HANDLESCOPE(thread) \
+ ReusableClassHandleScope reused_class_handle(thread);
+#define REUSABLE_CODE_HANDLESCOPE(thread) \
+ ReusableCodeHandleScope reused_code_handle(thread);
+#define REUSABLE_ERROR_HANDLESCOPE(thread) \
+ ReusableErrorHandleScope reused_error_handle(thread);
+#define REUSABLE_EXCEPTION_HANDLERS_HANDLESCOPE(thread) \
ReusableExceptionHandlersHandleScope \
- reused_exception_handlers_handle(isolate);
-#define REUSABLE_FIELD_HANDLESCOPE(isolate) \
- ReusableFieldHandleScope reused_field_handle(isolate);
-#define REUSABLE_FUNCTION_HANDLESCOPE(isolate) \
- ReusableFunctionHandleScope reused_function_handle(isolate);
-#define REUSABLE_GROWABLE_OBJECT_ARRAY_HANDLESCOPE(isolate) \
+ reused_exception_handlers_handle(thread);
+#define REUSABLE_FIELD_HANDLESCOPE(thread) \
+ ReusableFieldHandleScope reused_field_handle(thread);
+#define REUSABLE_FUNCTION_HANDLESCOPE(thread) \
+ ReusableFunctionHandleScope reused_function_handle(thread);
+#define REUSABLE_GROWABLE_OBJECT_ARRAY_HANDLESCOPE(thread) \
ReusableGrowableObjectArrayHandleScope \
- reused_growable_object_array_handle(isolate)
-#define REUSABLE_INSTANCE_HANDLESCOPE(isolate) \
- ReusableInstanceHandleScope reused_instance_handle(isolate);
-#define REUSABLE_LIBRARY_HANDLESCOPE(isolate) \
- ReusableLibraryHandleScope reused_library_handle(isolate);
-#define REUSABLE_OBJECT_HANDLESCOPE(isolate) \
- ReusableObjectHandleScope reused_object_handle(isolate);
-#define REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(isolate) \
- ReusablePcDescriptorsHandleScope reused_pc_descriptors_handle(isolate);
-#define REUSABLE_STRING_HANDLESCOPE(isolate) \
- ReusableStringHandleScope reused_string_handle(isolate);
-#define REUSABLE_TYPE_ARGUMENTS_HANDLESCOPE(isolate) \
- ReusableTypeArgumentsHandleScope reused_type_arguments_handle(isolate);
-#define REUSABLE_TYPE_PARAMETER_HANDLESCOPE(isolate) \
- ReusableTypeParameterHandleScope reused_type_parameter(isolate);
-
+ reused_growable_object_array_handle(thread)
+#define REUSABLE_INSTANCE_HANDLESCOPE(thread) \
+ ReusableInstanceHandleScope reused_instance_handle(thread);
+#define REUSABLE_LIBRARY_HANDLESCOPE(thread) \
+ ReusableLibraryHandleScope reused_library_handle(thread);
+#define REUSABLE_OBJECT_HANDLESCOPE(thread) \
+ ReusableObjectHandleScope reused_object_handle(thread);
+#define REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(thread) \
+ ReusablePcDescriptorsHandleScope reused_pc_descriptors_handle(thread);
+#define REUSABLE_STRING_HANDLESCOPE(thread) \
+ ReusableStringHandleScope reused_string_handle(thread);
+#define REUSABLE_TYPE_ARGUMENTS_HANDLESCOPE(thread) \
+ ReusableTypeArgumentsHandleScope reused_type_arguments_handle(thread);
+#define REUSABLE_TYPE_PARAMETER_HANDLESCOPE(thread) \
+ ReusableTypeParameterHandleScope reused_type_parameter(thread);
} // namespace dart
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698