nodejs/deps/v8/test/mjsunit/regress/regress-v8-14493.js
Michaël Zasso 1d29d81c69 deps: update V8 to 12.3.219.16
PR-URL: https://github.com/nodejs/node/pull/52293
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2024-04-19 08:39:47 +00:00

56 lines
1.3 KiB
JavaScript

// Copyright 2024 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-lazy-feedback-allocation
class A {
constructor(n, is_enum) {
if (n) {
Object.defineProperty(this, "p"+n,
{value: 0, enumerable: false, configurable: true, writable: true});
}
Object.defineProperty(this, "boom",
{value: 42, enumerable: is_enum, configurable: true, writable: true});
Object.defineProperty(this, "0",
{value: 55, enumerable: is_enum, configurable: true, writable: true});
}
}
class B extends A {
boom = 0;
[0] = 0;
foo = 1;
constructor(...args) {
super(...args);
}
}
const expected = ["0", "boom", "foo"];
(function TestMonomorphic() {
for (let i = 1; i <= 12; i++) {
const b = new B(0, false);
assertEquals(expected, Object.keys(b));
}
})();
(function TestPolymorphic() {
for (let i = 1; i <= 12; i++) {
const b = new B(0, true);
assertEquals(expected, Object.keys(b));
}
})();
(function TestMegamorphic() {
for (let i = 1; i <= 12; i++) {
const b = new B(i, false);
assertEquals(expected, Object.keys(b));
}
for (let i = 1; i <= 12; i++) {
const b = new B(i, true);
assertEquals(expected, Object.keys(b));
}
})();