| Ben Murdoch | f91f061 | 2016-11-29 16:50:11 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef V8_INTERPRETER_BYTECODE_DECODER_H_ |
| 6 | #define V8_INTERPRETER_BYTECODE_DECODER_H_ |
| 7 | |
| 8 | #include <iosfwd> |
| 9 | |
| 10 | #include "src/interpreter/bytecode-register.h" |
| 11 | #include "src/interpreter/bytecodes.h" |
| 12 | |
| 13 | namespace v8 { |
| 14 | namespace internal { |
| 15 | namespace interpreter { |
| 16 | |
| 17 | class BytecodeDecoder final { |
| 18 | public: |
| 19 | // Decodes a register operand in a byte array. |
| 20 | static Register DecodeRegisterOperand(const uint8_t* operand_start, |
| 21 | OperandType operand_type, |
| 22 | OperandScale operand_scale); |
| 23 | |
| 24 | // Decodes a signed operand in a byte array. |
| 25 | static int32_t DecodeSignedOperand(const uint8_t* operand_start, |
| 26 | OperandType operand_type, |
| 27 | OperandScale operand_scale); |
| 28 | |
| 29 | // Decodes an unsigned operand in a byte array. |
| 30 | static uint32_t DecodeUnsignedOperand(const uint8_t* operand_start, |
| 31 | OperandType operand_type, |
| 32 | OperandScale operand_scale); |
| 33 | |
| 34 | // Decode a single bytecode and operands to |os|. |
| 35 | static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, |
| 36 | int number_of_parameters); |
| 37 | }; |
| 38 | |
| 39 | } // namespace interpreter |
| 40 | } // namespace internal |
| 41 | } // namespace v8 |
| 42 | |
| 43 | #endif // V8_INTERPRETER_BYTECODE_DECODER_H_ |