2018-06-22 16:58:15 +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.addFunction(undefined, makeSig([kWasmI32, kWasmF32], []))
|
2020-09-10 12:39:52 +00:00
|
|
|
.addLocals(kWasmI32, 7)
|
2018-06-22 16:58:15 +00:00
|
|
|
.addBody([
|
2019-10-08 12:38:48 +00:00
|
|
|
kExprLocalGet, 0, // get_local
|
2018-06-22 16:58:15 +00:00
|
|
|
kExprI32Const, 0, // i32.const 0
|
|
|
|
kExprIf, kWasmStmt, // if
|
|
|
|
kExprUnreachable, // unreachable
|
|
|
|
kExprEnd, // end if
|
2019-10-08 12:38:48 +00:00
|
|
|
kExprLocalGet, 4, // get_local
|
|
|
|
kExprLocalTee, 8, // tee_local
|
2018-06-22 16:58:15 +00:00
|
|
|
kExprBrIf, 0, // br_if depth=0
|
2019-10-08 12:38:48 +00:00
|
|
|
kExprLocalTee, 7, // tee_local
|
|
|
|
kExprLocalTee, 0, // tee_local
|
|
|
|
kExprLocalTee, 2, // tee_local
|
|
|
|
kExprLocalTee, 8, // tee_local
|
2018-06-22 16:58:15 +00:00
|
|
|
kExprDrop, // drop
|
|
|
|
kExprLoop, kWasmStmt, // loop
|
|
|
|
kExprEnd, // end loop
|
|
|
|
]);
|
|
|
|
builder.instantiate();
|