node/deps/v8/test/mjsunit/get-current-frame-optimization-status-01.js
Michaël Zasso 09a8440b45
deps: update V8 to 12.2.281.27
PR-URL: https://github.com/nodejs/node/pull/51362
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2024-03-31 15:36:07 +02:00

44 lines
1.3 KiB
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: --sparkplug --no-always-sparkplug --maglev --turbofan
// Flags: --no-always-turbofan --allow-natives-syntax
const topLevel = %GetFunctionForCurrentFrame();
let status = %GetOptimizationStatus(topLevel);
assertTrue(topFrameIsInterpreted(status));
assertFalse(topFrameIsBaseline(status));
assertFalse(topFrameIsMaglevved(status));
assertFalse(topFrameIsTurboFanned(status));
// Need a back edge for OSR to happen:
for (let i = 0; i < 1; ++i) {
if (i == 0) {
%BaselineOsr();
}
}
assertTrue(topFrameIsInterpreted(status));
assertFalse(topFrameIsBaseline(status));
assertFalse(topFrameIsMaglevved(status));
assertFalse(topFrameIsTurboFanned(status));
%PrepareFunctionForOptimization(topLevel);
let gotMaglevved = false;
for (let i = 0; i < 3; ++i) {
if (i == 1) {
%OptimizeOsr();
}
// We cannot use isMaglevved(topLevel) because the OSRed code is not
// installed in the function.
const status = %GetOptimizationStatus(topLevel);
if (topFrameIsMaglevved(status)) {
// This will deopt but it's fine, the test is over.
gotMaglevved = true;
break;
}
}
assertTrue(gotMaglevved);