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

Unified Diff: runtime/vm/isolate.h

Issue 187503002: 1. Restructure reusable handles to make individual Scopes for each handle type (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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/dart_api_impl.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.h
===================================================================
--- runtime/vm/isolate.h (revision 33332)
+++ runtime/vm/isolate.h (working copy)
@@ -64,18 +64,6 @@
class ObjectIdRing;
-#define REUSABLE_HANDLE_LIST(V) \
- V(Object) \
- V(Array) \
- V(String) \
- V(Instance) \
- V(Function) \
- V(Field) \
- V(Class) \
- V(TypeParameter) \
- V(TypeArguments) \
-
-
class IsolateVisitor {
public:
IsolateVisitor() {}
@@ -87,6 +75,16 @@
DISALLOW_COPY_AND_ASSIGN(IsolateVisitor);
};
+#define REUSABLE_HANDLE_LIST(V) \
+ V(Object) \
+ V(Array) \
+ V(String) \
+ V(Instance) \
+ V(Function) \
+ V(Field) \
+ V(Class) \
+ V(TypeParameter) \
+ V(TypeArguments) \
class Isolate : public BaseIsolate {
public:
@@ -439,6 +437,25 @@
return thread_state_;
}
+#if defined(DEBUG)
+#define REUSABLE_HANDLE_SCOPE_ACCESSORS(object) \
+ void set_reusable_##object##_handle_scope_active(bool value) { \
+ reusable_##object##_handle_scope_active_ = value; \
+ } \
+ bool reusable_##object##_handle_scope_active() const { \
+ return reusable_##object##_handle_scope_active_; \
+ }
+ REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_ACCESSORS)
+#undef REUSABLE_HANDLE_SCOPE_ACCESSORS
+#endif // defined(DEBUG)
+
+#define REUSABLE_HANDLE(object) \
+ object& object##Handle() const { \
+ return *object##_handle_; \
+ }
+ REUSABLE_HANDLE_LIST(REUSABLE_HANDLE)
+#undef REUSABLE_HANDLE
+
static void VisitIsolates(IsolateVisitor* visitor);
private:
@@ -505,10 +522,17 @@
// Reusable handles support.
#define REUSABLE_HANDLE_FIELDS(object) \
- object* object##_handle_; \
-
+ object* object##_handle_;
REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_FIELDS)
#undef REUSABLE_HANDLE_FIELDS
+
+#if defined(DEBUG)
+#define REUSABLE_HANDLE_SCOPE_VARIABLE(object) \
+ bool reusable_##object##_handle_scope_active_;
+ REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_VARIABLE);
+#undef REUSABLE_HANDLE_SCOPE_VARIABLE
+#endif // defined(DEBUG)
+
VMHandles reusable_handles_;
static Dart_IsolateCreateCallback create_callback_;
@@ -530,8 +554,10 @@
static Monitor* isolates_list_monitor_;
static Isolate* isolates_list_head_;
- friend class ReusableHandleScope;
- friend class ReusableObjectHandleScope;
+#define REUSABLE_FRIEND_DECLARATION(name) \
+ friend class Reusable##name##HandleScope;
+REUSABLE_HANDLE_LIST(REUSABLE_FRIEND_DECLARATION)
+#undef REUSABLE_FRIEND_DECLARATION
DISALLOW_COPY_AND_ASSIGN(Isolate);
};
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698