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 #include "src/interpreter/bytecode-array-builder.h" | 5 #include "src/interpreter/bytecode-array-builder.h" |
6 #include "src/compiler.h" | 6 #include "src/compiler.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace interpreter { | 10 namespace interpreter { |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 case Bytecode::kJump: | 754 case Bytecode::kJump: |
755 return Bytecode::kJumpConstant; | 755 return Bytecode::kJumpConstant; |
756 case Bytecode::kJumpIfTrue: | 756 case Bytecode::kJumpIfTrue: |
757 return Bytecode::kJumpIfTrueConstant; | 757 return Bytecode::kJumpIfTrueConstant; |
758 case Bytecode::kJumpIfFalse: | 758 case Bytecode::kJumpIfFalse: |
759 return Bytecode::kJumpIfFalseConstant; | 759 return Bytecode::kJumpIfFalseConstant; |
760 case Bytecode::kJumpIfToBooleanTrue: | 760 case Bytecode::kJumpIfToBooleanTrue: |
761 return Bytecode::kJumpIfToBooleanTrueConstant; | 761 return Bytecode::kJumpIfToBooleanTrueConstant; |
762 case Bytecode::kJumpIfToBooleanFalse: | 762 case Bytecode::kJumpIfToBooleanFalse: |
763 return Bytecode::kJumpIfToBooleanFalseConstant; | 763 return Bytecode::kJumpIfToBooleanFalseConstant; |
| 764 case Bytecode::kJumpIfNotHole: |
| 765 return Bytecode::kJumpIfNotHoleConstant; |
764 case Bytecode::kJumpIfNull: | 766 case Bytecode::kJumpIfNull: |
765 return Bytecode::kJumpIfNullConstant; | 767 return Bytecode::kJumpIfNullConstant; |
766 case Bytecode::kJumpIfUndefined: | 768 case Bytecode::kJumpIfUndefined: |
767 return Bytecode::kJumpIfUndefinedConstant; | 769 return Bytecode::kJumpIfUndefinedConstant; |
768 default: | 770 default: |
769 UNREACHABLE(); | 771 UNREACHABLE(); |
770 return static_cast<Bytecode>(-1); | 772 return static_cast<Bytecode>(-1); |
771 } | 773 } |
772 } | 774 } |
773 | 775 |
774 | 776 |
775 // static | 777 // static |
776 Bytecode BytecodeArrayBuilder::GetJumpWithConstantWideOperand( | 778 Bytecode BytecodeArrayBuilder::GetJumpWithConstantWideOperand( |
777 Bytecode jump_bytecode) { | 779 Bytecode jump_bytecode) { |
778 switch (jump_bytecode) { | 780 switch (jump_bytecode) { |
779 case Bytecode::kJump: | 781 case Bytecode::kJump: |
780 return Bytecode::kJumpConstantWide; | 782 return Bytecode::kJumpConstantWide; |
781 case Bytecode::kJumpIfTrue: | 783 case Bytecode::kJumpIfTrue: |
782 return Bytecode::kJumpIfTrueConstantWide; | 784 return Bytecode::kJumpIfTrueConstantWide; |
783 case Bytecode::kJumpIfFalse: | 785 case Bytecode::kJumpIfFalse: |
784 return Bytecode::kJumpIfFalseConstantWide; | 786 return Bytecode::kJumpIfFalseConstantWide; |
785 case Bytecode::kJumpIfToBooleanTrue: | 787 case Bytecode::kJumpIfToBooleanTrue: |
786 return Bytecode::kJumpIfToBooleanTrueConstantWide; | 788 return Bytecode::kJumpIfToBooleanTrueConstantWide; |
787 case Bytecode::kJumpIfToBooleanFalse: | 789 case Bytecode::kJumpIfToBooleanFalse: |
788 return Bytecode::kJumpIfToBooleanFalseConstantWide; | 790 return Bytecode::kJumpIfToBooleanFalseConstantWide; |
| 791 case Bytecode::kJumpIfNotHole: |
| 792 return Bytecode::kJumpIfNotHoleConstantWide; |
789 case Bytecode::kJumpIfNull: | 793 case Bytecode::kJumpIfNull: |
790 return Bytecode::kJumpIfNullConstantWide; | 794 return Bytecode::kJumpIfNullConstantWide; |
791 case Bytecode::kJumpIfUndefined: | 795 case Bytecode::kJumpIfUndefined: |
792 return Bytecode::kJumpIfUndefinedConstantWide; | 796 return Bytecode::kJumpIfUndefinedConstantWide; |
793 default: | 797 default: |
794 UNREACHABLE(); | 798 UNREACHABLE(); |
795 return static_cast<Bytecode>(-1); | 799 return static_cast<Bytecode>(-1); |
796 } | 800 } |
797 } | 801 } |
798 | 802 |
799 | 803 |
800 // static | 804 // static |
801 Bytecode BytecodeArrayBuilder::GetJumpWithToBoolean(Bytecode jump_bytecode) { | 805 Bytecode BytecodeArrayBuilder::GetJumpWithToBoolean(Bytecode jump_bytecode) { |
802 switch (jump_bytecode) { | 806 switch (jump_bytecode) { |
803 case Bytecode::kJump: | 807 case Bytecode::kJump: |
804 case Bytecode::kJumpIfNull: | 808 case Bytecode::kJumpIfNull: |
805 case Bytecode::kJumpIfUndefined: | 809 case Bytecode::kJumpIfUndefined: |
806 case Bytecode::kJumpIfHole: | |
807 case Bytecode::kJumpIfNotHole: | 810 case Bytecode::kJumpIfNotHole: |
808 return jump_bytecode; | 811 return jump_bytecode; |
809 case Bytecode::kJumpIfTrue: | 812 case Bytecode::kJumpIfTrue: |
810 return Bytecode::kJumpIfToBooleanTrue; | 813 return Bytecode::kJumpIfToBooleanTrue; |
811 case Bytecode::kJumpIfFalse: | 814 case Bytecode::kJumpIfFalse: |
812 return Bytecode::kJumpIfToBooleanFalse; | 815 return Bytecode::kJumpIfToBooleanFalse; |
813 default: | 816 default: |
814 UNREACHABLE(); | 817 UNREACHABLE(); |
815 } | 818 } |
816 return static_cast<Bytecode>(-1); | 819 return static_cast<Bytecode>(-1); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfUndefined( | 966 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfUndefined( |
964 BytecodeLabel* label) { | 967 BytecodeLabel* label) { |
965 return OutputJump(Bytecode::kJumpIfUndefined, label); | 968 return OutputJump(Bytecode::kJumpIfUndefined, label); |
966 } | 969 } |
967 | 970 |
968 BytecodeArrayBuilder& BytecodeArrayBuilder::StackCheck() { | 971 BytecodeArrayBuilder& BytecodeArrayBuilder::StackCheck() { |
969 Output(Bytecode::kStackCheck); | 972 Output(Bytecode::kStackCheck); |
970 return *this; | 973 return *this; |
971 } | 974 } |
972 | 975 |
973 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfHole(BytecodeLabel* label) { | |
974 return OutputJump(Bytecode::kJumpIfHole, label); | |
975 } | |
976 | |
977 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfNotHole( | 976 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfNotHole( |
978 BytecodeLabel* label) { | 977 BytecodeLabel* label) { |
979 return OutputJump(Bytecode::kJumpIfNotHole, label); | 978 return OutputJump(Bytecode::kJumpIfNotHole, label); |
980 } | 979 } |
981 | 980 |
982 BytecodeArrayBuilder& BytecodeArrayBuilder::Throw() { | 981 BytecodeArrayBuilder& BytecodeArrayBuilder::Throw() { |
983 Output(Bytecode::kThrow); | 982 Output(Bytecode::kThrow); |
984 exit_seen_in_block_ = true; | 983 exit_seen_in_block_ = true; |
985 return *this; | 984 return *this; |
986 } | 985 } |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 } | 1691 } |
1693 | 1692 |
1694 // static | 1693 // static |
1695 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { | 1694 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { |
1696 return value.is_short_operand(); | 1695 return value.is_short_operand(); |
1697 } | 1696 } |
1698 | 1697 |
1699 } // namespace interpreter | 1698 } // namespace interpreter |
1700 } // namespace internal | 1699 } // namespace internal |
1701 } // namespace v8 | 1700 } // namespace v8 |
OLD | NEW |