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

Unified Diff: src/hydrogen-instructions.cc

Issue 12226112: Infrastructure classes for evaluating numeric relations between values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 side-by-side diff with in-line comments
Download patch
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(" ");

Powered by Google App Engine
This is Rietveld 408576698