Michaël Zasso 918fe04351
deps: update V8 to 13.6.233.8
PR-URL: https://github.com/nodejs/node/pull/58070
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2025-05-02 15:06:53 +02:00

38 lines
848 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 --turbolev --turbofan
function branch_cmp(w32, f64) {
let c1 = w32 + 2;
let v;
if (c1) {
v = c1 + 12;
} else {
v = c1 + 17;
}
let c2 = f64 + 1.5;
if (c2) {
v += 10;
} else {
v += 3;
}
if (f64 > 1.5) {
v += 2;
} else {
v += 7;
}
return v;
}
%PrepareFunctionForOptimization(branch_cmp);
assertEquals(41, branch_cmp(15, 3.25));
assertEquals(29, branch_cmp(-2, 3.25));
assertEquals(27, branch_cmp(-2, -1.5));
%OptimizeFunctionOnNextCall(branch_cmp);
assertEquals(41, branch_cmp(15, 3.25));
assertEquals(29, branch_cmp(-2, 3.25));
assertEquals(27, branch_cmp(-2, -1.5));
assertOptimized(branch_cmp);