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 02d7283

Browse filesBrowse files
bcoeMylesBorins
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 Backport-PR-URL: #31412 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 ad4af04 commit 02d7283
Copy full SHA for 02d7283

File tree

Expand file treeCollapse file tree

3 files changed

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

3 files changed

+39
-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
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.30',
41+
'v8_embedder_string': '-node.31',
4242

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

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
@@ -4087,6 +4087,7 @@ void ParserBase<Impl>::ParseFunctionBody(
40874087
inner_body.Rewind();
40884088
inner_body.Add(inner_block);
40894089
inner_block->set_scope(inner_scope);
4090+
impl()->RecordBlockSourceRange(inner_block, scope()->end_position());
40904091
if (!impl()->HasCheckedSyntax()) {
40914092
const AstRawString* conflict = inner_scope->FindVariableDeclaredIn(
40924093
function_scope, VariableMode::kLastLexicalVariableMode);
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
+37Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,4 +1097,41 @@ f(43); // 0450
10971097
{"start":204,"end":226,"count":1}]
10981098
);
10991099

1100+
TestCoverage(
1101+
"https://crbug.com/v8/9857",
1102+
`function foo() {function bar() {}}; foo()`,
1103+
[{"start":0,"end":41,"count":1},
1104+
{"start":0,"end":34,"count":1},
1105+
{"start":16,"end":33,"count":0}]
1106+
);
1107+
1108+
TestCoverage(
1109+
"https://crbug.com/v8/9952",
1110+
`
1111+
function test(foo = "foodef") { // 0000
1112+
return {bar}; // 0050
1113+
// 0100
1114+
function bar() { // 0150
1115+
console.log("test"); // 0200
1116+
} // 0250
1117+
} // 0300
1118+
test().bar(); // 0350`,
1119+
[{"start":0,"end":399,"count":1},
1120+
{"start":0,"end":301,"count":1},
1121+
{"start":152,"end":253,"count":1}]);
1122+
1123+
TestCoverage(
1124+
"https://crbug.com/v8/9952",
1125+
`
1126+
function test(foo = (()=>{})) { // 0000
1127+
return {foo}; // 0050
1128+
} // 0100
1129+
// 0150
1130+
test(()=>{}).foo(); // 0200`,
1131+
[{"start":0,"end":249,"count":1},
1132+
{"start":0,"end":101,"count":1},
1133+
{"start":21,"end":27,"count":0},
1134+
{"start":205,"end":211,"count":1}]
1135+
);
1136+
11001137
%DebugToggleBlockCoverage(false);

0 commit comments

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