2019-01-21 11:38:24 +00:00
|
|
|
// Copyright 2019 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.
|
|
|
|
|
2021-06-01 12:46:36 +00:00
|
|
|
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
2019-01-21 11:38:24 +00:00
|
|
|
|
|
|
|
const builder = new WasmModuleBuilder();
|
|
|
|
const sig = builder.addType(makeSig([kWasmI64], [kWasmI64]));
|
|
|
|
builder.addFunction(undefined, sig)
|
2020-09-10 12:39:52 +00:00
|
|
|
.addLocals(kWasmI32, 14).addLocals(kWasmI64, 17).addLocals(kWasmF32, 14)
|
2019-01-21 11:38:24 +00:00
|
|
|
.addBody([
|
2021-03-22 06:56:01 +00:00
|
|
|
kExprBlock, kWasmVoid,
|
2019-01-21 11:38:24 +00:00
|
|
|
kExprBr, 0x00,
|
|
|
|
kExprEnd,
|
2021-03-22 06:56:01 +00:00
|
|
|
kExprBlock, kWasmVoid,
|
2019-01-21 11:38:24 +00:00
|
|
|
kExprI32Const, 0x00,
|
2019-10-08 12:38:48 +00:00
|
|
|
kExprLocalSet, 0x09,
|
2019-01-21 11:38:24 +00:00
|
|
|
kExprI32Const, 0x00,
|
2021-03-22 06:56:01 +00:00
|
|
|
kExprIf, kWasmVoid,
|
|
|
|
kExprBlock, kWasmVoid,
|
2019-01-21 11:38:24 +00:00
|
|
|
kExprI32Const, 0x00,
|
2019-10-08 12:38:48 +00:00
|
|
|
kExprLocalSet, 0x0a,
|
2019-01-21 11:38:24 +00:00
|
|
|
kExprBr, 0x00,
|
|
|
|
kExprEnd,
|
2021-03-22 06:56:01 +00:00
|
|
|
kExprBlock, kWasmVoid,
|
|
|
|
kExprBlock, kWasmVoid,
|
2019-10-08 12:38:48 +00:00
|
|
|
kExprLocalGet, 0x00,
|
|
|
|
kExprLocalSet, 0x12,
|
2019-01-21 11:38:24 +00:00
|
|
|
kExprBr, 0x00,
|
|
|
|
kExprEnd,
|
2019-10-08 12:38:48 +00:00
|
|
|
kExprLocalGet, 0x16,
|
|
|
|
kExprLocalSet, 0x0f,
|
|
|
|
kExprLocalGet, 0x0f,
|
|
|
|
kExprLocalSet, 0x17,
|
|
|
|
kExprLocalGet, 0x0f,
|
|
|
|
kExprLocalSet, 0x18,
|
|
|
|
kExprLocalGet, 0x17,
|
|
|
|
kExprLocalGet, 0x18,
|
2019-01-21 11:38:24 +00:00
|
|
|
kExprI64ShrS,
|
2019-10-08 12:38:48 +00:00
|
|
|
kExprLocalSet, 0x19,
|
2019-01-21 11:38:24 +00:00
|
|
|
kExprUnreachable,
|
|
|
|
kExprEnd,
|
|
|
|
kExprUnreachable,
|
|
|
|
kExprElse,
|
|
|
|
kExprUnreachable,
|
|
|
|
kExprEnd,
|
|
|
|
kExprUnreachable,
|
|
|
|
kExprEnd,
|
|
|
|
kExprUnreachable
|
|
|
|
]);
|
|
|
|
builder.instantiate();
|