Skip to content

Commit 791a85b

Browse files
bcoerichardlau
authored andcommitted
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 1a9ca52 commit 791a85b

5 files changed

+49
-1
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.15',
39+
'v8_embedder_string': '-node.16',
4040

4141
##### V8 defaults for Node.js #####
4242

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

+1
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ bool BytecodeHasNoSideEffect(interpreter::Bytecode bytecode) {
473473
case Bytecode::kToNumeric:
474474
case Bytecode::kToString:
475475
// Misc.
476+
case Bytecode::kIncBlockCounter: // Coverage counters.
476477
case Bytecode::kForInEnumerate:
477478
case Bytecode::kForInPrepare:
478479
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
@@ -33,6 +33,7 @@
3333
'debugger/eval-scopes': [PASS, FAIL],
3434
'debugger/scope-skip-variables-with-empty-name': [PASS, FAIL],
3535
'debugger/update-call-frame-scopes': [PASS, FAIL],
36+
'debugger/side-effect-free-coverage-enabled': [PASS, FAIL],
3637
'debugger/side-effect-free-debug-evaluate': [PASS, FAIL],
3738
'debugger/evaluate-on-call-frame-in-module': [PASS, FAIL],
3839
}], # variant != default

0 commit comments

Comments
 (0)