Files
Kmake/deps/v8/test/mjsunit/maglev/continuation-after-inlined.js
2026-05-26 23:36:42 -07:00

30 lines
645 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: --maglev --maglev-inlining --allow-natives-syntax
function hasInstance(x) {
%DeoptimizeFunction(bar);
return 5;
}
function Foo() {}
Object.defineProperty(Foo, Symbol.hasInstance, {
value: hasInstance
})
let foo = new Foo();
function bar(x) {
return x instanceof Foo;
}
%PrepareFunctionForOptimization(bar);
%PrepareFunctionForOptimization(hasInstance);
assertTrue(bar(foo));
assertTrue(bar(foo));
%OptimizeMaglevOnNextCall(bar);
assertTrue(bar(foo));