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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 // Returns the size of the bytecode including its operands. | 172 // Returns the size of the bytecode including its operands. |
173 static int Size(Bytecode bytecode); | 173 static int Size(Bytecode bytecode); |
174 | 174 |
175 // The maximum number of operands across all bytecodes. | 175 // The maximum number of operands across all bytecodes. |
176 static int MaximumNumberOfOperands(); | 176 static int MaximumNumberOfOperands(); |
177 | 177 |
178 // Maximum size of a bytecode and its operands. | 178 // Maximum size of a bytecode and its operands. |
179 static int MaximumSize(); | 179 static int MaximumSize(); |
180 | 180 |
| 181 // Return true if the bytecode is a jump or a conditional jump taking |
| 182 // an immediate byte operand (OperandType::kImm8). |
| 183 static bool IsJump(Bytecode bytecode); |
| 184 |
| 185 // Return true if the bytecode is a jump or conditional jump taking a |
| 186 // constant pool entry (OperandType::kIdx). |
| 187 static bool IsJumpConstant(Bytecode bytecode); |
| 188 |
181 // Decode a single bytecode and operands to |os|. | 189 // Decode a single bytecode and operands to |os|. |
182 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, | 190 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, |
183 int number_of_parameters); | 191 int number_of_parameters); |
184 | 192 |
185 private: | 193 private: |
186 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 194 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
187 }; | 195 }; |
188 | 196 |
189 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 197 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
190 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 198 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
191 | 199 |
192 } // namespace interpreter | 200 } // namespace interpreter |
193 } // namespace internal | 201 } // namespace internal |
194 } // namespace v8 | 202 } // namespace v8 |
195 | 203 |
196 #endif // V8_INTERPRETER_BYTECODES_H_ | 204 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |