• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/globals.h"
11 #include "src/interpreter/bytecode-register.h"
12 #include "src/interpreter/bytecodes.h"
13 
14 namespace v8 {
15 namespace internal {
16 namespace interpreter {
17 
18 class V8_EXPORT_PRIVATE BytecodeDecoder final {
19  public:
20   // Decodes a register operand in a byte array.
21   static Register DecodeRegisterOperand(Address operand_start,
22                                         OperandType operand_type,
23                                         OperandScale operand_scale);
24 
25   // Decodes a register list operand in a byte array.
26   static RegisterList DecodeRegisterListOperand(Address operand_start,
27                                                 uint32_t count,
28                                                 OperandType operand_type,
29                                                 OperandScale operand_scale);
30 
31   // Decodes a signed operand in a byte array.
32   static int32_t DecodeSignedOperand(Address operand_start,
33                                      OperandType operand_type,
34                                      OperandScale operand_scale);
35 
36   // Decodes an unsigned operand in a byte array.
37   static uint32_t DecodeUnsignedOperand(Address operand_start,
38                                         OperandType operand_type,
39                                         OperandScale operand_scale);
40 
41   // Decode a single bytecode and operands to |os|.
42   static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start,
43                               int number_of_parameters);
44 };
45 
46 }  // namespace interpreter
47 }  // namespace internal
48 }  // namespace v8
49 
50 #endif  // V8_INTERPRETER_BYTECODE_DECODER_H_
51