| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_INTERPRETER_BYTECODE_DECODER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_DECODER_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_DECODER_H_ | 6 #define V8_INTERPRETER_BYTECODE_DECODER_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/interpreter/bytecode-register.h" | 10 #include "src/interpreter/bytecode-register.h" |
| 11 #include "src/interpreter/bytecodes.h" | 11 #include "src/interpreter/bytecodes.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 namespace interpreter { | 15 namespace interpreter { |
| 16 | 16 |
| 17 class BytecodeDecoder final { | 17 class BytecodeDecoder final { |
| 18 public: | 18 public: |
| 19 // Decodes a register operand in a byte array. | 19 // Decodes a register operand in a byte array. |
| 20 static Register DecodeRegisterOperand(const uint8_t* operand_start, | 20 static Register DecodeRegisterOperand(const uint8_t* operand_start, |
| 21 OperandType operand_type, | 21 OperandType operand_type, |
| 22 OperandScale operand_scale); | 22 OperandScale operand_scale); |
| 23 | 23 |
| 24 // Decodes a register list operand in a byte array. |
| 25 static RegisterList DecodeRegisterListOperand(const uint8_t* operand_start, |
| 26 uint32_t count, |
| 27 OperandType operand_type, |
| 28 OperandScale operand_scale); |
| 29 |
| 24 // Decodes a signed operand in a byte array. | 30 // Decodes a signed operand in a byte array. |
| 25 static int32_t DecodeSignedOperand(const uint8_t* operand_start, | 31 static int32_t DecodeSignedOperand(const uint8_t* operand_start, |
| 26 OperandType operand_type, | 32 OperandType operand_type, |
| 27 OperandScale operand_scale); | 33 OperandScale operand_scale); |
| 28 | 34 |
| 29 // Decodes an unsigned operand in a byte array. | 35 // Decodes an unsigned operand in a byte array. |
| 30 static uint32_t DecodeUnsignedOperand(const uint8_t* operand_start, | 36 static uint32_t DecodeUnsignedOperand(const uint8_t* operand_start, |
| 31 OperandType operand_type, | 37 OperandType operand_type, |
| 32 OperandScale operand_scale); | 38 OperandScale operand_scale); |
| 33 | 39 |
| 34 // Decode a single bytecode and operands to |os|. | 40 // Decode a single bytecode and operands to |os|. |
| 35 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, | 41 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, |
| 36 int number_of_parameters); | 42 int number_of_parameters); |
| 37 }; | 43 }; |
| 38 | 44 |
| 39 } // namespace interpreter | 45 } // namespace interpreter |
| 40 } // namespace internal | 46 } // namespace internal |
| 41 } // namespace v8 | 47 } // namespace v8 |
| 42 | 48 |
| 43 #endif // V8_INTERPRETER_BYTECODE_DECODER_H_ | 49 #endif // V8_INTERPRETER_BYTECODE_DECODER_H_ |
| OLD | NEW |