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

Unified Diff: src/api.cc

Issue 1079713002: api: introduce SealHandleScope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix typo in a test Created 5 years, 8 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.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 28c84106df4c260cfbd2e96972a12efcd1f10964..733214ec076712b31538853fe24fcc03162f80b9 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -674,6 +674,27 @@ i::Object** EscapableHandleScope::Escape(i::Object** escape_value) {
}
+SealHandleScope::SealHandleScope(Isolate* isolate) {
+ i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
+
+ isolate_ = internal_isolate;
+ i::HandleScopeData* current = internal_isolate->handle_scope_data();
+ prev_limit_ = current->limit;
+ current->limit = current->next;
+ prev_level_ = current->level;
+ current->level = 0;
+}
+
+
+SealHandleScope::~SealHandleScope() {
+ i::HandleScopeData* current = isolate_->handle_scope_data();
+ DCHECK_EQ(0, current->level);
+ current->level = prev_level_;
+ DCHECK_EQ(current->next, current->limit);
+ current->limit = prev_limit_;
+}
+
+
void Context::Enter() {
i::Handle<i::Context> env = Utils::OpenHandle(this);
i::Isolate* isolate = env->GetIsolate();
« no previous file with comments | « src/api.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698