diff --git a/common.gypi b/common.gypi index 35d09b75011b7c..0316afe7048df0 100644 --- a/common.gypi +++ b/common.gypi @@ -29,7 +29,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.18', + 'v8_embedder_string': '-node.19', # Enable disassembler for `--print-code` v8 options 'v8_enable_disassembler': 1, diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index b5bb85ca8a4ba4..362bece11f65a2 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -2901,7 +2901,11 @@ class V8_EXPORT String : public Name { * Creates a new string by concatenating the left and the right strings * passed in as parameters. */ - static Local Concat(Local left, Local right); + static Local Concat(Isolate* isolate, Local left, + Local right); + static V8_DEPRECATE_SOON("Use Isolate* version", + Local Concat(Local left, + Local right)); /** * Creates a new external string using the data defined in the given diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index fbd0dbc043be0f..5f8f3752008759 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -6646,10 +6646,10 @@ MaybeLocal String::NewFromTwoByte(Isolate* isolate, return result; } - -Local v8::String::Concat(Local left, Local right) { +Local v8::String::Concat(Isolate* v8_isolate, Local left, + Local right) { + i::Isolate* isolate = reinterpret_cast(v8_isolate); i::Handle left_string = Utils::OpenHandle(*left); - i::Isolate* isolate = left_string->GetIsolate(); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); LOG_API(isolate, String, Concat); i::Handle right_string = Utils::OpenHandle(*right); @@ -6663,6 +6663,11 @@ Local v8::String::Concat(Local left, Local right) { return Utils::ToLocal(result); } +Local v8::String::Concat(Local left, Local right) { + i::Handle left_string = Utils::OpenHandle(*left); + i::Isolate* isolate = left_string->GetIsolate(); + return Concat(reinterpret_cast(isolate), left, right); +} MaybeLocal v8::String::NewExternalTwoByte( Isolate* isolate, v8::String::ExternalStringResource* resource) { diff --git a/src/exceptions.cc b/src/exceptions.cc index 9cdb5a54b880c3..d1c0794e82fde4 100644 --- a/src/exceptions.cc +++ b/src/exceptions.cc @@ -26,32 +26,32 @@ Local ErrnoException(Isolate* isolate, Environment* env = Environment::GetCurrent(isolate); Local e; - Local estring = OneByteString(env->isolate(), errno_string(errorno)); + Local estring = OneByteString(isolate, errno_string(errorno)); if (msg == nullptr || msg[0] == '\0') { msg = strerror(errorno); } - Local message = OneByteString(env->isolate(), msg); + Local message = OneByteString(isolate, msg); Local cons = - String::Concat(estring, FIXED_ONE_BYTE_STRING(env->isolate(), ", ")); - cons = String::Concat(cons, message); + String::Concat(isolate, estring, FIXED_ONE_BYTE_STRING(isolate, ", ")); + cons = String::Concat(isolate, cons, message); Local path_string; if (path != nullptr) { // FIXME(bnoordhuis) It's questionable to interpret the file path as UTF-8. - path_string = String::NewFromUtf8(env->isolate(), path, - v8::NewStringType::kNormal).ToLocalChecked(); + path_string = String::NewFromUtf8(isolate, path, v8::NewStringType::kNormal) + .ToLocalChecked(); } if (path_string.IsEmpty() == false) { - cons = String::Concat(cons, FIXED_ONE_BYTE_STRING(env->isolate(), " '")); - cons = String::Concat(cons, path_string); - cons = String::Concat(cons, FIXED_ONE_BYTE_STRING(env->isolate(), "'")); + cons = String::Concat(isolate, cons, FIXED_ONE_BYTE_STRING(isolate, " '")); + cons = String::Concat(isolate, cons, path_string); + cons = String::Concat(isolate, cons, FIXED_ONE_BYTE_STRING(isolate, "'")); } e = Exception::Error(cons); Local obj = e.As(); - obj->Set(env->errno_string(), Integer::New(env->isolate(), errorno)); + obj->Set(env->errno_string(), Integer::New(isolate, errorno)); obj->Set(env->code_string(), estring); if (path_string.IsEmpty() == false) { @@ -59,7 +59,7 @@ Local ErrnoException(Isolate* isolate, } if (syscall != nullptr) { - obj->Set(env->syscall_string(), OneByteString(env->isolate(), syscall)); + obj->Set(env->syscall_string(), OneByteString(isolate, syscall)); } return e; @@ -68,10 +68,11 @@ Local ErrnoException(Isolate* isolate, static Local StringFromPath(Isolate* isolate, const char* path) { #ifdef _WIN32 if (strncmp(path, "\\\\?\\UNC\\", 8) == 0) { - return String::Concat(FIXED_ONE_BYTE_STRING(isolate, "\\\\"), - String::NewFromUtf8(isolate, path + 8, - v8::NewStringType::kNormal) - .ToLocalChecked()); + return String::Concat( + isolate, + FIXED_ONE_BYTE_STRING(isolate, "\\\\"), + String::NewFromUtf8(isolate, path + 8, v8::NewStringType::kNormal) + .ToLocalChecked()); } else if (strncmp(path, "\\\\?\\", 4) == 0) { return String::NewFromUtf8(isolate, path + 4, v8::NewStringType::kNormal) .ToLocalChecked(); @@ -109,25 +110,31 @@ Local UVException(Isolate* isolate, Local js_dest; Local js_msg = js_code; - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, ": ")); - js_msg = String::Concat(js_msg, OneByteString(isolate, msg)); - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, ", ")); - js_msg = String::Concat(js_msg, js_syscall); + js_msg = + String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, ": ")); + js_msg = String::Concat(isolate, js_msg, OneByteString(isolate, msg)); + js_msg = + String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, ", ")); + js_msg = String::Concat(isolate, js_msg, js_syscall); if (path != nullptr) { js_path = StringFromPath(isolate, path); - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, " '")); - js_msg = String::Concat(js_msg, js_path); - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, "'")); + js_msg = + String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, " '")); + js_msg = String::Concat(isolate, js_msg, js_path); + js_msg = + String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, "'")); } if (dest != nullptr) { js_dest = StringFromPath(isolate, dest); - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, " -> '")); - js_msg = String::Concat(js_msg, js_dest); - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, "'")); + js_msg = String::Concat( + isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, " -> '")); + js_msg = String::Concat(isolate, js_msg, js_dest); + js_msg = + String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, "'")); } Local e = Exception::Error(js_msg)->ToObject(isolate); @@ -182,17 +189,18 @@ Local WinapiErrnoException(Isolate* isolate, if (!msg || !msg[0]) { msg = winapi_strerror(errorno, &must_free); } - Local message = OneByteString(env->isolate(), msg); + Local message = OneByteString(isolate, msg); if (path) { Local cons1 = - String::Concat(message, FIXED_ONE_BYTE_STRING(isolate, " '")); - Local cons2 = - String::Concat(cons1, - String::NewFromUtf8(isolate, path, v8::NewStringType::kNormal) - .ToLocalChecked()); + String::Concat(isolate, message, FIXED_ONE_BYTE_STRING(isolate, " '")); + Local cons2 = String::Concat( + isolate, + cons1, + String::NewFromUtf8(isolate, path, v8::NewStringType::kNormal) + .ToLocalChecked()); Local cons3 = - String::Concat(cons2, FIXED_ONE_BYTE_STRING(isolate, "'")); + String::Concat(isolate, cons2, FIXED_ONE_BYTE_STRING(isolate, "'")); e = Exception::Error(cons3); } else { e = Exception::Error(message); diff --git a/src/node.cc b/src/node.cc index 5ec559fe5f7d32..4b17c5d7fa8af9 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1380,8 +1380,8 @@ static void DLOpen(const FunctionCallbackInfo& args) { dlib.Close(); #ifdef _WIN32 // Windows needs to add the filename into the error message - errmsg = String::Concat(errmsg, - args[1]->ToString(context).ToLocalChecked()); + errmsg = String::Concat( + env->isolate(), errmsg, args[1]->ToString(context).ToLocalChecked()); #endif // _WIN32 env->isolate()->ThrowException(Exception::Error(errmsg)); return; diff --git a/src/node_api.cc b/src/node_api.cc index 40ebc02798b4fe..cbbe78fab3474a 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -1838,14 +1838,16 @@ static napi_status set_error_code(napi_env env, if (!maybe_name.IsEmpty()) { v8::Local name = maybe_name.ToLocalChecked(); if (name->IsString()) { - name_string = v8::String::Concat(name_string, name.As()); + name_string = + v8::String::Concat(isolate, name_string, name.As()); } } - name_string = v8::String::Concat(name_string, - FIXED_ONE_BYTE_STRING(isolate, " [")); - name_string = v8::String::Concat(name_string, code_value.As()); - name_string = v8::String::Concat(name_string, - FIXED_ONE_BYTE_STRING(isolate, "]")); + name_string = v8::String::Concat( + isolate, name_string, FIXED_ONE_BYTE_STRING(isolate, " [")); + name_string = + v8::String::Concat(isolate, name_string, code_value.As()); + name_string = v8::String::Concat( + isolate, name_string, FIXED_ONE_BYTE_STRING(isolate, "]")); set_maybe = err_object->Set(context, name_key, name_string); RETURN_STATUS_IF_FALSE(env, diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 6ba2cb593a8bc4..ce9f5eb2f792e9 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -898,8 +898,10 @@ class ContextifyScript : public BaseObject { } Local decorated_stack = String::Concat( - String::Concat(arrow.As(), - FIXED_ONE_BYTE_STRING(env->isolate(), "\n")), + env->isolate(), + String::Concat(env->isolate(), + arrow.As(), + FIXED_ONE_BYTE_STRING(env->isolate(), "\n")), stack.As()); err_obj->Set(env->stack_string(), decorated_stack); err_obj->SetPrivate( diff --git a/src/string_decoder.cc b/src/string_decoder.cc index dcc99a09f9b3cd..b75169ff00cafb 100644 --- a/src/string_decoder.cc +++ b/src/string_decoder.cc @@ -226,7 +226,7 @@ MaybeLocal StringDecoder::DecodeData(Isolate* isolate, if (prepend.IsEmpty()) { return body; } else { - return String::Concat(prepend, body); + return String::Concat(isolate, prepend, body); } } else { CHECK(Encoding() == ASCII || Encoding() == HEX || Encoding() == LATIN1);