Index: runtime/vm/il_printer.cc |
=================================================================== |
--- runtime/vm/il_printer.cc (revision 7951) |
+++ 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(")"); |
} |
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()); |
} |