Commit d1552fa7 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm][eh] Remove kCatchInArity

The arity depends on the exception type now. Take the max over all
exceptions since we only need a conservative estimate.

R=clemensb@chromium.org

Bug: v8:8091
Change-Id: Id5a3e12d89c5d48219e8981e16c2b679d80b67db
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2691051Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72976}
parent 825cb671
......@@ -555,7 +555,6 @@ int64_t ExecuteI64ReinterpretF64(WasmValue a) {
return a.to_f64_boxed().get_bits();
}
constexpr int32_t kCatchInArity = 1;
constexpr int32_t kCatchAllExceptionIndex = -1;
constexpr int32_t kRethrowOrDelegateExceptionIndex = -2;
......@@ -733,6 +732,14 @@ class SideTable : public ZoneObject {
auto copy_unreachable = [&] {
control_stack.back().unreachable = control_parent().unreachable;
};
int max_exception_arity = 0;
if (module) {
for (auto& exception : module->exceptions) {
max_exception_arity =
std::max(max_exception_arity,
static_cast<int>(exception.sig->parameter_count()));
}
}
for (BytecodeIterator i(code->start, code->end, &code->locals);
i.has_next(); i.next()) {
WasmOpcode opcode = i.current();
......@@ -762,8 +769,9 @@ class SideTable : public ZoneObject {
DCHECK_GE(control_stack.size() - 1, exception_stack.back());
const Control* c = &control_stack[exception_stack.back()];
if (!unreachable) c->else_label->Ref(i.pc(), exceptional_stack_height);
if (exceptional_stack_height + kCatchInArity > max_stack_height_) {
max_stack_height_ = exceptional_stack_height + kCatchInArity;
if (exceptional_stack_height + max_exception_arity >
max_stack_height_) {
max_stack_height_ = exceptional_stack_height + max_exception_arity;
}
TRACE("handler @%u: %s -> try @%u\n", i.pc_offset(),
WasmOpcodes::OpcodeName(opcode),
......
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