Skip to content

Commit

Permalink
deps: backport String::Utf8Length with isolate
Browse files Browse the repository at this point in the history
This overload was added in V8 6.9 and the one without the isolate
parameter was removed in V8 7.0.

Refs: v8/v8@3dd5c6f

PR-URL: #22531
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
targos committed Aug 29, 2018
1 parent a64fd7f commit 17dd620
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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.21',
'v8_embedder_string': '-node.22',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
Expand Down
4 changes: 3 additions & 1 deletion deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -2674,7 +2674,9 @@ class V8_EXPORT String : public Name {
* Returns the number of bytes in the UTF-8 encoded
* representation of this string.
*/
int Utf8Length() const;
V8_DEPRECATE_SOON("Use Isolate version instead", int Utf8Length() const);

int Utf8Length(Isolate* isolate) const;

/**
* Returns whether this string is known to contain only one byte data,
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5484,6 +5484,9 @@ bool String::ContainsOnlyOneByte() const {
return helper.Check(*str);
}

int String::Utf8Length(Isolate* isolate) const {
return Utf8Length();
}

int String::Utf8Length() const {
i::Handle<i::String> str = Utils::OpenHandle(this);
Expand Down

0 comments on commit 17dd620

Please sign in to comment.