Commit ca1a2cfb authored by Thibaud Michaud's avatar Thibaud Michaud Committed by V8 LUCI CQ

[wasm][interpreter][eh] Fix unreachable ref

The delegate instruction is executed when an exception is thrown, not
after the last instruction of the block. Handle reachability
accordingly.

R=ahaas@chromium.org

Bug: chromium:1212396
Change-Id: I55e342cd73da44142cfbad7e16ab65ef513e6a60
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2928499Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74855}
parent 67e97125
......@@ -699,6 +699,17 @@ TEST(Regress1197408) {
CHECK_EQ(0, r.CallInterpreter(0, 0, 0));
}
TEST(Regress1212396) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<int32_t> r(TestExecutionTier::kInterpreter);
uint32_t except = r.builder().AddException(sigs.v_v());
BUILD(r, kExprTry, kVoidCode, kExprTry, kVoidCode, kExprI32Const, 0,
kExprThrow, except, kExprDelegate, 0, kExprCatch, except, kExprEnd,
kExprI32Const, 42);
CHECK_EQ(42, r.CallInterpreter());
}
} // namespace test_run_wasm_exceptions
} // namespace wasm
} // namespace internal
......
......@@ -1005,7 +1005,7 @@ class SideTable : public ZoneObject {
Control* target = &control_stack[max_depth - imm.depth];
DCHECK_EQ(*target->pc, kExprTry);
DCHECK_NOT_NULL(target->else_label);
if (!unreachable) {
if (!control_parent().unreachable) {
target->else_label->Ref(i.pc(),
c->end_label->target_stack_height);
}
......
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