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/zone-containers.h" | 10 #include "src/zone-containers.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 void set_spilled(bool value) { bits_ = SpilledField::update(bits_, value); } | 400 void set_spilled(bool value) { bits_ = SpilledField::update(bits_, value); } |
401 | 401 |
402 UseInterval* FirstSearchIntervalForPosition(LifetimePosition position) const; | 402 UseInterval* FirstSearchIntervalForPosition(LifetimePosition position) const; |
403 void AdvanceLastProcessedMarker(UseInterval* to_start_of, | 403 void AdvanceLastProcessedMarker(UseInterval* to_start_of, |
404 LifetimePosition but_not_past) const; | 404 LifetimePosition but_not_past) const; |
405 | 405 |
406 typedef BitField<bool, 0, 1> SpilledField; | 406 typedef BitField<bool, 0, 1> SpilledField; |
407 typedef BitField<int32_t, 6, 6> AssignedRegisterField; | 407 typedef BitField<int32_t, 6, 6> AssignedRegisterField; |
408 typedef BitField<MachineType, 12, 15> MachineTypeField; | 408 typedef BitField<MachineType, 12, 15> MachineTypeField; |
409 | 409 |
| 410 // Unique among children and splinters of the same virtual register. |
410 int relative_id_; | 411 int relative_id_; |
411 uint32_t bits_; | 412 uint32_t bits_; |
412 UseInterval* last_interval_; | 413 UseInterval* last_interval_; |
413 UseInterval* first_interval_; | 414 UseInterval* first_interval_; |
414 UsePosition* first_pos_; | 415 UsePosition* first_pos_; |
415 TopLevelLiveRange* top_level_; | 416 TopLevelLiveRange* top_level_; |
416 LiveRange* next_; | 417 LiveRange* next_; |
417 // This is used as a cache, it doesn't affect correctness. | 418 // This is used as a cache, it doesn't affect correctness. |
418 mutable UseInterval* current_interval_; | 419 mutable UseInterval* current_interval_; |
419 // This is used as a cache, it doesn't affect correctness. | 420 // This is used as a cache, it doesn't affect correctness. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 | 529 |
529 TopLevelLiveRange* splintered_from() const { return splintered_from_; } | 530 TopLevelLiveRange* splintered_from() const { return splintered_from_; } |
530 bool IsSplinter() const { return splintered_from_ != nullptr; } | 531 bool IsSplinter() const { return splintered_from_ != nullptr; } |
531 bool MayRequireSpillRange() const { | 532 bool MayRequireSpillRange() const { |
532 DCHECK(!IsSplinter()); | 533 DCHECK(!IsSplinter()); |
533 return !HasSpillOperand() && spill_range_ == nullptr; | 534 return !HasSpillOperand() && spill_range_ == nullptr; |
534 } | 535 } |
535 void UpdateSpillRangePostMerge(TopLevelLiveRange* merged); | 536 void UpdateSpillRangePostMerge(TopLevelLiveRange* merged); |
536 int vreg() const { return vreg_; } | 537 int vreg() const { return vreg_; } |
537 | 538 |
538 int GetNextChildId() { return ++last_child_id_; } | 539 int GetNextChildId() { |
| 540 return IsSplinter() ? splintered_from()->GetNextChildId() |
| 541 : ++last_child_id_; |
| 542 } |
| 543 |
539 bool IsSpilledOnlyInDeferredBlocks() const { | 544 bool IsSpilledOnlyInDeferredBlocks() const { |
540 return spilled_in_deferred_blocks_; | 545 return spilled_in_deferred_blocks_; |
541 } | 546 } |
542 | 547 |
543 struct SpillAtDefinitionList; | 548 struct SpillAtDefinitionList; |
544 | 549 |
545 SpillAtDefinitionList* spills_at_definition() const { | 550 SpillAtDefinitionList* spills_at_definition() const { |
546 return spills_at_definition_; | 551 return spills_at_definition_; |
547 } | 552 } |
548 void set_last_child(LiveRange* range) { last_child_ = range; } | 553 void set_last_child(LiveRange* range) { last_child_ = range; } |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 RegisterAllocationData* const data_; | 1052 RegisterAllocationData* const data_; |
1048 | 1053 |
1049 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 1054 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
1050 }; | 1055 }; |
1051 | 1056 |
1052 } // namespace compiler | 1057 } // namespace compiler |
1053 } // namespace internal | 1058 } // namespace internal |
1054 } // namespace v8 | 1059 } // namespace v8 |
1055 | 1060 |
1056 #endif // V8_REGISTER_ALLOCATOR_H_ | 1061 #endif // V8_REGISTER_ALLOCATOR_H_ |
OLD | NEW |