| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_CRANKSHAFT_LITHIUM_ALLOCATOR_H_ | 5 #ifndef V8_CRANKSHAFT_LITHIUM_ALLOCATOR_H_ |
| 6 #define V8_CRANKSHAFT_LITHIUM_ALLOCATOR_H_ | 6 #define V8_CRANKSHAFT_LITHIUM_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/base/compiler-specific.h" | 9 #include "src/base/compiler-specific.h" |
| 10 #include "src/crankshaft/compilation-phase.h" | 10 #include "src/crankshaft/compilation-phase.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // Code relies on kStep being a power of two. | 111 // Code relies on kStep being a power of two. |
| 112 STATIC_ASSERT(IS_POWER_OF_TWO(kStep)); | 112 STATIC_ASSERT(IS_POWER_OF_TWO(kStep)); |
| 113 | 113 |
| 114 explicit LifetimePosition(int value) : value_(value) { } | 114 explicit LifetimePosition(int value) : value_(value) { } |
| 115 | 115 |
| 116 int value_; | 116 int value_; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 | 119 |
| 120 // Representation of the non-empty interval [start,end[. | 120 // Representation of the non-empty interval [start,end[. |
| 121 class UseInterval: public ZoneObject { | 121 class UseInterval : public ZoneObject { |
| 122 public: | 122 public: |
| 123 UseInterval(LifetimePosition start, LifetimePosition end) | 123 UseInterval(LifetimePosition start, LifetimePosition end) |
| 124 : start_(start), end_(end), next_(NULL) { | 124 : start_(start), end_(end), next_(NULL) { |
| 125 DCHECK(start.Value() < end.Value()); | 125 DCHECK(start.Value() < end.Value()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 LifetimePosition start() const { return start_; } | 128 LifetimePosition start() const { return start_; } |
| 129 LifetimePosition end() const { return end_; } | 129 LifetimePosition end() const { return end_; } |
| 130 UseInterval* next() const { return next_; } | 130 UseInterval* next() const { return next_; } |
| 131 | 131 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 150 void set_next(UseInterval* next) { next_ = next; } | 150 void set_next(UseInterval* next) { next_ = next; } |
| 151 | 151 |
| 152 LifetimePosition start_; | 152 LifetimePosition start_; |
| 153 LifetimePosition end_; | 153 LifetimePosition end_; |
| 154 UseInterval* next_; | 154 UseInterval* next_; |
| 155 | 155 |
| 156 friend class LiveRange; // Assigns to start_. | 156 friend class LiveRange; // Assigns to start_. |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 // Representation of a use position. | 159 // Representation of a use position. |
| 160 class UsePosition: public ZoneObject { | 160 class UsePosition : public ZoneObject { |
| 161 public: | 161 public: |
| 162 UsePosition(LifetimePosition pos, LOperand* operand, LOperand* hint); | 162 UsePosition(LifetimePosition pos, LOperand* operand, LOperand* hint); |
| 163 | 163 |
| 164 LOperand* operand() const { return operand_; } | 164 LOperand* operand() const { return operand_; } |
| 165 bool HasOperand() const { return operand_ != NULL; } | 165 bool HasOperand() const { return operand_ != NULL; } |
| 166 | 166 |
| 167 LOperand* hint() const { return hint_; } | 167 LOperand* hint() const { return hint_; } |
| 168 bool HasHint() const; | 168 bool HasHint() const; |
| 169 bool RequiresRegister() const; | 169 bool RequiresRegister() const; |
| 170 bool RegisterIsBeneficial() const; | 170 bool RegisterIsBeneficial() const; |
| 171 | 171 |
| 172 LifetimePosition pos() const { return pos_; } | 172 LifetimePosition pos() const { return pos_; } |
| 173 UsePosition* next() const { return next_; } | 173 UsePosition* next() const { return next_; } |
| 174 | 174 |
| 175 private: | 175 private: |
| 176 void set_next(UsePosition* next) { next_ = next; } | 176 void set_next(UsePosition* next) { next_ = next; } |
| 177 | 177 |
| 178 LOperand* const operand_; | 178 LOperand* const operand_; |
| 179 LOperand* const hint_; | 179 LOperand* const hint_; |
| 180 LifetimePosition const pos_; | 180 LifetimePosition const pos_; |
| 181 UsePosition* next_; | 181 UsePosition* next_; |
| 182 bool requires_reg_; | 182 bool requires_reg_; |
| 183 bool register_beneficial_; | 183 bool register_beneficial_; |
| 184 | 184 |
| 185 friend class LiveRange; | 185 friend class LiveRange; |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 // Representation of SSA values' live ranges as a collection of (continuous) | 188 // Representation of SSA values' live ranges as a collection of (continuous) |
| 189 // intervals over the instruction ordering. | 189 // intervals over the instruction ordering. |
| 190 class LiveRange: public ZoneObject { | 190 class LiveRange : public ZoneObject { |
| 191 public: | 191 public: |
| 192 static const int kInvalidAssignment = 0x7fffffff; | 192 static const int kInvalidAssignment = 0x7fffffff; |
| 193 | 193 |
| 194 LiveRange(int id, Zone* zone); | 194 LiveRange(int id, Zone* zone); |
| 195 | 195 |
| 196 UseInterval* first_interval() const { return first_interval_; } | 196 UseInterval* first_interval() const { return first_interval_; } |
| 197 UsePosition* first_pos() const { return first_pos_; } | 197 UsePosition* first_pos() const { return first_pos_; } |
| 198 LiveRange* parent() const { return parent_; } | 198 LiveRange* parent() const { return parent_; } |
| 199 LiveRange* TopLevel() { return (parent_ == NULL) ? this : parent_; } | 199 LiveRange* TopLevel() { return (parent_ == NULL) ? this : parent_; } |
| 200 LiveRange* next() const { return next_; } | 200 LiveRange* next() const { return next_; } |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 size_t allocator_zone_start_allocation_size_; | 567 size_t allocator_zone_start_allocation_size_; |
| 568 | 568 |
| 569 DISALLOW_COPY_AND_ASSIGN(LAllocatorPhase); | 569 DISALLOW_COPY_AND_ASSIGN(LAllocatorPhase); |
| 570 }; | 570 }; |
| 571 | 571 |
| 572 | 572 |
| 573 } // namespace internal | 573 } // namespace internal |
| 574 } // namespace v8 | 574 } // namespace v8 |
| 575 | 575 |
| 576 #endif // V8_CRANKSHAFT_LITHIUM_ALLOCATOR_H_ | 576 #endif // V8_CRANKSHAFT_LITHIUM_ALLOCATOR_H_ |
| OLD | NEW |