diff options
author | Benjamin Coe <bencoe@google.com> | 2020-09-04 20:01:56 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2020-09-07 02:17:33 +0300 |
commit | 6d9a3162bfa6c119c5eb1dd2422fe65bef025685 (patch) | |
tree | 626b22dac988384ea78cdd0becf3bd2b40e5791e | |
parent | b0cc6572b0d6d3f302af5bb4aa3f098c9d8003c8 (diff) |
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.
R=jgruber@chromium.org, sigurds@chromium.org, yangguo@chromium.org
Bug: v8:10856
Change-Id: I0552e19a3a14ff61a9cb626494fb4a21979d535e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2384011
Commit-Queue: Benjamin Coe <bencoe@google.com>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69628}
Refs: https://github.com/v8/v8/commit/6be2f6e26e8ddfbc1a48c510672b319809674a34
PR-URL: https://github.com/nodejs/node/pull/35055
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
-rw-r--r-- | common.gypi | 2 | ||||
-rw-r--r-- | deps/v8/src/debug/debug-evaluate.cc | 1 | ||||
-rw-r--r-- | deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt | 3 | ||||
-rw-r--r-- | deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js | 43 | ||||
-rw-r--r-- | deps/v8/test/inspector/inspector.status | 1 |
5 files changed, 49 insertions, 1 deletions
diff --git a/common.gypi b/common.gypi index 99baed035be..46b4633f5d7 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.15', + 'v8_embedder_string': '-node.16', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/debug/debug-evaluate.cc b/deps/v8/src/debug/debug-evaluate.cc index 473bac1bf99..ccf45202ff0 100644 --- a/deps/v8/src/debug/debug-evaluate.cc +++ b/deps/v8/src/debug/debug-evaluate.cc @@ -473,6 +473,7 @@ bool BytecodeHasNoSideEffect(interpreter::Bytecode bytecode) { case Bytecode::kToNumeric: case Bytecode::kToString: // Misc. + case Bytecode::kIncBlockCounter: // Coverage counters. case Bytecode::kForInEnumerate: case Bytecode::kForInPrepare: case Bytecode::kForInContinue: diff --git a/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt b/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt new file mode 100644 index 00000000000..454d3196393 --- /dev/null +++ b/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled-expected.txt @@ -0,0 +1,3 @@ +Tests side-effect-free evaluation with coverage enabled +Paused on 'debugger;' +f() returns 1 diff --git a/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js b/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js new file mode 100644 index 00000000000..ffa86452287 --- /dev/null +++ b/deps/v8/test/inspector/debugger/side-effect-free-coverage-enabled.js @@ -0,0 +1,43 @@ +// Copyright 2020 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let {session, contextGroup, Protocol} = InspectorTest.start('Tests side-effect-free evaluation with coverage enabled'); + +contextGroup.addScript(` +function testFunction() +{ + var o = 0; + function f() { return 1; } + function g() { o = 2; return o; } + f,g; + debugger; +} +//# sourceURL=foo.js`); + +// Side effect free call should not result in EvalError when coverage +// is enabled: +Protocol.Profiler.enable() +Protocol.Profiler.startPreciseCoverage({callCount: true, detailed: true}) + +Protocol.Debugger.enable(); + +Protocol.Debugger.oncePaused().then(debuggerPaused); + +Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0)" }); + +var topFrameId; + +function debuggerPaused(messageObject) +{ + InspectorTest.log("Paused on 'debugger;'"); + + topFrameId = messageObject.params.callFrames[0].callFrameId; + Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: "f()", throwOnSideEffect: true}).then(evaluatedFirst); +} + +function evaluatedFirst(response) +{ + InspectorTest.log("f() returns " + response.result.result.value); + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/inspector.status b/deps/v8/test/inspector/inspector.status index 858a76141dd..61a7f022858 100644 --- a/deps/v8/test/inspector/inspector.status +++ b/deps/v8/test/inspector/inspector.status @@ -33,6 +33,7 @@ 'debugger/eval-scopes': [PASS, FAIL], 'debugger/scope-skip-variables-with-empty-name': [PASS, FAIL], 'debugger/update-call-frame-scopes': [PASS, FAIL], + 'debugger/side-effect-free-coverage-enabled': [PASS, FAIL], 'debugger/side-effect-free-debug-evaluate': [PASS, FAIL], 'debugger/evaluate-on-call-frame-in-module': [PASS, FAIL], }], # variant != default |