Commit fa955653 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Avoid repeated checking for stack growing

The vast majority of operations increases the stack size by at most one.
Many opcode (e.g. all unary and binary operations) never grow the stack
at all. Still, for every "push" operation, they check whether the
storage for the vector that holds the stack values needs to grow.

This CL avoids those redundant checks by ensuring that there is space
for at least one more stack element before decoding each instruction.

By centralizing this check, we not only improve performance, but also
reduce code size significantly (~49 kB on x64 release).

R=thibaudm@chromium.org

Bug: chromium:1096565, v8:10933
Change-Id: I986dcac734b986d1ce953b7ec3bde8ad31b4f2b7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2431525
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70177}
parent 7d60fe99
This diff is collapsed.
...@@ -456,6 +456,7 @@ class ValueType { ...@@ -456,6 +456,7 @@ class ValueType {
#undef TYPE_NAME #undef TYPE_NAME
}; };
CONSTEXPR_DCHECK(kind() < arraysize(kTypeName));
return kTypeName[kind()]; return kTypeName[kind()];
} }
......
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