GeezerVison is showing github.com — deps: backport String::Write{OneByte,Utf8} with isolate · nodejs/node@d50e1ff
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.20', | | 32 | + 'v8_embedder_string': '-node.21', | 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 +16-11Lines changed: 16 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2634,20 +2634,25 @@ class V8_EXPORT String : public Name { | 2634 | 2634 | }; | 2635 | 2635 |
| 2636 | 2636 | // 16-bit character codes. | 2637 | | - int Write(uint16_t* buffer, | 2638 | | - int start = 0, | 2639 | | - int length = -1, | | 2637 | + int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1, | 2640 | 2638 | int options = NO_OPTIONS) const; | | 2639 | + V8_DEPRECATE_SOON("Use Isolate* version", | | 2640 | + int Write(uint16_t* buffer, int start = 0, int length = -1, | | 2641 | + int options = NO_OPTIONS) const); | 2641 | 2642 | // One byte characters. | 2642 | | - int WriteOneByte(uint8_t* buffer, | 2643 | | - int start = 0, | 2644 | | - int length = -1, | 2645 | | - int options = NO_OPTIONS) const; | | 2643 | + int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0, | | 2644 | + int length = -1, int options = NO_OPTIONS) const; | | 2645 | + V8_DEPRECATE_SOON("Use Isolate* version", | | 2646 | + int WriteOneByte(uint8_t* buffer, int start = 0, | | 2647 | + int length = -1, int options = NO_OPTIONS) | | 2648 | + const); | 2646 | 2649 | // UTF-8 encoded characters. | 2647 | | - int WriteUtf8(char* buffer, | 2648 | | - int length = -1, | 2649 | | - int* nchars_ref = NULL, | 2650 | | - int options = NO_OPTIONS) const; | | 2650 | + int WriteUtf8(Isolate* isolate, char* buffer, int length = -1, | | 2651 | + int* nchars_ref = NULL, int options = NO_OPTIONS) const; | | 2652 | + V8_DEPRECATE_SOON("Use Isolate* version", | | 2653 | + int WriteUtf8(char* buffer, int length = -1, | | 2654 | + int* nchars_ref = NULL, | | 2655 | + int options = NO_OPTIONS) const); | 2651 | 2656 |
| 2652 | 2657 | /** | 2653 | 2658 | * A zero length string. | |
Collapse file Copy file name to clipboardExpand all lines: deps/v8/src/api.cc +29-13Lines changed: 29 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5702,12 +5702,10 @@ static bool RecursivelySerializeToUtf8(i::String* current, | 5702 | 5702 | } | 5703 | 5703 |
| 5704 | 5704 |
| 5705 | | -int String::WriteUtf8(char* buffer, | 5706 | | - int capacity, | 5707 | | - int* nchars_ref, | 5708 | | - int options) const { | | 5705 | +int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity, | | 5706 | + int* nchars_ref, int options) const { | 5709 | 5707 | i::Handle<i::String> str = Utils::OpenHandle(this); | 5710 | | - i::Isolate* isolate = str->GetIsolate(); | | 5708 | + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 5711 | 5709 | LOG_API(isolate, String, WriteUtf8); | 5712 | 5710 | ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); | 5713 | 5711 | str = i::String::Flatten(str); // Flatten the string for efficiency. | @@ -5748,14 +5746,18 @@ int String::WriteUtf8(char* buffer, | 5748 | 5746 | return writer.CompleteWrite(write_null, nchars_ref); | 5749 | 5747 | } | 5750 | 5748 |
| | 5749 | +int String::WriteUtf8(char* buffer, int capacity, int* nchars_ref, | | 5750 | + int options) const { | | 5751 | + i::Handle<i::String> str = Utils::OpenHandle(this); | | 5752 | + i::Isolate* isolate = str->GetIsolate(); | | 5753 | + return WriteUtf8(reinterpret_cast<Isolate*>(isolate), buffer, capacity, | | 5754 | + nchars_ref, options); | | 5755 | +} | 5751 | 5756 |
| 5752 | | -template<typename CharType> | 5753 | | -static inline int WriteHelper(const String* string, | 5754 | | - CharType* buffer, | 5755 | | - int start, | 5756 | | - int length, | | 5757 | +template <typename CharType> | | 5758 | +static inline int WriteHelper(i::Isolate* isolate, const String* string, | | 5759 | + CharType* buffer, int start, int length, | 5757 | 5760 | int options) { | 5758 | | - i::Isolate* isolate = Utils::OpenHandle(string)->GetIsolate(); | 5759 | 5761 | LOG_API(isolate, String, Write); | 5760 | 5762 | ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate); | 5761 | 5763 | DCHECK(start >= 0 && length >= -1); | @@ -5778,15 +5780,29 @@ int String::WriteOneByte(uint8_t* buffer, | 5778 | 5780 | int start, | 5779 | 5781 | int length, | 5780 | 5782 | int options) const { | 5781 | | - return WriteHelper(this, buffer, start, length, options); | | 5783 | + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | | 5784 | + return WriteHelper(isolate, this, buffer, start, length, options); | | 5785 | +} | | 5786 | + | | 5787 | +int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start, | | 5788 | + int length, int options) const { | | 5789 | + return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer, | | 5790 | + start, length, options); | 5782 | 5791 | } | 5783 | 5792 |
| 5784 | 5793 |
| 5785 | 5794 | int String::Write(uint16_t* buffer, | 5786 | 5795 | int start, | 5787 | 5796 | int length, | 5788 | 5797 | int options) const { | 5789 | | - return WriteHelper(this, buffer, start, length, options); | | 5798 | + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | | 5799 | + return WriteHelper(isolate, this, buffer, start, length, options); | | 5800 | +} | | 5801 | + | | 5802 | +int String::Write(Isolate* isolate, uint16_t* buffer, int start, int length, | | 5803 | + int options) const { | | 5804 | + return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer, | | 5805 | + start, length, options); | 5790 | 5806 | } | 5791 | 5807 |
| 5792 | 5808 |
| |
|