|
| 1 | +// Copyright 2020 the V8 project authors. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | + |
| 5 | +// Flags: --experimental-wasm-threads |
| 6 | + |
| 7 | +load('test/mjsunit/wasm/wasm-module-builder.js'); |
| 8 | + |
| 9 | +const builder = new WasmModuleBuilder(); |
| 10 | +builder.addMemory(1, 1, false, true); |
| 11 | +builder.addGlobal(kWasmI32, 1); |
| 12 | +builder.addGlobal(kWasmI32, 1); |
| 13 | +builder.addType(makeSig([kWasmI32, kWasmI64, kWasmI32], [])); |
| 14 | +// Generate function 1 (out of 1). |
| 15 | +builder.addFunction(undefined, 0 /* sig */) |
| 16 | + .addLocals(kWasmI32, 10) |
| 17 | + .addBodyWithEnd([ |
| 18 | +// signature: v_ili |
| 19 | +// body: |
| 20 | +kExprI32Const, 0x00, // i32.const |
| 21 | +kExprLocalSet, 0x04, // local.set |
| 22 | +kExprI32Const, 0x01, // i32.const |
| 23 | +kExprLocalSet, 0x05, // local.set |
| 24 | +kExprBlock, kWasmStmt, // block @11 |
| 25 | + kExprBr, 0x00, // br depth=0 |
| 26 | + kExprEnd, // end @15 |
| 27 | +kExprGlobalGet, 0x01, // global.get |
| 28 | +kExprLocalSet, 0x03, // local.set |
| 29 | +kExprLocalGet, 0x03, // local.get |
| 30 | +kExprI32Const, 0x01, // i32.const |
| 31 | +kExprI32Sub, // i32.sub |
| 32 | +kExprLocalSet, 0x06, // local.set |
| 33 | +kExprI64Const, 0x01, // i64.const |
| 34 | +kExprLocalSet, 0x01, // local.set |
| 35 | +kExprI32Const, 0x00, // i32.const |
| 36 | +kExprI32Eqz, // i32.eqz |
| 37 | +kExprLocalSet, 0x07, // local.set |
| 38 | +kExprBlock, kWasmStmt, // block @36 |
| 39 | + kExprBr, 0x00, // br depth=0 |
| 40 | + kExprEnd, // end @40 |
| 41 | +kExprGlobalGet, 0x01, // global.get |
| 42 | +kExprLocalSet, 0x08, // local.set |
| 43 | +kExprI32Const, 0x01, // i32.const |
| 44 | +kExprI32Const, 0x01, // i32.const |
| 45 | +kExprI32Sub, // i32.sub |
| 46 | +kExprLocalSet, 0x09, // local.set |
| 47 | +kExprLocalGet, 0x00, // local.get |
| 48 | +kExprLocalSet, 0x0a, // local.set |
| 49 | +kExprGlobalGet, 0x00, // global.get |
| 50 | +kExprLocalSet, 0x0b, // local.set |
| 51 | +kExprI32Const, 0x00, // i32.const |
| 52 | +kExprI32Const, 0x0f, // i32.const |
| 53 | +kExprI32And, // i32.and |
| 54 | +kExprLocalSet, 0x0c, // local.set |
| 55 | +kExprI32Const, 0x00, // i32.const |
| 56 | +kAtomicPrefix, kExprI64AtomicLoad, 0x03, 0x04, // i64.atomic.load64 |
| 57 | +kExprDrop, // drop |
| 58 | +kExprUnreachable, // unreachable |
| 59 | +kExprEnd, // end @75 |
| 60 | +]); |
| 61 | +builder.toModule(); |
0 commit comments