Files
Kmake/deps/v8/test/mjsunit/regress/regress-1476191.js

29 lines
721 B
JavaScript
Raw Normal View History

2026-05-26 23:36:42 -07:00
// 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: --allow-natives-syntax
class Foo extends Array {
constructor() {
super();
}
};
// Invalidate the array iterator, for FindNonDefaultConstructorOrConstruct
// reduction.
Array.prototype[Symbol.iterator] = function () {};
%PrepareFunctionForOptimization(Foo);
new Foo();
new Foo();
%OptimizeMaglevOnNextCall(Foo);
new Foo();
// This should invalidate the Foo code dependency.
Foo.__proto__ = [1];
// Should throw an exception because the super constructor is no longer a
// constructor (but an array).
assertThrows(()=>new Foo());