[wasm][interpreter] Fix multi-value try blocks

Fix target stack height of multi-value try blocks.

R=clemensb@chromium.org

Bug: chromium:1187896
Change-Id: I698b06141e65f7b545a695c035b862af31dd8875
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2772236
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73504}
This commit is contained in:
Thibaud Michaud 2021-03-18 10:32:20 +01:00 committed by Commit Bot
parent 2ce5acf66b
commit d8b6e14c15
2 changed files with 14 additions and 2 deletions

View File

@ -589,6 +589,17 @@ TEST(Regress1180457) {
CHECK_EQ(kResult0, r.CallInterpreter());
}
TEST(Regress1187896) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t> r(TestExecutionTier::kInterpreter);
byte try_sig = r.builder().AddSignature(sigs.v_i());
constexpr uint32_t kResult = 23;
BUILD(r, kExprI32Const, 0, kExprTry, try_sig, kExprDrop, kExprCatchAll,
kExprNop, kExprEnd, kExprI32Const, kResult);
CHECK_EQ(kResult, r.CallInterpreter());
}
} // namespace test_run_wasm_exceptions
} // namespace wasm
} // namespace internal

View File

@ -894,7 +894,8 @@ class SideTable : public ZoneObject {
}
TRACE("control @%u: Try, arity %d->%d\n", i.pc_offset(),
imm.in_arity(), imm.out_arity());
CLabel* end_label = CLabel::New(&control_transfer_zone, stack_height,
CLabel* end_label =
CLabel::New(&control_transfer_zone, stack_height - imm.in_arity(),
imm.out_arity());
CLabel* catch_label =
CLabel::New(&control_transfer_zone, stack_height, 0);