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

Unified Diff: src/handles.cc

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: Address review. 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
« src/handles.h ('K') | « src/handles.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles.cc
diff --git a/src/handles.cc b/src/handles.cc
index def1604ac7438c5769a0cb6287fd009dee54758d..cffbaf85af02288ad4bbecd73ebcf03a63addda0 100644
--- a/src/handles.cc
+++ b/src/handles.cc
@@ -958,4 +958,42 @@ int Utf8Length(Handle<String> str) {
return len;
}
+
+GatheringHandleScope::GatheringHandleScope(CompilationInfo* info)
+ : info_(info) {
+ Isolate* isolate = info->isolate();
danno 2012/06/24 11:07:03 You should be able to put the code below in the Sc
+ v8::ImplementationUtilities::HandleScopeData* current =
+ isolate->handle_scope_data();
+ prev_next_ = current->next;
+ prev_limit_ = current->limit;
+
+ HandleScopeImplementer* impl = isolate->handle_scope_implementer();
+ impl->begin_persistence();
+ Object** new_next = impl->GetSpareOrNewBlock();
+ Object** new_limit = &new_next[kHandleBlockSize];
+ impl->blocks()->Add(new_next);
+
+ current->next = new_next;
+ current->limit = new_limit;
+ current->level++;
+}
+
+
+GatheringHandleScope::~GatheringHandleScope() {
+ Isolate* isolate = info_->isolate();
+ HandleScopeImplementer* impl = isolate->handle_scope_implementer();
+ HandleScopeImplementer::PersistentExtensions* extensions =
+ impl->PersistExtensions(prev_limit_);
danno 2012/06/24 11:07:03 All of the code below can be pushed to the impl if
+ info_->StorePersistentExtensions(extensions);
+
+ v8::ImplementationUtilities::HandleScopeData* current =
+ isolate->handle_scope_data();
+ current->next = prev_next_;
+ current->limit = prev_limit_;
+
+ impl->end_persistence();
+ current->level--;
+}
+
+
} } // namespace v8::internal
« src/handles.h ('K') | « src/handles.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698