| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 V(Power) \ | 141 V(Power) \ |
| 142 V(PushArgument) \ | 142 V(PushArgument) \ |
| 143 V(RegExpLiteral) \ | 143 V(RegExpLiteral) \ |
| 144 V(Return) \ | 144 V(Return) \ |
| 145 V(Sar) \ | 145 V(Sar) \ |
| 146 V(Shl) \ | 146 V(Shl) \ |
| 147 V(Shr) \ | 147 V(Shr) \ |
| 148 V(Simulate) \ | 148 V(Simulate) \ |
| 149 V(StackCheck) \ | 149 V(StackCheck) \ |
| 150 V(StoreContextSlot) \ | 150 V(StoreContextSlot) \ |
| 151 V(StoreGlobal) \ | 151 V(StoreGlobalCell) \ |
| 152 V(StoreGlobalGeneric) \ |
| 152 V(StoreKeyedFastElement) \ | 153 V(StoreKeyedFastElement) \ |
| 153 V(StoreKeyedSpecializedArrayElement) \ | 154 V(StoreKeyedSpecializedArrayElement) \ |
| 154 V(StoreKeyedGeneric) \ | 155 V(StoreKeyedGeneric) \ |
| 155 V(StoreNamedField) \ | 156 V(StoreNamedField) \ |
| 156 V(StoreNamedGeneric) \ | 157 V(StoreNamedGeneric) \ |
| 157 V(StringCharCodeAt) \ | 158 V(StringCharCodeAt) \ |
| 158 V(StringCharFromCode) \ | 159 V(StringCharFromCode) \ |
| 159 V(StringLength) \ | 160 V(StringLength) \ |
| 160 V(Sub) \ | 161 V(Sub) \ |
| 161 V(Test) \ | 162 V(Test) \ |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") | 926 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") |
| 926 }; | 927 }; |
| 927 | 928 |
| 928 | 929 |
| 929 class HChange: public HUnaryOperation { | 930 class HChange: public HUnaryOperation { |
| 930 public: | 931 public: |
| 931 HChange(HValue* value, | 932 HChange(HValue* value, |
| 932 Representation from, | 933 Representation from, |
| 933 Representation to, | 934 Representation to, |
| 934 bool is_truncating) | 935 bool is_truncating) |
| 935 : HUnaryOperation(value), from_(from), to_(to) { | 936 : HUnaryOperation(value), from_(from) { |
| 936 ASSERT(!from.IsNone() && !to.IsNone()); | 937 ASSERT(!from.IsNone() && !to.IsNone()); |
| 937 ASSERT(!from.Equals(to)); | 938 ASSERT(!from.Equals(to)); |
| 938 set_representation(to); | 939 set_representation(to); |
| 939 SetFlag(kUseGVN); | 940 SetFlag(kUseGVN); |
| 940 if (is_truncating) SetFlag(kTruncatingToInt32); | 941 if (is_truncating) SetFlag(kTruncatingToInt32); |
| 941 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && | 942 if (from.IsInteger32() && to.IsTagged() && value->range() != NULL && |
| 942 value->range()->IsInSmiRange()) { | 943 value->range()->IsInSmiRange()) { |
| 943 set_type(HType::Smi()); | 944 set_type(HType::Smi()); |
| 944 } | 945 } |
| 945 } | 946 } |
| 946 | 947 |
| 947 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 948 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 948 | 949 |
| 949 Representation from() const { return from_; } | 950 Representation from() const { return from_; } |
| 950 Representation to() const { return to_; } | 951 Representation to() const { return representation(); } |
| 951 virtual Representation RequiredInputRepresentation(int index) const { | 952 virtual Representation RequiredInputRepresentation(int index) const { |
| 952 return from_; | 953 return from_; |
| 953 } | 954 } |
| 954 | 955 |
| 955 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 956 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
| 956 | 957 |
| 957 virtual void PrintDataTo(StringStream* stream); | 958 virtual void PrintDataTo(StringStream* stream); |
| 958 | 959 |
| 959 DECLARE_CONCRETE_INSTRUCTION(Change, | 960 DECLARE_CONCRETE_INSTRUCTION(Change, |
| 960 CanTruncateToInt32() ? "truncate" : "change") | 961 CanTruncateToInt32() ? "truncate" : "change") |
| 961 | 962 |
| 962 protected: | 963 protected: |
| 963 virtual bool DataEquals(HValue* other) { | 964 virtual bool DataEquals(HValue* other) { |
| 964 if (!other->IsChange()) return false; | 965 if (!other->IsChange()) return false; |
| 965 HChange* change = HChange::cast(other); | 966 HChange* change = HChange::cast(other); |
| 966 return value() == change->value() | 967 return value() == change->value() |
| 967 && to().Equals(change->to()); | 968 && to().Equals(change->to()); |
| 968 } | 969 } |
| 969 | 970 |
| 970 private: | 971 private: |
| 971 Representation from_; | 972 Representation from_; |
| 972 Representation to_; | |
| 973 }; | 973 }; |
| 974 | 974 |
| 975 | 975 |
| 976 class HSimulate: public HInstruction { | 976 class HSimulate: public HInstruction { |
| 977 public: | 977 public: |
| 978 HSimulate(int ast_id, int pop_count, int environment_length) | 978 HSimulate(int ast_id, int pop_count) |
| 979 : ast_id_(ast_id), | 979 : ast_id_(ast_id), |
| 980 pop_count_(pop_count), | 980 pop_count_(pop_count), |
| 981 environment_length_(environment_length), | |
| 982 values_(2), | 981 values_(2), |
| 983 assigned_indexes_(2) {} | 982 assigned_indexes_(2) {} |
| 984 virtual ~HSimulate() {} | 983 virtual ~HSimulate() {} |
| 985 | 984 |
| 986 virtual void PrintDataTo(StringStream* stream); | 985 virtual void PrintDataTo(StringStream* stream); |
| 987 | 986 |
| 988 bool HasAstId() const { return ast_id_ != AstNode::kNoNumber; } | 987 bool HasAstId() const { return ast_id_ != AstNode::kNoNumber; } |
| 989 int ast_id() const { return ast_id_; } | 988 int ast_id() const { return ast_id_; } |
| 990 void set_ast_id(int id) { | 989 void set_ast_id(int id) { |
| 991 ASSERT(!HasAstId()); | 990 ASSERT(!HasAstId()); |
| 992 ast_id_ = id; | 991 ast_id_ = id; |
| 993 } | 992 } |
| 994 | 993 |
| 995 int environment_length() const { return environment_length_; } | |
| 996 int pop_count() const { return pop_count_; } | 994 int pop_count() const { return pop_count_; } |
| 997 const ZoneList<HValue*>* values() const { return &values_; } | 995 const ZoneList<HValue*>* values() const { return &values_; } |
| 998 int GetAssignedIndexAt(int index) const { | 996 int GetAssignedIndexAt(int index) const { |
| 999 ASSERT(HasAssignedIndexAt(index)); | 997 ASSERT(HasAssignedIndexAt(index)); |
| 1000 return assigned_indexes_[index]; | 998 return assigned_indexes_[index]; |
| 1001 } | 999 } |
| 1002 bool HasAssignedIndexAt(int index) const { | 1000 bool HasAssignedIndexAt(int index) const { |
| 1003 return assigned_indexes_[index] != kNoIndex; | 1001 return assigned_indexes_[index] != kNoIndex; |
| 1004 } | 1002 } |
| 1005 void AddAssignedValue(int index, HValue* value) { | 1003 void AddAssignedValue(int index, HValue* value) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1031 void AddValue(int index, HValue* value) { | 1029 void AddValue(int index, HValue* value) { |
| 1032 assigned_indexes_.Add(index); | 1030 assigned_indexes_.Add(index); |
| 1033 // Resize the list of pushed values. | 1031 // Resize the list of pushed values. |
| 1034 values_.Add(NULL); | 1032 values_.Add(NULL); |
| 1035 // Set the operand through the base method in HValue to make sure that the | 1033 // Set the operand through the base method in HValue to make sure that the |
| 1036 // use lists are correctly updated. | 1034 // use lists are correctly updated. |
| 1037 SetOperandAt(values_.length() - 1, value); | 1035 SetOperandAt(values_.length() - 1, value); |
| 1038 } | 1036 } |
| 1039 int ast_id_; | 1037 int ast_id_; |
| 1040 int pop_count_; | 1038 int pop_count_; |
| 1041 int environment_length_; | |
| 1042 ZoneList<HValue*> values_; | 1039 ZoneList<HValue*> values_; |
| 1043 ZoneList<int> assigned_indexes_; | 1040 ZoneList<int> assigned_indexes_; |
| 1044 }; | 1041 }; |
| 1045 | 1042 |
| 1046 | 1043 |
| 1047 class HStackCheck: public HTemplateInstruction<0> { | 1044 class HStackCheck: public HTemplateInstruction<0> { |
| 1048 public: | 1045 public: |
| 1049 HStackCheck() { } | 1046 HStackCheck() { } |
| 1050 | 1047 |
| 1051 virtual Representation RequiredInputRepresentation(int index) const { | 1048 virtual Representation RequiredInputRepresentation(int index) const { |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2872 } | 2869 } |
| 2873 | 2870 |
| 2874 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load_global_generic") | 2871 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric, "load_global_generic") |
| 2875 | 2872 |
| 2876 private: | 2873 private: |
| 2877 Handle<Object> name_; | 2874 Handle<Object> name_; |
| 2878 bool for_typeof_; | 2875 bool for_typeof_; |
| 2879 }; | 2876 }; |
| 2880 | 2877 |
| 2881 | 2878 |
| 2882 class HStoreGlobal: public HUnaryOperation { | 2879 class HStoreGlobalCell: public HUnaryOperation { |
| 2883 public: | 2880 public: |
| 2884 HStoreGlobal(HValue* value, | 2881 HStoreGlobalCell(HValue* value, |
| 2885 Handle<JSGlobalPropertyCell> cell, | 2882 Handle<JSGlobalPropertyCell> cell, |
| 2886 bool check_hole_value) | 2883 bool check_hole_value) |
| 2887 : HUnaryOperation(value), | 2884 : HUnaryOperation(value), |
| 2888 cell_(cell), | 2885 cell_(cell), |
| 2889 check_hole_value_(check_hole_value) { | 2886 check_hole_value_(check_hole_value) { |
| 2890 SetFlag(kChangesGlobalVars); | 2887 SetFlag(kChangesGlobalVars); |
| 2891 } | 2888 } |
| 2892 | 2889 |
| 2893 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 2890 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
| 2894 bool check_hole_value() const { return check_hole_value_; } | 2891 bool check_hole_value() const { return check_hole_value_; } |
| 2895 | 2892 |
| 2896 virtual Representation RequiredInputRepresentation(int index) const { | 2893 virtual Representation RequiredInputRepresentation(int index) const { |
| 2897 return Representation::Tagged(); | 2894 return Representation::Tagged(); |
| 2898 } | 2895 } |
| 2899 virtual void PrintDataTo(StringStream* stream); | 2896 virtual void PrintDataTo(StringStream* stream); |
| 2900 | 2897 |
| 2901 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global") | 2898 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store_global_cell") |
| 2902 | 2899 |
| 2903 private: | 2900 private: |
| 2904 Handle<JSGlobalPropertyCell> cell_; | 2901 Handle<JSGlobalPropertyCell> cell_; |
| 2905 bool check_hole_value_; | 2902 bool check_hole_value_; |
| 2906 }; | 2903 }; |
| 2907 | 2904 |
| 2908 | 2905 |
| 2906 class HStoreGlobalGeneric: public HTemplateInstruction<3> { |
| 2907 public: |
| 2908 HStoreGlobalGeneric(HValue* context, |
| 2909 HValue* global_object, |
| 2910 Handle<Object> name, |
| 2911 HValue* value) |
| 2912 : name_(name) { |
| 2913 SetOperandAt(0, context); |
| 2914 SetOperandAt(1, global_object); |
| 2915 SetOperandAt(2, value); |
| 2916 set_representation(Representation::Tagged()); |
| 2917 SetAllSideEffects(); |
| 2918 } |
| 2919 |
| 2920 HValue* context() { return OperandAt(0); } |
| 2921 HValue* global_object() { return OperandAt(1); } |
| 2922 Handle<Object> name() const { return name_; } |
| 2923 HValue* value() { return OperandAt(2); } |
| 2924 |
| 2925 virtual void PrintDataTo(StringStream* stream); |
| 2926 |
| 2927 virtual Representation RequiredInputRepresentation(int index) const { |
| 2928 return Representation::Tagged(); |
| 2929 } |
| 2930 |
| 2931 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store_global_generic") |
| 2932 |
| 2933 private: |
| 2934 Handle<Object> name_; |
| 2935 }; |
| 2936 |
| 2937 |
| 2909 class HLoadContextSlot: public HUnaryOperation { | 2938 class HLoadContextSlot: public HUnaryOperation { |
| 2910 public: | 2939 public: |
| 2911 HLoadContextSlot(HValue* context , int slot_index) | 2940 HLoadContextSlot(HValue* context , int slot_index) |
| 2912 : HUnaryOperation(context), slot_index_(slot_index) { | 2941 : HUnaryOperation(context), slot_index_(slot_index) { |
| 2913 set_representation(Representation::Tagged()); | 2942 set_representation(Representation::Tagged()); |
| 2914 SetFlag(kUseGVN); | 2943 SetFlag(kUseGVN); |
| 2915 SetFlag(kDependsOnContextSlots); | 2944 SetFlag(kDependsOnContextSlots); |
| 2916 } | 2945 } |
| 2917 | 2946 |
| 2918 int slot_index() const { return slot_index_; } | 2947 int slot_index() const { return slot_index_; } |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3619 HValue* object() { return left(); } | 3648 HValue* object() { return left(); } |
| 3620 HValue* key() { return right(); } | 3649 HValue* key() { return right(); } |
| 3621 }; | 3650 }; |
| 3622 | 3651 |
| 3623 #undef DECLARE_INSTRUCTION | 3652 #undef DECLARE_INSTRUCTION |
| 3624 #undef DECLARE_CONCRETE_INSTRUCTION | 3653 #undef DECLARE_CONCRETE_INSTRUCTION |
| 3625 | 3654 |
| 3626 } } // namespace v8::internal | 3655 } } // namespace v8::internal |
| 3627 | 3656 |
| 3628 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3657 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |