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

Unified Diff: runtime/vm/handles.h

Issue 16174008: - Create isolate specific resuable handles and use them in the hot lookup paths. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/base_isolate.h ('k') | runtime/vm/handles.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/handles.h
===================================================================
--- runtime/vm/handles.h (revision 24061)
+++ runtime/vm/handles.h (working copy)
@@ -228,6 +228,7 @@
friend class HandleScope;
friend class Dart;
friend class ObjectStore;
+ friend class Isolate;
DISALLOW_ALLOCATION();
DISALLOW_COPY_AND_ASSIGN(Handles);
};
@@ -338,9 +339,48 @@
#endif // defined(DEBUG)
// Macro to start a no handles scope in the code.
-#define NOHANDLESCOPE(isolate) \
+#define NOHANDLESCOPE(isolate) \
dart::NoHandleScope no_vm_internal_handles_scope_(isolate);
+
+// The class ReusableHandleScope is used in regions of the
+// virtual machine where isolate specific reusable handles are used.
+// This class asserts that we do not add code that will result in recursive
+// uses of reusable handles.
+// It is used as follows:
+// {
+// REUSABLE_HANDLESCOPE(isolate);
+// ....
+// .....
+// code that uses isolate specific reusable handles.
+// ....
+// }
+#if defined(DEBUG)
+class ReusableHandleScope : public StackResource {
+ public:
+ explicit ReusableHandleScope(BaseIsolate* isolate);
+ ReusableHandleScope();
+ ~ReusableHandleScope();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ReusableHandleScope);
+};
+#else // defined(DEBUG)
+class ReusableHandleScope : public ValueObject {
+ public:
+ explicit ReusableHandleScope(BaseIsolate* isolate) { }
+ ReusableHandleScope() { }
+ ~ReusableHandleScope() { }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ReusableHandleScope);
+};
+#endif // defined(DEBUG)
+
+// Macro to start a no handles scope in the code.
Ivan Posva 2013/06/16 11:15:26 Comment does not match code.
siva 2013/06/19 20:41:55 Done.
+#define REUSABLE_HANDLESCOPE(isolate) \
+ dart::ReusableHandleScope reusable_vm_internal_handles_scope_(isolate);
+
} // namespace dart
#endif // VM_HANDLES_H_
« no previous file with comments | « runtime/vm/base_isolate.h ('k') | runtime/vm/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698