nodejs/deps/v8/test/mjsunit/regress/wasm/regress-364360260.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

54 lines
1.8 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.
// Flags: --allow-natives-syntax --wasm-deopt --wasm-inlining-ignore-call-counts
// Flags: --liftoff
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
let $sig8 = builder.addType(makeSig([], [wasmRefNullType(kWasmEqRef)]));
let $sig11 = builder.addType(makeSig([kWasmI64], []));
let $sig12 = builder.addType(kSig_i_i);
let callee_017 = builder.addFunction(undefined, $sig8);
let callee_118 = builder.addFunction(undefined, $sig8);
let inlinee_224 = builder.addFunction("inlinee_2", $sig11).exportFunc();
let main25 = builder.addFunction("main", $sig12).exportFunc();
let $global0 = builder.addGlobal(kWasmI32, true, false, wasmI32Const(0));
let $table0 = builder.addTable(kWasmFuncRef, 8, 8);
let $segment0 = builder.addActiveElementSegment($table0.index, wasmI32Const(0),
[[kExprRefFunc, callee_017.index], [kExprRefFunc, callee_118.index],
[kExprRefFunc, inlinee_224.index]],
kWasmFuncRef);
callee_017.addBody([
kExprUnreachable
]);
callee_118.addBody([
kExprUnreachable,
]);
inlinee_224.addBody([
kExprGlobalGet, $global0.index,
kExprTableGet, $table0.index,
kGCPrefix, kExprRefCast, $sig8,
kExprCallRef, $sig8,
kExprUnreachable,
]);
main25.addLocals(wasmRefNullType($sig12), 1).addBody([
kExprLocalGet, 0,
kExprGlobalSet, $global0.index,
...wasmI64Const(1n),
kExprCallFunction, inlinee_224.index,
kExprUnreachable,
]);
const instance = builder.instantiate({});
assertThrows(() => instance.exports.main(0));
%WasmTierUpFunction(instance.exports.inlinee_2);
assertThrows(() => instance.exports.main(1));
%WasmTierUpFunction(instance.exports.inlinee_2);