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

Unified Diff: runtime/vm/il_printer.cc

Issue 10431006: First step toward an optimizing compiler: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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
===================================================================
--- runtime/vm/il_printer.cc (revision 7907)
+++ runtime/vm/il_printer.cc (working copy)
@@ -25,16 +25,18 @@
void FlowGraphPrinter::PrintBlocks() {
- OS::Print("==== %s\n", function_.ToFullyQualifiedCString());
+ if (!function_.IsNull()) {
+ OS::Print("==== %s\n", function_.ToFullyQualifiedCString());
+ }
for (intptr_t i = 0; i < block_order_.length(); ++i) {
// Print the block entry.
- Print(block_order_[i]);
+ PrintInstruction(block_order_[i]);
Instruction* current = block_order_[i]->StraightLineSuccessor();
// And all the successors until an exit, branch, or a block entry.
while ((current != NULL) && !current->IsBlockEntry()) {
OS::Print("\n");
- Print(current);
+ PrintInstruction(current);
current = current->StraightLineSuccessor();
}
BlockEntryInstr* successor =
@@ -47,7 +49,7 @@
}
-void FlowGraphPrinter::Print(Instruction* instr) {
+void FlowGraphPrinter::PrintInstruction(Instruction* instr) {
char str[80];
BufferFormatter f(str, sizeof(str));
instr->PrintTo(&f);
@@ -55,6 +57,15 @@
}
+void FlowGraphPrinter::PrintComputation(Computation* comp) {
+ char str[80];
+ BufferFormatter f(str, sizeof(str));
+ comp->PrintTo(&f);
+ OS::Print("%s", str);
+}
+
+
+
void Computation::PrintTo(BufferFormatter* f) const {
f->Print("%s(", DebugName());
PrintOperandsTo(f);
@@ -66,7 +77,7 @@
for (int i = 0; i < InputCount(); ++i) {
if (i > 0) f->Print(", ");
if (InputAt(i) != NULL) InputAt(i)->PrintTo(f);
- OS::Print(")");
+ f->Print(")");
}
}
@@ -87,9 +98,9 @@
String::Handle(dst_type().Name()).ToCString(),
dst_name().ToCString());
if (instantiator() != NULL) {
- OS::Print(" (instantiator:");
+ f->Print(" (instantiator:");
instantiator()->PrintTo(f);
- OS::Print(")");
+ f->Print(")");
Florian Schneider 2012/05/24 00:20:39 Thanks for catching these!
}
if (instantiator_type_arguments() != NULL) {
f->Print(" (instantiator:");
@@ -188,9 +199,9 @@
negate_result() ? "ISNOT" : "IS",
String::Handle(type().Name()).ToCString());
if (instantiator() != NULL) {
- OS::Print(" (instantiator:");
+ f->Print(" (instantiator:");
instantiator()->PrintTo(f);
- OS::Print(")");
+ f->Print(")");
}
if (type_arguments() != NULL) {
f->Print(" (type-arg:");
@@ -277,6 +288,14 @@
}
+void BinaryOpComp::PrintOperandsTo(BufferFormatter* f) const {
+ f->Print("%s, ", Token::Str(op_kind()));
+ left()->PrintTo(f);
+ f->Print(", ");
+ right()->PrintTo(f);
+}
+
+
void GraphEntryInstr::PrintTo(BufferFormatter* f) const {
f->Print("%2d: [graph]", block_id());
}

Powered by Google App Engine
This is Rietveld 408576698