nodejs/deps/v8/test/mjsunit/regress/regress-1371935.js
Yagiz Nizipli 16e03e7968 deps: update V8 to 10.9.194.4
PR-URL: https://github.com/nodejs/node/pull/45579
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-11-27 17:27:13 +00:00

25 lines
813 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 --turbofan --no-always-turbofan
function f(a, b, c) {
// CheckBigInt64 is required if the type of input is UnsignedBigInt64
// because its value can be out of the range of SignedBigInt64.
let t = BigInt.asUintN(64, a + b);
// The addition is speculated as CheckedInt64Add and triggers the deopt
// for the large value coming in through <t>.
return t + c;
}
%PrepareFunctionForOptimization(f);
assertEquals(12n, f(9n, 2n, 1n));
%OptimizeFunctionOnNextCall(f);
assertEquals(12n, f(9n, 2n, 1n));
assertOptimized(f);
assertEquals(2n ** 64n, f(1n, -2n, 1n));
if (%Is64Bit()) {
assertUnoptimized(f);
}