Commit 312d6d52 authored by Gus Caplan's avatar Gus Caplan Committed by Commit Bot

[debugger] Mark Math.random as having side effects

Math.random, while technically not having any effects which modify the
surrounding JS state, does observably change between a no-side-effects
evaluation and an actual evaluation, and can cause confusion.

Change-Id: I4a41ac6fd3153a14245d5940fe52ada43ca05e0b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2207805Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Gus Caplan <me@gus.host>
Cr-Commit-Position: refs/heads/master@{#67927}
parent bc9deb83
......@@ -672,7 +672,6 @@ DebugInfo::SideEffectState BuiltinGetSideEffectState(Builtins::Name id) {
case Builtins::kMathMax:
case Builtins::kMathMin:
case Builtins::kMathPow:
case Builtins::kMathRandom:
case Builtins::kMathRound:
case Builtins::kMathSign:
case Builtins::kMathSin:
......
......@@ -144,12 +144,13 @@ function listener(event, exec_state, event_data, data) {
// Test Math functions.
for (f of Object.getOwnPropertyNames(Math)) {
if (typeof Math[f] === "function") {
if (f !== "random" && typeof Math[f] === "function") {
var result = exec_state.frame(0).evaluate(
`Math.${f}(0.5, -0.5);`, true).value();
if (f != "random") assertEquals(Math[f](0.5, -0.5), result);
assertEquals(Math[f](0.5, -0.5), result);
}
}
fail("Math.random();");
// Test Number functions.
success(new Number(0), `new Number()`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment