Chromium Code Reviews| Index: src/compiler/register-allocator.h |
| diff --git a/src/compiler/register-allocator.h b/src/compiler/register-allocator.h |
| index 163dd2ca30698ca9dbe997f6912836c5f26c9b80..2fad371d2adc5a281098e98ca426663af019a7c9 100644 |
| --- a/src/compiler/register-allocator.h |
| +++ b/src/compiler/register-allocator.h |
| @@ -6,6 +6,7 @@ |
| #define V8_REGISTER_ALLOCATOR_H_ |
| #include "src/compiler/instruction.h" |
| +#include "src/ostreams.h" |
| #include "src/zone-containers.h" |
| namespace v8 { |
| @@ -152,6 +153,9 @@ class LifetimePosition final { |
| }; |
| +std::ostream& operator<<(std::ostream& os, const LifetimePosition pos); |
| + |
| + |
| // Representation of the non-empty interval [start,end[. |
| class UseInterval final : public ZoneObject { |
| public: |
| @@ -467,6 +471,13 @@ class LiveRange final : public ZoneObject { |
| DISALLOW_COPY_AND_ASSIGN(LiveRange); |
| }; |
| +struct PrintableLiveRange { |
| + const RegisterConfiguration* register_configuration_; |
| + const LiveRange* range_; |
| +}; |
| + |
| +std::ostream& operator<<(std::ostream& os, |
| + const PrintableLiveRange printable_range); |
|
dcarney
2015/05/01 07:56:03
we usually use const & for these
Mircea Trofin
2015/05/01 15:06:33
Done.
|
| class SpillRange final : public ZoneObject { |
| public: |
| @@ -594,6 +605,22 @@ class RegisterAllocationData final : public ZoneObject { |
| PhiInstruction* phi); |
| PhiMapValue* GetPhiMapValueFor(int virtual_register); |
| + PrintableInstruction ToPrintable(Instruction* ins) const { |
| + return {config_, ins}; |
| + } |
| + |
| + PrintableInstructionOperand ToPrintable(InstructionOperand op) const { |
| + return {config_, op}; |
| + } |
| + |
| + PrintableInstructionSequence ToPrintable(InstructionSequence* seq) const { |
| + return {config_, seq}; |
| + } |
| + |
| + PrintableLiveRange ToPrintable(LiveRange* range) const { |
| + return {config_, range}; |
| + } |
|
dcarney
2015/05/01 07:56:03
these are dead code (gdb only). drop.
in gdb you
Mircea Trofin
2015/05/01 15:06:33
But you still need to construct the Printable{xyz}
|
| + |
| private: |
| Zone* const allocation_zone_; |
| Frame* const frame_; |
| @@ -839,7 +866,11 @@ class GreedyAllocator final : public RegisterAllocator { |
| void AllocateRegisters(); |
| private: |
| + LifetimePosition GetSplittablePos(LifetimePosition pos); |
| const RegisterConfiguration* config() const { return data()->config(); } |
| + Zone* local_zone() { return local_zone_; } |
|
dcarney
2015/05/01 07:56:03
const
Mircea Trofin
2015/05/01 15:06:33
Done.
|
| + bool TryReuseSpillForPhi(LiveRange* range); |
| + int GetHintedRegister(LiveRange* range); |
| typedef ZonePriorityQueue<std::pair<unsigned, LiveRange*>> PQueue; |
| @@ -855,12 +886,17 @@ class GreedyAllocator final : public RegisterAllocator { |
| bool TryAllocatePhysicalRegister(unsigned reg_id, LiveRange* range, |
| ZoneSet<LiveRange*>* conflicting); |
| bool HandleSpillOperands(LiveRange* range); |
| - bool AllocateBlockedRange(LiveRange*, const ZoneSet<LiveRange*>&); |
| + void AllocateBlockedRange(LiveRange* current, LifetimePosition pos, |
| + bool spill); |
| 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); |
| + |
| + Zone* local_zone_; |
| ZoneVector<CoallescedLiveRanges*> allocations_; |
| PQueue queue_; |
| DISALLOW_COPY_AND_ASSIGN(GreedyAllocator); |