forked from LeenkxTeam/Kmake
40 lines
1.0 KiB
JavaScript
40 lines
1.0 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: --allow-natives-syntax --turbolev --turbofan
|
|
// Flags: --maglev-extend-properties-backing-store
|
|
|
|
// TODO(dmercadier): this test is exactly the same as
|
|
// test/mjsunit/maglev/extend-properties-backing-store-1.js, but with an
|
|
// %OptimizeFunctionOnNextCall instead of the %OptimizeMaglevOnNextCall.
|
|
// Consider unifying the 2 tests.
|
|
|
|
const s = new Set();
|
|
|
|
function foo(o) {
|
|
// One of these stores will exhaust the slack and we need to add a property
|
|
// backing store.
|
|
o.b1 = 0;
|
|
o.b2 = 0;
|
|
o.b3 = 0;
|
|
}
|
|
%PrepareFunctionForOptimization(foo);
|
|
|
|
let o1 = {a: 1}; // One in-object property.
|
|
|
|
// Make the StoreIC in `foo` polymorphic.
|
|
foo(o1);
|
|
foo({a: 0, b: 2});
|
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
foo({a: 1, b: 3});
|
|
|
|
let o2 = {a: 1};
|
|
s.add(o2); // Force creating the hash.
|
|
|
|
foo(o2);
|
|
// Assert that the hash value was preseved when adding the properties backing
|
|
// store.
|
|
assertTrue(s.has(o2));
|