Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: runtime/vm/locations.cc

Issue 10800037: New linear scan allocator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: refactored liveness computation Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 26 matching lines...) Expand all
37 } 37 }
38 summary->set_out(out); 38 summary->set_out(out);
39 return summary; 39 return summary;
40 } 40 }
41 41
42 42
43 const char* Location::Name() const { 43 const char* Location::Name() const {
44 switch (kind()) { 44 switch (kind()) {
45 case kInvalid: return "?"; 45 case kInvalid: return "?";
46 case kRegister: return Assembler::RegisterName(reg()); 46 case kRegister: return Assembler::RegisterName(reg());
47 case kSpillSlot: return "S";
47 case kUnallocated: 48 case kUnallocated:
48 switch (policy()) { 49 switch (policy()) {
50 case kAny:
51 return "A";
52 case kPrefersRegister:
53 return "P";
49 case kRequiresRegister: 54 case kRequiresRegister:
50 return "R"; 55 return "R";
51 case kSameAsFirstInput: 56 case kSameAsFirstInput:
52 return "0"; 57 return "0";
53 } 58 }
59 UNREACHABLE();
srdjan 2012/07/22 23:27:33 Why not default UNREACHABLE?
Vyacheslav Egorov (Google) 2012/07/23 11:48:39 I prefer compilation error to the runtime error. I
srdjan 2012/07/23 17:02:50 I agree.
54 default: 60 default:
55 ASSERT(IsConstant()); 61 ASSERT(IsConstant());
56 return "C"; 62 return "C";
57 } 63 }
58 return "?"; 64 return "?";
59 } 65 }
60 66
61 67
68 void Location::PrintTo(BufferFormatter* f) const {
69 if (kind() == kSpillSlot) {
70 f->Print("S%d", spill_index());
71 } else {
72 f->Print("%s", Name());
73 }
74 }
75
76
62 void LocationSummary::PrintTo(BufferFormatter* f) const { 77 void LocationSummary::PrintTo(BufferFormatter* f) const {
63 if (input_count() > 0) { 78 if (input_count() > 0) {
64 f->Print(" ("); 79 f->Print(" (");
65 for (intptr_t i = 0; i < input_count(); i++) { 80 for (intptr_t i = 0; i < input_count(); i++) {
66 if (i != 0) f->Print(", "); 81 if (i != 0) f->Print(", ");
67 f->Print("%s", in(i).Name()); 82 in(i).PrintTo(f);
68 } 83 }
69 f->Print(")"); 84 f->Print(")");
70 } 85 }
71 86
72 if (temp_count() > 0) { 87 if (temp_count() > 0) {
73 f->Print(" ["); 88 f->Print(" [");
74 for (intptr_t i = 0; i < temp_count(); i++) { 89 for (intptr_t i = 0; i < temp_count(); i++) {
75 if (i != 0) f->Print(", "); 90 if (i != 0) f->Print(", ");
76 f->Print("%s", temp(i).Name()); 91 temp(i).PrintTo(f);
77 } 92 }
78 f->Print("]"); 93 f->Print("]");
79 } 94 }
80 95
81 if (!out().IsInvalid()) { 96 if (!out().IsInvalid()) {
82 f->Print(" => "); 97 f->Print(" => ");
83 f->Print("%s", out().Name()); 98 out().PrintTo(f);
84 } 99 }
85 100
86 if (is_call()) f->Print(" C"); 101 if (is_call()) f->Print(" C");
87 } 102 }
88 103
89 } // namespace dart 104 } // namespace dart
90 105
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698