2018-12-21 14:02:37 +00:00
|
|
|
// Copyright 2018 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.
|
|
|
|
|
|
|
|
load('test/mjsunit/wasm/wasm-module-builder.js');
|
|
|
|
|
|
|
|
const builder = new WasmModuleBuilder();
|
|
|
|
builder.addGlobal(kWasmI32, 1);
|
|
|
|
builder.addGlobal(kWasmF32, 1);
|
|
|
|
builder.addType(makeSig([kWasmI32, kWasmF32, kWasmF32, kWasmF64], [kWasmI32]));
|
|
|
|
builder.addFunction(undefined, 0 /* sig */)
|
2020-09-10 12:39:52 +00:00
|
|
|
.addLocals(kWasmI32, 504)
|
2018-12-21 14:02:37 +00:00
|
|
|
.addBody([
|
2019-10-08 13:16:30 +00:00
|
|
|
kExprGlobalGet, 0x00,
|
2019-10-08 12:38:48 +00:00
|
|
|
kExprLocalSet, 0x04,
|
|
|
|
kExprLocalGet, 0x04,
|
2018-12-21 14:02:37 +00:00
|
|
|
kExprI32Const, 0x01,
|
|
|
|
kExprI32Sub,
|
2019-10-08 13:16:30 +00:00
|
|
|
kExprGlobalGet, 0x00,
|
2018-12-21 14:02:37 +00:00
|
|
|
kExprI32Const, 0x00,
|
|
|
|
kExprI32Eqz,
|
2019-10-08 13:16:30 +00:00
|
|
|
kExprGlobalGet, 0x00,
|
2018-12-21 14:02:37 +00:00
|
|
|
kExprI32Const, 0x01,
|
|
|
|
kExprI32Const, 0x01,
|
|
|
|
kExprI32Sub,
|
2019-10-08 13:16:30 +00:00
|
|
|
kExprGlobalGet, 0x00,
|
2018-12-21 14:02:37 +00:00
|
|
|
kExprI32Const, 0x00,
|
|
|
|
kExprI32Eqz,
|
2019-10-08 13:16:30 +00:00
|
|
|
kExprGlobalGet, 0x00,
|
2018-12-21 14:02:37 +00:00
|
|
|
kExprI32Const, 0x00,
|
|
|
|
kExprI32Const, 0x01,
|
|
|
|
kExprI32Sub,
|
2019-10-08 13:16:30 +00:00
|
|
|
kExprGlobalGet, 0x01,
|
2018-12-21 14:02:37 +00:00
|
|
|
kExprUnreachable,
|
|
|
|
]);
|
|
|
|
builder.instantiate();
|