Reland "[wasm] ref.call: Consume sig index immediate"
Follow-up to commit6168782925
With this change 0x14 now also consumes a sig index immediate. This will allow users to switch from 0x17 back to 0x14 without breaking changes. After another grace period, 0x17 can be removed. Reland of commit I65fe8b5bceb70323dd5e6450ec7bcc02696b15fa adapted by the concurrent changes in35cc93aa42
. (This reverts commit 01379ba6d65371b70908da8e8386a9d9993aa2f9.) Change-Id: I699095afb85d460e1fef8bd88abfd4c748090eda Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3977828 Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Jakob Kummerow <jkummerow@chromium.org> Auto-Submit: Matthias Liedtke <mliedtke@chromium.org> Cr-Commit-Position: refs/heads/main@{#83900}
This commit is contained in:
parent
7eb43bf494
commit
0486ef3727
@ -1881,13 +1881,13 @@ class WasmDecoder : public Decoder {
|
||||
if (io) io->CallIndirect(imm);
|
||||
return 1 + imm.length;
|
||||
}
|
||||
case kExprCallRefDeprecated: // TODO(7748): Drop after grace period.
|
||||
case kExprCallRef:
|
||||
case kExprReturnCallRef: {
|
||||
SigIndexImmediate imm(decoder, pc + 1, validate);
|
||||
if (io) io->TypeIndex(imm);
|
||||
return 1 + imm.length;
|
||||
}
|
||||
case kExprCallRefDeprecated: // TODO(7748): Drop after grace period.
|
||||
case kExprDrop:
|
||||
case kExprSelect:
|
||||
case kExprCatchAll:
|
||||
@ -3737,27 +3737,17 @@ class WasmFullDecoder : public WasmDecoder<ValidationTag, decoding_mode> {
|
||||
// TODO(7748): After a certain grace period, drop this in favor of "CallRef".
|
||||
DECODE(CallRefDeprecated) {
|
||||
CHECK_PROTOTYPE_OPCODE(typed_funcref);
|
||||
Value func_ref = Peek(0);
|
||||
ValueType func_type = func_ref.type;
|
||||
if (func_type == kWasmBottom) {
|
||||
// We are in unreachable code, maintain the polymorphic stack.
|
||||
return 1;
|
||||
}
|
||||
if (!VALIDATE(func_type.is_object_reference() && func_type.has_index() &&
|
||||
this->module_->has_signature(func_type.ref_index()))) {
|
||||
PopTypeError(0, func_ref, "function reference");
|
||||
return 0;
|
||||
}
|
||||
const FunctionSig* sig = this->module_->signature(func_type.ref_index());
|
||||
ArgVector args = PeekArgs(sig, 1);
|
||||
ReturnVector returns = CreateReturnValues(sig);
|
||||
CALL_INTERFACE_IF_OK_AND_REACHABLE(CallRef, func_ref, sig,
|
||||
func_type.ref_index(), args.begin(),
|
||||
returns.begin());
|
||||
SigIndexImmediate imm(this, this->pc_ + 1, validate);
|
||||
if (!this->Validate(this->pc_ + 1, imm)) return 0;
|
||||
Value func_ref = Peek(0, 0, ValueType::RefNull(imm.index));
|
||||
ArgVector args = PeekArgs(imm.sig, 1);
|
||||
ReturnVector returns = CreateReturnValues(imm.sig);
|
||||
CALL_INTERFACE_IF_OK_AND_REACHABLE(CallRef, func_ref, imm.sig, imm.index,
|
||||
args.begin(), returns.begin());
|
||||
Drop(func_ref);
|
||||
DropArgs(sig);
|
||||
DropArgs(imm.sig);
|
||||
PushReturns(returns);
|
||||
return 1;
|
||||
return 1 + imm.length;
|
||||
}
|
||||
|
||||
DECODE(CallRef) {
|
||||
|
@ -60,9 +60,9 @@ bool V8_EXPORT_PRIVATE IsJSCompatibleSignature(const FunctionSig* sig,
|
||||
V(CallIndirect, 0x11, _, "call_indirect") \
|
||||
V(ReturnCall, 0x12, _, "return_call") \
|
||||
V(ReturnCallIndirect, 0x13, _, "return_call_indirect") \
|
||||
V(CallRefDeprecated, 0x14, _, "call_ref") /* typed_funcref prototype */ \
|
||||
V(CallRef, 0x14, _, "call_ref") /* typed_funcref prototype */ \
|
||||
V(ReturnCallRef, 0x15, _, "return_call_ref") /* typed_funcref prototype */ \
|
||||
V(CallRef, 0x17, _, "call_ref") /* temporary, for compat.*/ \
|
||||
V(CallRefDeprecated, 0x17, _, "call_ref") /* temporary, for compat.*/ \
|
||||
V(Drop, 0x1a, _, "drop") \
|
||||
V(Select, 0x1b, _, "select") \
|
||||
V(SelectWithType, 0x1c, _, "select") \
|
||||
|
@ -272,7 +272,7 @@ const kWasmOpcodes = {
|
||||
'CallIndirect': 0x11,
|
||||
'ReturnCall': 0x12,
|
||||
'ReturnCallIndirect': 0x13,
|
||||
'CallRef': 0x17, // TODO(7748): Temporary. Switch back to 0x14.
|
||||
'CallRef': 0x14,
|
||||
'ReturnCallRef': 0x15,
|
||||
'Delegate': 0x18,
|
||||
'Drop': 0x1a,
|
||||
|
Loading…
Reference in New Issue
Block a user