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/ostreams.h" | 9 #include "src/ostreams.h" |
10 #include "src/register-configuration.h" | 10 #include "src/register-configuration.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 LifetimePosition Intersect(const UseInterval* other) const { | 189 LifetimePosition Intersect(const UseInterval* other) const { |
190 if (other->start() < start_) return other->Intersect(this); | 190 if (other->start() < start_) return other->Intersect(this); |
191 if (other->start() < end_) return other->start(); | 191 if (other->start() < end_) return other->start(); |
192 return LifetimePosition::Invalid(); | 192 return LifetimePosition::Invalid(); |
193 } | 193 } |
194 | 194 |
195 bool Contains(LifetimePosition point) const { | 195 bool Contains(LifetimePosition point) const { |
196 return start_ <= point && point < end_; | 196 return start_ <= point && point < end_; |
197 } | 197 } |
198 | 198 |
199 int FirstInstructionIndex() const { | 199 // Returns the index of the first gap covered by this interval. |
| 200 int FirstGapIndex() const { |
200 int ret = start_.ToInstructionIndex(); | 201 int ret = start_.ToInstructionIndex(); |
201 if (start_.IsInstructionPosition() && start_.IsEnd()) { | 202 if (start_.IsInstructionPosition()) { |
202 ++ret; | 203 ++ret; |
203 } | 204 } |
204 return ret; | 205 return ret; |
205 } | 206 } |
206 | 207 |
207 int LastInstructionIndex() const { | 208 // Returns the index of the last gap covered by this interval. |
| 209 int LastGapIndex() const { |
208 int ret = end_.ToInstructionIndex(); | 210 int ret = end_.ToInstructionIndex(); |
209 if (end_.IsGapPosition() || end_.IsStart()) { | 211 if (end_.IsGapPosition() && end_.IsStart()) { |
210 --ret; | 212 --ret; |
211 } | 213 } |
212 return ret; | 214 return ret; |
213 } | 215 } |
214 | 216 |
215 private: | 217 private: |
216 LifetimePosition start_; | 218 LifetimePosition start_; |
217 LifetimePosition end_; | 219 LifetimePosition end_; |
218 UseInterval* next_; | 220 UseInterval* next_; |
219 | 221 |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 // branches. | 1145 // branches. |
1144 void ResolveControlFlow(Zone* local_zone); | 1146 void ResolveControlFlow(Zone* local_zone); |
1145 | 1147 |
1146 private: | 1148 private: |
1147 RegisterAllocationData* data() const { return data_; } | 1149 RegisterAllocationData* data() const { return data_; } |
1148 InstructionSequence* code() const { return data()->code(); } | 1150 InstructionSequence* code() const { return data()->code(); } |
1149 Zone* code_zone() const { return code()->zone(); } | 1151 Zone* code_zone() const { return code()->zone(); } |
1150 | 1152 |
1151 bool CanEagerlyResolveControlFlow(const InstructionBlock* block) const; | 1153 bool CanEagerlyResolveControlFlow(const InstructionBlock* block) const; |
1152 | 1154 |
1153 void ResolveControlFlow(const InstructionBlock* block, | 1155 int ResolveControlFlow(const InstructionBlock* block, |
1154 const InstructionOperand& cur_op, | 1156 const InstructionOperand& cur_op, |
1155 const InstructionBlock* pred, | 1157 const InstructionBlock* pred, |
1156 const InstructionOperand& pred_op); | 1158 const InstructionOperand& pred_op); |
1157 | 1159 |
1158 RegisterAllocationData* const data_; | 1160 RegisterAllocationData* const data_; |
1159 | 1161 |
1160 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 1162 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
1161 }; | 1163 }; |
1162 | 1164 |
1163 } // namespace compiler | 1165 } // namespace compiler |
1164 } // namespace internal | 1166 } // namespace internal |
1165 } // namespace v8 | 1167 } // namespace v8 |
1166 | 1168 |
1167 #endif // V8_REGISTER_ALLOCATOR_H_ | 1169 #endif // V8_REGISTER_ALLOCATOR_H_ |
OLD | NEW |