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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 static OperandSize SizeOfOperand(OperandType operand); | 293 static OperandSize SizeOfOperand(OperandType operand); |
294 | 294 |
295 // Return true if the bytecode is a jump or a conditional jump taking | 295 // Return true if the bytecode is a jump or a conditional jump taking |
296 // an immediate byte operand (OperandType::kImm8). | 296 // an immediate byte operand (OperandType::kImm8). |
297 static bool IsJump(Bytecode bytecode); | 297 static bool IsJump(Bytecode bytecode); |
298 | 298 |
299 // Return true if the bytecode is a jump or conditional jump taking a | 299 // Return true if the bytecode is a jump or conditional jump taking a |
300 // constant pool entry (OperandType::kIdx). | 300 // constant pool entry (OperandType::kIdx). |
301 static bool IsJumpConstant(Bytecode bytecode); | 301 static bool IsJumpConstant(Bytecode bytecode); |
302 | 302 |
303 // Converts bytes[0] and bytes[1] to a 16 bit 'short' operand value. | |
304 static uint16_t ShortOperandFromBytes(const uint8_t* bytes); | |
305 | |
306 // Converts 16 bit 'short' |operand| into bytes_out[0] and bytes_out[1]. | |
307 static void ShortOperandToBytes(uint16_t operand, uint8_t* bytes_out); | |
308 | |
309 // Decode a single bytecode and operands to |os|. | 303 // Decode a single bytecode and operands to |os|. |
310 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, | 304 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, |
311 int number_of_parameters); | 305 int number_of_parameters); |
312 | 306 |
313 private: | 307 private: |
314 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 308 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
315 }; | 309 }; |
316 | 310 |
317 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 311 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
318 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 312 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
319 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); | 313 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); |
320 | 314 |
321 } // namespace interpreter | 315 } // namespace interpreter |
322 } // namespace internal | 316 } // namespace internal |
323 } // namespace v8 | 317 } // namespace v8 |
324 | 318 |
325 #endif // V8_INTERPRETER_BYTECODES_H_ | 319 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |