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

[wasm][interpreter] Pop catch-less try scope info

Now that try blocks don't need a catch handler, ensure that we still
properly close the scope when we handle the "end" opcode.

R=clemensb@chromium.org

Change-Id: I012939d5b3ee9caee9275a2f0abd65e517593870
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2959623Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75126}
parent 423f38ab
......@@ -243,6 +243,23 @@ WASM_EXEC_TEST(TryUnwind) {
}
}
WASM_EXEC_TEST(TestCatchlessTry) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
WasmRunner<uint32_t> r(execution_tier);
uint32_t except = r.builder().AddException(sigs.v_i());
BUILD(r,
WASM_TRY_CATCH_T(
kWasmI32,
WASM_TRY_T(kWasmI32, WASM_STMTS(WASM_I32V(0), WASM_THROW(except))),
WASM_NOP, except));
if (execution_tier != TestExecutionTier::kInterpreter) {
r.CheckCallViaJS(0);
} else {
CHECK_EQ(0, r.CallInterpreter());
}
}
WASM_EXEC_TEST(TryCatchRethrow) {
TestSignatures sigs;
EXPERIMENTAL_FLAG_SCOPE(eh);
......
......@@ -954,6 +954,10 @@ class SideTable : public ZoneObject {
c->else_label->Bind(i.pc());
} else if (!exception_stack.empty()) {
// No catch_all block, prepare for implicit rethrow.
if (exception_stack.back() == control_stack.size() - 1) {
// Close try scope for catch-less try.
exception_stack.pop_back();
}
DCHECK_EQ(*c->pc, kExprTry);
constexpr int kUnusedControlIndex = -1;
c->else_label->Bind(i.pc(), kRethrowOrDelegateExceptionIndex,
......
......@@ -180,6 +180,8 @@
#define WASM_IF_ELSE_X(index, cond, tstmt, fstmt) \
cond, kExprIf, static_cast<byte>(index), tstmt, kExprElse, fstmt, kExprEnd
#define WASM_TRY_T(t, trystmt) \
kExprTry, static_cast<byte>((t).value_type_code()), trystmt, kExprEnd
#define WASM_TRY_CATCH_T(t, trystmt, catchstmt, except) \
kExprTry, static_cast<byte>((t).value_type_code()), trystmt, kExprCatch, \
except, catchstmt, kExprEnd
......
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