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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
803 // HGraph::ComputeSafeUint32Operations is responsible for setting this | 803 // HGraph::ComputeSafeUint32Operations is responsible for setting this |
804 // flag. | 804 // flag. |
805 kUint32, | 805 kUint32, |
806 // If a phi is involved in the evaluation of a numeric constraint the | 806 // If a phi is involved in the evaluation of a numeric constraint the |
807 // recursion can cause an endless cycle: we use this flag to exit the loop. | 807 // recursion can cause an endless cycle: we use this flag to exit the loop. |
808 kNumericConstraintEvaluationInProgress, | 808 kNumericConstraintEvaluationInProgress, |
809 // This flag is set to true after the SetupInformativeDefinitions() pass | 809 // This flag is set to true after the SetupInformativeDefinitions() pass |
810 // has processed this instruction. | 810 // has processed this instruction. |
811 kIDefsProcessingDone, | 811 kIDefsProcessingDone, |
812 kHasNoObservableSideEffects, | 812 kHasNoObservableSideEffects, |
813 // used during dead code elimination to indicate the instruction is live | |
Jakob Kummerow
2013/05/08 12:07:24
nit: Our style guide demands that comments be prop
titzer
2013/05/13 13:29:38
Done.
| |
814 kIsNotDead, | |
Sven Panne
2013/05/07 13:32:10
I don't like negated things, especially when the u
titzer
2013/05/13 13:29:38
Done.
| |
813 kLastFlag = kIDefsProcessingDone | 815 kLastFlag = kIDefsProcessingDone |
814 }; | 816 }; |
815 | 817 |
816 STATIC_ASSERT(kLastFlag < kBitsPerInt); | 818 STATIC_ASSERT(kLastFlag < kBitsPerInt); |
817 | 819 |
818 static const int kChangesToDependsFlagsLeftShift = 1; | 820 static const int kChangesToDependsFlagsLeftShift = 1; |
819 | 821 |
820 static GVNFlag ChangesFlagFromInt(int x) { | 822 static GVNFlag ChangesFlagFromInt(int x) { |
821 return static_cast<GVNFlag>(x * 2); | 823 return static_cast<GVNFlag>(x * 2); |
822 } | 824 } |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1065 | 1067 |
1066 virtual HType CalculateInferredType(); | 1068 virtual HType CalculateInferredType(); |
1067 | 1069 |
1068 // This function must be overridden for instructions which have the | 1070 // This function must be overridden for instructions which have the |
1069 // kTrackSideEffectDominators flag set, to track instructions that are | 1071 // kTrackSideEffectDominators flag set, to track instructions that are |
1070 // dominating side effects. | 1072 // dominating side effects. |
1071 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { | 1073 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
1072 UNREACHABLE(); | 1074 UNREACHABLE(); |
1073 } | 1075 } |
1074 | 1076 |
1075 bool IsDead() const { | 1077 bool IsDead() const { |
Jakob Kummerow
2013/05/08 12:07:24
I think this can be removed. It only had two call
titzer
2013/05/13 13:29:38
Done.
| |
1076 return HasNoUses() && !HasObservableSideEffects() && IsDeletable(); | 1078 return HasNoUses() && !HasObservableSideEffects() && IsDeletable(); |
1077 } | 1079 } |
1078 | 1080 |
1081 // has side effects or otherwise cannot be dead code eliminated | |
1082 bool IsNotDeletable() const { | |
1083 return HasObservableSideEffects() || !IsDeletable(); | |
Sven Panne
2013/05/07 13:32:10
Hmmm, do we really need IsDead *and* IsNotDeletabl
titzer
2013/05/13 13:29:38
Done.
| |
1084 } | |
1085 | |
1079 #ifdef DEBUG | 1086 #ifdef DEBUG |
1080 virtual void Verify() = 0; | 1087 virtual void Verify() = 0; |
1081 #endif | 1088 #endif |
1082 | 1089 |
1083 bool IsRelationTrue(NumericRelation relation, | 1090 bool IsRelationTrue(NumericRelation relation, |
1084 HValue* other, | 1091 HValue* other, |
1085 int offset = 0, | 1092 int offset = 0, |
1086 int scale = 0); | 1093 int scale = 0); |
1087 | 1094 |
1088 bool TryGuaranteeRange(HValue* upper_bound); | 1095 bool TryGuaranteeRange(HValue* upper_bound); |
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2958 virtual bool DataEquals(HValue* other) { return true; } | 2965 virtual bool DataEquals(HValue* other) { return true; } |
2959 }; | 2966 }; |
2960 | 2967 |
2961 | 2968 |
2962 class HPhi: public HValue { | 2969 class HPhi: public HValue { |
2963 public: | 2970 public: |
2964 HPhi(int merged_index, Zone* zone) | 2971 HPhi(int merged_index, Zone* zone) |
2965 : inputs_(2, zone), | 2972 : inputs_(2, zone), |
2966 merged_index_(merged_index), | 2973 merged_index_(merged_index), |
2967 phi_id_(-1), | 2974 phi_id_(-1), |
2968 is_live_(false), | |
2969 is_convertible_to_integer_(true) { | 2975 is_convertible_to_integer_(true) { |
2970 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 2976 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
2971 non_phi_uses_[i] = 0; | 2977 non_phi_uses_[i] = 0; |
2972 indirect_uses_[i] = 0; | 2978 indirect_uses_[i] = 0; |
2973 } | 2979 } |
2974 ASSERT(merged_index >= 0); | 2980 ASSERT(merged_index >= 0); |
2975 SetFlag(kFlexibleRepresentation); | 2981 SetFlag(kFlexibleRepresentation); |
2976 } | 2982 } |
2977 | 2983 |
2978 virtual Representation RepresentationFromInputs(); | 2984 virtual Representation RepresentationFromInputs(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3018 int tagged_indirect_uses() const { | 3024 int tagged_indirect_uses() const { |
3019 return indirect_uses_[Representation::kTagged]; | 3025 return indirect_uses_[Representation::kTagged]; |
3020 } | 3026 } |
3021 int int32_indirect_uses() const { | 3027 int int32_indirect_uses() const { |
3022 return indirect_uses_[Representation::kInteger32]; | 3028 return indirect_uses_[Representation::kInteger32]; |
3023 } | 3029 } |
3024 int double_indirect_uses() const { | 3030 int double_indirect_uses() const { |
3025 return indirect_uses_[Representation::kDouble]; | 3031 return indirect_uses_[Representation::kDouble]; |
3026 } | 3032 } |
3027 int phi_id() { return phi_id_; } | 3033 int phi_id() { return phi_id_; } |
3028 bool is_live() { return is_live_; } | |
3029 void set_is_live(bool b) { is_live_ = b; } | |
3030 | 3034 |
3031 static HPhi* cast(HValue* value) { | 3035 static HPhi* cast(HValue* value) { |
3032 ASSERT(value->IsPhi()); | 3036 ASSERT(value->IsPhi()); |
3033 return reinterpret_cast<HPhi*>(value); | 3037 return reinterpret_cast<HPhi*>(value); |
3034 } | 3038 } |
3035 virtual Opcode opcode() const { return HValue::kPhi; } | 3039 virtual Opcode opcode() const { return HValue::kPhi; } |
3036 | 3040 |
3037 virtual bool IsConvertibleToInteger() const { | 3041 virtual bool IsConvertibleToInteger() const { |
3038 return is_convertible_to_integer_; | 3042 return is_convertible_to_integer_; |
3039 } | 3043 } |
(...skipping 29 matching lines...) Expand all Loading... | |
3069 int offset = 0, | 3073 int offset = 0, |
3070 int scale = 0); | 3074 int scale = 0); |
3071 | 3075 |
3072 private: | 3076 private: |
3073 ZoneList<HValue*> inputs_; | 3077 ZoneList<HValue*> inputs_; |
3074 int merged_index_; | 3078 int merged_index_; |
3075 | 3079 |
3076 int non_phi_uses_[Representation::kNumRepresentations]; | 3080 int non_phi_uses_[Representation::kNumRepresentations]; |
3077 int indirect_uses_[Representation::kNumRepresentations]; | 3081 int indirect_uses_[Representation::kNumRepresentations]; |
3078 int phi_id_; | 3082 int phi_id_; |
3079 bool is_live_; | |
3080 bool is_convertible_to_integer_; | 3083 bool is_convertible_to_integer_; |
3081 }; | 3084 }; |
3082 | 3085 |
3083 | 3086 |
3084 class HInductionVariableAnnotation : public HUnaryOperation { | 3087 class HInductionVariableAnnotation : public HUnaryOperation { |
3085 public: | 3088 public: |
3086 static HInductionVariableAnnotation* AddToGraph(HPhi* phi, | 3089 static HInductionVariableAnnotation* AddToGraph(HPhi* phi, |
3087 NumericRelation relation, | 3090 NumericRelation relation, |
3088 int operand_index); | 3091 int operand_index); |
3089 | 3092 |
(...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6522 virtual bool IsDeletable() const { return true; } | 6525 virtual bool IsDeletable() const { return true; } |
6523 }; | 6526 }; |
6524 | 6527 |
6525 | 6528 |
6526 #undef DECLARE_INSTRUCTION | 6529 #undef DECLARE_INSTRUCTION |
6527 #undef DECLARE_CONCRETE_INSTRUCTION | 6530 #undef DECLARE_CONCRETE_INSTRUCTION |
6528 | 6531 |
6529 } } // namespace v8::internal | 6532 } } // namespace v8::internal |
6530 | 6533 |
6531 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6534 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |