Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: src/hydrogen-instructions.h

Issue 12301027: Fixed numeric relations on HPhi instances. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 V(FastLiteral) \ 112 V(FastLiteral) \
113 V(FixedArrayBaseLength) \ 113 V(FixedArrayBaseLength) \
114 V(ForceRepresentation) \ 114 V(ForceRepresentation) \
115 V(FunctionLiteral) \ 115 V(FunctionLiteral) \
116 V(GetCachedArrayIndex) \ 116 V(GetCachedArrayIndex) \
117 V(GlobalObject) \ 117 V(GlobalObject) \
118 V(GlobalReceiver) \ 118 V(GlobalReceiver) \
119 V(Goto) \ 119 V(Goto) \
120 V(HasCachedArrayIndexAndBranch) \ 120 V(HasCachedArrayIndexAndBranch) \
121 V(HasInstanceTypeAndBranch) \ 121 V(HasInstanceTypeAndBranch) \
122 V(InductionVariableAnnotation) \
122 V(In) \ 123 V(In) \
123 V(InstanceOf) \ 124 V(InstanceOf) \
124 V(InstanceOfKnownGlobal) \ 125 V(InstanceOfKnownGlobal) \
125 V(InvokeFunction) \ 126 V(InvokeFunction) \
126 V(IsConstructCallAndBranch) \ 127 V(IsConstructCallAndBranch) \
127 V(IsNilAndBranch) \ 128 V(IsNilAndBranch) \
128 V(IsObjectAndBranch) \ 129 V(IsObjectAndBranch) \
129 V(IsStringAndBranch) \ 130 V(IsStringAndBranch) \
130 V(IsSmiAndBranch) \ 131 V(IsSmiAndBranch) \
131 V(IsUndetectableAndBranch) \ 132 V(IsUndetectableAndBranch) \
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 kIsArguments, 698 kIsArguments,
698 kTruncatingToInt32, 699 kTruncatingToInt32,
699 kIsDead, 700 kIsDead,
700 // Instructions that are allowed to produce full range unsigned integer 701 // Instructions that are allowed to produce full range unsigned integer
701 // values are marked with kUint32 flag. If arithmetic shift or a load from 702 // values are marked with kUint32 flag. If arithmetic shift or a load from
702 // EXTERNAL_UNSIGNED_INT_ELEMENTS array is not marked with this flag 703 // EXTERNAL_UNSIGNED_INT_ELEMENTS array is not marked with this flag
703 // it will deoptimize if result does not fit into signed integer range. 704 // it will deoptimize if result does not fit into signed integer range.
704 // HGraph::ComputeSafeUint32Operations is responsible for setting this 705 // HGraph::ComputeSafeUint32Operations is responsible for setting this
705 // flag. 706 // flag.
706 kUint32, 707 kUint32,
708 // If a phi is involved in the evaluation of a numeric constraint the
709 // recursion can cause an endless cycle: we use this flag to exit the loop.
710 kNumericConstraintEvaluationInProgress,
707 // This flag is set to true after the SetupInformativeDefinitions() pass 711 // This flag is set to true after the SetupInformativeDefinitions() pass
708 // has processed this instruction. 712 // has processed this instruction.
709 kIDefsProcessingDone, 713 kIDefsProcessingDone,
710 kLastFlag = kIDefsProcessingDone 714 kLastFlag = kIDefsProcessingDone
711 }; 715 };
712 716
713 STATIC_ASSERT(kLastFlag < kBitsPerInt); 717 STATIC_ASSERT(kLastFlag < kBitsPerInt);
714 718
715 static const int kChangesToDependsFlagsLeftShift = 1; 719 static const int kChangesToDependsFlagsLeftShift = 1;
716 720
(...skipping 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2941 } 2945 }
2942 return true; 2946 return true;
2943 } 2947 }
2944 2948
2945 protected: 2949 protected:
2946 virtual void DeleteFromGraph(); 2950 virtual void DeleteFromGraph();
2947 virtual void InternalSetOperandAt(int index, HValue* value) { 2951 virtual void InternalSetOperandAt(int index, HValue* value) {
2948 inputs_[index] = value; 2952 inputs_[index] = value;
2949 } 2953 }
2950 2954
2955 virtual bool IsRelationTrueInternal(NumericRelation relation, HValue* other);
2956
2951 private: 2957 private:
2952 ZoneList<HValue*> inputs_; 2958 ZoneList<HValue*> inputs_;
2953 int merged_index_; 2959 int merged_index_;
2954 2960
2955 int non_phi_uses_[Representation::kNumRepresentations]; 2961 int non_phi_uses_[Representation::kNumRepresentations];
2956 int indirect_uses_[Representation::kNumRepresentations]; 2962 int indirect_uses_[Representation::kNumRepresentations];
2957 int phi_id_; 2963 int phi_id_;
2958 bool is_live_; 2964 bool is_live_;
2959 bool is_convertible_to_integer_; 2965 bool is_convertible_to_integer_;
2960 }; 2966 };
2961 2967
2962 2968
2969 class HInductionVariableAnnotation : public HUnaryOperation {
2970 public:
2971 static HInductionVariableAnnotation* AddToGraph(HPhi* phi,
2972 NumericRelation relation,
2973 int operand_index);
2974
2975 NumericRelation relation() { return relation_; }
2976 HValue* induction_base() { return phi_->OperandAt(operand_index_); }
2977
2978 virtual int RedefinedOperandIndex() { return 0; }
2979 virtual bool IsPurelyInformativeDefinition() { return true; }
2980 virtual Representation RequiredInputRepresentation(int index) {
2981 return representation();
2982 }
2983
2984 virtual void PrintDataTo(StringStream* stream);
2985
2986 virtual bool IsRelationTrueInternal(NumericRelation other_relation,
2987 HValue* other_related_value) {
2988 if (induction_base() == other_related_value) {
2989 return relation().Implies(other_relation);
2990 } else {
2991 return false;
2992 }
2993 }
2994
2995 DECLARE_CONCRETE_INSTRUCTION(InductionVariableAnnotation)
2996
2997 private:
2998 HInductionVariableAnnotation(HPhi* phi,
2999 NumericRelation relation,
3000 int operand_index)
3001 : HUnaryOperation(phi),
3002 phi_(phi), relation_(relation), operand_index_(operand_index) {
3003 set_representation(phi->representation());
3004 }
3005
3006 // We need to store the phi both here and in the instruction operand because
3007 // the operand can change if a new idef of the phi is added between the phi
3008 // and this instruction (inserting an idef updates every use).
3009 HPhi* phi_;
3010 NumericRelation relation_;
3011 int operand_index_;
3012 };
3013
3014
2963 class HArgumentsObject: public HTemplateInstruction<0> { 3015 class HArgumentsObject: public HTemplateInstruction<0> {
2964 public: 3016 public:
2965 HArgumentsObject() { 3017 HArgumentsObject() {
2966 set_representation(Representation::Tagged()); 3018 set_representation(Representation::Tagged());
2967 SetFlag(kIsArguments); 3019 SetFlag(kIsArguments);
2968 } 3020 }
2969 3021
2970 virtual Representation RequiredInputRepresentation(int index) { 3022 virtual Representation RequiredInputRepresentation(int index) {
2971 return Representation::None(); 3023 return Representation::None();
2972 } 3024 }
(...skipping 3052 matching lines...) Expand 10 before | Expand all | Expand 10 after
6025 virtual bool IsDeletable() const { return true; } 6077 virtual bool IsDeletable() const { return true; }
6026 }; 6078 };
6027 6079
6028 6080
6029 #undef DECLARE_INSTRUCTION 6081 #undef DECLARE_INSTRUCTION
6030 #undef DECLARE_CONCRETE_INSTRUCTION 6082 #undef DECLARE_CONCRETE_INSTRUCTION
6031 6083
6032 } } // namespace v8::internal 6084 } } // namespace v8::internal
6033 6085
6034 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6086 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698