Chromium Code Reviews| Index: runtime/vm/locations.h |
| diff --git a/runtime/vm/locations.h b/runtime/vm/locations.h |
| index 43182cd159ca42603bd9731fdc4eba70a61823cc..f70ea74603ed88737ebcdd2d4ebe2c7207468915 100644 |
| --- a/runtime/vm/locations.h |
| +++ b/runtime/vm/locations.h |
| @@ -13,6 +13,7 @@ namespace dart { |
| class BufferFormatter; |
| class Value; |
| +class PairLocation; |
| enum Representation { |
| @@ -24,6 +25,8 @@ enum Representation { |
| kUnboxedFloat32x4, |
| kUnboxedInt32x4, |
| kUnboxedFloat64x2, |
| + kPairOfTagged, |
| + kPairOfUnboxedDouble, |
| kNumRepresentations |
| }; |
| @@ -33,7 +36,7 @@ enum Representation { |
| // LocationSummary object which specifies expected location for every input |
| // and output. |
| // Each location is encoded as a single word: for non-constant locations |
| -// low 3 bits denote location kind, rest is kind specific location payload |
| +// low 4 bits denote location kind, rest is kind specific location payload |
| // e.g. for REGISTER kind payload is register code (value of the Register |
| // enumeration), constant locations contain a tagged (low 2 bits are set to 01) |
| // Object handle. |
| @@ -53,13 +56,10 @@ class Location : public ValueObject { |
| static const uword kInvalidLocation = 0; |
| static const uword kConstantMask = 0x3; |
| - static const intptr_t kMachineRegisterMask = 0x6; |
| - static const intptr_t kMachineRegister = 0x6; |
| - |
| public: |
| // Constant payload can overlap with kind field so Kind values |
| // have to be chosen in a way that their last 2 bits are never |
| - // the same as kConstant. |
| + // the same as kConstant or kPairLocation. |
|
Florian Schneider
2014/04/04 11:52:46
Maybe you can turn this comment into COMPILE_ASSER
Cutch
2014/04/04 16:34:46
Done.
|
| // Note that two locations with different kinds should never point to |
| // the same place. For example kQuadStackSlot location should never intersect |
| // with kDoubleStackSlot location. |
| @@ -70,25 +70,28 @@ class Location : public ValueObject { |
| // Constant value. This location contains a tagged Object handle. |
| kConstant = 1, |
| + // This location contains a pointer to a PairLocation. |
| + kPairLocation = 2, |
| + |
| // Unallocated location represents a location that is not fixed and can be |
| // allocated by a register allocator. Each unallocated location has |
| // a policy that specifies what kind of location is suitable. Payload |
| // contains register allocation policy. |
| - kUnallocated = 2, |
| + kUnallocated = 3, |
| // Spill slots allocated by the register allocator. Payload contains |
| // a spill index. |
| - kStackSlot = 3, // Word size slot. |
| - kDoubleStackSlot = 4, // 64bit stack slot. |
| - kQuadStackSlot = 8, // 128bit stack slot. |
| + kStackSlot = 4, // Word size slot. |
| + kDoubleStackSlot = 7, // 64bit stack slot. |
| + kQuadStackSlot = 11, // 128bit stack slot. |
| // Register location represents a fixed register. Payload contains |
| // register code. |
| - kRegister = 6, |
| + kRegister = 8, |
| // FpuRegister location represents a fixed fpu register. Payload contains |
| // its code. |
| - kFpuRegister = 7, |
| + kFpuRegister = 12, |
| }; |
| Location() : value_(kInvalidLocation) { |
| @@ -123,6 +126,15 @@ class Location : public ValueObject { |
| return *reinterpret_cast<const Object*>(value_ & ~kConstantMask); |
| } |
| + bool IsPairLocation() const { |
| + ASSERT((kPairLocation & kConstantMask) == kPairLocation); |
|
Florian Schneider
2014/04/04 11:52:46
Use COMPILE_ASSERT here.
Cutch
2014/04/04 16:34:46
Done here and elsewhere.
|
| + return (value_ & kConstantMask) == kPairLocation; |
|
Florian Schneider
2014/04/04 11:52:46
kConstantMask is not the right name anymore since
Cutch
2014/04/04 16:34:46
Renamed to kLocationTagMask.
|
| + } |
| + |
| + static Location Pair(Location first, Location second); |
| + |
| + PairLocation* AsPairLocation() const; |
| + |
| // Unallocated locations. |
| enum Policy { |
| kAny, |
| @@ -211,7 +223,7 @@ class Location : public ValueObject { |
| } |
| static bool IsMachineRegisterKind(Kind kind) { |
| - return (kind & kMachineRegisterMask) == kMachineRegister; |
| + return (kind == kRegister) || (kind == kFpuRegister); |
| } |
| static Location MachineRegisterLocation(Kind kind, |
| @@ -337,6 +349,40 @@ class Location : public ValueObject { |
| }; |
| +class PairLocation : public ZoneAllocated { |
| + public: |
| + PairLocation() { |
| + for (intptr_t i = 0; i < kPairLength; i++) { |
| + ASSERT(locations_[i].IsInvalid()); |
| + } |
| + } |
| + |
| + intptr_t length() const { return kPairLength; } |
| + |
| + Location At(intptr_t i) const { |
| + ASSERT(i >= 0); |
| + ASSERT(i < kPairLength); |
| + return locations_[i]; |
| + } |
| + |
| + void SetAt(intptr_t i, Location loc) { |
| + ASSERT(i >= 0); |
| + ASSERT(i < kPairLength); |
| + locations_[i] = loc; |
| + } |
| + |
| + Location* SlotAt(intptr_t i) { |
| + ASSERT(i >= 0); |
| + ASSERT(i < kPairLength); |
| + return &locations_[i]; |
| + } |
| + |
| + private: |
| + static const intptr_t kPairLength = 2; |
| + Location locations_[kPairLength]; |
| +}; |
| + |
| + |
| class RegisterSet : public ValueObject { |
| public: |
| RegisterSet() : cpu_registers_(0), fpu_registers_(0) { |