Chromium Code Reviews| Index: src/interpreter/bytecodes.h |
| diff --git a/src/interpreter/bytecodes.h b/src/interpreter/bytecodes.h |
| index aa5234924152f24a25383d980b2685749bd4d2db..7f9e844930a1fdd68bae556a422a8b8827181402 100644 |
| --- a/src/interpreter/bytecodes.h |
| +++ b/src/interpreter/bytecodes.h |
| @@ -104,7 +104,6 @@ namespace interpreter { |
| V(LoadICStrict, OperandType::kReg8, OperandType::kIdx8, OperandType::kIdx8) \ |
| V(KeyedLoadICSloppy, OperandType::kReg8, OperandType::kIdx8) \ |
| V(KeyedLoadICStrict, OperandType::kReg8, OperandType::kIdx8) \ |
| - /* TODO(rmcilroy): Wide register operands too? */ \ |
| V(LoadICSloppyWide, OperandType::kReg8, OperandType::kIdx16, \ |
| OperandType::kIdx16) \ |
| V(LoadICStrictWide, OperandType::kReg8, OperandType::kIdx16, \ |
| @@ -119,7 +118,6 @@ namespace interpreter { |
| OperandType::kIdx8) \ |
| V(KeyedStoreICStrict, OperandType::kReg8, OperandType::kReg8, \ |
| OperandType::kIdx8) \ |
| - /* TODO(rmcilroy): Wide register operands too? */ \ |
| V(StoreICSloppyWide, OperandType::kReg8, OperandType::kIdx16, \ |
| OperandType::kIdx16) \ |
| V(StoreICStrictWide, OperandType::kReg8, OperandType::kIdx16, \ |
| @@ -289,20 +287,22 @@ enum class Bytecode : uint8_t { |
| // in its stack-frame. Register hold parameters, this, and expression values. |
| class Register { |
| public: |
| - Register() : index_(kIllegalIndex) {} |
| - |
| - explicit Register(int index) : index_(index) {} |
| + explicit Register(int index = kInvalidIndex) : index_(index) {} |
| int index() const { |
| - DCHECK(index_ != kIllegalIndex); |
| + DCHECK(index_ != kInvalidIndex); |
| return index_; |
| } |
| bool is_parameter() const { return index() < 0; } |
| - bool is_valid() const { return index_ != kIllegalIndex; } |
| + bool is_valid() const { return index_ != kInvalidIndex; } |
| + bool is_byte_operand() const; |
| + bool is_short_operand() const; |
| static Register FromParameterIndex(int index, int parameter_count); |
| int ToParameterIndex(int parameter_count) const; |
| static int MaxParameterIndex(); |
| + static int MaxRegisterIndex(); |
| + static int MaxRegisterIndexForByteOperand(); |
| // Returns the register for the function's closure object. |
| static Register function_closure(); |
| @@ -350,7 +350,7 @@ class Register { |
| } |
| private: |
| - static const int kIllegalIndex = kMaxInt; |
| + static const int kInvalidIndex = kMaxInt; |
| void* operator new(size_t size); |
| void operator delete(void* p); |
| @@ -379,6 +379,9 @@ class Bytecodes { |
| // Returns the number of operands expected by |bytecode|. |
| static int NumberOfOperands(Bytecode bytecode); |
| + // Returns the number of register operands expected by |bytecode|. |
| + static int NumberOfRegisterOperands(Bytecode bytecode); |
| + |
| // Return the i-th operand of |bytecode|. |
| static OperandType GetOperandType(Bytecode bytecode, int i); |
| @@ -389,37 +392,40 @@ class Bytecodes { |
| // of the bytecode. |
| static int GetOperandOffset(Bytecode bytecode, int i); |
| + // Returns a zero-based bit of the register operand positions of |bitmap|. |
|
rmcilroy
2016/01/25 12:12:05
/s/bit/bitmap/ and /s/|bitmap|/|bytecode|
oth
2016/01/25 16:51:56
Done.
|
| + static int GetRegisterOperandBitmap(Bytecode bytecode); |
| + |
| // Returns the size of the bytecode including its operands. |
| static int Size(Bytecode bytecode); |
| // Returns the size of |operand|. |
| static OperandSize SizeOfOperand(OperandType operand); |
| - // Return true if the bytecode is a conditional jump taking |
| + // Returns true if the bytecode is a conditional jump taking |
| // an immediate byte operand (OperandType::kImm8). |
| static bool IsConditionalJumpImmediate(Bytecode bytecode); |
| - // Return true if the bytecode is a conditional jump taking |
| + // Returns true if the bytecode is a conditional jump taking |
| // a constant pool entry (OperandType::kIdx8). |
| static bool IsConditionalJumpConstant(Bytecode bytecode); |
| - // Return true if the bytecode is a conditional jump taking |
| + // Returns true if the bytecode is a conditional jump taking |
| // a constant pool entry (OperandType::kIdx16). |
| static bool IsConditionalJumpConstantWide(Bytecode bytecode); |
| - // Return true if the bytecode is a conditional jump taking |
| + // Returns true if the bytecode is a conditional jump taking |
| // any kind of operand. |
| static bool IsConditionalJump(Bytecode bytecode); |
| - // Return true if the bytecode is a jump or a conditional jump taking |
| + // Returns true if the bytecode is a jump or a conditional jump taking |
| // an immediate byte operand (OperandType::kImm8). |
| static bool IsJumpImmediate(Bytecode bytecode); |
| - // Return true if the bytecode is a jump or conditional jump taking a |
| + // Returns true if the bytecode is a jump or conditional jump taking a |
| // constant pool entry (OperandType::kIdx8). |
| static bool IsJumpConstant(Bytecode bytecode); |
| - // Return true if the bytecode is a jump or conditional jump taking a |
| + // Returns true if the bytecode is a jump or conditional jump taking a |
| // constant pool entry (OperandType::kIdx16). |
| static bool IsJumpConstantWide(Bytecode bytecode); |