2023-10-05 08:46:07 +02:00
|
|
|
// 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.
|
|
|
|
|
2025-04-29 08:03:15 +02:00
|
|
|
// Flags: --wasm-staging
|
2023-10-05 08:46:07 +02:00
|
|
|
|
|
|
|
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
|
|
|
|
|
|
|
const builder = new WasmModuleBuilder();
|
|
|
|
|
2024-08-14 20:41:00 +02:00
|
|
|
builder.addFunction("main", makeSig([kWasmStringRef], [kWasmI32])).exportFunc()
|
|
|
|
.addBodyWithEnd([
|
|
|
|
kExprLocalGet, 0,
|
|
|
|
...GCInstr(kExprStringAsIter),
|
|
|
|
kGCPrefix, kExprRefTestNull, kAnyRefCode,
|
|
|
|
kExprEnd,
|
|
|
|
]);
|
2023-10-05 08:46:07 +02:00
|
|
|
const instance = builder.instantiate();
|
2024-08-14 20:41:00 +02:00
|
|
|
assertEquals(0, instance.exports.main("foo"));
|