Chromium Code Reviews| Index: src/compiler/register-allocator.h |
| diff --git a/src/compiler/register-allocator.h b/src/compiler/register-allocator.h |
| index baffedd919292c93e68b263793f3424c30aa0aaa..d282bf7fbed332583273ffe5748f731b5ed60766 100644 |
| --- a/src/compiler/register-allocator.h |
| +++ b/src/compiler/register-allocator.h |
| @@ -728,12 +728,31 @@ class LiveRangeBuilder final : public ZoneObject { |
| DISALLOW_COPY_AND_ASSIGN(LiveRangeBuilder); |
| }; |
| +struct AllocatorStats { |
| + unsigned spills; |
| + unsigned wins; |
| + unsigned losses_no_eviction; |
| + unsigned losses_after_eviction; |
| + unsigned good_split_attempts; |
| + unsigned good_split_successes; |
| + unsigned good_split_smart_above; |
| + unsigned good_split_smart_below; |
| + unsigned good_split_above; |
| + unsigned good_split_below; |
| + |
| + void reset() { *this = {0}; } |
| +}; |
|
Jarin
2015/05/13 13:12:57
Could we have a proper constructor that sets every
|
| + |
| + |
| +std::ostream& operator<<(std::ostream& os, const AllocatorStats& stats); |
| + |
| class RegisterAllocator : public ZoneObject { |
| public: |
| explicit RegisterAllocator(RegisterAllocationData* data, RegisterKind kind); |
| protected: |
| + AllocatorStats stats_; |
| RegisterAllocationData* data() const { return data_; } |
| InstructionSequence* code() const { return data()->code(); } |
| RegisterKind mode() const { return mode_; } |
| @@ -767,6 +786,7 @@ class RegisterAllocator : public ZoneObject { |
| // hoist spill position out to the point just before the loop. |
| LifetimePosition FindOptimalSpillingPos(LiveRange* range, |
| LifetimePosition pos); |
| + const char* RegisterName(int allocation_index) const; |
| private: |
| RegisterAllocationData* const data_; |
| @@ -786,8 +806,6 @@ class LinearScanAllocator final : public RegisterAllocator { |
| void AllocateRegisters(); |
| private: |
| - const char* RegisterName(int allocation_index) const; |
| - |
| ZoneVector<LiveRange*>& unhandled_live_ranges() { |
| return unhandled_live_ranges_; |
| } |
| @@ -853,7 +871,10 @@ class GreedyAllocator final : public RegisterAllocator { |
| void AllocateRegisters(); |
| private: |
| - LifetimePosition GetSplittablePos(LifetimePosition pos); |
| + bool FindGoodSplitPoint(LiveRange* range, |
| + const ZoneSet<LiveRange*>& conflicts); |
| + LifetimePosition GetSplittablePos(UsePosition* use_pos, LiveRange* range); |
| + LifetimePosition GetCorrectSplitPos(LifetimePosition pos); |
|
Jarin
2015/05/13 13:12:57
Nit: ...Pos -> ...Position)
|
| const RegisterConfiguration* config() const { return data()->config(); } |
| Zone* local_zone() const { return local_zone_; } |
| bool TryReuseSpillForPhi(LiveRange* range); |
| @@ -861,27 +882,29 @@ class GreedyAllocator final : public RegisterAllocator { |
| typedef ZonePriorityQueue<std::pair<unsigned, LiveRange*>> PQueue; |
| + unsigned GetLiveRangeSize(LiveRange* range, LifetimePosition start, |
| + LifetimePosition end); |
| unsigned GetLiveRangeSize(LiveRange* range); |
| void Enqueue(LiveRange* range); |
| void Evict(LiveRange* range); |
| float CalculateSpillWeight(LiveRange* range); |
| - float CalculateMaxSpillWeight(const ZoneSet<LiveRange*>& ranges); |
| - |
| + float CalculateSpillWeight(LiveRange* range, LifetimePosition start, |
| + LifetimePosition end); |
| bool TryAllocate(LiveRange* current, ZoneSet<LiveRange*>* conflicting); |
| bool TryAllocatePhysicalRegister(unsigned reg_id, LiveRange* range, |
| ZoneSet<LiveRange*>* conflicting); |
| bool HandleSpillOperands(LiveRange* range); |
| - void AllocateBlockedRange(LiveRange* current, LifetimePosition pos, |
| - bool spill); |
| + void AllocateBlockedRange(LiveRange* current, |
| + const ZoneSet<LiveRange*>& conflicts); |
| LiveRange* SpillBetweenUntil(LiveRange* range, LifetimePosition start, |
| LifetimePosition until, LifetimePosition end); |
| void AssignRangeToRegister(int reg_id, LiveRange* range); |
| - LifetimePosition FindProgressingSplitPosition(LiveRange* range, |
| - bool* is_spill_pos); |
| + bool RangeHasSplitOrSpillPosition(LiveRange* range, LifetimePosition start, |
| + LifetimePosition end); |
| Zone* local_zone_; |
| ZoneVector<CoalescedLiveRanges*> allocations_; |