Lines Matching defs:opcode
57 "Invalid opcode 0x%02x (enable with --experimental-wasm-" #feat ")", \
58 opcode); \
263 byte val = decoder->read_u8<validate>(pc, "value type opcode");
630 // opcode.
913 F(BinOp, WasmOpcode opcode, const Value& lhs, const Value& rhs, \
939 F(UnOp, WasmOpcode opcode, const Value& value, Value* result) \
991 F(SimdOp, WasmOpcode opcode, base::Vector<Value> args, Value* result) \
992 F(SimdLaneOp, WasmOpcode opcode, const SimdLaneImmediate<validate>& imm, \
1004 F(AtomicOp, WasmOpcode opcode, base::Vector<Value> args, \
1188 // starting 'loop' opcode.
1195 WasmOpcode opcode = static_cast<WasmOpcode>(*pc);
1196 switch (opcode) {
1376 bool Validate(const byte* pc, WasmOpcode opcode,
1379 switch (opcode) {
1571 // Returns the length of the opcode under {pc}.
1573 WasmOpcode opcode = static_cast<WasmOpcode>(*pc);
1577 // actually decoding that opcode.
1579 switch (opcode) {
1712 opcode = decoder->read_prefixed_opcode<validate>(pc, &length);
1713 switch (opcode) {
1761 decoder->DecodeError(pc, "invalid numeric opcode");
1768 opcode = decoder->read_prefixed_opcode<validate>(pc, &length);
1769 switch (opcode) {
1795 decoder->DecodeError(pc, "invalid SIMD opcode");
1802 opcode = decoder->read_prefixed_opcode<validate>(pc, &length,
1804 switch (opcode) {
1816 decoder->DecodeError(pc, "invalid Atomics opcode");
1823 opcode =
1825 switch (opcode) {
1903 decoder->DecodeError(pc, "invalid gc opcode");
1927 decoder->DecodeError(pc, "invalid opcode");
1934 WasmOpcode opcode = static_cast<WasmOpcode>(*pc);
1936 const FunctionSig* sig = WasmOpcodes::Signature(opcode);
1937 if (!sig) sig = WasmOpcodes::AsmjsSignature(opcode);
1940 #define DECLARE_OPCODE_CASE(name, opcode, sig) case kExpr##name:
1942 switch (opcode) {
2016 opcode = this->read_prefixed_opcode<validate>(pc);
2017 switch (opcode) {
2035 sig = WasmOpcodes::Signature(opcode);
2042 opcode = this->read_prefixed_opcode<validate>(pc);
2043 switch (opcode) {
2096 return {length_imm.index + (opcode == kExprArrayInit ? 1 : 0), 1};
2103 FATAL("unimplemented opcode: %x (%s)", opcode,
2104 WasmOpcodes::OpcodeName(opcode));
2268 this->DecodeError("function body must end with \"end\" opcode");
2294 WasmOpcode opcode = static_cast<WasmOpcode>(*pc);
2295 if (!WasmOpcodes::IsPrefixOpcode(opcode)) {
2296 return WasmOpcodes::OpcodeName(static_cast<WasmOpcode>(opcode));
2298 opcode = this->template read_prefixed_opcode<Decoder::kFullValidation>(pc);
2299 return WasmOpcodes::OpcodeName(opcode);
2386 WasmOpcode opcode = static_cast<WasmOpcode>(first_byte);
2387 CALL_INTERFACE_IF_OK_AND_REACHABLE(NextInstruction, opcode);
2393 if (opcode == kExprLocalGet) {
2394 len = WasmFullDecoder::DecodeLocalGet(this, opcode);
2395 } else if (opcode == kExprI32Const) {
2396 len = WasmFullDecoder::DecodeI32Const(this, opcode);
2399 len = (*handler)(this, opcode);
2433 bool CheckSimdFeatureFlagOpcode(WasmOpcode opcode) {
2435 WasmOpcodes::IsRelaxedSimdOpcode(opcode)) {
2437 "simd opcode not available, enable with --experimental-relaxed-simd");
2454 WasmOpcode opcode = static_cast<WasmOpcode>(*decoder->pc());
2455 if (!WasmOpcodes::IsPrefixOpcode(opcode)) AppendOpcode(opcode);
2458 void AppendOpcode(WasmOpcode opcode) {
2459 DCHECK(!WasmOpcodes::IsPrefixOpcode(opcode));
2461 WasmOpcodes::OpcodeName(opcode));
2544 static int Decode##name(WasmFullDecoder* decoder, WasmOpcode opcode) { \
2546 return decoder->Decode##name##Impl(&trace_msg, opcode); \
2548 V8_INLINE int Decode##name##Impl(TraceLine* trace_msg, WasmOpcode opcode)
2554 this->DecodeError("Invalid opcode 0x%x", opcode);
3262 DCHECK_LE(kMinOpcode, opcode);
3263 DCHECK_GE(kMaxOpcode, opcode);
3264 return DecodeLoadMem(kLoadTypes[opcode - kMinOpcode]);
3278 DCHECK_LE(kMinOpcode, opcode);
3279 DCHECK_GE(kMaxOpcode, opcode);
3280 return DecodeStoreMem(kStoreTypes[opcode - kMinOpcode]);
3286 // This opcode will not be emitted by the asm translator.
3470 DECODE(name) { return BuildSimplePrototypeOperator(opcode); }
3477 this->DecodeError("Invalid opcode 0x%x", opcode);
3480 const FunctionSig* sig = WasmOpcodes::AsmjsSignature(opcode);
3482 return BuildSimpleOperator(opcode, sig);
3487 static int NonConstError(WasmFullDecoder* decoder, WasmOpcode opcode) {
3488 decoder->DecodeError("opcode %s is not allowed in init. expressions",
3489 WasmOpcodes::OpcodeName(opcode));
3501 #define DECODE_IMPL(opcode) DECODE_IMPL2(kExpr##opcode, opcode)
3502 #define DECODE_IMPL2(opcode, name) \
3503 if (idx == opcode) { \
3510 #define DECODE_IMPL_CONST(opcode) DECODE_IMPL_CONST2(kExpr##opcode, opcode)
3511 #define DECODE_IMPL_CONST2(opcode, name) \
3512 if (idx == opcode) return &WasmFullDecoder::Decode##name
3587 OpcodeHandler GetOpcodeHandler(uint8_t opcode) {
3590 return kOpcodeHandlers[opcode];
3792 int DecodeLoadLane(WasmOpcode opcode, LoadType type, uint32_t opcode_length) {
3798 if (!this->Validate(this->pc_ + opcode_length, opcode, lane_imm)) return 0;
3810 int DecodeStoreLane(WasmOpcode opcode, StoreType type,
3817 if (!this->Validate(this->pc_ + opcode_length, opcode, lane_imm)) return 0;
3847 uint32_t SimdExtractLane(WasmOpcode opcode, ValueType type,
3850 if (this->Validate(this->pc_ + opcode_length, opcode, imm)) {
3853 CALL_INTERFACE_IF_OK_AND_REACHABLE(SimdLaneOp, opcode, imm,
3861 uint32_t SimdReplaceLane(WasmOpcode opcode, ValueType type,
3864 if (this->Validate(this->pc_ + opcode_length, opcode, imm)) {
3867 CALL_INTERFACE_IF_OK_AND_REACHABLE(SimdLaneOp, opcode, imm,
3889 uint32_t DecodeSimdOpcode(WasmOpcode opcode, uint32_t opcode_length) {
3892 if (opcode != kExprS128Const) {
3893 this->DecodeError("opcode %s is not allowed in init. expressions",
3899 // opcode_length is the number of bytes that this SIMD-specific opcode takes
3901 switch (opcode) {
3903 return SimdExtractLane(opcode, kWasmF64, opcode_length);
3905 return SimdExtractLane(opcode, kWasmF32, opcode_length);
3907 return SimdExtractLane(opcode, kWasmI64, opcode_length);
3913 return SimdExtractLane(opcode, kWasmI32, opcode_length);
3915 return SimdReplaceLane(opcode, kWasmF64, opcode_length);
3917 return SimdReplaceLane(opcode, kWasmF32, opcode_length);
3919 return SimdReplaceLane(opcode, kWasmI64, opcode_length);
3923 return SimdReplaceLane(opcode, kWasmI32, opcode_length);
3977 return DecodeLoadLane(opcode, LoadType::kI32Load8S, opcode_length);
3980 return DecodeLoadLane(opcode, LoadType::kI32Load16S, opcode_length);
3983 return DecodeLoadLane(opcode, LoadType::kI32Load, opcode_length);
3986 return DecodeLoadLane(opcode, LoadType::kI64Load, opcode_length);
3989 return DecodeStoreLane(opcode, StoreType::kI32Store8, opcode_length);
3992 return DecodeStoreLane(opcode, StoreType::kI32Store16, opcode_length);
3995 return DecodeStoreLane(opcode, StoreType::kI32Store, opcode_length);
3998 return DecodeStoreLane(opcode, StoreType::kI64Store, opcode_length);
4003 const FunctionSig* sig = WasmOpcodes::Signature(opcode);
4005 this->DecodeError("invalid simd opcode");
4010 CALL_INTERFACE_IF_OK_AND_REACHABLE(SimdOp, opcode,
4016 SimdOp, opcode, base::VectorOf(args), results.begin());
4047 this->DecodeError("opcode %s is not allowed in init. expressions", \
4052 int DecodeGCOpcode(WasmOpcode opcode, uint32_t opcode_length) {
4053 switch (opcode) {
4059 Value rtt = opcode == kExprStructNew
4062 if (opcode == kExprStructNew) {
4085 WasmOpcodes::OpcodeName(opcode), imm.index, i,
4092 Value rtt = opcode == kExprStructNewDefault ? CreateValue(rtt_type)
4094 if (opcode == kExprStructNewDefault) {
4138 WasmOpcodes::OpcodeName(opcode), field.field_imm.index,
4146 opcode == kExprStructGetS, &value);
4176 Value rtt = opcode == kExprArrayNew ? CreateValue(rtt_type)
4178 if (opcode == kExprArrayNew) {
4200 WasmOpcodes::OpcodeName(opcode), imm.index,
4205 Value rtt = opcode == kExprArrayNewDefault ? CreateValue(rtt_type)
4207 if (opcode == kExprArrayNewDefault) {
4247 Value rtt = opcode == kExprArrayInitFromDataStatic
4250 if (opcode == kExprArrayInitFromDataStatic) {
4276 WasmOpcodes::OpcodeName(opcode), imm.index,
4284 opcode == kExprArrayGetS, &value);
4389 Value rtt = opcode == kExprArrayInit
4392 if (opcode == kExprArrayInitStatic) {
4450 if (opcode == kExprRefTestStatic) {
4459 DCHECK_EQ(opcode, kExprRefTest);
4506 if (opcode == kExprRefCastStatic) {
4515 DCHECK_EQ(opcode, kExprRefCast);
4578 if (opcode == kExprBrOnCastStatic) {
4587 DCHECK_EQ(opcode, kExprBrOnCast);
4663 if (opcode == kExprBrOnCastStaticFail) {
4672 DCHECK_EQ(opcode, kExprBrOnCastFail);
4840 opcode == kExprBrOnFunc
4842 : opcode == kExprBrOnData
4844 : opcode == kExprBrOnArray ? HeapType::kArray
4855 if (opcode == kExprBrOnFunc) {
4857 } else if (opcode == kExprBrOnData) {
4859 } else if (opcode == kExprBrOnArray) {
4892 opcode == kExprBrOnNonFunc
4894 : opcode == kExprBrOnNonData
4896 : opcode == kExprBrOnNonArray ? HeapType::kArray
4902 if (opcode == kExprBrOnNonFunc) {
4905 } else if (opcode == kExprBrOnNonData) {
4908 } else if (opcode == kExprBrOnNonArray) {
4922 this->DecodeError("invalid gc opcode: %x", opcode);
4928 uint32_t DecodeAtomicOpcode(WasmOpcode opcode, uint32_t opcode_length) {
4930 const FunctionSig* sig = WasmOpcodes::Signature(opcode);
4932 this->DecodeError("invalid atomic opcode");
4936 switch (opcode) {
4965 this->DecodeError("invalid atomic opcode");
4978 CALL_INTERFACE_IF_OK_AND_REACHABLE(AtomicOp, opcode, base::VectorOf(args),
4983 CALL_INTERFACE_IF_OK_AND_REACHABLE(AtomicOp, opcode, base::VectorOf(args),
4991 unsigned DecodeNumericOpcode(WasmOpcode opcode, uint32_t opcode_length) {
4992 const FunctionSig* sig = WasmOpcodes::Signature(opcode);
4993 switch (opcode) {
5002 BuildSimpleOperator(opcode, sig);
5108 this->DecodeError("invalid numeric opcode");
5416 int BuildSimplePrototypeOperator(WasmOpcode opcode) {
5417 if (opcode == kExprRefEq) {
5420 const FunctionSig* sig = WasmOpcodes::Signature(opcode);
5421 return BuildSimpleOperator(opcode, sig);
5424 int BuildSimpleOperator(WasmOpcode opcode, const FunctionSig* sig) {
5429 return BuildSimpleOperator(opcode, sig->GetReturn(0), sig->GetParam(0));
5433 return BuildSimpleOperator(opcode, ret, sig->GetParam(0),
5438 int BuildSimpleOperator(WasmOpcode opcode, ValueType return_type,
5443 CALL_INTERFACE_IF_OK_AND_REACHABLE(UnOp, opcode, val, &ret);
5449 int BuildSimpleOperator(WasmOpcode opcode, ValueType return_type,
5454 CALL_INTERFACE_IF_OK_AND_REACHABLE(BinOp, opcode, lval, rval, nullptr);
5458 CALL_INTERFACE_IF_OK_AND_REACHABLE(BinOp, opcode, lval, rval, &ret);
5466 int BuildSimpleOperator_##sig(WasmOpcode opcode) { \
5467 return BuildSimpleOperator(opcode, __VA_ARGS__); \