GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deps: V8: cherry-pick deac757 · nodejs/node@23271dd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common.gypi
  • deps/v8
    • src/ast
      • source-range-ast-visitor.cc
      • source-range-ast-visitor.h
    • test/mjsunit
      • code-coverage-block.js
      • code-coverage-utils.js
Expand file treeCollapse file tree
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.9',
41+
'v8_embedder_string': '-node.10',
4242

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

Collapse file

‎deps/v8/src/ast/source-range-ast-visitor.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/ast/source-range-ast-visitor.cc
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ void SourceRangeAstVisitor::VisitBlock(Block* stmt) {
2525
}
2626
}
2727

28+
void SourceRangeAstVisitor::VisitSwitchStatement(SwitchStatement* stmt) {
29+
AstTraversalVisitor::VisitSwitchStatement(stmt);
30+
ZonePtrList<CaseClause>* clauses = stmt->cases();
31+
for (CaseClause* clause : *clauses) {
32+
MaybeRemoveLastContinuationRange(clause->statements());
33+
}
34+
}
35+
2836
void SourceRangeAstVisitor::VisitFunctionLiteral(FunctionLiteral* expr) {
2937
AstTraversalVisitor::VisitFunctionLiteral(expr);
3038
ZonePtrList<Statement>* stmts = expr->body();
Collapse file

‎deps/v8/src/ast/source-range-ast-visitor.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/ast/source-range-ast-visitor.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class SourceRangeAstVisitor final
3434
friend class AstTraversalVisitor<SourceRangeAstVisitor>;
3535

3636
void VisitBlock(Block* stmt);
37+
void VisitSwitchStatement(SwitchStatement* stmt);
3738
void VisitFunctionLiteral(FunctionLiteral* expr);
3839
bool VisitNode(AstNode* node);
3940

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
+49-4Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ TestCoverage(
434434
`,
435435
[{"start":0,"end":399,"count":1},
436436
{"start":1,"end":351,"count":1},
437-
{"start":154,"end":204,"count":0},
438-
{"start":226,"end":350,"count":0}]
437+
{"start":154,"end":176,"count":0},
438+
{"start":254,"end":276,"count":0}]
439439
);
440440

441441
TestCoverage(
@@ -464,8 +464,8 @@ TestCoverage(
464464
`,
465465
[{"start":0,"end":999,"count":1},
466466
{"start":1,"end":951,"count":1},
467-
{"start":152,"end":202,"count":0},
468-
{"start":285,"end":353,"count":0}]
467+
{"start":152,"end":168,"count":0},
468+
{"start":287,"end":310,"count":0}]
469469
);
470470

471471
TestCoverage(
@@ -1052,4 +1052,49 @@ try { // 0500
10521052
{"start":69,"end":153,"count":1}]
10531053
);
10541054

1055+
TestCoverage(
1056+
"https://crbug.com/v8/9705",
1057+
`
1058+
function f(x) { // 0000
1059+
switch (x) { // 0050
1060+
case 40: nop(); // 0100
1061+
case 41: nop(); return 1; // 0150
1062+
case 42: nop(); break; // 0200
1063+
} // 0250
1064+
return 3; // 0300
1065+
}; // 0350
1066+
f(40); // 0400
1067+
f(41); // 0450
1068+
f(42); // 0500
1069+
f(43); // 0550
1070+
`,
1071+
[{"start":0,"end":599,"count":1},
1072+
{"start":0,"end":351,"count":4},
1073+
{"start":104,"end":119,"count":1},
1074+
{"start":154,"end":179,"count":2},
1075+
{"start":204,"end":226,"count":1},
1076+
{"start":253,"end":350,"count":2}]
1077+
);
1078+
1079+
TestCoverage(
1080+
"https://crbug.com/v8/9705",
1081+
`
1082+
function f(x) { // 0000
1083+
switch (x) { // 0050
1084+
case 40: nop(); // 0100
1085+
case 41: nop(); return 1; // 0150
1086+
case 42: nop(); break; // 0200
1087+
} // 0250
1088+
return 3; // 0300
1089+
}; // 0350
1090+
f(42); // 0400
1091+
f(43); // 0450
1092+
`,
1093+
[{"start":0,"end":499,"count":1},
1094+
{"start":0,"end":351,"count":2},
1095+
{"start":104,"end":119,"count":0},
1096+
{"start":154,"end":179,"count":0},
1097+
{"start":204,"end":226,"count":1}]
1098+
);
1099+
10551100
%DebugToggleBlockCoverage(false);
Collapse file

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

Copy file name to clipboardExpand all lines: deps/v8/test/mjsunit/code-coverage-utils.js
+22-7Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,40 @@ let gen;
1818
return undefined;
1919
};
2020

21-
function TestCoverageInternal(name, source, expectation, collect_garbage) {
21+
function TestCoverageInternal(
22+
name, source, expectation, collect_garbage, prettyPrintResults) {
2223
source = source.trim();
2324
eval(source);
2425
if (collect_garbage) %CollectGarbage("collect dead objects");
2526
var covfefe = GetCoverage(source);
2627
var stringified_result = JSON.stringify(covfefe);
2728
var stringified_expectation = JSON.stringify(expectation);
28-
if (stringified_result != stringified_expectation) {
29-
print(stringified_result.replace(/[}],[{]/g, "},\n {"));
29+
const mismatch = stringified_result != stringified_expectation;
30+
if (mismatch) {
31+
console.log(stringified_result.replace(/[}],[{]/g, "},\n {"));
32+
}
33+
if (prettyPrintResults) {
34+
console.log("=== Coverage Expectation ===")
35+
for (const {start,end,count} of expectation) {
36+
console.log(`Range [${start}, ${end}) (count: ${count})`);
37+
console.log(source.substring(start, end));
38+
}
39+
console.log("=== Coverage Results ===")
40+
for (const {start,end,count} of covfefe) {
41+
console.log(`Range [${start}, ${end}) (count: ${count})`);
42+
console.log(source.substring(start, end));
43+
}
44+
console.log("========================")
3045
}
3146
assertEquals(stringified_expectation, stringified_result, name + " failed");
3247
};
3348

34-
TestCoverage = function(name, source, expectation) {
35-
TestCoverageInternal(name, source, expectation, true);
49+
TestCoverage = function(name, source, expectation, prettyPrintResults) {
50+
TestCoverageInternal(name, source, expectation, true, prettyPrintResults);
3651
};
3752

38-
TestCoverageNoGC = function(name, source, expectation) {
39-
TestCoverageInternal(name, source, expectation, false);
53+
TestCoverageNoGC = function(name, source, expectation, prettyPrintResults) {
54+
TestCoverageInternal(name, source, expectation, false, prettyPrintResults);
4055
};
4156

4257
nop = function() {};

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.