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

Unified Diff: src/compiler.h

Issue 10697094: 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: Created 8 years, 5 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 | « src/api.cc ('k') | src/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index 26c0ac43c1b33d5ea25c942544cd3cbb882a0b86..135904860eaea42e4790182d113bcd173b29bd2c 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -45,6 +45,8 @@ class CompilationInfo BASE_EMBEDDED {
CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone);
CompilationInfo(Handle<JSFunction> closure, Zone* zone);
+ ~CompilationInfo();
+
Isolate* isolate() {
ASSERT(Isolate::Current() == isolate_);
return isolate_;
@@ -173,6 +175,11 @@ class CompilationInfo BASE_EMBEDDED {
// current compilation pipeline.
void AbortOptimization();
+ void set_deferred_handles(DeferredHandles* deferred_handles) {
+ ASSERT(deferred_handles_ == NULL);
+ deferred_handles_ = deferred_handles;
+ }
+
private:
Isolate* isolate_;
@@ -259,6 +266,8 @@ class CompilationInfo BASE_EMBEDDED {
// CompilationInfo allocates.
Zone* zone_;
+ DeferredHandles* deferred_handles_;
+
DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
};
@@ -286,6 +295,23 @@ class CompilationInfoWithZone: public CompilationInfo {
};
+// A wrapper around a CompilationInfo that detaches the Handles from
+// the underlying DeferredHandleScope and stores them in info_ on
+// destruction.
+class CompilationHandleScope BASE_EMBEDDED {
+ public:
+ explicit CompilationHandleScope(CompilationInfo* info)
+ : deferred_(info->isolate()), info_(info) {}
+ ~CompilationHandleScope() {
+ info_->set_deferred_handles(deferred_.Detach());
+ }
+
+ private:
+ DeferredHandleScope deferred_;
+ CompilationInfo* info_;
+};
+
+
// The V8 compiler
//
// General strategy: Source code is translated into an anonymous function w/o
« no previous file with comments | « src/api.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698