Chromium Code Reviews| Index: src/interpreter/bytecode-array-builder.h |
| diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h |
| index 6d26c141a3eaa9c024ef581b9c5810438d935597..a38ce05999fbf582ce858b65f094295136a0bba2 100644 |
| --- a/src/interpreter/bytecode-array-builder.h |
| +++ b/src/interpreter/bytecode-array-builder.h |
| @@ -10,7 +10,6 @@ |
| #include "src/interpreter/bytecodes.h" |
| #include "src/interpreter/constant-array-builder.h" |
| #include "src/interpreter/handler-table-builder.h" |
| -#include "src/interpreter/register-translator.h" |
| #include "src/interpreter/source-position-table.h" |
| #include "src/zone-containers.h" |
| @@ -24,7 +23,7 @@ namespace interpreter { |
| class BytecodeLabel; |
| class Register; |
| -class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover { |
| +class BytecodeArrayBuilder final : public ZoneObject { |
| public: |
| BytecodeArrayBuilder(Isolate* isolate, Zone* zone, int parameter_count, |
| int context_count, int locals_count, |
| @@ -66,13 +65,6 @@ class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover { |
| return temporary_register_allocator()->allocation_count(); |
| } |
| - // Returns the number of registers used for translating wide |
| - // register operands into byte sized register operands. |
| - int translation_register_count() const { |
| - return RegisterTranslator::RegisterCountAdjustment( |
| - fixed_and_temporary_register_count(), parameter_count()); |
| - } |
| - |
| Register Parameter(int parameter_index) const; |
| // Return true if the register |reg| represents a parameter or a |
| @@ -276,6 +268,20 @@ class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover { |
| void EnsureReturn(); |
| + static OperandScale OperandSizesToScale( |
| + OperandSize size0, OperandSize size1 = OperandSize::kByte, |
| + OperandSize size2 = OperandSize::kByte, |
| + OperandSize size3 = OperandSize::kByte); |
| + static OperandSize SizeForRegisterOperand(Register reg); |
|
rmcilroy
2016/03/17 17:30:49
nit - newline above
oth
2016/03/21 09:16:53
Done.
|
| + static OperandSize SizeForSignedOperand(int value); |
| + static OperandSize SizeForUnsignedOperand(int value); |
| + static OperandSize SizeForUnsignedOperand(size_t value); |
| + static uint32_t RegisterOperand(Register reg); |
|
rmcilroy
2016/03/17 17:30:49
nit - newline above. Also, can these all be privat
oth
2016/03/21 09:16:53
Done newline. Unittests check these work. The size
|
| + static Register RegisterFromOperand(uint32_t operand); |
| + static uint32_t SignedOperand(int value, OperandSize size); |
| + static uint32_t UnsignedOperand(int value); |
| + static uint32_t UnsignedOperand(size_t value); |
| + |
| private: |
| class PreviousBytecodeHelper; |
| friend class BytecodeRegisterAllocator; |
| @@ -283,7 +289,6 @@ class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover { |
| static Bytecode BytecodeForBinaryOperation(Token::Value op); |
| static Bytecode BytecodeForCountOperation(Token::Value op); |
| static Bytecode BytecodeForCompareOperation(Token::Value op); |
| - static Bytecode BytecodeForWideOperands(Bytecode bytecode); |
| static Bytecode BytecodeForStoreIC(LanguageMode language_mode); |
| static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); |
| static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); |
| @@ -293,32 +298,22 @@ class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover { |
| static Bytecode BytecodeForDelete(LanguageMode language_mode); |
| static Bytecode BytecodeForCall(TailCallMode tail_call_mode); |
| - static bool FitsInIdx8Operand(int value); |
| - static bool FitsInIdx8Operand(size_t value); |
| - static bool FitsInImm8Operand(int value); |
| - static bool FitsInIdx16Operand(int value); |
| - static bool FitsInIdx16Operand(size_t value); |
| - static bool FitsInReg8Operand(Register value); |
| - static bool FitsInReg8OperandUntranslated(Register value); |
| - static bool FitsInReg16Operand(Register value); |
| - static bool FitsInReg16OperandUntranslated(Register value); |
| - |
| - // RegisterMover interface. |
| - void MoveRegisterUntranslated(Register from, Register to) override; |
| - |
| static Bytecode GetJumpWithConstantOperand(Bytecode jump_smi8_operand); |
| - static Bytecode GetJumpWithConstantWideOperand(Bytecode jump_smi8_operand); |
| static Bytecode GetJumpWithToBoolean(Bytecode jump_smi8_operand); |
| template <size_t N> |
| - INLINE(void Output(Bytecode bytecode, uint32_t(&operands)[N])); |
| - void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
| - uint32_t operand2, uint32_t operand3); |
| - void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, |
| - uint32_t operand2); |
| - void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1); |
| - void Output(Bytecode bytecode, uint32_t operand0); |
| + INLINE(void Output(Bytecode bytecode, uint32_t (&operands)[N], |
| + OperandScale operand_scale = OperandScale::k1X)); |
| void Output(Bytecode bytecode); |
| + void OutputScaled(Bytecode bytecode, OperandScale operand_scale, |
| + uint32_t operand0, uint32_t operand1, uint32_t operand2, |
| + uint32_t operand3); |
| + void OutputScaled(Bytecode bytecode, OperandScale operand_scale, |
| + uint32_t operand0, uint32_t operand1, uint32_t operand2); |
| + void OutputScaled(Bytecode bytecode, OperandScale operand_scale, |
| + uint32_t operand0, uint32_t operand1); |
| + void OutputScaled(Bytecode bytecode, OperandScale operand_scale, |
| + uint32_t operand0); |
| BytecodeArrayBuilder& OutputJump(Bytecode jump_bytecode, |
| BytecodeLabel* label); |
| @@ -328,12 +323,14 @@ class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover { |
| const ZoneVector<uint8_t>::iterator& jump_location, int delta); |
| void PatchIndirectJumpWith16BitOperand( |
| const ZoneVector<uint8_t>::iterator& jump_location, int delta); |
| + void PatchIndirectJumpWith32BitOperand( |
| + const ZoneVector<uint8_t>::iterator& jump_location, int delta); |
| void LeaveBasicBlock(); |
| - bool OperandIsValid(Bytecode bytecode, int operand_index, |
| - uint32_t operand_value) const; |
| - bool RegisterIsValid(Register reg, OperandType reg_type) const; |
| + bool OperandIsValid(Bytecode bytecode, OperandScale operand_scale, |
| + int operand_index, uint32_t operand_value) const; |
| + bool RegisterIsValid(Register reg, OperandSize reg_size) const; |
| bool LastBytecodeInSameBlock() const; |
| bool NeedToBooleanCast(); |
| @@ -360,7 +357,6 @@ class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover { |
| SourcePositionTableBuilder* source_position_table_builder() { |
| return &source_position_table_builder_; |
| } |
| - RegisterTranslator* register_translator() { return ®ister_translator_; } |
| Isolate* isolate_; |
| Zone* zone_; |
| @@ -378,7 +374,6 @@ class BytecodeArrayBuilder final : public ZoneObject, private RegisterMover { |
| int context_register_count_; |
| int return_position_; |
| TemporaryRegisterAllocator temporary_allocator_; |
| - RegisterTranslator register_translator_; |
| DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
| }; |