a345a442d3
- Add d8.file.read() and d8.file.execute() helpers - Change tools and tests to use new d8.file helper - Unify error throwing in v8::Shell::ReadFile Change-Id: I5ef4cb27f217508a367106f01e872a4059d5e399 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2928505 Commit-Queue: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Maya Lekova <mslekova@chromium.org> Reviewed-by: Marja Hölttä <marja@chromium.org> Cr-Commit-Position: refs/heads/master@{#74883}
50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
// Copyright 2021 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.
|
|
|
|
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
|
|
|
// This test creates the situation where BranchElimination's VisitIf sees a
|
|
// different condition than the preceding VisitBranch (because an interleaved
|
|
// CommonOperatorReducer replaced the condition).
|
|
|
|
(function foo() {
|
|
let builder = new WasmModuleBuilder();
|
|
|
|
builder.addFunction("main", kSig_v_l)
|
|
.addLocals(kWasmI32, 2)
|
|
.addBody([
|
|
kExprLoop, kWasmVoid,
|
|
kExprLocalGet, 0x02,
|
|
kExprLocalTee, 0x01,
|
|
kExprIf, kWasmVoid,
|
|
kExprElse,
|
|
kExprLoop, kWasmVoid,
|
|
kExprLoop, kWasmVoid,
|
|
kExprLocalGet, 0x01,
|
|
kExprIf, kWasmVoid,
|
|
kExprElse,
|
|
kExprLocalGet, 0x02,
|
|
kExprBrIf, 0x04,
|
|
kExprBr, 0x01,
|
|
kExprEnd,
|
|
kExprLocalGet, 0x00,
|
|
kExprCallFunction, 0x01,
|
|
kExprLocalTee, 0x02,
|
|
kExprBrIf, 0x00,
|
|
kExprEnd,
|
|
kExprLocalGet, 0x01,
|
|
kExprBrIf, 0x00,
|
|
kExprEnd,
|
|
kExprEnd,
|
|
kExprBr, 0x00,
|
|
kExprEnd])
|
|
.exportAs("main");
|
|
|
|
builder.addFunction("callee", kSig_i_l)
|
|
.addBody([kExprLocalGet, 0, kExprI32ConvertI64]);
|
|
|
|
let module = new WebAssembly.Module(builder.toBuffer());
|
|
let instance = new WebAssembly.Instance(module);
|
|
})();
|