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 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3013 public: | 3013 public: |
3014 HPhi(int merged_index, Zone* zone) | 3014 HPhi(int merged_index, Zone* zone) |
3015 : inputs_(2, zone), | 3015 : inputs_(2, zone), |
3016 merged_index_(merged_index), | 3016 merged_index_(merged_index), |
3017 phi_id_(-1), | 3017 phi_id_(-1), |
3018 induction_variable_data_(NULL) { | 3018 induction_variable_data_(NULL) { |
3019 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 3019 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
3020 non_phi_uses_[i] = 0; | 3020 non_phi_uses_[i] = 0; |
3021 indirect_uses_[i] = 0; | 3021 indirect_uses_[i] = 0; |
3022 } | 3022 } |
3023 ASSERT(merged_index >= 0); | 3023 ASSERT(merged_index >= 0 || merged_index == kInvalidMergedIndex); |
3024 SetFlag(kFlexibleRepresentation); | 3024 SetFlag(kFlexibleRepresentation); |
3025 SetFlag(kAllowUndefinedAsNaN); | 3025 SetFlag(kAllowUndefinedAsNaN); |
3026 } | 3026 } |
3027 | 3027 |
3028 virtual Representation RepresentationFromInputs(); | 3028 virtual Representation RepresentationFromInputs(); |
3029 | 3029 |
3030 virtual Range* InferRange(Zone* zone); | 3030 virtual Range* InferRange(Zone* zone); |
3031 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); | 3031 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
3032 virtual Representation RequiredInputRepresentation(int index) { | 3032 virtual Representation RequiredInputRepresentation(int index) { |
3033 return representation(); | 3033 return representation(); |
3034 } | 3034 } |
3035 virtual Representation KnownOptimalRepresentation() { | 3035 virtual Representation KnownOptimalRepresentation() { |
3036 return representation(); | 3036 return representation(); |
3037 } | 3037 } |
3038 virtual HType CalculateInferredType(); | 3038 virtual HType CalculateInferredType(); |
3039 virtual int OperandCount() { return inputs_.length(); } | 3039 virtual int OperandCount() { return inputs_.length(); } |
3040 virtual HValue* OperandAt(int index) const { return inputs_[index]; } | 3040 virtual HValue* OperandAt(int index) const { return inputs_[index]; } |
3041 HValue* GetRedundantReplacement(); | 3041 HValue* GetRedundantReplacement(); |
3042 void AddInput(HValue* value); | 3042 void AddInput(HValue* value); |
3043 bool HasRealUses(); | 3043 bool HasRealUses(); |
3044 | 3044 |
3045 bool IsReceiver() const { return merged_index_ == 0; } | 3045 bool IsReceiver() const { return merged_index_ == 0; } |
| 3046 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } |
3046 | 3047 |
3047 int merged_index() const { return merged_index_; } | 3048 int merged_index() const { return merged_index_; } |
3048 | 3049 |
3049 InductionVariableData* induction_variable_data() { | 3050 InductionVariableData* induction_variable_data() { |
3050 return induction_variable_data_; | 3051 return induction_variable_data_; |
3051 } | 3052 } |
3052 bool IsInductionVariable() { | 3053 bool IsInductionVariable() { |
3053 return induction_variable_data_ != NULL; | 3054 return induction_variable_data_ != NULL; |
3054 } | 3055 } |
3055 bool IsLimitedInductionVariable() { | 3056 bool IsLimitedInductionVariable() { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3098 int phi_id() { return phi_id_; } | 3099 int phi_id() { return phi_id_; } |
3099 | 3100 |
3100 static HPhi* cast(HValue* value) { | 3101 static HPhi* cast(HValue* value) { |
3101 ASSERT(value->IsPhi()); | 3102 ASSERT(value->IsPhi()); |
3102 return reinterpret_cast<HPhi*>(value); | 3103 return reinterpret_cast<HPhi*>(value); |
3103 } | 3104 } |
3104 virtual Opcode opcode() const { return HValue::kPhi; } | 3105 virtual Opcode opcode() const { return HValue::kPhi; } |
3105 | 3106 |
3106 void SimplifyConstantInputs(); | 3107 void SimplifyConstantInputs(); |
3107 | 3108 |
| 3109 // Marker value representing an invalid merge index. |
| 3110 static const int kInvalidMergedIndex = -1; |
| 3111 |
3108 protected: | 3112 protected: |
3109 virtual void DeleteFromGraph(); | 3113 virtual void DeleteFromGraph(); |
3110 virtual void InternalSetOperandAt(int index, HValue* value) { | 3114 virtual void InternalSetOperandAt(int index, HValue* value) { |
3111 inputs_[index] = value; | 3115 inputs_[index] = value; |
3112 } | 3116 } |
3113 | 3117 |
3114 private: | 3118 private: |
3115 ZoneList<HValue*> inputs_; | 3119 ZoneList<HValue*> inputs_; |
3116 int merged_index_; | 3120 int merged_index_; |
3117 | 3121 |
(...skipping 3660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6778 virtual bool IsDeletable() const { return true; } | 6782 virtual bool IsDeletable() const { return true; } |
6779 }; | 6783 }; |
6780 | 6784 |
6781 | 6785 |
6782 #undef DECLARE_INSTRUCTION | 6786 #undef DECLARE_INSTRUCTION |
6783 #undef DECLARE_CONCRETE_INSTRUCTION | 6787 #undef DECLARE_CONCRETE_INSTRUCTION |
6784 | 6788 |
6785 } } // namespace v8::internal | 6789 } } // namespace v8::internal |
6786 | 6790 |
6787 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6791 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |