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

[wasm][eh] Update interpreter 'delegate' behavior

Bug: v8:8091, chromium:1247119
Change-Id: Icafd0bf9277aed835032396c2512e7d991407e0d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3144910Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76720}
parent 53302d29
......@@ -504,6 +504,13 @@ TEST(Regress1092130) {
r.Call();
}
TEST(Regress1247119) {
WasmRunner<uint32_t> r(TestExecutionTier::kInterpreter);
BUILD(r, kExprLoop, 0, kExprTry, 0, kExprUnreachable, kExprDelegate, 0,
kExprEnd);
r.Call();
}
} // namespace test_run_wasm_interpreter
} // namespace wasm
} // namespace internal
......
......@@ -968,12 +968,17 @@ class SideTable : public ZoneObject {
Control* c = &control_stack.back();
const size_t new_stack_size = control_stack.size() - 1;
const size_t max_depth = new_stack_size - 1;
if (imm.depth < max_depth) {
size_t target_depth = imm.depth;
while (target_depth < max_depth &&
*control_stack[max_depth - target_depth].pc != kExprTry) {
target_depth++;
}
if (target_depth < max_depth) {
constexpr int kUnusedControlIndex = -1;
c->else_label->Bind(i.pc(), kRethrowOrDelegateExceptionIndex,
kUnusedControlIndex);
c->else_label->Finish(&map_, code->start);
Control* target = &control_stack[max_depth - imm.depth];
Control* target = &control_stack[max_depth - target_depth];
DCHECK_EQ(*target->pc, kExprTry);
DCHECK_NOT_NULL(target->else_label);
if (!control_parent().unreachable) {
......
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