From: Ben Noordhuis Date: Fri, 2 Aug 2013 21:12:56 +0000 (+0200) Subject: src: remove non-isolate PersistentToLocal() X-Git-Tag: v0.11.5~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78d90945d6c203a85402698258d96897379694e6;p=platform%2Fupstream%2Fnodejs.git src: remove non-isolate PersistentToLocal() There is no need for it and it's a tiny bit slower than the version of PersistentToLocal() that takes a v8::Isolate* as its first argument. --- diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index e930431..6cb55a5 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -261,7 +261,7 @@ class QueryWrap { } inline Local object() { - return PersistentToLocal(persistent()); + return PersistentToLocal(node_isolate, persistent()); } protected: diff --git a/src/node.cc b/src/node.cc index 4e6c5b5..bcc3996 100644 --- a/src/node.cc +++ b/src/node.cc @@ -894,7 +894,7 @@ void SetupDomainUse(const FunctionCallbackInfo& args) { if (using_domains) return; HandleScope scope(node_isolate); using_domains = true; - Local process = PersistentToLocal(process_p); + Local process = PersistentToLocal(node_isolate, process_p); Local tdc_v = process->Get(String::New("_tickDomainCallback")); Local ndt_v = process->Get(String::New("_nextDomainTick")); if (!tdc_v->IsFunction()) { @@ -983,8 +983,8 @@ MakeDomainCallback(const Handle object, } // process nextTicks after call - Local process = PersistentToLocal(process_p); - Local fn = PersistentToLocal(process_tickCallback); + Local process = PersistentToLocal(node_isolate, process_p); + Local fn = PersistentToLocal(node_isolate, process_tickCallback); fn->Call(process, 0, NULL); if (try_catch.HasCaught()) { @@ -1001,7 +1001,7 @@ MakeCallback(const Handle object, int argc, Handle argv[]) { // TODO(trevnorris) Hook for long stack traces to be made here. - Local process = PersistentToLocal(process_p); + Local process = PersistentToLocal(node_isolate, process_p); if (using_domains) return MakeDomainCallback(object, callback, argc, argv); @@ -1035,7 +1035,7 @@ MakeCallback(const Handle object, } // process nextTicks after call - Local fn = PersistentToLocal(process_tickCallback); + Local fn = PersistentToLocal(node_isolate, process_tickCallback); fn->Call(process, 0, NULL); if (try_catch.HasCaught()) { @@ -1873,7 +1873,7 @@ void FatalException(Handle error, Handle message) { if (fatal_exception_symbol.IsEmpty()) fatal_exception_symbol = String::New("_fatalException"); - Local process = PersistentToLocal(process_p); + Local process = PersistentToLocal(node_isolate, process_p); Local fatal_v = process->Get(fatal_exception_symbol); if (!fatal_v->IsFunction()) { @@ -1928,7 +1928,7 @@ static void Binding(const FunctionCallbackInfo& args) { String::Utf8Value module_v(module); node_module_struct* modp; - Local cache = PersistentToLocal(binding_cache); + Local cache = PersistentToLocal(node_isolate, binding_cache); Local exports; if (cache->Has(module)) { @@ -1941,7 +1941,7 @@ static void Binding(const FunctionCallbackInfo& args) { char buf[1024]; snprintf(buf, sizeof(buf), "Binding %s", *module_v); - Local modules = PersistentToLocal(module_load_list); + Local modules = PersistentToLocal(node_isolate, module_load_list); uint32_t l = modules->Length(); modules->Set(l, String::New(buf)); diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 754ec65..540d9cd 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1179,7 +1179,7 @@ int Connection::AdvertiseNextProtoCallback_(SSL *s, *data = reinterpret_cast(""); *len = 0; } else { - Local obj = PersistentToLocal(p->npnProtos_); + Local obj = PersistentToLocal(node_isolate, p->npnProtos_); *data = reinterpret_cast(Buffer::Data(obj)); *len = Buffer::Length(obj); } @@ -1208,7 +1208,7 @@ int Connection::SelectNextProtoCallback_(SSL *s, return SSL_TLSEXT_ERR_OK; } - Local obj = PersistentToLocal(p->npnProtos_); + Local obj = PersistentToLocal(node_isolate, p->npnProtos_); const unsigned char* npnProtos = reinterpret_cast(Buffer::Data(obj)); @@ -1250,7 +1250,7 @@ int Connection::SelectSNIContextCallback_(SSL *s, int *ad, void* arg) { if (!p->sniObject_.IsEmpty()) { p->sniContext_.Dispose(); - Local arg = PersistentToLocal(p->servername_); + Local arg = PersistentToLocal(node_isolate, p->servername_); Local ret = MakeCallback(p->sniObject_, "onselect", 1, &arg); // If ret is SecureContext diff --git a/src/node_file.cc b/src/node_file.cc index 403ec10..15f6427 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -305,7 +305,8 @@ Local BuildStatsObject(const uv_stat_t* s) { ctime_symbol = String::New("ctime"); } - Local constructor = PersistentToLocal(stats_constructor); + Local constructor = + PersistentToLocal(node_isolate, stats_constructor); Local stats = constructor->NewInstance(); if (stats.IsEmpty()) return Local(); diff --git a/src/node_internals.h b/src/node_internals.h index b6dd676..c8d12f4 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -69,13 +69,6 @@ class Cached : public CachedBase { // reference to the object. template inline v8::Local PersistentToLocal( - const v8::Persistent& persistent); - -// If persistent.IsWeak() == false, then do not call persistent.Dispose() -// while the returned Local is still in scope, it will destroy the -// reference to the object. -template -inline v8::Local PersistentToLocal( v8::Isolate* isolate, const v8::Persistent& persistent); diff --git a/src/node_script.cc b/src/node_script.cc index 5cf9189..9c6a598 100644 --- a/src/node_script.cc +++ b/src/node_script.cc @@ -168,7 +168,7 @@ WrappedContext::~WrappedContext() { Local WrappedContext::NewInstance() { Local constructor_template_handle = - PersistentToLocal(constructor_template); + PersistentToLocal(node_isolate, constructor_template); return constructor_template_handle->GetFunction()->NewInstance(); } diff --git a/src/smalloc.cc b/src/smalloc.cc index 8694d80..7ef17d5 100644 --- a/src/smalloc.cc +++ b/src/smalloc.cc @@ -204,7 +204,7 @@ void AllocDispose(Handle obj) { if (using_alloc_cb && obj->Has(smalloc_sym)) { Local ext = obj->GetHiddenValue(smalloc_sym).As(); CallbackInfo* cb_info = static_cast(ext->Value()); - Local obj = PersistentToLocal(cb_info->p_obj); + Local obj = PersistentToLocal(node_isolate, cb_info->p_obj); TargetFreeCallback(node_isolate, obj, cb_info); return; } diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 6261ec8..f7fe4e1 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -1205,7 +1205,7 @@ int TLSCallbacks::AdvertiseNextProtoCallback(SSL* s, *data = reinterpret_cast(""); *len = 0; } else { - Local obj = PersistentToLocal(p->npn_protos_); + Local obj = PersistentToLocal(node_isolate, p->npn_protos_); *data = reinterpret_cast(Buffer::Data(obj)); *len = Buffer::Length(obj); } @@ -1237,7 +1237,7 @@ int TLSCallbacks::SelectNextProtoCallback(SSL* s, return SSL_TLSEXT_ERR_OK; } - Local obj = PersistentToLocal(p->npn_protos_); + Local obj = PersistentToLocal(node_isolate, p->npn_protos_); const unsigned char* npn_protos = reinterpret_cast(Buffer::Data(obj)); size_t len = Buffer::Length(obj); @@ -1354,7 +1354,7 @@ int TLSCallbacks::SelectSNIContextCallback(SSL* s, int* ad, void* arg) { if (object->Has(onsniselect_sym)) { p->sni_context_.Dispose(); - Local arg = PersistentToLocal(p->servername_); + Local arg = PersistentToLocal(node_isolate, p->servername_); Handle ret = MakeCallback(object, onsniselect_sym, 1, &arg); // If ret is SecureContext