diff --git a/common.gypi b/common.gypi index 64c70c83975bee..ba4966e435171c 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.20', + 'v8_embedder_string': '-node.21', # 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 91001cf594ca26..b5befd51573e30 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -2634,20 +2634,25 @@ class V8_EXPORT String : public Name { }; // 16-bit character codes. - int Write(uint16_t* buffer, - int start = 0, - int length = -1, + int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1, int options = NO_OPTIONS) const; + V8_DEPRECATE_SOON("Use Isolate* version", + int Write(uint16_t* buffer, int start = 0, int length = -1, + int options = NO_OPTIONS) const); // One byte characters. - int WriteOneByte(uint8_t* buffer, - int start = 0, - int length = -1, - int options = NO_OPTIONS) const; + int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0, + int length = -1, int options = NO_OPTIONS) const; + V8_DEPRECATE_SOON("Use Isolate* version", + int WriteOneByte(uint8_t* buffer, int start = 0, + int length = -1, int options = NO_OPTIONS) + const); // UTF-8 encoded characters. - int WriteUtf8(char* buffer, - int length = -1, - int* nchars_ref = NULL, - int options = NO_OPTIONS) const; + int WriteUtf8(Isolate* isolate, char* buffer, int length = -1, + int* nchars_ref = NULL, int options = NO_OPTIONS) const; + V8_DEPRECATE_SOON("Use Isolate* version", + int WriteUtf8(char* buffer, int length = -1, + int* nchars_ref = NULL, + int options = NO_OPTIONS) const); /** * A zero length string. diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index a2721f180e20a9..191acb80aac8c2 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -5702,12 +5702,10 @@ static bool RecursivelySerializeToUtf8(i::String* current, } -int String::WriteUtf8(char* buffer, - int capacity, - int* nchars_ref, - int options) const { +int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity, + int* nchars_ref, int options) const { i::Handle str = Utils::OpenHandle(this); - i::Isolate* isolate = str->GetIsolate(); + i::Isolate* isolate = reinterpret_cast(v8_isolate); LOG_API(isolate, String, WriteUtf8); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); str = i::String::Flatten(str); // Flatten the string for efficiency. @@ -5748,14 +5746,18 @@ int String::WriteUtf8(char* buffer, return writer.CompleteWrite(write_null, nchars_ref); } +int String::WriteUtf8(char* buffer, int capacity, int* nchars_ref, + int options) const { + i::Handle str = Utils::OpenHandle(this); + i::Isolate* isolate = str->GetIsolate(); + return WriteUtf8(reinterpret_cast(isolate), buffer, capacity, + nchars_ref, options); +} -template -static inline int WriteHelper(const String* string, - CharType* buffer, - int start, - int length, +template +static inline int WriteHelper(i::Isolate* isolate, const String* string, + CharType* buffer, int start, int length, int options) { - i::Isolate* isolate = Utils::OpenHandle(string)->GetIsolate(); LOG_API(isolate, String, Write); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); DCHECK(start >= 0 && length >= -1); @@ -5778,7 +5780,14 @@ int String::WriteOneByte(uint8_t* buffer, int start, int length, int options) const { - return WriteHelper(this, buffer, start, length, options); + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); + return WriteHelper(isolate, this, buffer, start, length, options); +} + +int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start, + int length, int options) const { + return WriteHelper(reinterpret_cast(isolate), this, buffer, + start, length, options); } @@ -5786,7 +5795,14 @@ int String::Write(uint16_t* buffer, int start, int length, int options) const { - return WriteHelper(this, buffer, start, length, options); + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); + return WriteHelper(isolate, this, buffer, start, length, options); +} + +int String::Write(Isolate* isolate, uint16_t* buffer, int start, int length, + int options) const { + return WriteHelper(reinterpret_cast(isolate), this, buffer, + start, length, options); }