| 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 <cstdint> | 8 #include <cstdint> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 bytecode == Bytecode::kJumpIfToBooleanTrueConstant || | 493 bytecode == Bytecode::kJumpIfToBooleanTrueConstant || |
| 494 bytecode == Bytecode::kJumpIfToBooleanFalseConstant; | 494 bytecode == Bytecode::kJumpIfToBooleanFalseConstant; |
| 495 } | 495 } |
| 496 | 496 |
| 497 // Returns true if the bytecode is a jump or conditional jump taking | 497 // Returns true if the bytecode is a jump or conditional jump taking |
| 498 // any kind of operand. | 498 // any kind of operand. |
| 499 static CONSTEXPR bool IsJump(Bytecode bytecode) { | 499 static CONSTEXPR bool IsJump(Bytecode bytecode) { |
| 500 return IsJumpImmediate(bytecode) || IsJumpConstant(bytecode); | 500 return IsJumpImmediate(bytecode) || IsJumpConstant(bytecode); |
| 501 } | 501 } |
| 502 | 502 |
| 503 // Returns true if the bytecode is a forward jump or conditional jump taking |
| 504 // any kind of operand. |
| 505 static CONSTEXPR bool IsForwardJump(Bytecode bytecode) { |
| 506 return bytecode != Bytecode::kJumpLoop && IsJump(bytecode); |
| 507 } |
| 508 |
| 503 // Returns true if the bytecode is a conditional jump, a jump, or a return. | 509 // Returns true if the bytecode is a conditional jump, a jump, or a return. |
| 504 static CONSTEXPR bool IsJumpOrReturn(Bytecode bytecode) { | 510 static CONSTEXPR bool IsJumpOrReturn(Bytecode bytecode) { |
| 505 return bytecode == Bytecode::kReturn || IsJump(bytecode); | 511 return bytecode == Bytecode::kReturn || IsJump(bytecode); |
| 506 } | 512 } |
| 507 | 513 |
| 508 // Return true if |bytecode| is a jump without effects, | 514 // Return true if |bytecode| is a jump without effects, |
| 509 // e.g. any jump excluding those that include type coercion like | 515 // e.g. any jump excluding those that include type coercion like |
| 510 // JumpIfTrueToBoolean. | 516 // JumpIfTrueToBoolean. |
| 511 static CONSTEXPR bool IsJumpWithoutEffects(Bytecode bytecode) { | 517 static CONSTEXPR bool IsJumpWithoutEffects(Bytecode bytecode) { |
| 512 return IsJump(bytecode) && !IsJumpIfToBoolean(bytecode); | 518 return IsJump(bytecode) && !IsJumpIfToBoolean(bytecode); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 #undef CONSTEXPR | 747 #undef CONSTEXPR |
| 742 | 748 |
| 743 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, | 749 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, |
| 744 const Bytecode& bytecode); | 750 const Bytecode& bytecode); |
| 745 | 751 |
| 746 } // namespace interpreter | 752 } // namespace interpreter |
| 747 } // namespace internal | 753 } // namespace internal |
| 748 } // namespace v8 | 754 } // namespace v8 |
| 749 | 755 |
| 750 #endif // V8_INTERPRETER_BYTECODES_H_ | 756 #endif // V8_INTERPRETER_BYTECODES_H_ |
| OLD | NEW |