Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index ada94c7b837a1ddc1fa1140003bd0372361f61a8..01aa2ceb4be49be70af7d17da565902853ba75bf 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -701,6 +701,26 @@ i::Object** HandleScope::CreateHandle(i::HeapObject* value) { |
} |
+EscapableHandleScope::EscapableHandleScope(Isolate* v8_isolate) { |
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
+ escape_slot_ = CreateHandle(isolate, isolate->heap()->the_hole_value()); |
+ Initialize(v8_isolate); |
+} |
+ |
+ |
+i::Object** EscapableHandleScope::Escape(i::Object** escape_value) { |
+ ApiCheck(*escape_slot_ == isolate_->heap()->the_hole_value(), |
+ "EscapeableHandleScope::Escape", |
+ "Escape value set twice"); |
+ if (escape_value == NULL) { |
+ *escape_slot_ = isolate_->heap()->undefined_value(); |
+ return NULL; |
+ } |
+ *escape_slot_ = *escape_value; |
+ return escape_slot_; |
+} |
+ |
+ |
void Context::Enter() { |
i::Handle<i::Context> env = Utils::OpenHandle(this); |
i::Isolate* isolate = env->GetIsolate(); |