diff options
author | Trevor Norris <trev.norris@gmail.com> | 2015-01-07 13:29:58 -0800 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2015-01-07 14:19:40 -0800 |
commit | d55338662329ac37386783ef1aa88f099eff86b2 (patch) | |
tree | 0bf70e21e9c99e7d8faf62a28bfc4f0e92fa066b /src | |
parent | 6e9d1c868474273b3b5891508c28aa13f70ff465 (diff) | |
download | node-new-d55338662329ac37386783ef1aa88f099eff86b2.tar.gz |
src: pass Isolate to additional locations
Due to a recent V8 upgrade, more methods require Isolate as an argument.
PR-URL: https://github.com/iojs/io.js/pull/244
Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 30 | ||||
-rw-r--r-- | src/node_buffer.cc | 6 | ||||
-rw-r--r-- | src/node_contextify.cc | 13 | ||||
-rw-r--r-- | src/node_crypto.cc | 20 | ||||
-rw-r--r-- | src/node_dtrace.cc | 2 | ||||
-rw-r--r-- | src/node_file.cc | 2 | ||||
-rw-r--r-- | src/node_http_parser.cc | 4 | ||||
-rw-r--r-- | src/node_zlib.cc | 6 | ||||
-rw-r--r-- | src/process_wrap.cc | 2 | ||||
-rw-r--r-- | src/smalloc.cc | 3 | ||||
-rw-r--r-- | src/spawn_sync.cc | 4 | ||||
-rw-r--r-- | src/stream_wrap.cc | 4 | ||||
-rw-r--r-- | src/string_bytes.cc | 4 | ||||
-rw-r--r-- | src/util.cc | 2 |
14 files changed, 57 insertions, 45 deletions
diff --git a/src/node.cc b/src/node.cc index e2a506680b..685d3839e3 100644 --- a/src/node.cc +++ b/src/node.cc @@ -757,7 +757,7 @@ Local<Value> ErrnoException(Isolate* isolate, e = Exception::Error(cons2); } - Local<Object> obj = e->ToObject(); + Local<Object> obj = e->ToObject(env->isolate()); obj->Set(env->errno_string(), Integer::New(env->isolate(), errorno)); obj->Set(env->code_string(), estring); @@ -819,7 +819,7 @@ Local<Value> UVException(Isolate* isolate, e = Exception::Error(cons2); } - Local<Object> obj = e->ToObject(); + Local<Object> obj = e->ToObject(env->isolate()); // TODO(piscisaureus) errno should probably go obj->Set(env->errno_string(), Integer::New(env->isolate(), errorno)); obj->Set(env->code_string(), estring); @@ -899,7 +899,7 @@ Local<Value> WinapiErrnoException(Isolate* isolate, e = Exception::Error(message); } - Local<Object> obj = e->ToObject(); + Local<Object> obj = e->ToObject(env->isolate()); obj->Set(env->errno_string(), Integer::New(isolate, errorno)); if (path != nullptr) { @@ -1350,9 +1350,9 @@ void AppendExceptionLine(Environment* env, goto print; err_obj->Set(env->message_string(), - String::Concat(arrow_str, msg->ToString())); + String::Concat(arrow_str, msg->ToString(env->isolate()))); err_obj->Set(env->stack_string(), - String::Concat(arrow_str, stack->ToString())); + String::Concat(arrow_str, stack->ToString(env->isolate()))); return; print: @@ -1376,7 +1376,7 @@ static void ReportException(Environment* env, if (er->IsUndefined() || er->IsNull()) trace_value = Undefined(env->isolate()); else - trace_value = er->ToObject()->Get(env->stack_string()); + trace_value = er->ToObject(env->isolate())->Get(env->stack_string()); node::Utf8Value trace(trace_value); @@ -1988,7 +1988,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) { return; } - Local<Object> module = args[0]->ToObject(); // Cast + Local<Object> module = args[0]->ToObject(env->isolate()); // Cast node::Utf8Value filename(args[1]); // Cast const bool is_dlopen_error = uv_dlopen(*filename, &lib); @@ -2002,7 +2002,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) { Local<String> errmsg = OneByteString(env->isolate(), uv_dlerror(&lib)); #ifdef _WIN32 // Windows needs to add the filename into the error message - errmsg = String::Concat(errmsg, args[1]->ToString()); + errmsg = String::Concat(errmsg, args[1]->ToString(env->isolate())); #endif // _WIN32 env->isolate()->ThrowException(Exception::Error(errmsg)); return; @@ -2031,7 +2031,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) { modlist_addon = mp; Local<String> exports_string = env->exports_string(); - Local<Object> exports = module->Get(exports_string)->ToObject(); + Local<Object> exports = module->Get(exports_string)->ToObject(env->isolate()); if (mp->nm_context_register_func != nullptr) { mp->nm_context_register_func(exports, module, env->context(), mp->nm_priv); @@ -2123,14 +2123,14 @@ void OnMessage(Handle<Message> message, Handle<Value> error) { static void Binding(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); - Local<String> module = args[0]->ToString(); + Local<String> module = args[0]->ToString(env->isolate()); node::Utf8Value module_v(module); Local<Object> cache = env->binding_cache_object(); Local<Object> exports; if (cache->Has(module)) { - exports = cache->Get(module)->ToObject(); + exports = cache->Get(module)->ToObject(env->isolate()); args.GetReturnValue().Set(exports); return; } @@ -2176,7 +2176,7 @@ static void Binding(const FunctionCallbackInfo<Value>& args) { static void LinkedBinding(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args.GetIsolate()); - Local<String> module = args[0]->ToString(); + Local<String> module = args[0]->ToString(env->isolate()); Local<Object> cache = env->binding_cache_object(); Local<Value> exports_v = cache->Get(module); @@ -2792,8 +2792,8 @@ static void RawDebug(const FunctionCallbackInfo<Value>& args) { void LoadEnvironment(Environment* env) { HandleScope handle_scope(env->isolate()); - V8::SetFatalErrorHandler(node::OnFatalError); - V8::AddMessageListener(OnMessage); + env->isolate()->SetFatalErrorHandler(node::OnFatalError); + env->isolate()->AddMessageListener(OnMessage); // Compile, execute the src/node.js file. (Which was included as static C // string in node_natives.h. 'natve_node' is the string containing that @@ -3485,7 +3485,7 @@ void EmitBeforeExit(Environment* env) { Local<String> exit_code = FIXED_ONE_BYTE_STRING(env->isolate(), "exitCode"); Local<Value> args[] = { FIXED_ONE_BYTE_STRING(env->isolate(), "beforeExit"), - process_object->Get(exit_code)->ToInteger() + process_object->Get(exit_code)->ToInteger(env->isolate()) }; MakeCallback(env, process_object, "emit", ARRAY_SIZE(args), args); } diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 420dc293af..e9f3415511 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -336,7 +336,7 @@ void Base64Slice(const FunctionCallbackInfo<Value>& args) { void Copy(const FunctionCallbackInfo<Value> &args) { Environment* env = Environment::GetCurrent(args); - Local<Object> target = args[0]->ToObject(); + Local<Object> target = args[0]->ToObject(env->isolate()); if (!HasInstance(target)) return env->ThrowTypeError("first arg should be a Buffer"); @@ -421,7 +421,7 @@ void StringWrite(const FunctionCallbackInfo<Value>& args) { if (!args[0]->IsString()) return env->ThrowTypeError("Argument must be a string"); - Local<String> str = args[0]->ToString(); + Local<String> str = args[0]->ToString(env->isolate()); if (encoding == HEX && str->Length() % 2 != 0) return env->ThrowTypeError("Invalid hex string"); @@ -583,7 +583,7 @@ void ByteLength(const FunctionCallbackInfo<Value> &args) { if (!args[0]->IsString()) return env->ThrowTypeError("Argument must be a string"); - Local<String> s = args[0]->ToString(); + Local<String> s = args[0]->ToString(env->isolate()); enum encoding e = ParseEncoding(env->isolate(), args[1], UTF8); uint32_t size = StringBytes::Size(env->isolate(), s, e); diff --git a/src/node_contextify.cc b/src/node_contextify.cc index ead5e3efc3..11712f727a 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -144,7 +144,8 @@ class ContextifyContext { HandleScope scope(env()->isolate()); Local<Context> context = PersistentToLocal(env()->isolate(), context_); - Local<Object> global = context->Global()->GetPrototype()->ToObject(); + Local<Object> global = + context->Global()->GetPrototype()->ToObject(env()->isolate()); Local<Object> sandbox = PersistentToLocal(env()->isolate(), sandbox_); Local<Function> clone_property_method; @@ -152,7 +153,7 @@ class ContextifyContext { Local<Array> names = global->GetOwnPropertyNames(); int length = names->Length(); for (int i = 0; i < length; i++) { - Local<String> key = names->Get(i)->ToString(); + Local<String> key = names->Get(i)->ToString(env()->isolate()); bool has = sandbox->HasOwnProperty(key); if (!has) { // Could also do this like so: @@ -253,7 +254,7 @@ class ContextifyContext { static void RunInDebugContext(const FunctionCallbackInfo<Value>& args) { - Local<String> script_source(args[0]->ToString()); + Local<String> script_source(args[0]->ToString(args.GetIsolate())); if (script_source.IsEmpty()) return; // Exception pending. Context::Scope context_scope(Debug::GetDebugContext()); @@ -476,7 +477,7 @@ class ContextifyScript : public BaseObject { new ContextifyScript(env, args.This()); TryCatch try_catch; - Local<String> code = args[0]->ToString(); + Local<String> code = args[0]->ToString(env->isolate()); Local<String> filename = GetFilenameArg(args, 1); bool display_errors = GetDisplayErrorsArg(args, 1); if (try_catch.HasCaught()) { @@ -643,7 +644,9 @@ class ContextifyScript : public BaseObject { Local<String> key = FIXED_ONE_BYTE_STRING(args.GetIsolate(), "filename"); Local<Value> value = args[i].As<Object>()->Get(key); - return value->IsUndefined() ? defaultFilename : value->ToString(); + if (value->IsUndefined()) + return defaultFilename; + return value->ToString(args.GetIsolate()); } diff --git a/src/node_crypto.cc b/src/node_crypto.cc index f65a7b902f..9610191144 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1686,7 +1686,7 @@ void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) { Isolate* isolate = args.GetIsolate(); Local<String> reason_string = OneByteString(isolate, reason); Local<Value> exception_value = Exception::Error(reason_string); - Local<Object> exception_object = exception_value->ToObject(); + Local<Object> exception_object = exception_value->ToObject(isolate); exception_object->Set(FIXED_ONE_BYTE_STRING(isolate, "code"), OneByteString(isolate, code)); args.GetReturnValue().Set(exception_object); @@ -2169,7 +2169,7 @@ void Connection::New(const FunctionCallbackInfo<Value>& args) { return; } - SecureContext* sc = Unwrap<SecureContext>(args[0]->ToObject()); + SecureContext* sc = Unwrap<SecureContext>(args[0]->ToObject(env->isolate())); bool is_server = args[1]->BooleanValue(); @@ -3004,7 +3004,9 @@ void Hmac::HmacDigest(const FunctionCallbackInfo<Value>& args) { enum encoding encoding = BUFFER; if (args.Length() >= 1) { - encoding = ParseEncoding(env->isolate(), args[0]->ToString(), BUFFER); + encoding = ParseEncoding(env->isolate(), + args[0]->ToString(env->isolate()), + BUFFER); } unsigned char* md_value = nullptr; @@ -3119,7 +3121,9 @@ void Hash::HashDigest(const FunctionCallbackInfo<Value>& args) { enum encoding encoding = BUFFER; if (args.Length() >= 1) { - encoding = ParseEncoding(env->isolate(), args[0]->ToString(), BUFFER); + encoding = ParseEncoding(env->isolate(), + args[0]->ToString(env->isolate()), + BUFFER); } unsigned char md_value[EVP_MAX_MD_SIZE]; @@ -3319,7 +3323,9 @@ void Sign::SignFinal(const FunctionCallbackInfo<Value>& args) { unsigned int len = args.Length(); enum encoding encoding = BUFFER; if (len >= 2 && args[1]->IsString()) { - encoding = ParseEncoding(env->isolate(), args[1]->ToString(), BUFFER); + encoding = ParseEncoding(env->isolate(), + args[1]->ToString(env->isolate()), + BUFFER); } node::Utf8Value passphrase(args[2]); @@ -3532,7 +3538,9 @@ void Verify::VerifyFinal(const FunctionCallbackInfo<Value>& args) { // BINARY works for both buffers and binary strings. enum encoding encoding = BINARY; if (args.Length() >= 3) { - encoding = ParseEncoding(env->isolate(), args[2]->ToString(), BINARY); + encoding = ParseEncoding(env->isolate(), + args[2]->ToString(env->isolate()), + BINARY); } ssize_t hlen = StringBytes::Size(env->isolate(), args[1], encoding); diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc index 7fb2312c9a..8feedb600f 100644 --- a/src/node_dtrace.cc +++ b/src/node_dtrace.cc @@ -87,7 +87,7 @@ using v8::Value; "expected object for " #obj " to contain integer member " #member); \ } \ *valp = obj->Get(OneByteString(env->isolate(), #member)) \ - ->ToInteger()->Value(); + ->ToInteger(env->isolate())->Value(); #define SLURP_OBJECT(obj, member, valp) \ if (!(obj)->IsObject()) { \ diff --git a/src/node_file.cc b/src/node_file.cc index 88b1262e16..e6ef3cbbf2 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -927,7 +927,7 @@ static void Read(const FunctionCallbackInfo<Value>& args) { return env->ThrowError("Second argument needs to be a buffer"); } - Local<Object> buffer_obj = args[1]->ToObject(); + Local<Object> buffer_obj = args[1]->ToObject(env->isolate()); char *buffer_data = Buffer::Data(buffer_obj); size_t buffer_length = Buffer::Length(buffer_obj); diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index ee312ddedf..e9422ca1dc 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -421,7 +421,7 @@ class Parser : public BaseObject { enum http_errno err = HTTP_PARSER_ERRNO(&parser->parser_); Local<Value> e = Exception::Error(env->parse_error_string()); - Local<Object> obj = e->ToObject(); + Local<Object> obj = e->ToObject(env->isolate()); obj->Set(env->bytes_parsed_string(), nparsed_obj); obj->Set(env->code_string(), OneByteString(env->isolate(), http_errno_name(err))); @@ -450,7 +450,7 @@ class Parser : public BaseObject { enum http_errno err = HTTP_PARSER_ERRNO(&parser->parser_); Local<Value> e = env->parse_error_string(); - Local<Object> obj = e->ToObject(); + Local<Object> obj = e->ToObject(env->isolate()); obj->Set(env->bytes_parsed_string(), Integer::New(env->isolate(), 0)); obj->Set(env->code_string(), OneByteString(env->isolate(), http_errno_name(err))); diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 5b8024330b..f59e60015a 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -178,7 +178,7 @@ class ZCtx : public AsyncWrap { } else { CHECK(Buffer::HasInstance(args[1])); Local<Object> in_buf; - in_buf = args[1]->ToObject(); + in_buf = args[1]->ToObject(args.GetIsolate()); in_off = args[2]->Uint32Value(); in_len = args[3]->Uint32Value(); @@ -187,7 +187,7 @@ class ZCtx : public AsyncWrap { } CHECK(Buffer::HasInstance(args[4])); - Local<Object> out_buf = args[4]->ToObject(); + Local<Object> out_buf = args[4]->ToObject(args.GetIsolate()); out_off = args[5]->Uint32Value(); out_len = args[6]->Uint32Value(); CHECK(Buffer::IsWithinBounds(out_off, out_len, Buffer::Length(out_buf))); @@ -420,7 +420,7 @@ class ZCtx : public AsyncWrap { char* dictionary = nullptr; size_t dictionary_len = 0; if (args.Length() >= 5 && Buffer::HasInstance(args[4])) { - Local<Object> dictionary_ = args[4]->ToObject(); + Local<Object> dictionary_ = args[4]->ToObject(args.GetIsolate()); dictionary_len = Buffer::Length(dictionary_); dictionary = new char[dictionary_len]; diff --git a/src/process_wrap.cc b/src/process_wrap.cc index ab7d9bfddb..5368e2803b 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -130,7 +130,7 @@ class ProcessWrap : public HandleWrap { ProcessWrap* wrap = Unwrap<ProcessWrap>(args.Holder()); - Local<Object> js_options = args[0]->ToObject(); + Local<Object> js_options = args[0]->ToObject(env->isolate()); uv_process_options_t options; memset(&options, 0, sizeof(uv_process_options_t)); diff --git a/src/smalloc.cc b/src/smalloc.cc index 38adce304f..4d85acd609 100644 --- a/src/smalloc.cc +++ b/src/smalloc.cc @@ -493,7 +493,8 @@ const char RetainedAllocInfo::label_[] = "smalloc"; RetainedAllocInfo::RetainedAllocInfo(Handle<Value> wrapper) { - Local<Object> obj = wrapper->ToObject(); + // TODO(trevnorris): Fix to properly acquire the Isolate. + Local<Object> obj = wrapper->ToObject(Isolate::GetCurrent()); length_ = obj->GetIndexedPropertiesExternalArrayDataLength(); data_ = static_cast<char*>(obj->GetIndexedPropertiesExternalArrayData()); } diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index bb5c606afc..62ef7e21bc 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -958,7 +958,7 @@ int SyncProcessRunner::CopyJsString(Local<Value> js_value, if (js_value->IsString()) js_string = js_value.As<String>(); else - js_string = js_value->ToString(); + js_string = js_value->ToString(env()->isolate()); // Include space for null terminator byte. size = StringBytes::StorageSize(isolate, js_string, UTF8) + 1; @@ -992,7 +992,7 @@ int SyncProcessRunner::CopyJsStringArray(Local<Value> js_value, // needed - it's okay since we cloned the original object. for (uint32_t i = 0; i < length; i++) { if (!js_array->Get(i)->IsString()) - js_array->Set(i, js_array->Get(i)->ToString()); + js_array->Set(i, js_array->Get(i)->ToString(env()->isolate())); } // Index has a pointer to every string element, plus one more for a final diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 2d13ae0f88..830f1b5757 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -433,7 +433,7 @@ void StreamWrap::Writev(const FunctionCallbackInfo<Value>& args) { // Buffer chunk, no additional storage required // String chunk - Handle<String> string = chunk->ToString(); + Handle<String> string = chunk->ToString(env->isolate()); enum encoding encoding = ParseEncoding(env->isolate(), chunks->Get(i * 2 + 1)); size_t chunk_size; @@ -477,7 +477,7 @@ void StreamWrap::Writev(const FunctionCallbackInfo<Value>& args) { char* str_storage = storage + offset; size_t str_size = storage_size - offset; - Handle<String> string = chunk->ToString(); + Handle<String> string = chunk->ToString(env->isolate()); enum encoding encoding = ParseEncoding(env->isolate(), chunks->Get(i * 2 + 1)); str_size = StringBytes::Write(env->isolate(), diff --git a/src/string_bytes.cc b/src/string_bytes.cc index f1ff697452..8ab977b11a 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -409,7 +409,7 @@ size_t StringBytes::StorageSize(Isolate* isolate, return Buffer::Length(val); } - Local<String> str = val->ToString(); + Local<String> str = val->ToString(isolate); switch (encoding) { case BINARY: @@ -461,7 +461,7 @@ size_t StringBytes::Size(Isolate* isolate, if (GetExternalParts(isolate, val, &data, &data_size)) return data_size; - Local<String> str = val->ToString(); + Local<String> str = val->ToString(isolate); switch (encoding) { case BINARY: diff --git a/src/util.cc b/src/util.cc index 5a652663c8..a42e893401 100644 --- a/src/util.cc +++ b/src/util.cc @@ -30,7 +30,7 @@ Utf8Value::Utf8Value(v8::Handle<v8::Value> value) if (value.IsEmpty()) return; - v8::Local<v8::String> val_ = value->ToString(); + v8::Local<v8::String> val_ = value->ToString(v8::Isolate::GetCurrent()); if (val_.IsEmpty()) return; |