| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 void UseVal::PrintTo(BufferFormatter* f) const { | 151 void UseVal::PrintTo(BufferFormatter* f) const { |
| 152 if (definition()->HasSSATemp()) { | 152 if (definition()->HasSSATemp()) { |
| 153 f->Print("v%d", definition()->ssa_temp_index()); | 153 f->Print("v%d", definition()->ssa_temp_index()); |
| 154 } else { | 154 } else { |
| 155 f->Print("t%d", definition()->temp_index()); | 155 f->Print("t%d", definition()->temp_index()); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 | 159 |
| 160 void ConstantVal::PrintTo(BufferFormatter* f) const { | 160 void ConstantComp::PrintOperandsTo(BufferFormatter* f) const { |
| 161 f->Print("#%s", value().ToCString()); | 161 f->Print("#%s", value().ToCString()); |
| 162 } | 162 } |
| 163 | 163 |
| 164 | 164 |
| 165 void MaterializeComp::PrintOperandsTo(BufferFormatter* f) const { | |
| 166 constant_val()->PrintTo(f); | |
| 167 } | |
| 168 | |
| 169 | |
| 170 void AssertAssignableComp::PrintOperandsTo(BufferFormatter* f) const { | 165 void AssertAssignableComp::PrintOperandsTo(BufferFormatter* f) const { |
| 171 value()->PrintTo(f); | 166 value()->PrintTo(f); |
| 172 f->Print(", %s, '%s'%s", | 167 f->Print(", %s, '%s'%s", |
| 173 String::Handle(dst_type().Name()).ToCString(), | 168 String::Handle(dst_type().Name()).ToCString(), |
| 174 dst_name().ToCString(), | 169 dst_name().ToCString(), |
| 175 is_eliminated() ? " eliminated" : ""); | 170 is_eliminated() ? " eliminated" : ""); |
| 176 f->Print(" instantiator("); | 171 f->Print(" instantiator("); |
| 177 instantiator()->PrintTo(f); | 172 instantiator()->PrintTo(f); |
| 178 f->Print(")"); | 173 f->Print(")"); |
| 179 f->Print(" instantiator_type_arguments("); | 174 f->Print(" instantiator_type_arguments("); |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 } | 731 } |
| 737 | 732 |
| 738 | 733 |
| 739 void JoinEntryInstr::PrintToVisualizer(BufferFormatter* f) const { | 734 void JoinEntryInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 740 f->Print("_ [join]"); | 735 f->Print("_ [join]"); |
| 741 } | 736 } |
| 742 | 737 |
| 743 | 738 |
| 744 void PhiInstr::PrintToVisualizer(BufferFormatter* f) const { | 739 void PhiInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 745 f->Print("v%d [", ssa_temp_index()); | 740 f->Print("v%d [", ssa_temp_index()); |
| 746 bool has_constant = false; | |
| 747 for (intptr_t i = 0; i < InputCount(); ++i) { | 741 for (intptr_t i = 0; i < InputCount(); ++i) { |
| 748 if (i > 0) f->Print(" "); | 742 if (i > 0) f->Print(" "); |
| 749 if (InputAt(i)->IsConstant()) { | 743 InputAt(i)->PrintTo(f); |
| 750 f->Print("const"); | |
| 751 has_constant = true; | |
| 752 } else { | |
| 753 InputAt(i)->PrintTo(f); | |
| 754 } | |
| 755 } | 744 } |
| 756 f->Print("]"); | 745 f->Print("]"); |
| 757 // The vizualizer file format does not allow arbitrary strings inside the phi. | |
| 758 // Print constants as a line-end comment instead. | |
| 759 if (has_constant) { | |
| 760 f->Print("\""); | |
| 761 for (intptr_t i = 0; i < InputCount(); ++i) { | |
| 762 if (i > 0) f->Print(" "); | |
| 763 if (InputAt(i)->IsConstant()) { | |
| 764 InputAt(i)->PrintTo(f); | |
| 765 } | |
| 766 } | |
| 767 f->Print("\""); | |
| 768 } | |
| 769 } | 746 } |
| 770 | 747 |
| 771 | 748 |
| 772 void ParameterInstr::PrintToVisualizer(BufferFormatter* f) const { | 749 void ParameterInstr::PrintToVisualizer(BufferFormatter* f) const { |
| 773 ASSERT(HasSSATemp()); | 750 ASSERT(HasSSATemp()); |
| 774 ASSERT(temp_index() == -1); | 751 ASSERT(temp_index() == -1); |
| 775 f->Print("v%d Parameter(%d)", ssa_temp_index(), index()); | 752 f->Print("v%d Parameter(%d)", ssa_temp_index(), index()); |
| 776 } | 753 } |
| 777 | 754 |
| 778 | 755 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 if ((locations_ != NULL) && !locations_[i].IsInvalid()) { | 839 if ((locations_ != NULL) && !locations_[i].IsInvalid()) { |
| 863 f->Print(" ["); | 840 f->Print(" ["); |
| 864 locations_[i].PrintTo(f); | 841 locations_[i].PrintTo(f); |
| 865 f->Print("]"); | 842 f->Print("]"); |
| 866 } | 843 } |
| 867 } | 844 } |
| 868 f->Print(" }"); | 845 f->Print(" }"); |
| 869 } | 846 } |
| 870 | 847 |
| 871 } // namespace dart | 848 } // namespace dart |
| OLD | NEW |