Browse Source

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.
v0.11.5-release
Ben Noordhuis 12 years ago
parent
commit
78d90945d6
  1. 2
      src/cares_wrap.cc
  2. 16
      src/node.cc
  3. 6
      src/node_crypto.cc
  4. 3
      src/node_file.cc
  5. 7
      src/node_internals.h
  6. 2
      src/node_script.cc
  7. 2
      src/smalloc.cc
  8. 6
      src/tls_wrap.cc

2
src/cares_wrap.cc

@ -261,7 +261,7 @@ class QueryWrap {
}
inline Local<Object> object() {
return PersistentToLocal(persistent());
return PersistentToLocal(node_isolate, persistent());
}
protected:

16
src/node.cc

@ -894,7 +894,7 @@ void SetupDomainUse(const FunctionCallbackInfo<Value>& args) {
if (using_domains) return;
HandleScope scope(node_isolate);
using_domains = true;
Local<Object> process = PersistentToLocal(process_p);
Local<Object> process = PersistentToLocal(node_isolate, process_p);
Local<Value> tdc_v = process->Get(String::New("_tickDomainCallback"));
Local<Value> ndt_v = process->Get(String::New("_nextDomainTick"));
if (!tdc_v->IsFunction()) {
@ -983,8 +983,8 @@ MakeDomainCallback(const Handle<Object> object,
}
// process nextTicks after call
Local<Object> process = PersistentToLocal(process_p);
Local<Function> fn = PersistentToLocal(process_tickCallback);
Local<Object> process = PersistentToLocal(node_isolate, process_p);
Local<Function> fn = PersistentToLocal(node_isolate, process_tickCallback);
fn->Call(process, 0, NULL);
if (try_catch.HasCaught()) {
@ -1001,7 +1001,7 @@ MakeCallback(const Handle<Object> object,
int argc,
Handle<Value> argv[]) {
// TODO(trevnorris) Hook for long stack traces to be made here.
Local<Object> process = PersistentToLocal(process_p);
Local<Object> process = PersistentToLocal(node_isolate, process_p);
if (using_domains)
return MakeDomainCallback(object, callback, argc, argv);
@ -1035,7 +1035,7 @@ MakeCallback(const Handle<Object> object,
}
// process nextTicks after call
Local<Function> fn = PersistentToLocal(process_tickCallback);
Local<Function> fn = PersistentToLocal(node_isolate, process_tickCallback);
fn->Call(process, 0, NULL);
if (try_catch.HasCaught()) {
@ -1873,7 +1873,7 @@ void FatalException(Handle<Value> error, Handle<Message> message) {
if (fatal_exception_symbol.IsEmpty())
fatal_exception_symbol = String::New("_fatalException");
Local<Object> process = PersistentToLocal(process_p);
Local<Object> process = PersistentToLocal(node_isolate, process_p);
Local<Value> fatal_v = process->Get(fatal_exception_symbol);
if (!fatal_v->IsFunction()) {
@ -1928,7 +1928,7 @@ static void Binding(const FunctionCallbackInfo<Value>& args) {
String::Utf8Value module_v(module);
node_module_struct* modp;
Local<Object> cache = PersistentToLocal(binding_cache);
Local<Object> cache = PersistentToLocal(node_isolate, binding_cache);
Local<Object> exports;
if (cache->Has(module)) {
@ -1941,7 +1941,7 @@ static void Binding(const FunctionCallbackInfo<Value>& args) {
char buf[1024];
snprintf(buf, sizeof(buf), "Binding %s", *module_v);
Local<Array> modules = PersistentToLocal(module_load_list);
Local<Array> modules = PersistentToLocal(node_isolate, module_load_list);
uint32_t l = modules->Length();
modules->Set(l, String::New(buf));

6
src/node_crypto.cc

@ -1179,7 +1179,7 @@ int Connection::AdvertiseNextProtoCallback_(SSL *s,
*data = reinterpret_cast<const unsigned char*>("");
*len = 0;
} else {
Local<Object> obj = PersistentToLocal(p->npnProtos_);
Local<Object> obj = PersistentToLocal(node_isolate, p->npnProtos_);
*data = reinterpret_cast<const unsigned char*>(Buffer::Data(obj));
*len = Buffer::Length(obj);
}
@ -1208,7 +1208,7 @@ int Connection::SelectNextProtoCallback_(SSL *s,
return SSL_TLSEXT_ERR_OK;
}
Local<Object> obj = PersistentToLocal(p->npnProtos_);
Local<Object> obj = PersistentToLocal(node_isolate, p->npnProtos_);
const unsigned char* npnProtos =
reinterpret_cast<const unsigned char*>(Buffer::Data(obj));
@ -1250,7 +1250,7 @@ int Connection::SelectSNIContextCallback_(SSL *s, int *ad, void* arg) {
if (!p->sniObject_.IsEmpty()) {
p->sniContext_.Dispose();
Local<Value> arg = PersistentToLocal(p->servername_);
Local<Value> arg = PersistentToLocal(node_isolate, p->servername_);
Local<Value> ret = MakeCallback(p->sniObject_, "onselect", 1, &arg);
// If ret is SecureContext

3
src/node_file.cc

@ -305,7 +305,8 @@ Local<Object> BuildStatsObject(const uv_stat_t* s) {
ctime_symbol = String::New("ctime");
}
Local<Function> constructor = PersistentToLocal(stats_constructor);
Local<Function> constructor =
PersistentToLocal(node_isolate, stats_constructor);
Local<Object> stats = constructor->NewInstance();
if (stats.IsEmpty()) return Local<Object>();

7
src/node_internals.h

@ -64,13 +64,6 @@ class Cached<v8::Value> : public CachedBase<v8::Value> {
void operator=(v8::Handle<v8::Value> that);
};
// If persistent.IsWeak() == false, then do not call persistent.Dispose()
// while the returned Local<T> is still in scope, it will destroy the
// reference to the object.
template <class TypeName>
inline v8::Local<TypeName> PersistentToLocal(
const v8::Persistent<TypeName>& persistent);
// If persistent.IsWeak() == false, then do not call persistent.Dispose()
// while the returned Local<T> is still in scope, it will destroy the
// reference to the object.

2
src/node_script.cc

@ -168,7 +168,7 @@ WrappedContext::~WrappedContext() {
Local<Object> WrappedContext::NewInstance() {
Local<FunctionTemplate> constructor_template_handle =
PersistentToLocal(constructor_template);
PersistentToLocal(node_isolate, constructor_template);
return constructor_template_handle->GetFunction()->NewInstance();
}

2
src/smalloc.cc

@ -204,7 +204,7 @@ void AllocDispose(Handle<Object> obj) {
if (using_alloc_cb && obj->Has(smalloc_sym)) {
Local<External> ext = obj->GetHiddenValue(smalloc_sym).As<External>();
CallbackInfo* cb_info = static_cast<CallbackInfo*>(ext->Value());
Local<Object> obj = PersistentToLocal(cb_info->p_obj);
Local<Object> obj = PersistentToLocal(node_isolate, cb_info->p_obj);
TargetFreeCallback(node_isolate, obj, cb_info);
return;
}

6
src/tls_wrap.cc

@ -1205,7 +1205,7 @@ int TLSCallbacks::AdvertiseNextProtoCallback(SSL* s,
*data = reinterpret_cast<const unsigned char*>("");
*len = 0;
} else {
Local<Object> obj = PersistentToLocal(p->npn_protos_);
Local<Object> obj = PersistentToLocal(node_isolate, p->npn_protos_);
*data = reinterpret_cast<const unsigned char*>(Buffer::Data(obj));
*len = Buffer::Length(obj);
}
@ -1237,7 +1237,7 @@ int TLSCallbacks::SelectNextProtoCallback(SSL* s,
return SSL_TLSEXT_ERR_OK;
}
Local<Object> obj = PersistentToLocal(p->npn_protos_);
Local<Object> obj = PersistentToLocal(node_isolate, p->npn_protos_);
const unsigned char* npn_protos =
reinterpret_cast<const unsigned char*>(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<Value> arg = PersistentToLocal(p->servername_);
Local<Value> arg = PersistentToLocal(node_isolate, p->servername_);
Handle<Value> ret = MakeCallback(object, onsniselect_sym, 1, &arg);
// If ret is SecureContext

Loading…
Cancel
Save