Commit b7e33d04 authored by Manos Koukoutos's avatar Manos Koukoutos Committed by Commit Bot

[wasm] Do not inline error code in Pop()

This is to mitigate a binary size increase caused by
https://chromium-review.googlesource.com/c/v8/v8/+/2243215.
This CL reduces binary size by 102kB.

Change-Id: Idd106efab0c2b974b4f90bf6ca3e1c321de06aea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2315984Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69022}
parent 4aa185bc
...@@ -3901,13 +3901,26 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3901,13 +3901,26 @@ class WasmFullDecoder : public WasmDecoder<validate> {
return stack_.data() + old_size; return stack_.data() + old_size;
} }
// We do not inline these functions because doing so causes a large binary
// size increase. Not inlining them should not create a performance
// degradation, because their invocations are guarded by V8_LIKELY.
V8_NOINLINE void PopTypeError(int index, Value val, ValueType expected) {
this->errorf(val.pc, "%s[%d] expected type %s, found %s of type %s",
SafeOpcodeNameAt(this->pc_), index, expected.name().c_str(),
SafeOpcodeNameAt(val.pc), val.type.name().c_str());
}
V8_NOINLINE void NotEnoughArgumentsError(int index) {
this->errorf(this->pc_,
"not enough arguments on the stack for %s, expected %d more",
SafeOpcodeNameAt(this->pc_), index + 1);
}
V8_INLINE Value Pop(int index, ValueType expected) { V8_INLINE Value Pop(int index, ValueType expected) {
Value val = Pop(index); Value val = Pop(index);
if (!VALIDATE(IsSubtypeOf(val.type, expected, this->module_) || if (!VALIDATE(IsSubtypeOf(val.type, expected, this->module_) ||
val.type == kWasmBottom || expected == kWasmBottom)) { val.type == kWasmBottom || expected == kWasmBottom)) {
this->errorf(val.pc, "%s[%d] expected type %s, found %s of type %s", PopTypeError(index, val, expected);
SafeOpcodeNameAt(this->pc_), index, expected.name().c_str(),
SafeOpcodeNameAt(val.pc), val.type.name().c_str());
} }
return val; return val;
} }
...@@ -3918,10 +3931,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -3918,10 +3931,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
if (stack_.size() <= limit) { if (stack_.size() <= limit) {
// Popping past the current control start in reachable code. // Popping past the current control start in reachable code.
if (!VALIDATE(control_.back().unreachable())) { if (!VALIDATE(control_.back().unreachable())) {
this->errorf( NotEnoughArgumentsError(index);
this->pc_,
"not enough arguments on the stack for %s, expected %d more",
SafeOpcodeNameAt(this->pc_), index + 1);
} }
return UnreachableValue(this->pc_); return UnreachableValue(this->pc_);
} }
......
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