| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/il_printer.h" | 5 #include "vm/il_printer.h" |
| 6 | 6 |
| 7 #include "vm/intermediate_language.h" | 7 #include "vm/intermediate_language.h" |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 #include "vm/parser.h" | 9 #include "vm/parser.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 intptr_t available = size_ - position_; | 25 intptr_t available = size_ - position_; |
| 26 if (available <= 0) return; | 26 if (available <= 0) return; |
| 27 intptr_t written = | 27 intptr_t written = |
| 28 OS::VSNPrint(buffer_ + position_, available, format, args); | 28 OS::VSNPrint(buffer_ + position_, available, format, args); |
| 29 if (written >= 0) { | 29 if (written >= 0) { |
| 30 position_ += (available <= written) ? available : written; | 30 position_ += (available <= written) ? available : written; |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 | 34 |
| 35 void FlowGraphPrinter::PrintGraph(const char* phase, FlowGraph* flow_graph) { |
| 36 OS::Print("*** BEGIN CFG\n%s\n", phase); |
| 37 FlowGraphPrinter printer(*flow_graph); |
| 38 printer.PrintBlocks(); |
| 39 OS::Print("*** END CFG\n"); |
| 40 } |
| 41 |
| 42 |
| 35 void FlowGraphPrinter::PrintBlocks() { | 43 void FlowGraphPrinter::PrintBlocks() { |
| 36 if (!function_.IsNull()) { | 44 if (!function_.IsNull()) { |
| 37 OS::Print("==== %s\n", function_.ToFullyQualifiedCString()); | 45 OS::Print("==== %s\n", function_.ToFullyQualifiedCString()); |
| 38 } | 46 } |
| 39 | 47 |
| 40 for (intptr_t i = 0; i < block_order_.length(); ++i) { | 48 for (intptr_t i = 0; i < block_order_.length(); ++i) { |
| 41 // Print the block entry. | 49 // Print the block entry. |
| 42 PrintInstruction(block_order_[i]); | 50 PrintInstruction(block_order_[i]); |
| 43 // And all the successors until an exit, branch, or a block entry. | 51 // And all the successors until an exit, branch, or a block entry. |
| 44 Instruction* current = block_order_[i]; | 52 Instruction* current = block_order_[i]; |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 f->Print(" ["); | 714 f->Print(" ["); |
| 707 locations_[i].PrintTo(f); | 715 locations_[i].PrintTo(f); |
| 708 f->Print("]"); | 716 f->Print("]"); |
| 709 } | 717 } |
| 710 } | 718 } |
| 711 f->Print(" }"); | 719 f->Print(" }"); |
| 712 if (outer_ != NULL) outer_->PrintTo(f); | 720 if (outer_ != NULL) outer_->PrintTo(f); |
| 713 } | 721 } |
| 714 | 722 |
| 715 } // namespace dart | 723 } // namespace dart |
| OLD | NEW |