| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 if (definition.is_used()) { | 147 if (definition.is_used()) { |
| 148 if (definition.HasSSATemp()) { | 148 if (definition.HasSSATemp()) { |
| 149 f->Print("v%"Pd, definition.ssa_temp_index()); | 149 f->Print("v%"Pd, definition.ssa_temp_index()); |
| 150 } else if (definition.temp_index() != -1) { | 150 } else if (definition.temp_index() != -1) { |
| 151 f->Print("t%"Pd, definition.temp_index()); | 151 f->Print("t%"Pd, definition.temp_index()); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 | 156 |
| 157 void Instruction::PrintTo(BufferFormatter* f) const { |
| 158 f->Print("%s:%"Pd"(", DebugName(), GetDeoptId()); |
| 159 PrintOperandsTo(f); |
| 160 f->Print(")"); |
| 161 } |
| 162 |
| 163 |
| 164 void Instruction::PrintOperandsTo(BufferFormatter* f) const { |
| 165 for (int i = 0; i < InputCount(); ++i) { |
| 166 if (i > 0) f->Print(", "); |
| 167 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); |
| 168 } |
| 169 } |
| 170 |
| 171 |
| 172 void Instruction::PrintToVisualizer(BufferFormatter* f) const { |
| 173 PrintTo(f); |
| 174 } |
| 175 |
| 176 |
| 157 void Definition::PrintTo(BufferFormatter* f) const { | 177 void Definition::PrintTo(BufferFormatter* f) const { |
| 158 PrintUse(f, *this); | 178 PrintUse(f, *this); |
| 159 if (is_used()) { | 179 if (is_used()) { |
| 160 if (HasSSATemp() || (temp_index() != -1)) f->Print(" <- "); | 180 if (HasSSATemp() || (temp_index() != -1)) f->Print(" <- "); |
| 161 } | 181 } |
| 162 f->Print("%s:%"Pd"(", DebugName(), GetDeoptId()); | 182 f->Print("%s:%"Pd"(", DebugName(), GetDeoptId()); |
| 163 PrintOperandsTo(f); | 183 PrintOperandsTo(f); |
| 164 f->Print(")"); | 184 f->Print(")"); |
| 165 PrintPropagatedType(f, *this); | 185 PrintPropagatedType(f, *this); |
| 166 } | 186 } |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 parallel_move()->PrintTo(f); | 533 parallel_move()->PrintTo(f); |
| 514 } | 534 } |
| 515 } | 535 } |
| 516 | 536 |
| 517 | 537 |
| 518 void PushArgumentInstr::PrintOperandsTo(BufferFormatter* f) const { | 538 void PushArgumentInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 519 value()->PrintTo(f); | 539 value()->PrintTo(f); |
| 520 } | 540 } |
| 521 | 541 |
| 522 | 542 |
| 523 void ReturnInstr::PrintTo(BufferFormatter* f) const { | |
| 524 f->Print("%s ", DebugName()); | |
| 525 value()->PrintTo(f); | |
| 526 } | |
| 527 | |
| 528 | |
| 529 void ThrowInstr::PrintTo(BufferFormatter* f) const { | |
| 530 f->Print("%s" , DebugName()); | |
| 531 } | |
| 532 | |
| 533 | |
| 534 void ReThrowInstr::PrintTo(BufferFormatter* f) const { | |
| 535 f->Print("%s ", DebugName()); | |
| 536 } | |
| 537 | |
| 538 | |
| 539 void GotoInstr::PrintTo(BufferFormatter* f) const { | 543 void GotoInstr::PrintTo(BufferFormatter* f) const { |
| 540 if (HasParallelMove()) { | 544 if (HasParallelMove()) { |
| 541 parallel_move()->PrintTo(f); | 545 parallel_move()->PrintTo(f); |
| 542 f->Print(" "); | 546 f->Print(" "); |
| 543 } | 547 } |
| 544 f->Print("goto:%"Pd" %"Pd"", GetDeoptId(), successor()->block_id()); | 548 f->Print("goto:%"Pd" %"Pd"", GetDeoptId(), successor()->block_id()); |
| 545 } | 549 } |
| 546 | 550 |
| 547 | 551 |
| 548 void BranchInstr::PrintTo(BufferFormatter* f) const { | 552 void BranchInstr::PrintTo(BufferFormatter* f) const { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 } | 746 } |
| 743 } | 747 } |
| 744 | 748 |
| 745 | 749 |
| 746 void PushArgumentInstr::PrintToVisualizer(BufferFormatter* f) const { | 750 void PushArgumentInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 747 f->Print("_ %s ", DebugName()); | 751 f->Print("_ %s ", DebugName()); |
| 748 value()->PrintTo(f); | 752 value()->PrintTo(f); |
| 749 } | 753 } |
| 750 | 754 |
| 751 | 755 |
| 752 void ReturnInstr::PrintToVisualizer(BufferFormatter* f) const { | |
| 753 f->Print("_ %s ", DebugName()); | |
| 754 value()->PrintTo(f); | |
| 755 } | |
| 756 | |
| 757 | |
| 758 void ThrowInstr::PrintToVisualizer(BufferFormatter* f) const { | |
| 759 f->Print("_ %s ", DebugName()); | |
| 760 } | |
| 761 | |
| 762 | |
| 763 void ReThrowInstr::PrintToVisualizer(BufferFormatter* f) const { | |
| 764 f->Print("_ %s ", DebugName()); | |
| 765 } | |
| 766 | |
| 767 | |
| 768 void GotoInstr::PrintToVisualizer(BufferFormatter* f) const { | 756 void GotoInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 769 f->Print("_ goto B%"Pd"", successor()->block_id()); | 757 f->Print("_ goto B%"Pd"", successor()->block_id()); |
| 770 } | 758 } |
| 771 | 759 |
| 772 | 760 |
| 773 void BranchInstr::PrintToVisualizer(BufferFormatter* f) const { | 761 void BranchInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 774 f->Print("_ %s ", DebugName()); | 762 f->Print("_ %s ", DebugName()); |
| 775 f->Print("if "); | 763 f->Print("if "); |
| 776 comparison()->PrintTo(f); | 764 comparison()->PrintTo(f); |
| 777 f->Print(" goto (B%"Pd", B%"Pd")", | 765 f->Print(" goto (B%"Pd", B%"Pd")", |
| (...skipping 21 matching lines...) Expand all Loading... |
| 799 f->Print(" ["); | 787 f->Print(" ["); |
| 800 locations_[i].PrintTo(f); | 788 locations_[i].PrintTo(f); |
| 801 f->Print("]"); | 789 f->Print("]"); |
| 802 } | 790 } |
| 803 } | 791 } |
| 804 f->Print(" }"); | 792 f->Print(" }"); |
| 805 if (outer_ != NULL) outer_->PrintTo(f); | 793 if (outer_ != NULL) outer_->PrintTo(f); |
| 806 } | 794 } |
| 807 | 795 |
| 808 } // namespace dart | 796 } // namespace dart |
| OLD | NEW |