Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: V8: cherry-pick dfcdf7837e23 #36573

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -36,7 +36,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',

##### V8 defaults for Node.js #####

Expand Down
15 changes: 9 additions & 6 deletions deps/v8/src/parsing/parser-base.h
Expand Up @@ -2989,12 +2989,15 @@ ParserBase<Impl>::ParseCoalesceExpression(ExpressionT expression) {
bool first_nullish = true;
while (peek() == Token::NULLISH) {
SourceRange right_range;
SourceRangeScope right_range_scope(scanner(), &right_range);
Consume(Token::NULLISH);
int pos = peek_position();

// Parse BitwiseOR or higher.
ExpressionT y = ParseBinaryExpression(6);
int pos;
ExpressionT y;
{
SourceRangeScope right_range_scope(scanner(), &right_range);
Consume(Token::NULLISH);
pos = peek_position();
// Parse BitwiseOR or higher.
y = ParseBinaryExpression(6);
}
if (first_nullish) {
expression =
factory()->NewBinaryOperation(Token::NULLISH, expression, y, pos);
Expand Down
18 changes: 18 additions & 0 deletions deps/v8/test/mjsunit/code-coverage-block.js
Expand Up @@ -1177,4 +1177,22 @@ a(true); // 0500
{"start":0,"end":401,"count":2},
{"start":154,"end":254,"count":0}]);

TestCoverage(
"https://crbug.com/v8/11231 - nullish coalescing",
`
const a = true // 0000
const b = false // 0050
const c = undefined // 0100
const d = a ?? 99 // 0150
const e = 33 // 0200
const f = b ?? (c ?? 99) // 0250
const g = 33 // 0300
const h = c ?? (c ?? 'hello') // 0350
const i = c ?? b ?? 'hello' // 0400
`,
[{"start":0,"end":449,"count":1},
{"start":162,"end":167,"count":0},
{"start":262,"end":274,"count":0},
{"start":417,"end":427,"count":0}]);

%DebugToggleBlockCoverage(false);