| Index: src/interpreter/bytecodes.cc
|
| diff --git a/src/interpreter/bytecodes.cc b/src/interpreter/bytecodes.cc
|
| index e626acc69022e88089d4b9f3d20ff86689c73d52..f3bb59e8b0cbc830a8c34a9d8764b2cc11329113 100644
|
| --- a/src/interpreter/bytecodes.cc
|
| +++ b/src/interpreter/bytecodes.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include <iomanip>
|
|
|
| +#include "src/base/bits.h"
|
| #include "src/frames.h"
|
| #include "src/interpreter/bytecode-traits.h"
|
| #include "src/interpreter/interpreter.h"
|
| @@ -324,6 +325,20 @@ const OperandType* Bytecodes::GetOperandTypes(Bytecode bytecode) {
|
| }
|
|
|
| // static
|
| +const OperandTypeInfo* Bytecodes::GetOperandTypeInfos(Bytecode bytecode) {
|
| + DCHECK(bytecode <= Bytecode::kLast);
|
| + switch (bytecode) {
|
| +#define CASE(Name, ...) \
|
| + case Bytecode::k##Name: \
|
| + return BytecodeTraits<__VA_ARGS__>::GetOperandTypeInfos();
|
| + BYTECODE_LIST(CASE)
|
| +#undef CASE
|
| + }
|
| + UNREACHABLE();
|
| + return nullptr;
|
| +}
|
| +
|
| +// static
|
| OperandSize Bytecodes::GetOperandSize(Bytecode bytecode, int i,
|
| OperandScale operand_scale) {
|
| DCHECK_LT(i, NumberOfOperands(bytecode));
|
| @@ -598,7 +613,7 @@ bool Bytecodes::IsUnsignedOperandType(OperandType operand_type) {
|
| switch (operand_type) {
|
| #define CASE(Name, _) \
|
| case OperandType::k##Name: \
|
| - return OperandTraits<OperandType::k##Name>::TypeInfo::kIsUnsigned;
|
| + return OperandTraits<OperandType::k##Name>::TypeInfoTraits::kIsUnsigned;
|
| OPERAND_TYPE_LIST(CASE)
|
| #undef CASE
|
| }
|
| @@ -608,9 +623,9 @@ bool Bytecodes::IsUnsignedOperandType(OperandType operand_type) {
|
|
|
| // static
|
| OperandSize Bytecodes::SizeForSignedOperand(int value) {
|
| - if (kMinInt8 <= value && value <= kMaxInt8) {
|
| + if (value >= kMinInt8 && value <= kMaxInt8) {
|
| return OperandSize::kByte;
|
| - } else if (kMinInt16 <= value && value <= kMaxInt16) {
|
| + } else if (value >= kMinInt16 && value <= kMaxInt16) {
|
| return OperandSize::kShort;
|
| } else {
|
| return OperandSize::kQuad;
|
| @@ -618,8 +633,7 @@ OperandSize Bytecodes::SizeForSignedOperand(int value) {
|
| }
|
|
|
| // static
|
| -OperandSize Bytecodes::SizeForUnsignedOperand(int value) {
|
| - DCHECK_GE(value, 0);
|
| +OperandSize Bytecodes::SizeForUnsignedOperand(uint32_t value) {
|
| if (value <= kMaxUInt8) {
|
| return OperandSize::kByte;
|
| } else if (value <= kMaxUInt16) {
|
| @@ -629,19 +643,6 @@ OperandSize Bytecodes::SizeForUnsignedOperand(int value) {
|
| }
|
| }
|
|
|
| -OperandSize Bytecodes::SizeForUnsignedOperand(size_t value) {
|
| - if (value <= static_cast<size_t>(kMaxUInt8)) {
|
| - return OperandSize::kByte;
|
| - } else if (value <= static_cast<size_t>(kMaxUInt16)) {
|
| - return OperandSize::kShort;
|
| - } else if (value <= kMaxUInt32) {
|
| - return OperandSize::kQuad;
|
| - } else {
|
| - UNREACHABLE();
|
| - return OperandSize::kQuad;
|
| - }
|
| -}
|
| -
|
| OperandScale Bytecodes::OperandSizesToScale(OperandSize size0) {
|
| OperandScale operand_scale = static_cast<OperandScale>(size0);
|
| DCHECK(operand_scale == OperandScale::kSingle ||
|
|
|