node/deps/v8/test/mjsunit/wasm/nan-constant.js
Michaël Zasso 9d7cd9b864
deps: update V8 to 12.8.374.13
PR-URL: https://github.com/nodejs/node/pull/54077
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
2024-08-16 16:03:01 +02:00

57 lines
1.9 KiB
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.
// Note that we explicitly set the --turboshaft-wasm flag as the bug only
// reproduces on ia32 full debug builds which do not seem to execute the
// turboshaft variant.
// Flags: --allow-natives-syntax --turboshaft-wasm
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
(function TestInstructionSelectionSignalingNanFloat32Literal() {
var builder = new WasmModuleBuilder();
let funcRefT = builder.addType(makeSig([kWasmF32], [kWasmI32]));
builder.addFunction("reinterpretF32", funcRefT)
.addBody([kExprLocalGet, 0, kExprI32ReinterpretF32])
.exportFunc();
let mainSig =
makeSig([wasmRefType(funcRefT)], [kWasmI32]);
builder.addFunction("main", mainSig)
.addBody([
...wasmF32ConstSignalingNaN(),
kExprLocalGet, 0,
kExprCallRef, funcRefT,
]).exportFunc();
let wasm = builder.instantiate().exports;
assertEquals(0x7fa7a1b9, wasm.main(wasm.reinterpretF32));
%WasmTierUpFunction(wasm.main);
assertEquals(0x7fa7a1b9, wasm.main(wasm.reinterpretF32));
})();
(function TestInstructionSelectionSignalingNanFloat64Literal() {
var builder = new WasmModuleBuilder();
let funcRefT = builder.addType(makeSig([kWasmF64], [kWasmI64]));
builder.addFunction("reinterpretF64", funcRefT)
.addBody([kExprLocalGet, 0, kExprI64ReinterpretF64])
.exportFunc();
let mainSig =
makeSig([wasmRefType(funcRefT)], [kWasmI64]);
builder.addFunction("main", mainSig)
.addBody([
...wasmF64ConstSignalingNaN(),
kExprLocalGet, 0,
kExprCallRef, funcRefT,
]).exportFunc();
let wasm = builder.instantiate().exports;
assertEquals(0x7ff4000000000000n, wasm.main(wasm.reinterpretF64));
%WasmTierUpFunction(wasm.main);
assertEquals(0x7ff4000000000000n, wasm.main(wasm.reinterpretF64));
})();