| 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/locations.h" | 5 #include "vm/locations.h" |
| 6 | 6 |
| 7 #include "vm/il_printer.h" | 7 #include "vm/il_printer.h" |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 summary->set_out(out); | 22 summary->set_out(out); |
| 23 return summary; | 23 return summary; |
| 24 } | 24 } |
| 25 | 25 |
| 26 | 26 |
| 27 const char* Location::Name() const { | 27 const char* Location::Name() const { |
| 28 switch (kind()) { | 28 switch (kind()) { |
| 29 case kInvalid: return "?"; | 29 case kInvalid: return "?"; |
| 30 case kRegister: return Assembler::RegisterName(reg()); | 30 case kRegister: return Assembler::RegisterName(reg()); |
| 31 case kSpillSlot: return "S"; |
| 31 case kUnallocated: | 32 case kUnallocated: |
| 32 switch (policy()) { | 33 switch (policy()) { |
| 34 case kAny: |
| 35 return "A"; |
| 36 case kPrefersRegister: |
| 37 return "P"; |
| 33 case kRequiresRegister: | 38 case kRequiresRegister: |
| 34 return "R"; | 39 return "R"; |
| 35 case kSameAsFirstInput: | 40 case kSameAsFirstInput: |
| 36 return "0"; | 41 return "0"; |
| 37 } | 42 } |
| 43 UNREACHABLE(); |
| 38 default: | 44 default: |
| 39 ASSERT(IsConstant()); | 45 ASSERT(IsConstant()); |
| 40 return "C"; | 46 return "C"; |
| 41 } | 47 } |
| 42 return "?"; | 48 return "?"; |
| 43 } | 49 } |
| 44 | 50 |
| 45 | 51 |
| 52 void Location::PrintTo(BufferFormatter* f) const { |
| 53 if (kind() == kSpillSlot) { |
| 54 f->Print("S%d", spill_index()); |
| 55 } else { |
| 56 f->Print("%s", Name()); |
| 57 } |
| 58 } |
| 59 |
| 60 |
| 46 void LocationSummary::PrintTo(BufferFormatter* f) const { | 61 void LocationSummary::PrintTo(BufferFormatter* f) const { |
| 47 if (input_count() > 0) { | 62 if (input_count() > 0) { |
| 48 f->Print(" ("); | 63 f->Print(" ("); |
| 49 for (intptr_t i = 0; i < input_count(); i++) { | 64 for (intptr_t i = 0; i < input_count(); i++) { |
| 50 if (i != 0) f->Print(", "); | 65 if (i != 0) f->Print(", "); |
| 51 f->Print("%s", in(i).Name()); | 66 in(i).PrintTo(f); |
| 52 } | 67 } |
| 53 f->Print(")"); | 68 f->Print(")"); |
| 54 } | 69 } |
| 55 | 70 |
| 56 if (temp_count() > 0) { | 71 if (temp_count() > 0) { |
| 57 f->Print(" ["); | 72 f->Print(" ["); |
| 58 for (intptr_t i = 0; i < temp_count(); i++) { | 73 for (intptr_t i = 0; i < temp_count(); i++) { |
| 59 if (i != 0) f->Print(", "); | 74 if (i != 0) f->Print(", "); |
| 60 f->Print("%s", temp(i).Name()); | 75 temp(i).PrintTo(f); |
| 61 } | 76 } |
| 62 f->Print("]"); | 77 f->Print("]"); |
| 63 } | 78 } |
| 64 | 79 |
| 65 if (!out().IsInvalid()) { | 80 if (!out().IsInvalid()) { |
| 66 f->Print(" => "); | 81 f->Print(" => "); |
| 67 f->Print("%s", out().Name()); | 82 out().PrintTo(f); |
| 68 } | 83 } |
| 69 | 84 |
| 70 if (is_call()) f->Print(" C"); | 85 if (is_call()) f->Print(" C"); |
| 71 } | 86 } |
| 72 | 87 |
| 73 } // namespace dart | 88 } // namespace dart |
| 74 | 89 |
| OLD | NEW |