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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // Returns the offset of the i-th operand of |bytecode| relative to the start | 333 // Returns the offset of the i-th operand of |bytecode| relative to the start |
334 // of the bytecode. | 334 // of the bytecode. |
335 static int GetOperandOffset(Bytecode bytecode, int i); | 335 static int GetOperandOffset(Bytecode bytecode, int i); |
336 | 336 |
337 // Returns the size of the bytecode including its operands. | 337 // Returns the size of the bytecode including its operands. |
338 static int Size(Bytecode bytecode); | 338 static int Size(Bytecode bytecode); |
339 | 339 |
340 // Returns the size of |operand|. | 340 // Returns the size of |operand|. |
341 static OperandSize SizeOfOperand(OperandType operand); | 341 static OperandSize SizeOfOperand(OperandType operand); |
342 | 342 |
| 343 // Return true if the bytecode is a conditional jump taking |
| 344 // an immediate byte operand (OperandType::kImm8). |
| 345 static bool IsConditionalJumpImmediate(Bytecode bytecode); |
| 346 |
| 347 // Return true if the bytecode is a conditional jump taking |
| 348 // a constant pool entry (OperandType::kIdx). |
| 349 static bool IsConditionalJumpConstant(Bytecode bytecode); |
| 350 |
| 351 // Return true if the bytecode is a conditional jump taking |
| 352 // any kind of operand. |
| 353 static bool IsConditionalJump(Bytecode bytecode); |
| 354 |
343 // Return true if the bytecode is a jump or a conditional jump taking | 355 // Return true if the bytecode is a jump or a conditional jump taking |
344 // an immediate byte operand (OperandType::kImm8). | 356 // an immediate byte operand (OperandType::kImm8). |
345 static bool IsJump(Bytecode bytecode); | 357 static bool IsJumpImmediate(Bytecode bytecode); |
346 | 358 |
347 // Return true if the bytecode is a jump or conditional jump taking a | 359 // Return true if the bytecode is a jump or conditional jump taking a |
348 // constant pool entry (OperandType::kIdx). | 360 // constant pool entry (OperandType::kIdx). |
349 static bool IsJumpConstant(Bytecode bytecode); | 361 static bool IsJumpConstant(Bytecode bytecode); |
350 | 362 |
| 363 // Return true if the bytecode is a jump or conditional jump taking |
| 364 // any kind of operand. |
| 365 static bool IsJump(Bytecode bytecode); |
| 366 |
| 367 // Return true if the bytecode is a conditional jump, a jump, or a return. |
| 368 static bool IsJumpOrReturn(Bytecode bytecode); |
| 369 |
351 // Decode a single bytecode and operands to |os|. | 370 // Decode a single bytecode and operands to |os|. |
352 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, | 371 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, |
353 int number_of_parameters); | 372 int number_of_parameters); |
354 | 373 |
355 private: | 374 private: |
356 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 375 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
357 }; | 376 }; |
358 | 377 |
359 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 378 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
360 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 379 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
361 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); | 380 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); |
362 | 381 |
363 } // namespace interpreter | 382 } // namespace interpreter |
364 } // namespace internal | 383 } // namespace internal |
365 } // namespace v8 | 384 } // namespace v8 |
366 | 385 |
367 #endif // V8_INTERPRETER_BYTECODES_H_ | 386 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |