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

Unified Diff: runtime/vm/locations.h

Issue 252333002: Use GPRs for mints (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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.h
diff --git a/runtime/vm/locations.h b/runtime/vm/locations.h
index cabb8dbda12a8b5c01da1d51aa4d9cbe84202408..cf6a60b10157c51a340246754bc4eef64b6dd669 100644
--- a/runtime/vm/locations.h
+++ b/runtime/vm/locations.h
@@ -331,11 +331,15 @@ class Location : public ValueObject {
}
intptr_t stack_index() const {
- ASSERT(IsStackSlot() || IsDoubleStackSlot() || IsQuadStackSlot());
+ ASSERT(HasStackIndex());
// Decode stack index manually to preserve sign.
return payload() - kStackIndexBias;
}
+ bool HasStackIndex() const {
+ return IsStackSlot() || IsDoubleStackSlot() || IsQuadStackSlot();
+ }
+
// Return a memory operand for stack slot locations.
Address ToStackSlotAddress() const;
@@ -365,6 +369,8 @@ class Location : public ValueObject {
return KindField::decode(value_);
}
+ Location Copy() const;
+
private:
explicit Location(uword value) : value_(value) { }
@@ -428,15 +434,20 @@ class PairLocation : public ZoneAllocated {
class RegisterSet : public ValueObject {
public:
- RegisterSet() : cpu_registers_(0), fpu_registers_(0) {
+ RegisterSet() : cpu_registers_(0), untagged_cpu_registers_(0),
+ fpu_registers_(0) {
ASSERT(kNumberOfCpuRegisters <= (kWordSize * kBitsPerByte));
ASSERT(kNumberOfFpuRegisters <= (kWordSize * kBitsPerByte));
}
- void Add(Location loc) {
+ void Add(Location loc, Representation rep = kTagged) {
if (loc.IsRegister()) {
cpu_registers_ |= (1 << loc.reg());
+ if (rep != kTagged) {
+ // CPU register contains an untagged value.
+ MarkUntagged(loc);
+ }
} else if (loc.IsFpuRegister()) {
fpu_registers_ |= (1 << loc.fpu_reg());
}
@@ -450,6 +461,32 @@ class RegisterSet : public ValueObject {
}
}
+ void DebugPrint() {
+ for (intptr_t i = 0; i < kNumberOfCpuRegisters; i++) {
+ Register r = static_cast<Register>(i);
+ if (ContainsRegister(r)) {
+ OS::Print("%s %s\n", Assembler::RegisterName(r),
+ IsTagged(r) ? "tagged" : "untagged");
+ }
+ }
+
+ for (intptr_t i = 0; i < kNumberOfFpuRegisters; i++) {
+ FpuRegister r = static_cast<FpuRegister>(i);
+ if (ContainsFpuRegister(r)) {
+ OS::Print("%s\n", Assembler::FpuRegisterName(r));
+ }
+ }
+ }
+
+ void MarkUntagged(Location loc) {
+ ASSERT(loc.IsRegister());
+ untagged_cpu_registers_ |= (1 << loc.reg());
+ }
+
+ bool IsTagged(Register reg) const {
+ return (untagged_cpu_registers_ & (1 << reg)) == 0;
+ }
+
bool ContainsRegister(Register reg) const {
return (cpu_registers_ & (1 << reg)) != 0;
}
@@ -468,6 +505,7 @@ class RegisterSet : public ValueObject {
private:
intptr_t cpu_registers_;
+ intptr_t untagged_cpu_registers_;
intptr_t fpu_registers_;
DISALLOW_COPY_AND_ASSIGN(RegisterSet);
@@ -561,6 +599,10 @@ class LocationSummary : public ZoneAllocated {
return contains_call_ != kNoCall;
}
+ bool HasCallOnSlowPath() {
+ return can_call() && !always_calls();
+ }
+
void PrintTo(BufferFormatter* f) const;
static LocationSummary* Make(intptr_t input_count,

Powered by Google App Engine
This is Rietveld 408576698