GeezerVison is showing github.com — src,deps: add isolate parameter to String::Concat · nodejs/node@383d578
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: common.gypi +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 29 | 29 |
| 30 | 30 | # Reset this number to 0 on major V8 upgrades. | 31 | 31 | # Increment by one for each non-official patch applied to deps/v8. | 32 | | - 'v8_embedder_string': '-node.17', | | 32 | + 'v8_embedder_string': '-node.18', | 33 | 33 |
| 34 | 34 | # Enable disassembler for `--print-code` v8 options | 35 | 35 | 'v8_enable_disassembler': 1, | |
Collapse file Copy file name to clipboardExpand all lines: deps/v8/include/v8.h +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -2807,7 +2807,11 @@ class V8_EXPORT String : public Name { | 2807 | 2807 | * Creates a new string by concatenating the left and the right strings | 2808 | 2808 | * passed in as parameters. | 2809 | 2809 | */ | 2810 | | - static Local<String> Concat(Local<String> left, Local<String> right); | | 2810 | + static Local<String> Concat(Isolate* isolate, Local<String> left, | | 2811 | + Local<String> right); | | 2812 | + static V8_DEPRECATE_SOON("Use Isolate* version", | | 2813 | + Local<String> Concat(Local<String> left, | | 2814 | + Local<String> right)); | 2811 | 2815 |
| 2812 | 2816 | /** | 2813 | 2817 | * Creates a new external string using the data defined in the given | |
Collapse file Copy file name to clipboardExpand all lines: deps/v8/src/api.cc +8-3Lines changed: 8 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -6637,10 +6637,10 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate, | 6637 | 6637 | return result; | 6638 | 6638 | } | 6639 | 6639 |
| 6640 | | - | 6641 | | -Local<String> v8::String::Concat(Local<String> left, Local<String> right) { | | 6640 | +Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left, | | 6641 | + Local<String> right) { | | 6642 | + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 6642 | 6643 | i::Handle<i::String> left_string = Utils::OpenHandle(*left); | 6643 | | - i::Isolate* isolate = left_string->GetIsolate(); | 6644 | 6644 | ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); | 6645 | 6645 | LOG_API(isolate, String, Concat); | 6646 | 6646 | i::Handle<i::String> right_string = Utils::OpenHandle(*right); | @@ -6654,6 +6654,11 @@ Local<String> v8::String::Concat(Local<String> left, Local<String> right) { | 6654 | 6654 | return Utils::ToLocal(result); | 6655 | 6655 | } | 6656 | 6656 |
| | 6657 | +Local<String> v8::String::Concat(Local<String> left, Local<String> right) { | | 6658 | + i::Handle<i::String> left_string = Utils::OpenHandle(*left); | | 6659 | + i::Isolate* isolate = left_string->GetIsolate(); | | 6660 | + return Concat(reinterpret_cast<Isolate*>(isolate), left, right); | | 6661 | +} | 6657 | 6662 |
| 6658 | 6663 | MaybeLocal<String> v8::String::NewExternalTwoByte( | 6659 | 6664 | Isolate* isolate, v8::String::ExternalStringResource* resource) { | |
Collapse file Copy file name to clipboardExpand all lines: src/exceptions.cc +40-32Lines changed: 40 additions & 32 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -26,40 +26,40 @@ Local<Value> ErrnoException(Isolate* isolate, | 26 | 26 | Environment* env = Environment::GetCurrent(isolate); | 27 | 27 |
| 28 | 28 | Local<Value> e; | 29 | | - Local<String> estring = OneByteString(env->isolate(), errno_string(errorno)); | | 29 | + Local<String> estring = OneByteString(isolate, errno_string(errorno)); | 30 | 30 | if (msg == nullptr || msg[0] == '\0') { | 31 | 31 | msg = strerror(errorno); | 32 | 32 | } | 33 | | - Local<String> message = OneByteString(env->isolate(), msg); | | 33 | + Local<String> message = OneByteString(isolate, msg); | 34 | 34 |
| 35 | 35 | Local<String> cons = | 36 | | - String::Concat(estring, FIXED_ONE_BYTE_STRING(env->isolate(), ", ")); | 37 | | - cons = String::Concat(cons, message); | | 36 | + String::Concat(isolate, estring, FIXED_ONE_BYTE_STRING(isolate, ", ")); | | 37 | + cons = String::Concat(isolate, cons, message); | 38 | 38 |
| 39 | 39 | Local<String> path_string; | 40 | 40 | if (path != nullptr) { | 41 | 41 | // FIXME(bnoordhuis) It's questionable to interpret the file path as UTF-8. | 42 | | - path_string = String::NewFromUtf8(env->isolate(), path, | 43 | | - v8::NewStringType::kNormal).ToLocalChecked(); | | 42 | + path_string = String::NewFromUtf8(isolate, path, v8::NewStringType::kNormal) | | 43 | + .ToLocalChecked(); | 44 | 44 | } | 45 | 45 |
| 46 | 46 | if (path_string.IsEmpty() == false) { | 47 | | - cons = String::Concat(cons, FIXED_ONE_BYTE_STRING(env->isolate(), " '")); | 48 | | - cons = String::Concat(cons, path_string); | 49 | | - cons = String::Concat(cons, FIXED_ONE_BYTE_STRING(env->isolate(), "'")); | | 47 | + cons = String::Concat(isolate, cons, FIXED_ONE_BYTE_STRING(isolate, " '")); | | 48 | + cons = String::Concat(isolate, cons, path_string); | | 49 | + cons = String::Concat(isolate, cons, FIXED_ONE_BYTE_STRING(isolate, "'")); | 50 | 50 | } | 51 | 51 | e = Exception::Error(cons); | 52 | 52 |
| 53 | 53 | Local<Object> obj = e.As<Object>(); | 54 | | - obj->Set(env->errno_string(), Integer::New(env->isolate(), errorno)); | | 54 | + obj->Set(env->errno_string(), Integer::New(isolate, errorno)); | 55 | 55 | obj->Set(env->code_string(), estring); | 56 | 56 |
| 57 | 57 | if (path_string.IsEmpty() == false) { | 58 | 58 | obj->Set(env->path_string(), path_string); | 59 | 59 | } | 60 | 60 |
| 61 | 61 | if (syscall != nullptr) { | 62 | | - obj->Set(env->syscall_string(), OneByteString(env->isolate(), syscall)); | | 62 | + obj->Set(env->syscall_string(), OneByteString(isolate, syscall)); | 63 | 63 | } | 64 | 64 |
| 65 | 65 | return e; | @@ -68,10 +68,11 @@ Local<Value> ErrnoException(Isolate* isolate, | 68 | 68 | static Local<String> StringFromPath(Isolate* isolate, const char* path) { | 69 | 69 | #ifdef _WIN32 | 70 | 70 | if (strncmp(path, "\\\\?\\UNC\\", 8) == 0) { | 71 | | - return String::Concat(FIXED_ONE_BYTE_STRING(isolate, "\\\\"), | 72 | | - String::NewFromUtf8(isolate, path + 8, | 73 | | - v8::NewStringType::kNormal) | 74 | | - .ToLocalChecked()); | | 71 | + return String::Concat( | | 72 | + isolate, | | 73 | + FIXED_ONE_BYTE_STRING(isolate, "\\\\"), | | 74 | + String::NewFromUtf8(isolate, path + 8, v8::NewStringType::kNormal) | | 75 | + .ToLocalChecked()); | 75 | 76 | } else if (strncmp(path, "\\\\?\\", 4) == 0) { | 76 | 77 | return String::NewFromUtf8(isolate, path + 4, v8::NewStringType::kNormal) | 77 | 78 | .ToLocalChecked(); | @@ -109,25 +110,31 @@ Local<Value> UVException(Isolate* isolate, | 109 | 110 | Local<String> js_dest; | 110 | 111 |
| 111 | 112 | Local<String> js_msg = js_code; | 112 | | - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, ": ")); | 113 | | - js_msg = String::Concat(js_msg, OneByteString(isolate, msg)); | 114 | | - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, ", ")); | 115 | | - js_msg = String::Concat(js_msg, js_syscall); | | 113 | + js_msg = | | 114 | + String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, ": ")); | | 115 | + js_msg = String::Concat(isolate, js_msg, OneByteString(isolate, msg)); | | 116 | + js_msg = | | 117 | + String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, ", ")); | | 118 | + js_msg = String::Concat(isolate, js_msg, js_syscall); | 116 | 119 |
| 117 | 120 | if (path != nullptr) { | 118 | 121 | js_path = StringFromPath(isolate, path); | 119 | 122 |
| 120 | | - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, " '")); | 121 | | - js_msg = String::Concat(js_msg, js_path); | 122 | | - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, "'")); | | 123 | + js_msg = | | 124 | + String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, " '")); | | 125 | + js_msg = String::Concat(isolate, js_msg, js_path); | | 126 | + js_msg = | | 127 | + String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, "'")); | 123 | 128 | } | 124 | 129 |
| 125 | 130 | if (dest != nullptr) { | 126 | 131 | js_dest = StringFromPath(isolate, dest); | 127 | 132 |
| 128 | | - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, " -> '")); | 129 | | - js_msg = String::Concat(js_msg, js_dest); | 130 | | - js_msg = String::Concat(js_msg, FIXED_ONE_BYTE_STRING(isolate, "'")); | | 133 | + js_msg = String::Concat( | | 134 | + isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, " -> '")); | | 135 | + js_msg = String::Concat(isolate, js_msg, js_dest); | | 136 | + js_msg = | | 137 | + String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, "'")); | 131 | 138 | } | 132 | 139 |
| 133 | 140 | Local<Object> e = Exception::Error(js_msg)->ToObject(isolate); | @@ -182,17 +189,18 @@ Local<Value> WinapiErrnoException(Isolate* isolate, | 182 | 189 | if (!msg || !msg[0]) { | 183 | 190 | msg = winapi_strerror(errorno, &must_free); | 184 | 191 | } | 185 | | - Local<String> message = OneByteString(env->isolate(), msg); | | 192 | + Local<String> message = OneByteString(isolate, msg); | 186 | 193 |
| 187 | 194 | if (path) { | 188 | 195 | Local<String> cons1 = | 189 | | - String::Concat(message, FIXED_ONE_BYTE_STRING(isolate, " '")); | 190 | | - Local<String> cons2 = | 191 | | - String::Concat(cons1, | 192 | | - String::NewFromUtf8(isolate, path, v8::NewStringType::kNormal) | 193 | | - .ToLocalChecked()); | | 196 | + String::Concat(isolate, message, FIXED_ONE_BYTE_STRING(isolate, " '")); | | 197 | + Local<String> cons2 = String::Concat( | | 198 | + isolate, | | 199 | + cons1, | | 200 | + String::NewFromUtf8(isolate, path, v8::NewStringType::kNormal) | | 201 | + .ToLocalChecked()); | 194 | 202 | Local<String> cons3 = | 195 | | - String::Concat(cons2, FIXED_ONE_BYTE_STRING(isolate, "'")); | | 203 | + String::Concat(isolate, cons2, FIXED_ONE_BYTE_STRING(isolate, "'")); | 196 | 204 | e = Exception::Error(cons3); | 197 | 205 | } else { | 198 | 206 | e = Exception::Error(message); | |
Collapse file Copy file name to clipboardExpand all lines: src/node.cc +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1379,8 +1379,8 @@ static void DLOpen(const FunctionCallbackInfo<Value>& args) { | 1379 | 1379 | dlib.Close(); | 1380 | 1380 | #ifdef _WIN32 | 1381 | 1381 | // Windows needs to add the filename into the error message | 1382 | | - errmsg = String::Concat(errmsg, | 1383 | | - args[1]->ToString(context).ToLocalChecked()); | | 1382 | + errmsg = String::Concat( | | 1383 | + env->isolate(), errmsg, args[1]->ToString(context).ToLocalChecked()); | 1384 | 1384 | #endif // _WIN32 | 1385 | 1385 | env->isolate()->ThrowException(Exception::Error(errmsg)); | 1386 | 1386 | return; | |
Collapse file Copy file name to clipboardExpand all lines: src/node_api.cc +8-6Lines changed: 8 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1838,14 +1838,16 @@ static napi_status set_error_code(napi_env env, | 1838 | 1838 | if (!maybe_name.IsEmpty()) { | 1839 | 1839 | v8::Local<v8::Value> name = maybe_name.ToLocalChecked(); | 1840 | 1840 | if (name->IsString()) { | 1841 | | - name_string = v8::String::Concat(name_string, name.As<v8::String>()); | | 1841 | + name_string = | | 1842 | + v8::String::Concat(isolate, name_string, name.As<v8::String>()); | 1842 | 1843 | } | 1843 | 1844 | } | 1844 | | - name_string = v8::String::Concat(name_string, | 1845 | | - FIXED_ONE_BYTE_STRING(isolate, " [")); | 1846 | | - name_string = v8::String::Concat(name_string, code_value.As<v8::String>()); | 1847 | | - name_string = v8::String::Concat(name_string, | 1848 | | - FIXED_ONE_BYTE_STRING(isolate, "]")); | | 1845 | + name_string = v8::String::Concat( | | 1846 | + isolate, name_string, FIXED_ONE_BYTE_STRING(isolate, " [")); | | 1847 | + name_string = | | 1848 | + v8::String::Concat(isolate, name_string, code_value.As<v8::String>()); | | 1849 | + name_string = v8::String::Concat( | | 1850 | + isolate, name_string, FIXED_ONE_BYTE_STRING(isolate, "]")); | 1849 | 1851 |
| 1850 | 1852 | set_maybe = err_object->Set(context, name_key, name_string); | 1851 | 1853 | RETURN_STATUS_IF_FALSE(env, | |
Collapse file Copy file name to clipboardExpand all lines: src/node_contextify.cc +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -897,8 +897,10 @@ class ContextifyScript : public BaseObject { | 897 | 897 | } | 898 | 898 |
| 899 | 899 | Local<String> decorated_stack = String::Concat( | 900 | | - String::Concat(arrow.As<String>(), | 901 | | - FIXED_ONE_BYTE_STRING(env->isolate(), "\n")), | | 900 | + env->isolate(), | | 901 | + String::Concat(env->isolate(), | | 902 | + arrow.As<String>(), | | 903 | + FIXED_ONE_BYTE_STRING(env->isolate(), "\n")), | 902 | 904 | stack.As<String>()); | 903 | 905 | err_obj->Set(env->stack_string(), decorated_stack); | 904 | 906 | err_obj->SetPrivate( | |
Collapse file Copy file name to clipboardExpand all lines: src/string_decoder.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -226,7 +226,7 @@ MaybeLocal<String> StringDecoder::DecodeData(Isolate* isolate, | 226 | 226 | if (prepend.IsEmpty()) { | 227 | 227 | return body; | 228 | 228 | } else { | 229 | | - return String::Concat(prepend, body); | | 229 | + return String::Concat(isolate, prepend, body); | 230 | 230 | } | 231 | 231 | } else { | 232 | 232 | CHECK(Encoding() == ASCII || Encoding() == HEX || Encoding() == LATIN1); | |
|