Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index b353cdb2cc514acd7f31bc1752c92faff3f10ff7..89f2ff4d88c36b5d4dd7cd298fe0e154cb4dfcff 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -690,6 +690,14 @@ void HInstruction::PrintMnemonicTo(StringStream* stream) { |
} |
+HValue* HValue::AddNumericConstraint(HInstruction* insertion_point, |
Jakob Kummerow
2013/02/12 15:10:42
I don't think we need this. Let's just inline it e
Massi
2013/02/13 11:56:42
Done.
|
+ HValue* related_value, |
+ NumericRelation relation) { |
+ return HNumericConstraint::New( |
+ insertion_point, this, related_value, relation); |
+} |
+ |
+ |
void HInstruction::Unlink() { |
ASSERT(IsLinked()); |
ASSERT(!IsControlInstruction()); // Must never move control instructions. |
@@ -794,6 +802,27 @@ void HInstruction::Verify() { |
#endif |
+HNumericConstraint* HNumericConstraint::New(HInstruction* insertion_point, |
Jakob Kummerow
2013/02/12 15:10:42
This should probably be renamed (AddToGraph?). Als
Massi
2013/02/13 11:56:42
Done.
|
+ HValue* constrained_value, |
+ HValue* related_value, |
+ NumericRelation relation) { |
+ HNumericConstraint* result = |
+ new(insertion_point->block()->zone()) HNumericConstraint( |
+ constrained_value, related_value, relation); |
+ result->InsertAfter(insertion_point); |
+ return result; |
+} |
+ |
+ |
+void HNumericConstraint::PrintDataTo(StringStream* stream) { |
+ stream->Add("("); |
+ constrained_value()->PrintNameTo(stream); |
+ stream->Add(" %s ", relation().Mnemonic()); |
+ related_value()->PrintNameTo(stream); |
+ stream->Add(")"); |
+} |
+ |
+ |
void HDummyUse::PrintDataTo(StringStream* stream) { |
value()->PrintNameTo(stream); |
} |
@@ -815,6 +844,18 @@ void HBinaryCall::PrintDataTo(StringStream* stream) { |
} |
+bool HBoundsCheck::CheckRelation(NumericRelation relation, |
+ HValue* related_value) { |
Jakob Kummerow
2013/02/12 15:10:42
nit: indentation
Massi
2013/02/13 11:56:42
Done.
|
+ if (related_value == length()) { |
+ return NumericRelation::Lt().Implies(relation); |
Jakob Kummerow
2013/02/12 15:10:42
How about a comment:
// We know that a BoundsCheck
Massi
2013/02/13 11:56:42
Done.
|
+ } else if (related_value == block()->graph()->GetConstant0()) { |
+ return NumericRelation::Ge().Implies(relation); |
+ } else { |
+ return false; |
+ } |
+} |
+ |
+ |
void HBoundsCheck::PrintDataTo(StringStream* stream) { |
index()->PrintNameTo(stream); |
stream->Add(" "); |