nodejs/deps/v8/test/mjsunit/regress/wasm/regress-1294384.js
Michaël Zasso 09a8440b45
deps: update V8 to 12.2.281.27
PR-URL: https://github.com/nodejs/node/pull/51362
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2024-03-31 15:36:07 +02:00

92 lines
3.5 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: --wasm-staging
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
builder.addType(makeSig([], [kWasmI32]));
builder.addType(makeSig([kWasmF64, kWasmF32, kWasmF32, kWasmF32,
kWasmF32, kWasmF64, kWasmF64],
[kWasmF32, kWasmF32, kWasmF32, kWasmF32, kWasmF32,
kWasmF32, kWasmF32, kWasmF32, kWasmF32, kWasmF32]));
// Generate function 1 (out of 2).
// signature: i_iii
builder.addFunction(undefined, 0 /* sig */)
.addBody([
// body:
kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // f64.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // f64.const
kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // f64.const
kExprCallFunction, 0x01,
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprI32SConvertF32]); // i32.trunc_f32_s
// Generate function 2 (out of 2).
builder.addFunction(undefined, 1 /* sig */)
.addBody([
// body:
kExprF32Const, 0x04, 0x04, 0x05, 0x04, // f32.const
kExprLoop, 0x40, // loop @24
kExprEnd, // end @26
kExprF32Ceil, // f32.ceil
kExprF32Const, 0x08, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprI32Const, 0x00, // i32.const
kExprBrIf, 0x00, // br_if depth=0
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprDrop, // drop
kExprF32Ceil, // f32.ceil
kExprF32Ceil, // f32.ceil
kExprF32Const, 0xed, 0xed, 0xed, 0xed, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x65, 0x73, 0x61, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const
kExprI64Const, 0x00, // i64.const
kExprF32SConvertI64]); // f32.convert_i64_s
builder.addExport('main', 0);
const instance = builder.instantiate();
assertEquals(1, instance.exports.main());