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

Unified Diff: runtime/vm/il_printer.cc

Issue 10960014: Implement range analysis for smi values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: addressed majority of comments Created 8 years, 3 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: runtime/vm/il_printer.cc
diff --git a/runtime/vm/il_printer.cc b/runtime/vm/il_printer.cc
index a863199cd6bd1ffe17d804aba1767f66b49ccdaa..b536165d7acf0b4d4a14dec36217bdb3a3f499c0 100644
--- a/runtime/vm/il_printer.cc
+++ b/runtime/vm/il_printer.cc
@@ -183,6 +183,10 @@ void Definition::PrintTo(BufferFormatter* f) const {
PrintOperandsTo(f);
f->Print(")");
PrintPropagatedType(f, *this);
+ if (range_ != NULL) {
+ f->Print(" ");
+ range_->PrintTo(f);
+ }
}
@@ -209,6 +213,38 @@ void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const {
}
+void ConstraintInstr::PrintOperandsTo(BufferFormatter* f) const {
+ value()->PrintTo(f);
+ f->Print(" ^ ");
+ constraint()->PrintTo(f);
+}
+
+
+void Range::PrintTo(BufferFormatter* f) const {
+ f->Print("[");
+ min_.PrintTo(f);
+ f->Print(", ");
+ max_.PrintTo(f);
+ f->Print("]");
+}
+
+
+void RangeBoundary::PrintTo(BufferFormatter* f) const {
+ switch (kind_) {
+ case kSymbol:
+ f->Print("v%"Pd, reinterpret_cast<Definition*>(value_)->ssa_temp_index());
+ if (offset_ != 0) f->Print("%+"Pd, offset_);
+ break;
+ case kConstant:
+ f->Print("%"Pd, value_);
+ break;
+ case kUnknown:
+ f->Print("_|_");
+ break;
+ }
+}
+
+
void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const {
value()->PrintTo(f);
f->Print(", %s, '%s'%s",
@@ -429,6 +465,11 @@ void CatchEntryInstr::PrintOperandsTo(BufferFormatter* f) const {
}
+void BinarySmiOpInstr::PrintTo(BufferFormatter* f) const {
+ Definition::PrintTo(f);
+ f->Print(" %co", overflow_ ? '+' : '-');
+}
+
void BinarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const {
f->Print("%s, ", Token::Str(op_kind()));
left()->PrintTo(f);
@@ -506,6 +547,10 @@ void PhiInstr::PrintTo(BufferFormatter* f) const {
}
f->Print(")");
PrintPropagatedType(f, *this);
+ if (range_ != NULL) {
+ f->Print(" ");
+ range_->PrintTo(f);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698