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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // Can this live range be spilled at this position. | 335 // Can this live range be spilled at this position. |
336 bool CanBeSpilled(LifetimePosition pos) const; | 336 bool CanBeSpilled(LifetimePosition pos) const; |
337 | 337 |
338 // Splitting primitive used by both splitting and splintering members. | 338 // Splitting primitive used by both splitting and splintering members. |
339 // Performs the split, but does not link the resulting ranges. | 339 // Performs the split, but does not link the resulting ranges. |
340 // The given position must follow the start of the range. | 340 // The given position must follow the start of the range. |
341 // All uses following the given position will be moved from this | 341 // All uses following the given position will be moved from this |
342 // live range to the result live range. | 342 // live range to the result live range. |
343 // The current range will terminate at position, while result will start from | 343 // The current range will terminate at position, while result will start from |
344 // position. | 344 // position. |
345 void DetachAt(LifetimePosition position, LiveRange* result, Zone* zone); | 345 UsePosition* DetachAt(LifetimePosition position, LiveRange* result, |
| 346 Zone* zone); |
346 | 347 |
347 // Detaches at position, and then links the resulting ranges. Returns the | 348 // Detaches at position, and then links the resulting ranges. Returns the |
348 // child, which starts at position. | 349 // child, which starts at position. |
349 LiveRange* SplitAt(LifetimePosition position, Zone* zone); | 350 LiveRange* SplitAt(LifetimePosition position, Zone* zone); |
350 | 351 |
351 // Returns nullptr when no register is hinted, otherwise sets register_index. | 352 // Returns nullptr when no register is hinted, otherwise sets register_index. |
352 UsePosition* FirstHintPosition(int* register_index) const; | 353 UsePosition* FirstHintPosition(int* register_index) const; |
353 UsePosition* FirstHintPosition() const { | 354 UsePosition* FirstHintPosition() const { |
354 int register_index; | 355 int register_index; |
355 return FirstHintPosition(®ister_index); | 356 return FirstHintPosition(®ister_index); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 UseInterval* first_interval_; | 419 UseInterval* first_interval_; |
419 UsePosition* first_pos_; | 420 UsePosition* first_pos_; |
420 TopLevelLiveRange* top_level_; | 421 TopLevelLiveRange* top_level_; |
421 LiveRange* next_; | 422 LiveRange* next_; |
422 // This is used as a cache, it doesn't affect correctness. | 423 // This is used as a cache, it doesn't affect correctness. |
423 mutable UseInterval* current_interval_; | 424 mutable UseInterval* current_interval_; |
424 // This is used as a cache, it doesn't affect correctness. | 425 // This is used as a cache, it doesn't affect correctness. |
425 mutable UsePosition* last_processed_use_; | 426 mutable UsePosition* last_processed_use_; |
426 // This is used as a cache, it's invalid outside of BuildLiveRanges. | 427 // This is used as a cache, it's invalid outside of BuildLiveRanges. |
427 mutable UsePosition* current_hint_position_; | 428 mutable UsePosition* current_hint_position_; |
428 | 429 // Cache the last position splintering stopped at. |
| 430 mutable UsePosition* splitting_pointer_; |
429 // greedy: the number of LifetimePositions covered by this range. Used to | 431 // greedy: the number of LifetimePositions covered by this range. Used to |
430 // prioritize selecting live ranges for register assignment, as well as | 432 // prioritize selecting live ranges for register assignment, as well as |
431 // in weight calculations. | 433 // in weight calculations. |
432 int size_; | 434 int size_; |
433 | 435 |
434 // greedy: a metric for resolving conflicts between ranges with an assigned | 436 // greedy: a metric for resolving conflicts between ranges with an assigned |
435 // register and ranges that intersect them and need a register. | 437 // register and ranges that intersect them and need a register. |
436 float weight_; | 438 float weight_; |
437 | 439 |
438 // greedy: groupping | 440 // greedy: groupping |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 RegisterAllocationData* const data_; | 1086 RegisterAllocationData* const data_; |
1085 | 1087 |
1086 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 1088 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
1087 }; | 1089 }; |
1088 | 1090 |
1089 } // namespace compiler | 1091 } // namespace compiler |
1090 } // namespace internal | 1092 } // namespace internal |
1091 } // namespace v8 | 1093 } // namespace v8 |
1092 | 1094 |
1093 #endif // V8_REGISTER_ALLOCATOR_H_ | 1095 #endif // V8_REGISTER_ALLOCATOR_H_ |
OLD | NEW |