v8/test/mjsunit/regress/regress-1262478.js
Jakob Gruber a6a113c6d5 [csa] Fix an old spec violation in Array.length writes
We used to apply an invalid optimization which skips `length` writes
if the JSArray is 'fast' and the old value equals the new value. This
optimization is not valid if e.g. `length` is non-writable.

Fixed: chromium:1262478
Change-Id: I49ef50de293dae5c3a62c64b303ec34b9c0f6cbc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3236720
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77552}
2021-10-26 13:30:04 +00:00

9 lines
335 B
JavaScript

// Copyright 2021 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 __v_0 = [];
Object.defineProperty(__v_0, 'length', { writable: false });
function __f_5() { return __v_0; }
assertThrows(() => Array.of.call(__f_5), TypeError);