Commit bded0eb6 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Handle break to outermost block like a return

This saves a few control merges in Liftoff, and might also generate
smaller graphs in Turbofan.

R=titzer@chromium.org

Bug: v8:6600, v8:8423
Change-Id: Ice921f8b048809bc38b820b94688f482e67bd386
Reviewed-on: https://chromium-review.googlesource.com/c/1354039Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57907}
parent 49dd27b0
......@@ -1822,10 +1822,14 @@ class WasmFullDecoder : public WasmDecoder<validate> {
BreakDepthImmediate<validate> imm(this, this->pc_);
if (!this->Validate(this->pc_, imm, control_.size())) break;
Control* c = control_at(imm.depth);
if (!TypeCheckBreak(c)) break;
if (control_.back().reachable()) {
CALL_INTERFACE(Br, c);
c->br_merge()->reached = true;
if (imm.depth == control_.size() - 1) {
DoReturn(c, false);
} else {
if (!TypeCheckBreak(c)) break;
if (control_.back().reachable()) {
CALL_INTERFACE(Br, c);
c->br_merge()->reached = true;
}
}
len = 1 + imm.length;
EndControl();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment