| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_REGISTER_ALLOCATOR_H_ | 5 #ifndef V8_REGISTER_ALLOCATOR_H_ |
| 6 #define V8_REGISTER_ALLOCATOR_H_ | 6 #define V8_REGISTER_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include "src/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
| 9 #include "src/zone-containers.h" | 9 #include "src/zone-containers.h" |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 LifetimePosition start() const { return start_; } | 140 LifetimePosition start() const { return start_; } |
| 141 void set_start(LifetimePosition start) { start_ = start; } | 141 void set_start(LifetimePosition start) { start_ = start; } |
| 142 LifetimePosition end() const { return end_; } | 142 LifetimePosition end() const { return end_; } |
| 143 void set_end(LifetimePosition end) { end_ = end; } | 143 void set_end(LifetimePosition end) { end_ = end; } |
| 144 UseInterval* next() const { return next_; } | 144 UseInterval* next() const { return next_; } |
| 145 void set_next(UseInterval* next) { next_ = next; } | 145 void set_next(UseInterval* next) { next_ = next; } |
| 146 | 146 |
| 147 // Split this interval at the given position without effecting the | 147 // Split this interval at the given position without effecting the |
| 148 // live range that owns it. The interval must contain the position. | 148 // live range that owns it. The interval must contain the position. |
| 149 void SplitAt(LifetimePosition pos, Zone* zone); | 149 UseInterval* SplitAt(LifetimePosition pos, Zone* zone); |
| 150 | 150 |
| 151 // If this interval intersects with other return smallest position | 151 // If this interval intersects with other return smallest position |
| 152 // that belongs to both of them. | 152 // that belongs to both of them. |
| 153 LifetimePosition Intersect(const UseInterval* other) const { | 153 LifetimePosition Intersect(const UseInterval* other) const { |
| 154 if (other->start().Value() < start_.Value()) return other->Intersect(this); | 154 if (other->start().Value() < start_.Value()) return other->Intersect(this); |
| 155 if (other->start().Value() < end_.Value()) return other->start(); | 155 if (other->start().Value() < end_.Value()) return other->start(); |
| 156 return LifetimePosition::Invalid(); | 156 return LifetimePosition::Invalid(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool Contains(LifetimePosition point) const { | 159 bool Contains(LifetimePosition point) const { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 334 |
| 335 // Add a new interval or a new use position to this live range. | 335 // Add a new interval or a new use position to this live range. |
| 336 void EnsureInterval(LifetimePosition start, LifetimePosition end, Zone* zone); | 336 void EnsureInterval(LifetimePosition start, LifetimePosition end, Zone* zone); |
| 337 void AddUseInterval(LifetimePosition start, LifetimePosition end, Zone* zone); | 337 void AddUseInterval(LifetimePosition start, LifetimePosition end, Zone* zone); |
| 338 void AddUsePosition(LifetimePosition pos, InstructionOperand* operand, | 338 void AddUsePosition(LifetimePosition pos, InstructionOperand* operand, |
| 339 InstructionOperand* hint, Zone* zone); | 339 InstructionOperand* hint, Zone* zone); |
| 340 | 340 |
| 341 // Shorten the most recently added interval by setting a new start. | 341 // Shorten the most recently added interval by setting a new start. |
| 342 void ShortenTo(LifetimePosition start); | 342 void ShortenTo(LifetimePosition start); |
| 343 | 343 |
| 344 // True if target overlaps an existing interval. | |
| 345 bool HasOverlap(UseInterval* target) const; | |
| 346 void Verify() const; | 344 void Verify() const; |
| 347 | 345 |
| 348 void ConvertUsesToOperand(const InstructionOperand& op, | 346 void ConvertUsesToOperand(const InstructionOperand& op, |
| 349 InstructionOperand* spill_op); | 347 InstructionOperand* spill_op); |
| 350 | 348 |
| 351 void set_kind(RegisterKind kind) { kind_ = kind; } | 349 void set_kind(RegisterKind kind) { kind_ = kind; } |
| 352 | 350 |
| 353 private: | 351 private: |
| 354 struct SpillAtDefinitionList; | 352 struct SpillAtDefinitionList; |
| 355 | 353 |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 RegisterAllocationData* const data_; | 792 RegisterAllocationData* const data_; |
| 795 | 793 |
| 796 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 794 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
| 797 }; | 795 }; |
| 798 | 796 |
| 799 } // namespace compiler | 797 } // namespace compiler |
| 800 } // namespace internal | 798 } // namespace internal |
| 801 } // namespace v8 | 799 } // namespace v8 |
| 802 | 800 |
| 803 #endif // V8_REGISTER_ALLOCATOR_H_ | 801 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |