Commit 0215fd72 authored by Manos Koukoutos's avatar Manos Koukoutos Committed by Commit Bot

[wasm-gc] Implement StackEffect for GC instructions

Bug: v8:7748
Change-Id: I1c844768e09095ad85396f1752420b616048ec36
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2278473
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68665}
parent ecfbc749
......@@ -1827,10 +1827,53 @@ class WasmDecoder : public Decoder {
sig = WasmOpcodes::Signature(opcode);
if (sig) {
return {sig->parameter_count(), sig->return_count()};
} else {
UNREACHABLE();
}
}
}
}
case kGCPrefix: {
opcode = this->read_prefixed_opcode<validate>(pc);
switch (opcode) {
case kExprStructGet:
case kExprStructGetS:
case kExprStructGetU:
case kExprI31New:
case kExprI31GetS:
case kExprI31GetU:
case kExprArrayLen:
case kExprRttSub:
return {1, 1};
case kExprStructSet:
return {2, 0};
case kExprArrayNew:
case kExprArrayGet:
case kExprArrayGetS:
case kExprArrayGetU:
case kExprRefTest:
case kExprRefCast:
case kExprBrOnCast:
return {2, 1};
case kExprArraySet:
return {3, 0};
case kExprRttCanon:
return {0, 1};
case kExprArrayNewSub:
return {3, 1};
case kExprStructNew: {
StructIndexImmediate<validate> imm(this, this->pc_ + 2);
this->Complete(imm);
return {imm.struct_type->field_count(), 1};
}
case kExprStructNewWithRtt: {
StructIndexImmediate<validate> imm(this, this->pc_ + 2);
this->Complete(imm);
return {imm.struct_type->field_count() + 1, 1};
}
default:
UNREACHABLE();
}
V8_FALLTHROUGH;
}
default:
FATAL("unimplemented opcode: %x (%s)", 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