325853cf50
Wait for TF optimisation to be requested (or to have happened) before cranking up TF OSR urgency; this prevents us from getting into a situation where we repeatedly call Maglev code which then OSRs into TurboFan lots of times before finally tiering up to TurboFan properly. Since we are waiting for TF optimisation to be requested, we also need a mechanism to allow TF optimisation to be requested even when Maglev code has been requested hasn't yet run (for direct Baseline->Turbofan tierup, since Maglev can't OSR). Do so by re-trying the optimisation check if it spits out Maglev but Maglev is already requested. As a drive-by, clean up some naming around OSR code. Bug: v8:7700 Change-Id: I483a412dd92fe13ee21f8aa46d86572bcf3f8a61 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3942385 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/main@{#83630}
38 lines
967 B
JavaScript
38 lines
967 B
JavaScript
// Copyright 2022 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 --maglev --no-stress-opt
|
|
// Flags: --no-baseline-batch-compilation --use-osr --turbofan
|
|
|
|
let keep_going = 10000000; // A counter to avoid test hangs on failure.
|
|
|
|
function f() {
|
|
let reached_tf = false;
|
|
let prev_status = 0;
|
|
while (!reached_tf && --keep_going) {
|
|
// This loop should trigger OSR.
|
|
reached_tf = %CurrentFrameIsTurbofan();
|
|
let status = %GetOptimizationStatus(f);
|
|
if (status !== prev_status) {
|
|
let p = []
|
|
for (let k in V8OptimizationStatus) {
|
|
if (V8OptimizationStatus[k] & status) {
|
|
p.push(k);
|
|
}
|
|
}
|
|
print(p.join(","));
|
|
prev_status = status;
|
|
}
|
|
}
|
|
}
|
|
|
|
function g() {
|
|
assertTrue(%IsTurbofanEnabled());
|
|
f();
|
|
assertTrue(keep_going > 0);
|
|
}
|
|
%NeverOptimizeFunction(g);
|
|
|
|
g();
|