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); |
}; |