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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/locations.cc
diff --git a/runtime/vm/locations.cc b/runtime/vm/locations.cc
index f70f697d2b51c326ba7d543def1e5dfe44bffad7..ba8d24bcbd39d312e940fea7fb6cf5c09d118056 100644
--- a/runtime/vm/locations.cc
+++ b/runtime/vm/locations.cc
@@ -44,13 +44,19 @@ const char* Location::Name() const {
switch (kind()) {
case kInvalid: return "?";
case kRegister: return Assembler::RegisterName(reg());
+ case kSpillSlot: return "S";
case kUnallocated:
switch (policy()) {
+ case kAny:
+ return "A";
+ case kPrefersRegister:
+ return "P";
case kRequiresRegister:
return "R";
case kSameAsFirstInput:
return "0";
}
+ 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.
default:
ASSERT(IsConstant());
return "C";
@@ -59,12 +65,21 @@ const char* Location::Name() const {
}
+void Location::PrintTo(BufferFormatter* f) const {
+ if (kind() == kSpillSlot) {
+ f->Print("S%d", spill_index());
+ } else {
+ f->Print("%s", Name());
+ }
+}
+
+
void LocationSummary::PrintTo(BufferFormatter* f) const {
if (input_count() > 0) {
f->Print(" (");
for (intptr_t i = 0; i < input_count(); i++) {
if (i != 0) f->Print(", ");
- f->Print("%s", in(i).Name());
+ in(i).PrintTo(f);
}
f->Print(")");
}
@@ -73,14 +88,14 @@ void LocationSummary::PrintTo(BufferFormatter* f) const {
f->Print(" [");
for (intptr_t i = 0; i < temp_count(); i++) {
if (i != 0) f->Print(", ");
- f->Print("%s", temp(i).Name());
+ temp(i).PrintTo(f);
}
f->Print("]");
}
if (!out().IsInvalid()) {
f->Print(" => ");
- f->Print("%s", out().Name());
+ out().PrintTo(f);
}
if (is_call()) f->Print(" C");

Powered by Google App Engine
This is Rietveld 408576698