nodejs/deps/v8/test/mjsunit/maglev/regress-382190919.js
Michaël Zasso 5edec0e39a
deps: update V8 to 13.0.245.25
PR-URL: https://github.com/nodejs/node/pull/55014
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-01-31 12:45:51 +01:00

40 lines
914 B
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 --no-maglev-loop-peeling
function g() { }
%NeverOptimizeFunction(g);
function foo(b) {
let phi1 = 0;
for (let i = 0; i < 10; i++) {
phi1++; // Int32 use so that {phi1} gets untagged.
}
let phi2 = undefined; // Not untaggable.
let j = 0;
if (b) {
g(phi1); // Triggering retagging of {phi1}.
}
// Nothing between the `if` and the loop header, so that the loop header ends
// up having 2 incoming forward edges.
for (; j < 5; j++) {
phi2 = phi1; // New retagging of {phi1} since previous one is not available
// in all predecessors.
}
return phi2;
}
%PrepareFunctionForOptimization(foo);
foo(true);
foo(false);
%OptimizeMaglevOnNextCall(foo);
foo(true);