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_BYTECODES_H_ | 5 #ifndef V8_INTERPRETER_BYTECODES_H_ |
6 #define V8_INTERPRETER_BYTECODES_H_ | 6 #define V8_INTERPRETER_BYTECODES_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 // Clients of this interface shouldn't depend on lots of interpreter internals. | 10 // Clients of this interface shouldn't depend on lots of interpreter internals. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 // Returns the size of the bytecode including its operands. | 99 // Returns the size of the bytecode including its operands. |
100 static int Size(Bytecode bytecode); | 100 static int Size(Bytecode bytecode); |
101 | 101 |
102 // The maximum number of operands across all bytecodes. | 102 // The maximum number of operands across all bytecodes. |
103 static int MaximumNumberOfOperands(); | 103 static int MaximumNumberOfOperands(); |
104 | 104 |
105 // Maximum size of a bytecode and its operands. | 105 // Maximum size of a bytecode and its operands. |
106 static int MaximumSize(); | 106 static int MaximumSize(); |
107 | 107 |
| 108 // Returns the operand value for register with the specified index. |
| 109 static uint8_t RegisterIndexToOperand(int index); |
| 110 |
| 111 // Returns the register index for a register operand. |
| 112 static int RegisterIndexFromOperand(uint8_t operand); |
| 113 |
| 114 // Returns the operand value for parameter with the specified index. |
| 115 static uint8_t ParameterIndexToOperand(int index, int number_of_parameters); |
| 116 |
| 117 // Returns the maximum number of parameters including this. |
| 118 static int MaximumNumberOfParameters(); |
| 119 |
| 120 // Returns the parameter index for a parameter operand. |
| 121 static int ParameterIndexFromOperand(uint8_t operand, |
| 122 int number_of_parameters); |
| 123 |
108 // Decode a single bytecode and operands to |os|. | 124 // Decode a single bytecode and operands to |os|. |
109 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start); | 125 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, |
| 126 int number_of_parameters); |
110 | 127 |
111 private: | 128 private: |
112 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 129 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
113 }; | 130 }; |
114 | 131 |
115 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 132 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
116 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 133 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
117 | 134 |
118 } // namespace interpreter | 135 } // namespace interpreter |
119 } // namespace internal | 136 } // namespace internal |
120 } // namespace v8 | 137 } // namespace v8 |
121 | 138 |
122 #endif // V8_INTERPRETER_BYTECODES_H_ | 139 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |