v8/test/mjsunit/maglev/osr-from-ml-to-tf.js
Jakob Linke 7086e988e7 [maglev] Fix osr-from-ml-to-tf flake again
We've previously reset profiler ticks on ML finalization to avoid
unexpected early tierups to TF. This CL additionally avoid early TF
tierup through the `small function` reason by disabling small-function
optimization.

Bug: v8:7700
Change-Id: I57ba294af0d1d189f76c2cb1ffc31af0837b1e42
Fixed: v8:13242
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3865550
Auto-Submit: Jakob Linke <jgruber@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Jakob Linke <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82886}
2022-09-01 08:03:22 +00:00

40 lines
1.0 KiB
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
//
// Disable small-function TF optimization to avoid flakes that unexpectedly
// tier up `f` before we get a chance to enter the OSR loop.
// Flags: --max-bytecode-size-for-early-opt=0
let keep_going = 10000000; // A counter to avoid test hangs on failure.
let i; // The loop counter for the test function.
function f() {
let sum = i;
while (--i > 0 && !%CurrentFrameIsTurbofan() && --keep_going) {
// This loop should trigger OSR.
sum += i;
}
return sum;
}
function g() {
assertTrue(%IsMaglevEnabled());
assertTrue(%IsTurbofanEnabled());
while (!%ActiveTierIsMaglev(f) && --keep_going) {
i = 5.2;
f();
}
i = 66666666666;
f();
assertTrue(keep_going > 0);
}
%NeverOptimizeFunction(g);
g();