2022-04-12 11:10:15 +02:00
|
|
|
// 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.
|
|
|
|
|
2024-03-30 09:54:35 +01:00
|
|
|
// Flags: --wasm-staging
|
2022-04-12 11:10:15 +02:00
|
|
|
|
|
|
|
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
|
|
|
|
|
|
|
const builder = new WasmModuleBuilder();
|
2023-10-05 08:46:07 +02:00
|
|
|
builder.addMemory(16, 32);
|
2022-04-12 11:10:15 +02:00
|
|
|
builder.addFunction('main', kSig_i_iii)
|
|
|
|
.addBody([
|
|
|
|
kExprLocalGet, 1, // local.get
|
|
|
|
kExprLocalGet, 1, // local.get
|
|
|
|
kExprLocalGet, 0, // local.get
|
|
|
|
kExprLocalSet, 1, // local.set
|
|
|
|
kAtomicPrefix, kExprI32AtomicSub, 0x02, 0x26, // i32.atomic.sub32
|
|
|
|
])
|
|
|
|
.exportFunc();
|
|
|
|
const instance = builder.instantiate();
|
|
|
|
assertEquals(0, instance.exports.main(1, 2, 3));
|