| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 V(IsNull) \ | 117 V(IsNull) \ |
| 118 V(IsObject) \ | 118 V(IsObject) \ |
| 119 V(IsSmi) \ | 119 V(IsSmi) \ |
| 120 V(IsConstructCall) \ | 120 V(IsConstructCall) \ |
| 121 V(JSArrayLength) \ | 121 V(JSArrayLength) \ |
| 122 V(LeaveInlined) \ | 122 V(LeaveInlined) \ |
| 123 V(LoadContextSlot) \ | 123 V(LoadContextSlot) \ |
| 124 V(LoadElements) \ | 124 V(LoadElements) \ |
| 125 V(LoadExternalArrayPointer) \ | 125 V(LoadExternalArrayPointer) \ |
| 126 V(LoadFunctionPrototype) \ | 126 V(LoadFunctionPrototype) \ |
| 127 V(LoadGlobalCell) \ | 127 V(LoadGlobal) \ |
| 128 V(LoadGlobalGeneric) \ | |
| 129 V(LoadKeyedFastElement) \ | 128 V(LoadKeyedFastElement) \ |
| 130 V(LoadKeyedGeneric) \ | 129 V(LoadKeyedGeneric) \ |
| 131 V(LoadKeyedSpecializedArrayElement) \ | 130 V(LoadKeyedSpecializedArrayElement) \ |
| 132 V(LoadNamedField) \ | 131 V(LoadNamedField) \ |
| 133 V(LoadNamedFieldPolymorphic) \ | 132 V(LoadNamedFieldPolymorphic) \ |
| 134 V(LoadNamedGeneric) \ | 133 V(LoadNamedGeneric) \ |
| 135 V(Mod) \ | 134 V(Mod) \ |
| 136 V(Mul) \ | 135 V(Mul) \ |
| 137 V(ObjectLiteral) \ | 136 V(ObjectLiteral) \ |
| 138 V(OsrEntry) \ | 137 V(OsrEntry) \ |
| 139 V(OuterContext) \ | 138 V(OuterContext) \ |
| 140 V(Parameter) \ | 139 V(Parameter) \ |
| 141 V(Power) \ | 140 V(Power) \ |
| 142 V(PushArgument) \ | 141 V(PushArgument) \ |
| 143 V(RegExpLiteral) \ | 142 V(RegExpLiteral) \ |
| 144 V(Return) \ | 143 V(Return) \ |
| 145 V(Sar) \ | 144 V(Sar) \ |
| 146 V(Shl) \ | 145 V(Shl) \ |
| 147 V(Shr) \ | 146 V(Shr) \ |
| 148 V(Simulate) \ | 147 V(Simulate) \ |
| 149 V(StackCheck) \ | 148 V(StackCheck) \ |
| 150 V(StoreContextSlot) \ | 149 V(StoreContextSlot) \ |
| 151 V(StoreGlobalCell) \ | 150 V(StoreGlobal) \ |
| 152 V(StoreGlobalGeneric) \ | |
| 153 V(StoreKeyedFastElement) \ | 151 V(StoreKeyedFastElement) \ |
| 154 V(StoreKeyedSpecializedArrayElement) \ | 152 V(StoreKeyedSpecializedArrayElement) \ |
| 155 V(StoreKeyedGeneric) \ | 153 V(StoreKeyedGeneric) \ |
| 156 V(StoreNamedField) \ | 154 V(StoreNamedField) \ |
| 157 V(StoreNamedGeneric) \ | 155 V(StoreNamedGeneric) \ |
| 158 V(StringCharCodeAt) \ | 156 V(StringCharCodeAt) \ |
| 159 V(StringCharFromCode) \ | 157 V(StringCharFromCode) \ |
| 160 V(StringLength) \ | 158 V(StringLength) \ |
| 161 V(Sub) \ | 159 V(Sub) \ |
| 162 V(Test) \ | 160 V(Test) \ |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") | 924 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") |
| 927 }; | 925 }; |
| 928 | 926 |
| 929 | 927 |
| 930 class HChange: public HUnaryOperation { | 928 class HChange: public HUnaryOperation { |
| 931 public: | 929 public: |
| 932 HChange(HValue* value, | 930 HChange(HValue* value, |
| 933 Representation from, | 931 Representation from, |
| 934 Representation to, | 932 Representation to, |
| 935 bool is_truncating) | 933 bool is_truncating) |
| 936 : HUnaryOperation(value), from_(from) { | 934 : HUnaryOperation(value), from_(from), to_(to) { |
| 937 ASSERT(!from.IsNone() && !to.IsNone()); | 935 ASSERT(!from.IsNone() && !to.IsNone()); |
| 938 ASSERT(!from.Equals(to)); | 936 ASSERT(!from.Equals(to)); |
| 939 set_representation(to); | 937 set_representation(to); |
| 940 SetFlag(kUseGVN); | 938 SetFlag(kUseGVN); |
| 941 if (is_truncating) SetFlag(kTruncatingToInt32); | 939 if (is_truncating) SetFlag(kTruncatingToInt32); |
| 942 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && | 940 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && |
| 943 value->range()->IsInSmiRange()) { | 941 value->range()->IsInSmiRange()) { |
| 944 set_type(HType::Smi()); | 942 set_type(HType::Smi()); |
| 945 } | 943 } |
| 946 } | 944 } |
| 947 | 945 |
| 948 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 946 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 949 | 947 |
| 950 Representation from() const { return from_; } | 948 Representation from() const { return from_; } |
| 951 Representation to() const { return representation(); } | 949 Representation to() const { return to_; } |
| 952 virtual Representation RequiredInputRepresentation(int index) const { | 950 virtual Representation RequiredInputRepresentation(int index) const { |
| 953 return from_; | 951 return from_; |
| 954 } | 952 } |
| 955 | 953 |
| 956 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 954 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
| 957 | 955 |
| 958 virtual void PrintDataTo(StringStream* stream); | 956 virtual void PrintDataTo(StringStream* stream); |
| 959 | 957 |
| 960 DECLARE_CONCRETE_INSTRUCTION(Change, | 958 DECLARE_CONCRETE_INSTRUCTION(Change, |
| 961 CanTruncateToInt32() ? "truncate" : "change") | 959 CanTruncateToInt32() ? "truncate" : "change") |
| 962 | 960 |
| 963 protected: | 961 protected: |
| 964 virtual bool DataEquals(HValue* other) { | 962 virtual bool DataEquals(HValue* other) { |
| 965 if (!other->IsChange()) return false; | 963 if (!other->IsChange()) return false; |
| 966 HChange* change = HChange::cast(other); | 964 HChange* change = HChange::cast(other); |
| 967 return value() == change->value() | 965 return value() == change->value() |
| 968 && to().Equals(change->to()); | 966 && to().Equals(change->to()); |
| 969 } | 967 } |
| 970 | 968 |
| 971 private: | 969 private: |
| 972 Representation from_; | 970 Representation from_; |
| 971 Representation to_; |
| 973 }; | 972 }; |
| 974 | 973 |
| 975 | 974 |
| 976 class HSimulate: public HInstruction { | 975 class HSimulate: public HInstruction { |
| 977 public: | 976 public: |
| 978 HSimulate(int ast_id, int pop_count, int environment_length) | 977 HSimulate(int ast_id, int pop_count, int environment_length) |
| 979 : ast_id_(ast_id), | 978 : ast_id_(ast_id), |
| 980 pop_count_(pop_count), | 979 pop_count_(pop_count), |
| 981 environment_length_(environment_length), | 980 environment_length_(environment_length), |
| 982 values_(2), | 981 values_(2), |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2803 HUnknownOSRValue() { set_representation(Representation::Tagged()); } | 2802 HUnknownOSRValue() { set_representation(Representation::Tagged()); } |
| 2804 | 2803 |
| 2805 virtual Representation RequiredInputRepresentation(int index) const { | 2804 virtual Representation RequiredInputRepresentation(int index) const { |
| 2806 return Representation::None(); | 2805 return Representation::None(); |
| 2807 } | 2806 } |
| 2808 | 2807 |
| 2809 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown_osr_value") | 2808 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown_osr_value") |
| 2810 }; | 2809 }; |
| 2811 | 2810 |
| 2812 | 2811 |
| 2813 class HLoadGlobalCell: public HTemplateInstruction<0> { | 2812 class HLoadGlobal: public HTemplateInstruction<0> { |
| 2814 public: | 2813 public: |
| 2815 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, bool check_hole_value) | 2814 HLoadGlobal(Handle<JSGlobalPropertyCell> cell, bool check_hole_value) |
| 2816 : cell_(cell), check_hole_value_(check_hole_value) { | 2815 : cell_(cell), check_hole_value_(check_hole_value) { |
| 2817 set_representation(Representation::Tagged()); | 2816 set_representation(Representation::Tagged()); |
| 2818 SetFlag(kUseGVN); | 2817 SetFlag(kUseGVN); |
| 2819 SetFlag(kDependsOnGlobalVars); | 2818 SetFlag(kDependsOnGlobalVars); |
| 2820 } | 2819 } |
| 2821 | 2820 |
| 2822 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 2821 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
| 2823 bool check_hole_value() const { return check_hole_value_; } | 2822 bool check_hole_value() const { return check_hole_value_; } |
| 2824 | 2823 |
| 2825 virtual void PrintDataTo(StringStream* stream); | 2824 virtual void PrintDataTo(StringStream* stream); |
| 2826 | 2825 |
| 2827 virtual intptr_t Hashcode() { | 2826 virtual intptr_t Hashcode() { |
| 2828 ASSERT(!HEAP->allow_allocation(false)); | 2827 ASSERT(!HEAP->allow_allocation(false)); |
| 2829 return reinterpret_cast<intptr_t>(*cell_); | 2828 return reinterpret_cast<intptr_t>(*cell_); |
| 2830 } | 2829 } |
| 2831 | 2830 |
| 2832 virtual Representation RequiredInputRepresentation(int index) const { | 2831 virtual Representation RequiredInputRepresentation(int index) const { |
| 2833 return Representation::None(); | 2832 return Representation::None(); |
| 2834 } | 2833 } |
| 2835 | 2834 |
| 2836 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell, "load_global_cell") | 2835 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load_global") |
| 2837 | 2836 |
| 2838 protected: | 2837 protected: |
| 2839 virtual bool DataEquals(HValue* other) { | 2838 virtual bool DataEquals(HValue* other) { |
| 2840 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); | 2839 HLoadGlobal* b = HLoadGlobal::cast(other); |
| 2841 return cell_.is_identical_to(b->cell()); | 2840 return cell_.is_identical_to(b->cell()); |
| 2842 } | 2841 } |
| 2843 | 2842 |
| 2844 private: | 2843 private: |
| 2845 Handle<JSGlobalPropertyCell> cell_; | 2844 Handle<JSGlobalPropertyCell> cell_; |
| 2846 bool check_hole_value_; | 2845 bool check_hole_value_; |
| 2847 }; | 2846 }; |
| 2848 | 2847 |
| 2849 | 2848 |
| 2850 class HLoadGlobalGeneric: public HBinaryOperation { | 2849 class HStoreGlobal: public HUnaryOperation { |
| 2851 public: | 2850 public: |
| 2852 HLoadGlobalGeneric(HValue* context, | 2851 HStoreGlobal(HValue* value, |
| 2853 HValue* global_object, | 2852 Handle<JSGlobalPropertyCell> cell, |
| 2854 Handle<Object> name, | 2853 bool check_hole_value) |
| 2855 bool for_typeof) | |
| 2856 : HBinaryOperation(context, global_object), | |
| 2857 name_(name), | |
| 2858 for_typeof_(for_typeof) { | |
| 2859 set_representation(Representation::Tagged()); | |
| 2860 SetAllSideEffects(); | |
| 2861 } | |
| 2862 | |
| 2863 HValue* context() { return OperandAt(0); } | |
| 2864 HValue* global_object() { return OperandAt(1); } | |
| 2865 Handle<Object> name() const { return name_; } | |
| 2866 bool for_typeof() const { return for_typeof_; } | |
| 2867 | |
| 2868 virtual void PrintDataTo(StringStream* stream); | |
| 2869 | |
| 2870 virtual Representation RequiredInputRepresentation(int index) const { | |
| 2871 return Representation::Tagged(); | |
| 2872 } | |
| 2873 | |
| 2874 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load_global_generic") | |
| 2875 | |
| 2876 private: | |
| 2877 Handle<Object> name_; | |
| 2878 bool for_typeof_; | |
| 2879 }; | |
| 2880 | |
| 2881 | |
| 2882 class HStoreGlobalCell: public HUnaryOperation { | |
| 2883 public: | |
| 2884 HStoreGlobalCell(HValue* value, | |
| 2885 Handle<JSGlobalPropertyCell> cell, | |
| 2886 bool check_hole_value) | |
| 2887 : HUnaryOperation(value), | 2854 : HUnaryOperation(value), |
| 2888 cell_(cell), | 2855 cell_(cell), |
| 2889 check_hole_value_(check_hole_value) { | 2856 check_hole_value_(check_hole_value) { |
| 2890 SetFlag(kChangesGlobalVars); | 2857 SetFlag(kChangesGlobalVars); |
| 2891 } | 2858 } |
| 2892 | 2859 |
| 2893 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 2860 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
| 2894 bool check_hole_value() const { return check_hole_value_; } | 2861 bool check_hole_value() const { return check_hole_value_; } |
| 2895 | 2862 |
| 2896 virtual Representation RequiredInputRepresentation(int index) const { | 2863 virtual Representation RequiredInputRepresentation(int index) const { |
| 2897 return Representation::Tagged(); | 2864 return Representation::Tagged(); |
| 2898 } | 2865 } |
| 2899 virtual void PrintDataTo(StringStream* stream); | 2866 virtual void PrintDataTo(StringStream* stream); |
| 2900 | 2867 |
| 2901 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store_global_cell") | 2868 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global") |
| 2902 | 2869 |
| 2903 private: | 2870 private: |
| 2904 Handle<JSGlobalPropertyCell> cell_; | 2871 Handle<JSGlobalPropertyCell> cell_; |
| 2905 bool check_hole_value_; | 2872 bool check_hole_value_; |
| 2906 }; | 2873 }; |
| 2907 | 2874 |
| 2908 | 2875 |
| 2909 class HStoreGlobalGeneric: public HTemplateInstruction<3> { | |
| 2910 public: | |
| 2911 HStoreGlobalGeneric(HValue* context, | |
| 2912 HValue* global_object, | |
| 2913 Handle<Object> name, | |
| 2914 HValue* value) | |
| 2915 : name_(name) { | |
| 2916 SetOperandAt(0, context); | |
| 2917 SetOperandAt(1, global_object); | |
| 2918 SetOperandAt(2, value); | |
| 2919 set_representation(Representation::Tagged()); | |
| 2920 SetAllSideEffects(); | |
| 2921 } | |
| 2922 | |
| 2923 HValue* context() { return OperandAt(0); } | |
| 2924 HValue* global_object() { return OperandAt(1); } | |
| 2925 Handle<Object> name() const { return name_; } | |
| 2926 HValue* value() { return OperandAt(2); } | |
| 2927 | |
| 2928 virtual void PrintDataTo(StringStream* stream); | |
| 2929 | |
| 2930 virtual Representation RequiredInputRepresentation(int index) const { | |
| 2931 return Representation::Tagged(); | |
| 2932 } | |
| 2933 | |
| 2934 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store_global_generic") | |
| 2935 | |
| 2936 private: | |
| 2937 Handle<Object> name_; | |
| 2938 }; | |
| 2939 | |
| 2940 | |
| 2941 class HLoadContextSlot: public HUnaryOperation { | 2876 class HLoadContextSlot: public HUnaryOperation { |
| 2942 public: | 2877 public: |
| 2943 HLoadContextSlot(HValue* context , int slot_index) | 2878 HLoadContextSlot(HValue* context , int slot_index) |
| 2944 : HUnaryOperation(context), slot_index_(slot_index) { | 2879 : HUnaryOperation(context), slot_index_(slot_index) { |
| 2945 set_representation(Representation::Tagged()); | 2880 set_representation(Representation::Tagged()); |
| 2946 SetFlag(kUseGVN); | 2881 SetFlag(kUseGVN); |
| 2947 SetFlag(kDependsOnContextSlots); | 2882 SetFlag(kDependsOnContextSlots); |
| 2948 } | 2883 } |
| 2949 | 2884 |
| 2950 int slot_index() const { return slot_index_; } | 2885 int slot_index() const { return slot_index_; } |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3651 HValue* object() { return left(); } | 3586 HValue* object() { return left(); } |
| 3652 HValue* key() { return right(); } | 3587 HValue* key() { return right(); } |
| 3653 }; | 3588 }; |
| 3654 | 3589 |
| 3655 #undef DECLARE_INSTRUCTION | 3590 #undef DECLARE_INSTRUCTION |
| 3656 #undef DECLARE_CONCRETE_INSTRUCTION | 3591 #undef DECLARE_CONCRETE_INSTRUCTION |
| 3657 | 3592 |
| 3658 } } // namespace v8::internal | 3593 } } // namespace v8::internal |
| 3659 | 3594 |
| 3660 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3595 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |