OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) | 1881 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) |
1882 | 1882 |
1883 protected: | 1883 protected: |
1884 virtual bool DataEquals(HValue* other_raw) { return true; } | 1884 virtual bool DataEquals(HValue* other_raw) { return true; } |
1885 }; | 1885 }; |
1886 | 1886 |
1887 | 1887 |
1888 class HFixedArrayBaseLength: public HUnaryOperation { | 1888 class HFixedArrayBaseLength: public HUnaryOperation { |
1889 public: | 1889 public: |
1890 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { | 1890 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { |
| 1891 set_type(HType::Smi()); |
1891 set_representation(Representation::Tagged()); | 1892 set_representation(Representation::Tagged()); |
1892 SetFlag(kUseGVN); | 1893 SetFlag(kUseGVN); |
1893 SetGVNFlag(kDependsOnArrayLengths); | 1894 SetGVNFlag(kDependsOnArrayLengths); |
1894 } | 1895 } |
1895 | 1896 |
1896 virtual Representation RequiredInputRepresentation(int index) { | 1897 virtual Representation RequiredInputRepresentation(int index) { |
1897 return Representation::Tagged(); | 1898 return Representation::Tagged(); |
1898 } | 1899 } |
1899 | 1900 |
1900 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength) | 1901 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength) |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2750 HValue* arguments() { return OperandAt(0); } | 2751 HValue* arguments() { return OperandAt(0); } |
2751 HValue* length() { return OperandAt(1); } | 2752 HValue* length() { return OperandAt(1); } |
2752 HValue* index() { return OperandAt(2); } | 2753 HValue* index() { return OperandAt(2); } |
2753 | 2754 |
2754 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) | 2755 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) |
2755 | 2756 |
2756 virtual bool DataEquals(HValue* other) { return true; } | 2757 virtual bool DataEquals(HValue* other) { return true; } |
2757 }; | 2758 }; |
2758 | 2759 |
2759 | 2760 |
| 2761 enum BoundsCheckKeyMode { |
| 2762 DONT_ALLOW_SMI_KEY, |
| 2763 ALLOW_SMI_KEY |
| 2764 }; |
| 2765 |
| 2766 |
2760 class HBoundsCheck: public HTemplateInstruction<2> { | 2767 class HBoundsCheck: public HTemplateInstruction<2> { |
2761 public: | 2768 public: |
2762 HBoundsCheck(HValue* index, HValue* length) { | 2769 HBoundsCheck(HValue* index, HValue* length, |
| 2770 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY) |
| 2771 : key_mode_(key_mode) { |
2763 SetOperandAt(0, index); | 2772 SetOperandAt(0, index); |
2764 SetOperandAt(1, length); | 2773 SetOperandAt(1, length); |
2765 set_representation(Representation::Integer32()); | 2774 set_representation(Representation::Integer32()); |
2766 SetFlag(kUseGVN); | 2775 SetFlag(kUseGVN); |
2767 } | 2776 } |
2768 | 2777 |
2769 virtual Representation RequiredInputRepresentation(int index) { | 2778 virtual Representation RequiredInputRepresentation(int arg_index) { |
2770 return Representation::Integer32(); | 2779 if (index()->representation().IsTagged() && |
| 2780 !index()->IsConstant() && |
| 2781 key_mode_ == ALLOW_SMI_KEY) { |
| 2782 return Representation::Tagged(); |
| 2783 } else { |
| 2784 return Representation::Integer32(); |
| 2785 } |
2771 } | 2786 } |
2772 | 2787 |
2773 virtual void PrintDataTo(StringStream* stream); | 2788 virtual void PrintDataTo(StringStream* stream); |
2774 | 2789 |
2775 HValue* index() { return OperandAt(0); } | 2790 HValue* index() { return OperandAt(0); } |
2776 HValue* length() { return OperandAt(1); } | 2791 HValue* length() { return OperandAt(1); } |
2777 | 2792 |
2778 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) | 2793 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
2779 | 2794 |
2780 protected: | 2795 protected: |
2781 virtual bool DataEquals(HValue* other) { return true; } | 2796 virtual bool DataEquals(HValue* other) { return true; } |
| 2797 BoundsCheckKeyMode key_mode_; |
2782 }; | 2798 }; |
2783 | 2799 |
2784 | 2800 |
2785 class HBitwiseBinaryOperation: public HBinaryOperation { | 2801 class HBitwiseBinaryOperation: public HBinaryOperation { |
2786 public: | 2802 public: |
2787 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) | 2803 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) |
2788 : HBinaryOperation(context, left, right) { | 2804 : HBinaryOperation(context, left, right) { |
2789 set_representation(Representation::Tagged()); | 2805 set_representation(Representation::Tagged()); |
2790 SetFlag(kFlexibleRepresentation); | 2806 SetFlag(kFlexibleRepresentation); |
2791 SetAllSideEffects(); | 2807 SetAllSideEffects(); |
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5160 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); | 5176 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
5161 }; | 5177 }; |
5162 | 5178 |
5163 | 5179 |
5164 #undef DECLARE_INSTRUCTION | 5180 #undef DECLARE_INSTRUCTION |
5165 #undef DECLARE_CONCRETE_INSTRUCTION | 5181 #undef DECLARE_CONCRETE_INSTRUCTION |
5166 | 5182 |
5167 } } // namespace v8::internal | 5183 } } // namespace v8::internal |
5168 | 5184 |
5169 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5185 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |