From: svenpanne@chromium.org Date: Wed, 4 Dec 2013 10:09:08 +0000 (+0000) Subject: Remove internal uses of HandleScope::Close(). X-Git-Tag: upstream/4.7.83~11422 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6b75581f3781ec083e8426d65cc64db52a398ff;p=platform%2Fupstream%2Fv8.git Remove internal uses of HandleScope::Close(). R=dslomov@chromium.org Review URL: https://codereview.chromium.org/104183002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18254 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/samples/process.cc b/samples/process.cc index b18a3ff..7e3f78f 100644 --- a/samples/process.cc +++ b/samples/process.cc @@ -311,7 +311,7 @@ Persistent JsHttpRequestProcessor::map_template_; // JavaScript object. Handle JsHttpRequestProcessor::WrapMap(map* obj) { // Handle scope for temporary handles. - HandleScope handle_scope(GetIsolate()); + EscapableHandleScope handle_scope(GetIsolate()); // Fetch the template for creating JavaScript map wrappers. // It only has to be created once, which we do on demand. @@ -323,7 +323,7 @@ Handle JsHttpRequestProcessor::WrapMap(map* obj) { Local::New(GetIsolate(), map_template_); // Create an empty map wrapper. - Handle result = templ->NewInstance(); + Local result = templ->NewInstance(); // Wrap the raw C++ pointer in an External so it can be referenced // from within JavaScript. @@ -336,7 +336,7 @@ Handle JsHttpRequestProcessor::WrapMap(map* obj) { // of these handles will go away when the handle scope is deleted // we need to call Close to let one, the result, escape into the // outer handle scope. - return handle_scope.Close(result); + return handle_scope.Escape(result); } @@ -399,14 +399,14 @@ void JsHttpRequestProcessor::MapSet(Local name, Handle JsHttpRequestProcessor::MakeMapTemplate( Isolate* isolate) { - HandleScope handle_scope(isolate); + EscapableHandleScope handle_scope(isolate); - Handle result = ObjectTemplate::New(); + Local result = ObjectTemplate::New(); result->SetInternalFieldCount(1); result->SetNamedPropertyHandler(MapGet, MapSet); // Again, return the result through the current handle scope. - return handle_scope.Close(result); + return handle_scope.Escape(result); } @@ -420,7 +420,7 @@ Handle JsHttpRequestProcessor::MakeMapTemplate( */ Handle JsHttpRequestProcessor::WrapRequest(HttpRequest* request) { // Handle scope for temporary handles. - HandleScope handle_scope(GetIsolate()); + EscapableHandleScope handle_scope(GetIsolate()); // Fetch the template for creating JavaScript http request wrappers. // It only has to be created once, which we do on demand. @@ -432,7 +432,7 @@ Handle JsHttpRequestProcessor::WrapRequest(HttpRequest* request) { Local::New(GetIsolate(), request_template_); // Create an empty http request wrapper. - Handle result = templ->NewInstance(); + Local result = templ->NewInstance(); // Wrap the raw C++ pointer in an External so it can be referenced // from within JavaScript. @@ -445,7 +445,7 @@ Handle JsHttpRequestProcessor::WrapRequest(HttpRequest* request) { // of these handles will go away when the handle scope is deleted // we need to call Close to let one, the result, escape into the // outer handle scope. - return handle_scope.Close(result); + return handle_scope.Escape(result); } @@ -509,9 +509,9 @@ void JsHttpRequestProcessor::GetUserAgent( Handle JsHttpRequestProcessor::MakeRequestTemplate( Isolate* isolate) { - HandleScope handle_scope(isolate); + EscapableHandleScope handle_scope(isolate); - Handle result = ObjectTemplate::New(); + Local result = ObjectTemplate::New(); result->SetInternalFieldCount(1); // Add accessors for each of the fields of the request. @@ -529,7 +529,7 @@ Handle JsHttpRequestProcessor::MakeRequestTemplate( GetUserAgent); // Again, return the result through the current handle scope. - return handle_scope.Close(result); + return handle_scope.Escape(result); } diff --git a/src/d8.cc b/src/d8.cc index 2fdbe0c..2b5b996 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -610,19 +610,19 @@ void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) { Handle Shell::GetCompletions(Isolate* isolate, Handle text, Handle full) { - HandleScope handle_scope(isolate); + EscapableHandleScope handle_scope(isolate); v8::Local utility_context = v8::Local::New(isolate, utility_context_); v8::Context::Scope context_scope(utility_context); Handle global = utility_context->Global(); - Handle fun = + Local fun = global->Get(String::NewFromUtf8(isolate, "GetCompletions")); static const int kArgc = 3; v8::Local evaluation_context = v8::Local::New(isolate, evaluation_context_); Handle argv[kArgc] = { evaluation_context->Global(), text, full }; - Handle val = Handle::Cast(fun)->Call(global, kArgc, argv); - return handle_scope.Close(Handle::Cast(val)); + Local val = Local::Cast(fun)->Call(global, kArgc, argv); + return handle_scope.Escape(Local::Cast(val)); } @@ -966,7 +966,7 @@ Local Shell::CreateEvaluationContext(Isolate* isolate) { #endif // V8_SHARED // Initialize the global objects Handle global_template = CreateGlobalTemplate(isolate); - HandleScope handle_scope(isolate); + EscapableHandleScope handle_scope(isolate); Local context = Context::New(isolate, NULL, global_template); ASSERT(!context.IsEmpty()); Context::Scope scope(context); @@ -986,7 +986,7 @@ Local Shell::CreateEvaluationContext(Isolate* isolate) { context->Global()->Set(String::NewFromUtf8(isolate, "arguments"), Utils::ToLocal(arguments_jsarray)); #endif // V8_SHARED - return handle_scope.Close(context); + return handle_scope.Escape(context); } diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index e8852e3..819f42d 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -1195,14 +1195,14 @@ void FastReturnValueCallback( template Handle TestFastReturnValues() { LocalContext env; - v8::HandleScope scope(env->GetIsolate()); + v8::EscapableHandleScope scope(env->GetIsolate()); v8::Handle object_template = v8::ObjectTemplate::New(); v8::FunctionCallback callback = &FastReturnValueCallback; object_template->Set(env->GetIsolate(), "callback", v8::FunctionTemplate::New(callback)); v8::Local object = object_template->NewInstance(); (*env)->Global()->Set(v8_str("callback_object"), object); - return scope.Close(CompileRun("callback_object.callback()")); + return scope.Escape(CompileRun("callback_object.callback()")); } @@ -4188,12 +4188,12 @@ THREADED_TEST(Array) { void HandleF(const v8::FunctionCallbackInfo& args) { - v8::HandleScope scope(args.GetIsolate()); + v8::EscapableHandleScope scope(args.GetIsolate()); ApiTestFuzzer::Fuzz(); Local result = v8::Array::New(args.GetIsolate(), args.Length()); for (int i = 0; i < args.Length(); i++) result->Set(i, args[i]); - args.GetReturnValue().Set(scope.Close(result)); + args.GetReturnValue().Set(scope.Escape(result)); } @@ -13236,10 +13236,10 @@ THREADED_TEST(CheckForCrossContextObjectLiterals) { static v8::Handle NestedScope(v8::Local env) { - v8::HandleScope inner(env->GetIsolate()); + v8::EscapableHandleScope inner(env->GetIsolate()); env->Enter(); - v8::Handle three = v8_num(3); - v8::Handle value = inner.Close(three); + v8::Local three = v8_num(3); + v8::Local value = inner.Escape(three); env->Exit(); return value; } @@ -13865,10 +13865,10 @@ THREADED_TEST(Regress54) { v8::HandleScope outer(isolate); static v8::Persistent templ; if (templ.IsEmpty()) { - v8::HandleScope inner(isolate); - v8::Handle local = v8::ObjectTemplate::New(); + v8::EscapableHandleScope inner(isolate); + v8::Local local = v8::ObjectTemplate::New(); local->SetInternalFieldCount(1); - templ.Reset(isolate, inner.Close(local)); + templ.Reset(isolate, inner.Escape(local)); } v8::Handle result = v8::Local::New(isolate, templ)->NewInstance();