v8/test/mjsunit/regress/wasm/condition-change-during-branch-elimination.js
Manos Koukoutos a51056f5c4 [wasm] Rename kWasmStmt -> kWasmVoid
This is a more canonical type name, and is in line with {kVoidCode}.

Change-Id: Iaae9524b6fb6ecaafd63ce81cf30e3d01ca3e525
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2775565
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73557}
2021-03-22 07:58:18 +00:00

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.
load("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);
})();