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

Unified Diff: src/handles.h

Issue 10640012: Add a second kind of HandleScope that ties the lifetime of Handles created in its scope to the life… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleanup. Created 8 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
Index: src/handles.h
diff --git a/src/handles.h b/src/handles.h
index 960696b5fb81f705f2128b5586fef44ca0c8e7fb..a369646600556d94a27c2870d1463cbc67a66fe0 100644
--- a/src/handles.h
+++ b/src/handles.h
@@ -95,6 +95,9 @@ class Handle {
};
+class HandleScopeImplementer;
+
+
// A stack-allocated class that governs a number of local handles.
// After a handle scope has been created, all local handles will be
// allocated within that handle scope until either the handle scope is
@@ -157,10 +160,54 @@ class HandleScope {
static void ZapRange(internal::Object** start, internal::Object** end);
friend class v8::HandleScope;
+ friend class v8::internal::HandleScopeImplementer;
friend class v8::ImplementationUtilities;
};
+class DeferredHandles;
+
+
+class DeferredHandleScope {
+ public:
+ explicit DeferredHandleScope(Isolate* isolate);
+ // The DeferredHandles object returned stores the Handles created
+ // since the creation of this DeferredHandleScope. The Handles are
+ // alive till as long as the DeferredHandles object is alive.
Erik Corry 2012/06/27 10:28:15 till as long as -> as long as
sanjoy 2012/06/27 11:17:09 Fixed.
+ DeferredHandles* Detach();
+ ~DeferredHandleScope();
+
+ private:
+ Object** prev_limit_;
+ Object** prev_next_;
+ HandleScopeImplementer* impl_;
+
+#ifdef DEBUG
+ bool handles_detached_;
+ int prev_level_;
+#endif
+
+ friend class HandleScopeImplementer;
+};
+
+
+class CompilationInfo;
Erik Corry 2012/06/27 10:28:15 This declaration and the CompilationHandleScope ar
sanjoy 2012/06/27 11:17:09 Moved to compiler.h.
+
+
+// A wrapper around a CompilationInfo that Detaches the Handles from
Erik Corry 2012/06/27 10:28:15 Detaches -> detaches
sanjoy 2012/06/27 11:17:09 Fixed.
+// the underlying DeferredHandleScope and stores them in info_ on
+// destruction.
+class CompilationHandleScope BASE_EMBEDDED {
+ public:
+ explicit CompilationHandleScope(CompilationInfo* info);
+ ~CompilationHandleScope();
+
+ private:
+ DeferredHandleScope deferred_;
+ CompilationInfo* info_;
+};
+
+
// ----------------------------------------------------------------------------
// Handle operations.
// They might invoke garbage collection. The result is an handle to

Powered by Google App Engine
This is Rietveld 408576698