Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0ba877a

Browse filesBrowse files
bcoetargos
authored andcommitted
deps: V8: cherry-pick 0dfd9ea51241
Original commit message: [coverage] Fix coverage with default arguments In the presence of default arguments, the body of the function gets wrapped into another block. This caused our trailing-range-after-return optimization to not apply, because the wrapper block had no source range assigned. This CL correctly assignes a source range to that block, which allows already present code to handle it correctly. Note that this is not a real coverage bug; we've just been reporting whitespace as uncovered. We're fixing it for consistency. Originally reported on github.com/bcoe/c8/issues/66 Bug: v8:9952 Change-Id: Iab3905f558eb99126e0dad8072d03d0a312fdcd3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1903430 Commit-Queue: Sigurd Schneider <sigurds@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#64836} Refs: v8/v8@0dfd9ea PR-URL: #30713 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 93707c4 commit 0ba877a
Copy full SHA for 0ba877a

File tree

Expand file treeCollapse file tree

4 files changed

+48
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+48
-1
lines changed
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
# Reset this number to 0 on major V8 upgrades.
4141
# Increment by one for each non-official patch applied to deps/v8.
42-
'v8_embedder_string': '-node.22',
42+
'v8_embedder_string': '-node.23',
4343

4444
##### V8 defaults for Node.js #####
4545

Collapse file

‎deps/v8/src/parsing/parser-base.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/parsing/parser-base.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4108,6 +4108,7 @@ void ParserBase<Impl>::ParseFunctionBody(
41084108
inner_body.Rewind();
41094109
inner_body.Add(inner_block);
41104110
inner_block->set_scope(inner_scope);
4111+
impl()->RecordBlockSourceRange(inner_block, scope()->end_position());
41114112
if (!impl()->HasCheckedSyntax()) {
41124113
const AstRawString* conflict = inner_scope->FindVariableDeclaredIn(
41134114
function_scope, VariableMode::kLastLexicalVariableMode);
Collapse file

‎deps/v8/test/mjsunit/code-coverage-block-async.js‎

Copy file name to clipboardExpand all lines: deps/v8/test/mjsunit/code-coverage-block-async.js
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,21 @@ new Foo().timeout().next(); // 0400
119119
{"start":184,"end":302,"count":0},
120120
{"start":158,"end":182,"count":1}] );
121121

122+
TestCoverage(
123+
"https://crbug.com/v8/9952",
124+
`
125+
async function test(foo) { // 0000
126+
return {bar}; // 0050
127+
// 0100
128+
function bar() { // 0150
129+
console.log("test"); // 0200
130+
} // 0250
131+
} // 0300
132+
test().then(r => r.bar()); // 0350
133+
%PerformMicrotaskCheckpoint(); // 0400`,
134+
[{"start":0,"end":449,"count":1},
135+
{"start":0,"end":301,"count":1},
136+
{"start":152,"end":253,"count":1},
137+
{"start":362,"end":374,"count":1}]);
138+
122139
%DebugToggleBlockCoverage(false);
Collapse file

‎deps/v8/test/mjsunit/code-coverage-block.js‎

Copy file name to clipboardExpand all lines: deps/v8/test/mjsunit/code-coverage-block.js
+29Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,4 +1083,33 @@ TestCoverage(
10831083
{"start":16,"end":33,"count":0}]
10841084
);
10851085

1086+
TestCoverage(
1087+
"https://crbug.com/v8/9952",
1088+
`
1089+
function test(foo = "foodef") { // 0000
1090+
return {bar}; // 0050
1091+
// 0100
1092+
function bar() { // 0150
1093+
console.log("test"); // 0200
1094+
} // 0250
1095+
} // 0300
1096+
test().bar(); // 0350`,
1097+
[{"start":0,"end":399,"count":1},
1098+
{"start":0,"end":301,"count":1},
1099+
{"start":152,"end":253,"count":1}]);
1100+
1101+
TestCoverage(
1102+
"https://crbug.com/v8/9952",
1103+
`
1104+
function test(foo = (()=>{})) { // 0000
1105+
return {foo}; // 0050
1106+
} // 0100
1107+
// 0150
1108+
test(()=>{}).foo(); // 0200`,
1109+
[{"start":0,"end":249,"count":1},
1110+
{"start":0,"end":101,"count":1},
1111+
{"start":21,"end":27,"count":0},
1112+
{"start":205,"end":211,"count":1}]
1113+
);
1114+
10861115
%DebugToggleBlockCoverage(false);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.