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

Unified Diff: runtime/vm/locations.h

Issue 10800037: New linear scan allocator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address Kevin's comments 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
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/locations.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/locations.h
diff --git a/runtime/vm/locations.h b/runtime/vm/locations.h
index e52f9d2cfd7594622ed4fff98f1212e04e8638f7..14e928a2512fc7842f4125a2740c647be1abf538 100644
--- a/runtime/vm/locations.h
+++ b/runtime/vm/locations.h
@@ -78,7 +78,10 @@ class Location : public ValueObject {
}
// Unallocated locations.
+ // TODO(vegorov): writable register policy?
enum Policy {
+ kAny,
+ kPrefersRegister,
kRequiresRegister,
kSameAsFirstInput,
};
@@ -87,11 +90,23 @@ class Location : public ValueObject {
return kind() == kUnallocated;
}
+ bool IsRegisterBeneficial() {
+ return !Equals(Any());
+ }
+
static Location UnallocatedLocation(Policy policy) {
return Location(kUnallocated, PolicyField::encode(policy));
}
// Any free register is suitable to replace this unallocated location.
+ static Location Any() {
+ return UnallocatedLocation(kAny);
+ }
+
+ static Location PrefersRegister() {
+ return UnallocatedLocation(kPrefersRegister);
+ }
+
static Location RequiresRegister() {
return UnallocatedLocation(kRequiresRegister);
}
@@ -143,9 +158,8 @@ class Location : public ValueObject {
const char* Name() const;
void PrintTo(BufferFormatter* f) const;
- // Compare two non-constant locations.
+ // Compare two locations.
bool Equals(Location other) const {
- ASSERT(!IsConstant() && !other.IsConstant());
return value_ == other.value_;
}
@@ -169,7 +183,7 @@ class Location : public ValueObject {
typedef BitField<uword, 3, kWordSize * kBitsPerByte - 2> PayloadField;
// Layout for kUnallocated locations payload.
- typedef BitField<Policy, 0, 1> PolicyField;
+ typedef BitField<Policy, 0, 2> PolicyField;
// Location either contains kind and payload fields or a tagged handle for
// a constant locations. Values of enumeration Kind are selected in such a
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/locations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698