nodejs/deps/v8/test/mjsunit/regress/wasm/regress-1466183.js
Michaël Zasso cfbf9e0d14 deps: update V8 to 12.4.254.14
PR-URL: https://github.com/nodejs/node/pull/52465
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2024-04-22 21:25:15 +00:00

25 lines
797 B
JavaScript

// Copyright 2023 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.
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
builder.addStruct([makeField(kWasmI32, true)]);
builder.addStruct([makeField(wasmRefNullType(0), true)]);
builder.addTable(wasmRefType(1), 1, 2, [kGCPrefix, kExprStructNewDefault, 1]);
builder.addFunction(undefined, kSig_i_v)
.addBody([
kExprI32Const, 0, // i32.const
kExprTableGet, 0x0, // table.get
kGCPrefix, kExprStructGet, 0x01, 0x00, // struct.get
kExprRefNull, 0,
kExprRefEq]);
builder.addExport('main', 0);
const instance = builder.instantiate();
assertEquals(1, instance.exports.main());