Skip to content

Commit 64b4a2e

Browse files
bcoeMylesBorins
authored andcommittedNov 3, 2020
deps: V8: cherry-pick 6be2f6e26e8d
Original commit message: [coverage] IncBlockCounter should not be side-effect Incrementing coverage counter was triggering EvalError for evaluateOnCallFrame when throwOnSideEffect is true. [email protected], [email protected], [email protected] Bug: v8:10856 Change-Id: I0552e19a3a14ff61a9cb626494fb4a21979d535e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2384011 Commit-Queue: Benjamin Coe <[email protected]> Reviewed-by: Jakob Gruber <[email protected]> Reviewed-by: Yang Guo <[email protected]> Reviewed-by: Sigurd Schneider <[email protected]> Cr-Commit-Position: refs/heads/master@{#69628} Refs: v8/v8@6be2f6e PR-URL: #35055 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Shelley Vohr <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 3179fa5 commit 64b4a2e

5 files changed

+49
-1
lines changed
 

‎common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
# Reset this number to 0 on major V8 upgrades.
3636
# Increment by one for each non-official patch applied to deps/v8.
37-
'v8_embedder_string': '-node.44',
37+
'v8_embedder_string': '-node.45',
3838

3939
##### V8 defaults for Node.js #####
4040

‎deps/v8/src/debug/debug-evaluate.cc

+1
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ bool BytecodeHasNoSideEffect(interpreter::Bytecode bytecode) {
457457
case Bytecode::kToNumeric:
458458
case Bytecode::kToString:
459459
// Misc.
460+
case Bytecode::kIncBlockCounter: // Coverage counters.
460461
case Bytecode::kForInEnumerate:
461462
case Bytecode::kForInPrepare:
462463
case Bytecode::kForInContinue:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Tests side-effect-free evaluation with coverage enabled
2+
Paused on 'debugger;'
3+
f() returns 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2020 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
let {session, contextGroup, Protocol} = InspectorTest.start('Tests side-effect-free evaluation with coverage enabled');
6+
7+
contextGroup.addScript(`
8+
function testFunction()
9+
{
10+
var o = 0;
11+
function f() { return 1; }
12+
function g() { o = 2; return o; }
13+
f,g;
14+
debugger;
15+
}
16+
//# sourceURL=foo.js`);
17+
18+
// Side effect free call should not result in EvalError when coverage
19+
// is enabled:
20+
Protocol.Profiler.enable()
21+
Protocol.Profiler.startPreciseCoverage({callCount: true, detailed: true})
22+
23+
Protocol.Debugger.enable();
24+
25+
Protocol.Debugger.oncePaused().then(debuggerPaused);
26+
27+
Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0)" });
28+
29+
var topFrameId;
30+
31+
function debuggerPaused(messageObject)
32+
{
33+
InspectorTest.log("Paused on 'debugger;'");
34+
35+
topFrameId = messageObject.params.callFrames[0].callFrameId;
36+
Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: "f()", throwOnSideEffect: true}).then(evaluatedFirst);
37+
}
38+
39+
function evaluatedFirst(response)
40+
{
41+
InspectorTest.log("f() returns " + response.result.result.value);
42+
InspectorTest.completeTest();
43+
}

‎deps/v8/test/inspector/inspector.status

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
'debugger/eval-scopes': [PASS, FAIL],
3232
'debugger/scope-skip-variables-with-empty-name': [PASS, FAIL],
3333
'debugger/update-call-frame-scopes': [PASS, FAIL],
34+
'debugger/side-effect-free-coverage-enabled': [PASS, FAIL],
3435
'debugger/side-effect-free-debug-evaluate': [PASS, FAIL],
3536
'debugger/evaluate-on-call-frame-in-module': [PASS, FAIL],
3637
}], # variant != default

0 commit comments

Comments
 (0)
Please sign in to comment.