Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 829567acaf6c4d4d5bd1ca6b590aa9211a6cc820..f3232f6575e7e5ed8d6890a1cdc158775f489fd9 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -119,6 +119,7 @@ class LChunkBuilder; |
V(Goto) \ |
V(HasCachedArrayIndexAndBranch) \ |
V(HasInstanceTypeAndBranch) \ |
+ V(InductionVariable) \ |
V(In) \ |
V(InstanceOf) \ |
V(InstanceOfKnownGlobal) \ |
@@ -704,6 +705,9 @@ class HValue: public ZoneObject { |
// HGraph::ComputeSafeUint32Operations is responsible for setting this |
// flag. |
kUint32, |
+ // If a phi is involved in the evaluation of a numeric constraints the |
Jakob Kummerow
2013/02/20 10:46:47
"a numeric constraints" -> singular or plural?
Massi
2013/02/21 07:40:32
Done.
|
+ // recursion can cause an endless cycle: we use this flag to exit the loop. |
+ kNumericConstraintEvaluationInProgress, |
// This flag is set to true after the SetupInformativeDefinitions() pass |
// has processed this instruction. |
kIDefsProcessingDone, |
@@ -2948,6 +2952,8 @@ class HPhi: public HValue { |
inputs_[index] = value; |
} |
+ virtual bool IsRelationTrueInternal(NumericRelation relation, HValue* other); |
+ |
private: |
ZoneList<HValue*> inputs_; |
int merged_index_; |
@@ -2960,6 +2966,47 @@ class HPhi: public HValue { |
}; |
+class HInductionVariable : public HUnaryOperation { |
Jakob Kummerow
2013/02/20 10:46:47
The name is misleading, as this instruction *isn't
Massi
2013/02/21 07:40:32
Done.
|
+ public: |
+ static HInductionVariable* AddToGraph(HPhi* phi, |
+ NumericRelation relation, |
+ int operand_index); |
+ |
+ NumericRelation relation() { return relation_; } |
+ HValue* induction_base() { return phi_->OperandAt(operand_index_); } |
+ |
+ virtual int RedefinedOperandIndex() { return 0; } |
+ virtual bool IsPurelyInformativeDefinition() { return true; } |
+ virtual Representation RequiredInputRepresentation(int index) { |
+ return representation(); |
+ } |
+ |
+ virtual void PrintDataTo(StringStream* stream); |
+ |
+ virtual bool IsRelationTrueInternal(NumericRelation other_relation, |
+ HValue* other_related_value) { |
+ if (induction_base() == other_related_value) { |
+ return relation().Implies(other_relation); |
+ } else { |
+ return false; |
+ } |
+ } |
+ |
+ DECLARE_CONCRETE_INSTRUCTION(InductionVariable) |
+ |
+ private: |
+ HInductionVariable(HPhi* phi, NumericRelation relation, int operand_index) |
+ : HUnaryOperation(phi), |
+ phi_(phi), relation_(relation), operand_index_(operand_index) { |
+ set_representation(phi->representation()); |
+ } |
+ |
+ HPhi* phi_; |
Jakob Kummerow
2013/02/20 10:46:47
No need to store this -- the UnaryOperation base c
Massi
2013/02/21 07:40:32
Actually it is needed, adding a comment to clarify
|
+ NumericRelation relation_; |
+ int operand_index_; |
+}; |
+ |
+ |
class HArgumentsObject: public HTemplateInstruction<0> { |
public: |
HArgumentsObject() { |