Reviewers: Dmitry Lomov (chromium),
Description:
Remove remaining HandleScope::Close usage
For some reason, this is only caught when compiling with chromium on
Mac.
BUG=none
[email protected]
LOG=n
Please review this at https://codereview.chromium.org/99263002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+31, -32 lines):
M src/api.h
M src/api.cc
M src/debug.cc
M src/factory.cc
M src/handles.h
M test/cctest/test-heap.cc
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
90e50ccc79f51503f97b9f5d90e75c291f7131f9..aee9e3a469eae454a9fdc7b241142050044a730a
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2131,18 +2131,18 @@ Local<String> Message::Get() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Message::Get()", return Local<String>());
ENTER_V8(isolate);
- HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::Object> obj = Utils::OpenHandle(this);
i::Handle<i::String> raw_result = i::MessageHandler::GetMessage(isolate,
obj);
Local<String> result = Utils::ToLocal(raw_result);
- return scope.Close(result);
+ return scope.Escape(result);
}
v8::Handle<Value> Message::GetScriptResourceName() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
- HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::JSMessageObject> message =
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
// Return this.script.name.
@@ -2151,14 +2151,14 @@ v8::Handle<Value> Message::GetScriptResourceName()
const {
isolate));
i::Handle<i::Object>
resource_name(i::Script::cast(script->value())->name(),
isolate);
- return scope.Close(Utils::ToLocal(resource_name));
+ return scope.Escape(Utils::ToLocal(resource_name));
}
v8::Handle<Value> Message::GetScriptData() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
- HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::JSMessageObject> message =
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
// Return this.script.data.
@@ -2166,21 +2166,21 @@ v8::Handle<Value> Message::GetScriptData() const {
i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(),
isolate));
i::Handle<i::Object> data(i::Script::cast(script->value())->data(),
isolate);
- return scope.Close(Utils::ToLocal(data));
+ return scope.Escape(Utils::ToLocal(data));
}
v8::Handle<v8::StackTrace> Message::GetStackTrace() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
- HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::JSMessageObject> message =
i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate);
if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>();
i::Handle<i::JSArray> stackTrace =
i::Handle<i::JSArray>::cast(stackFramesObj);
- return scope.Close(Utils::StackTraceToLocal(stackTrace));
+ return scope.Escape(Utils::StackTraceToLocal(stackTrace));
}
@@ -2300,14 +2300,14 @@ Local<String> Message::GetSourceLine() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return
Local<String>());
ENTER_V8(isolate);
- HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine",
Utils::OpenHandle(this),
&has_pending_exception);
EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>());
if (result->IsString()) {
- return scope.Close(Utils::ToLocal(i::Handle<i::String>::cast(result)));
+ return
scope.Escape(Utils::ToLocal(i::Handle<i::String>::cast(result)));
} else {
return Local<String>();
}
@@ -2331,11 +2331,11 @@ void Message::PrintCurrentStackTrace(FILE* out) {
Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
- HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::JSArray> self = Utils::OpenHandle(this);
i::Object* raw_object = self->GetElementNoExceptionThrown(isolate,
index);
i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object));
- return scope.Close(Utils::StackFrameToLocal(obj));
+ return scope.Escape(Utils::StackFrameToLocal(obj));
}
@@ -2415,39 +2415,39 @@ int StackFrame::GetScriptId() const {
Local<String> StackFrame::GetScriptName() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
- HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> name = GetProperty(self, "scriptName");
if (!name->IsString()) {
return Local<String>();
}
- return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
+ return scope.Escape(Local<String>::Cast(Utils::ToLocal(name)));
}
Local<String> StackFrame::GetScriptNameOrSourceURL() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
- HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> name = GetProperty(self, "scriptNameOrSourceURL");
if (!name->IsString()) {
return Local<String>();
}
- return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
+ return scope.Escape(Local<String>::Cast(Utils::ToLocal(name)));
}
Local<String> StackFrame::GetFunctionName() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
- HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> name = GetProperty(self, "functionName");
if (!name->IsString()) {
return Local<String>();
}
- return scope.Close(Local<String>::Cast(Utils::ToLocal(name)));
+ return scope.Escape(Local<String>::Cast(Utils::ToLocal(name)));
}
@@ -4158,7 +4158,7 @@ Local<v8::Object> Function::NewInstance(int argc,
ENTER_V8(isolate);
i::Logger::TimerEventScope timer_scope(
isolate, i::Logger::TimerEventScope::v8_execute);
- HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::JSFunction> function = Utils::OpenHandle(this);
STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
i::Handle<i::Object>* args =
reinterpret_cast<i::Handle<i::Object>*>(argv);
@@ -4166,7 +4166,7 @@ Local<v8::Object> Function::NewInstance(int argc,
i::Handle<i::Object> returned =
i::Execution::New(function, argc, args, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>());
- return
scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
+ return
scope.Escape(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
}
@@ -7069,7 +7069,7 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value>
obj) {
if (!isolate->IsInitialized()) return Local<Value>();
ON_BAILOUT(isolate, "v8::Debug::GetMirror()", return Local<Value>());
ENTER_V8(isolate);
- v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ v8::EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
i::Debug* isolate_debug = isolate->debug();
isolate_debug->Load();
i::Handle<i::JSObject>
debug(isolate_debug->debug_context()->global_object());
@@ -7081,11 +7081,10 @@ Local<Value> Debug::GetMirror(v8::Handle<v8::Value>
obj) {
const int kArgc = 1;
v8::Handle<v8::Value> argv[kArgc] = { obj };
EXCEPTION_PREAMBLE(isolate);
- v8::Handle<v8::Value> result = v8_fun->Call(Utils::ToLocal(debug),
- kArgc,
- argv);
+ v8::Local<v8::Value> result =
+ v8_fun->Call(Utils::ToLocal(debug), kArgc, argv);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
- return scope.Close(result);
+ return scope.Escape(result);
}
Index: src/api.h
diff --git a/src/api.h b/src/api.h
index
9197bafbc52331785f8d636b732a68e61281ba47..5f19380e65b5011b9f6f8eb67ea7ada51a3ac725
100644
--- a/src/api.h
+++ b/src/api.h
@@ -308,12 +308,12 @@ OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE)
template <class T>
v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom(
- v8::HandleScope* scope) {
+ v8::EscapableHandleScope* scope) {
v8::internal::Handle<T> handle;
if (!is_null()) {
handle = *this;
}
- return Utils::OpenHandle(*scope->Close(Utils::ToLocal(handle)), true);
+ return Utils::OpenHandle(*scope->Escape(Utils::ToLocal(handle)), true);
}
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index
23495c8e5c630862fdeb19216a6812afae7a4f30..25be003f707c06a068ec7f84813e0b8eb3790e24
100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -3640,7 +3640,7 @@ v8::Handle<v8::Object> MessageImpl::GetEventData()
const {
v8::Handle<v8::String> MessageImpl::GetJSON() const {
- v8::HandleScope scope(
+ v8::EscapableHandleScope scope(
reinterpret_cast<v8::Isolate*>(event_data_->GetIsolate()));
if (IsEvent()) {
@@ -3656,7 +3656,7 @@ v8::Handle<v8::String> MessageImpl::GetJSON() const {
if (caught_exception || !json->IsString()) {
return v8::Handle<v8::String>();
}
- return scope.Close(v8::Utils::ToLocal(Handle<String>::cast(json)));
+ return scope.Escape(v8::Utils::ToLocal(Handle<String>::cast(json)));
} else {
return v8::Utils::ToLocal(response_json_);
}
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index
01f58544e308c7d22d8e7f37694b1af802ecffcc..483e6a632a3e6f975a9f8bee259869d5e318251a
100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -854,7 +854,7 @@ Handle<Object> Factory::NewError(const char* maker,
const char* message,
Vector< Handle<Object> > args) {
// Instantiate a closeable HandleScope for EscapeFrom.
- v8::HandleScope scope(reinterpret_cast<v8::Isolate*>(isolate()));
+ v8::EscapableHandleScope
scope(reinterpret_cast<v8::Isolate*>(isolate()));
Handle<FixedArray> array = NewFixedArray(args.length());
for (int i = 0; i < args.length(); i++) {
array->set(i, *args[i]);
Index: src/handles.h
diff --git a/src/handles.h b/src/handles.h
index
5bc5779549581379827bf2125fe04db17ac75c63..7fef91986466b0e6847b85ef44ed6e45ad338620
100644
--- a/src/handles.h
+++ b/src/handles.h
@@ -83,7 +83,7 @@ class Handle {
// Closes the given scope, but lets this handle escape. See
// implementation in api.h.
- inline Handle<T> EscapeFrom(v8::HandleScope* scope);
+ inline Handle<T> EscapeFrom(v8::EscapableHandleScope* scope);
#ifdef DEBUG
enum DereferenceCheckMode { INCLUDE_DEFERRED_CHECK, NO_DEFERRED_CHECK };
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index
77395b534980ef5e8086c6142f1c313a72e4d98b..8a8df2990457f9d13ff95ea2ae3ee402d123452c
100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -935,7 +935,7 @@ TEST(EmptyHandleEscapeFrom) {
Handle<JSObject> runaway;
{
- v8::HandleScope nested(CcTest::isolate());
+ v8::EscapableHandleScope nested(CcTest::isolate());
Handle<JSObject> empty;
runaway = empty.EscapeFrom(&nested);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.