Files
v8/test/debugger/debug/side-effect/debug-evaluate-no-side-effect-array-fill.js
Yang Guo 983dcd0311 Remove special handling for side-effect check in ArrayPrototypeFill
The special handling with explicit side effect check is not necessary, since we have a general mechanism via
Debug::PerformSideEffectCheckForObject.

Also added a test to make sure Array.prototype.fill triggers side
effects for an existing array but does not for a newly-created array.

R=syg@chormium.org

Change-Id: I44a82823bd35bee9a900468832c3e79c3d15a121
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4624438
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#88399}
2023-06-21 08:05:06 +00:00

42 lines
980 B
JavaScript

// Copyright 2023 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.
// Flags: --no-enable-one-shot-optimization
Debug = debug.Debug
var exception = null;
var array = [1,2,3];
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
function success(expectation, source) {
var result = exec_state.frame(0).evaluate(source, true).value();
if (expectation !== undefined) assertEquals(expectation, result);
}
function fail(source) {
assertThrows(() => exec_state.frame(0).evaluate(source, true),
EvalError);
}
fail(`array.fill(1)`);
success([1, 1, 1], `[1, 2, 3].fill(1)`);
} catch (e) {
exception = e;
print(e, e.stack);
};
};
// Add the debug event listener.
Debug.setListener(listener);
function f() {
debugger;
};
f();
assertNull(exception);