| 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 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 | 59 |
| 60 void FlowGraphPrinter::PrintInstruction(Instruction* instr) { | 60 void FlowGraphPrinter::PrintInstruction(Instruction* instr) { |
| 61 char str[1000]; | 61 char str[1000]; |
| 62 BufferFormatter f(str, sizeof(str)); | 62 BufferFormatter f(str, sizeof(str)); |
| 63 instr->PrintTo(&f); | 63 instr->PrintTo(&f); |
| 64 if (FLAG_print_environments && (instr->env() != NULL)) { | 64 if (FLAG_print_environments && (instr->env() != NULL)) { |
| 65 instr->env()->PrintTo(&f); | 65 instr->env()->PrintTo(&f); |
| 66 } | 66 } |
| 67 if (print_locations_ && (instr->locs() != NULL)) { |
| 68 instr->locs()->PrintTo(&f); |
| 69 } |
| 70 if (instr->lifetime_position() != -1) { |
| 71 OS::Print("%3d: ", instr->lifetime_position()); |
| 72 } |
| 67 OS::Print("%s", str); | 73 OS::Print("%s", str); |
| 68 } | 74 } |
| 69 | 75 |
| 70 | 76 |
| 71 void FlowGraphPrinter::PrintComputation(Computation* comp) { | 77 void FlowGraphPrinter::PrintComputation(Computation* comp) { |
| 72 char str[1000]; | 78 char str[1000]; |
| 73 BufferFormatter f(str, sizeof(str)); | 79 BufferFormatter f(str, sizeof(str)); |
| 74 comp->PrintTo(&f); | 80 comp->PrintTo(&f); |
| 75 OS::Print("%s", str); | 81 OS::Print("%s", str); |
| 76 } | 82 } |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 if (is_negated()) { | 416 if (is_negated()) { |
| 411 f->Print(" (negated)"); | 417 f->Print(" (negated)"); |
| 412 } | 418 } |
| 413 f->Print(" goto (%d, %d)", | 419 f->Print(" goto (%d, %d)", |
| 414 true_successor()->block_id(), | 420 true_successor()->block_id(), |
| 415 false_successor()->block_id()); | 421 false_successor()->block_id()); |
| 416 } | 422 } |
| 417 | 423 |
| 418 | 424 |
| 419 void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { | 425 void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { |
| 420 UNIMPLEMENTED(); | 426 f->Print(" %s ", DebugName()); |
| 427 for (intptr_t i = 0; i < moves_.length(); i++) { |
| 428 if (i != 0) f->Print(", "); |
| 429 f->Print("%s = %s", moves_[i].dest().Name(), moves_[i].src().Name()); |
| 430 } |
| 421 } | 431 } |
| 422 | 432 |
| 423 | 433 |
| 424 void FlowGraphVisualizer::Print(const char* format, ...) { | 434 void FlowGraphVisualizer::Print(const char* format, ...) { |
| 425 char str[1000]; | 435 char str[1000]; |
| 426 BufferFormatter f(str, sizeof(str)); | 436 BufferFormatter f(str, sizeof(str)); |
| 427 f.Print("%*s", 2 * indent_, ""); | 437 f.Print("%*s", 2 * indent_, ""); |
| 428 va_list args; | 438 va_list args; |
| 429 va_start(args, format); | 439 va_start(args, format); |
| 430 f.VPrint(format, args); | 440 f.VPrint(format, args); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 void ParallelMoveInstr::PrintToVisualizer(BufferFormatter* f) const { | 670 void ParallelMoveInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 661 UNIMPLEMENTED(); | 671 UNIMPLEMENTED(); |
| 662 } | 672 } |
| 663 | 673 |
| 664 | 674 |
| 665 void Environment::PrintTo(BufferFormatter* f) const { | 675 void Environment::PrintTo(BufferFormatter* f) const { |
| 666 f->Print(" env={ "); | 676 f->Print(" env={ "); |
| 667 for (intptr_t i = 0; i < values_.length(); ++i) { | 677 for (intptr_t i = 0; i < values_.length(); ++i) { |
| 668 if (i > 0) f->Print(", "); | 678 if (i > 0) f->Print(", "); |
| 669 values_[i]->PrintTo(f); | 679 values_[i]->PrintTo(f); |
| 680 if ((i < locations_.length()) && !locations_[i].IsInvalid()) { |
| 681 f->Print(" [%s]", locations_[i].Name()); |
| 682 } |
| 670 } | 683 } |
| 671 f->Print(" }"); | 684 f->Print(" }"); |
| 672 } | 685 } |
| 673 | 686 |
| 674 } // namespace dart | 687 } // namespace dart |
| OLD | NEW |