Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1199)

Side by Side Diff: src/compiler/register-allocator.h

Issue 1391023007: [turbofan] Splinter into one range. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 void AddUseInterval(LifetimePosition start, LifetimePosition end, Zone* zone); 486 void AddUseInterval(LifetimePosition start, LifetimePosition end, Zone* zone);
487 void AddUsePosition(UsePosition* pos); 487 void AddUsePosition(UsePosition* pos);
488 488
489 // Shorten the most recently added interval by setting a new start. 489 // Shorten the most recently added interval by setting a new start.
490 void ShortenTo(LifetimePosition start); 490 void ShortenTo(LifetimePosition start);
491 491
492 // Detaches between start and end, and attributes the resulting range to 492 // Detaches between start and end, and attributes the resulting range to
493 // result. 493 // result.
494 // The current range is pointed to as "splintered_from". No parent/child 494 // The current range is pointed to as "splintered_from". No parent/child
495 // relationship is established between this and result. 495 // relationship is established between this and result.
496 void Splinter(LifetimePosition start, LifetimePosition end, 496 void Splinter(LifetimePosition start, LifetimePosition end, Zone* zone);
497 TopLevelLiveRange* result, Zone* zone);
498 497
499 // Assuming other was splintered from this range, embeds other and its 498 // Assuming other was splintered from this range, embeds other and its
500 // children as part of the children sequence of this range. 499 // children as part of the children sequence of this range.
501 void Merge(TopLevelLiveRange* other, Zone* zone); 500 void Merge(TopLevelLiveRange* other, Zone* zone);
502 501
503 // Spill range management. 502 // Spill range management.
504 void SetSpillRange(SpillRange* spill_range); 503 void SetSpillRange(SpillRange* spill_range);
505 enum class SpillType { kNoSpillType, kSpillOperand, kSpillRange }; 504 enum class SpillType { kNoSpillType, kSpillOperand, kSpillRange };
506 void set_spill_type(SpillType value) { 505 void set_spill_type(SpillType value) {
507 bits_ = SpillTypeField::update(bits_, value); 506 bits_ = SpillTypeField::update(bits_, value);
(...skipping 23 matching lines...) Expand all
531 530
532 AllocatedOperand GetSpillRangeOperand() const; 531 AllocatedOperand GetSpillRangeOperand() const;
533 532
534 void SpillAtDefinition(Zone* zone, int gap_index, 533 void SpillAtDefinition(Zone* zone, int gap_index,
535 InstructionOperand* operand); 534 InstructionOperand* operand);
536 void SetSpillOperand(InstructionOperand* operand); 535 void SetSpillOperand(InstructionOperand* operand);
537 void SetSpillStartIndex(int start) { 536 void SetSpillStartIndex(int start) {
538 spill_start_index_ = Min(start, spill_start_index_); 537 spill_start_index_ = Min(start, spill_start_index_);
539 } 538 }
540 539
541 void SetSplinteredFrom(TopLevelLiveRange* splinter_parent);
542 void CommitSpillsAtDefinition(InstructionSequence* sequence, 540 void CommitSpillsAtDefinition(InstructionSequence* sequence,
543 const InstructionOperand& operand, 541 const InstructionOperand& operand,
544 bool might_be_duplicated); 542 bool might_be_duplicated);
545 543
546 // If all the children of this range are spilled in deferred blocks, and if 544 // If all the children of this range are spilled in deferred blocks, and if
547 // for any non-spilled child with a use position requiring a slot, that range 545 // for any non-spilled child with a use position requiring a slot, that range
548 // is contained in a deferred block, mark the range as 546 // is contained in a deferred block, mark the range as
549 // IsSpilledOnlyInDeferredBlocks, so that we avoid spilling at definition, 547 // IsSpilledOnlyInDeferredBlocks, so that we avoid spilling at definition,
550 // and instead let the LiveRangeConnector perform the spills within the 548 // and instead let the LiveRangeConnector perform the spills within the
551 // deferred blocks. If so, we insert here spills for non-spilled ranges 549 // deferred blocks. If so, we insert here spills for non-spilled ranges
(...skipping 19 matching lines...) Expand all
571 return spilled_in_deferred_blocks_; 569 return spilled_in_deferred_blocks_;
572 } 570 }
573 571
574 struct SpillAtDefinitionList; 572 struct SpillAtDefinitionList;
575 573
576 SpillAtDefinitionList* spills_at_definition() const { 574 SpillAtDefinitionList* spills_at_definition() const {
577 return spills_at_definition_; 575 return spills_at_definition_;
578 } 576 }
579 void set_last_child(LiveRange* range) { last_child_ = range; } 577 void set_last_child(LiveRange* range) { last_child_ = range; }
580 LiveRange* last_child() const { return last_child_; } 578 LiveRange* last_child() const { return last_child_; }
579 TopLevelLiveRange* splinter() const { return splinter_; }
580 void SetSplinter(TopLevelLiveRange* splinter) {
581 DCHECK_NULL(splinter_);
582 DCHECK_NOT_NULL(splinter);
583
584 splinter_ = splinter;
585 splinter->relative_id_ = GetNextChildId();
586 splinter->set_spill_type(spill_type());
587 splinter->SetSplinteredFrom(this);
588 }
581 589
582 private: 590 private:
591 void SetSplinteredFrom(TopLevelLiveRange* splinter_parent);
592
583 typedef BitField<bool, 1, 1> HasSlotUseField; 593 typedef BitField<bool, 1, 1> HasSlotUseField;
584 typedef BitField<bool, 2, 1> IsPhiField; 594 typedef BitField<bool, 2, 1> IsPhiField;
585 typedef BitField<bool, 3, 1> IsNonLoopPhiField; 595 typedef BitField<bool, 3, 1> IsNonLoopPhiField;
586 typedef BitField<SpillType, 4, 2> SpillTypeField; 596 typedef BitField<SpillType, 4, 2> SpillTypeField;
587 597
588 int vreg_; 598 int vreg_;
589 int last_child_id_; 599 int last_child_id_;
590 TopLevelLiveRange* splintered_from_; 600 TopLevelLiveRange* splintered_from_;
591 union { 601 union {
592 // Correct value determined by spill_type() 602 // Correct value determined by spill_type()
593 InstructionOperand* spill_operand_; 603 InstructionOperand* spill_operand_;
594 SpillRange* spill_range_; 604 SpillRange* spill_range_;
595 }; 605 };
596 SpillAtDefinitionList* spills_at_definition_; 606 SpillAtDefinitionList* spills_at_definition_;
597 // TODO(mtrofin): generalize spilling after definition, currently specialized 607 // TODO(mtrofin): generalize spilling after definition, currently specialized
598 // just for spill in a single deferred block. 608 // just for spill in a single deferred block.
599 bool spilled_in_deferred_blocks_; 609 bool spilled_in_deferred_blocks_;
600 int spill_start_index_; 610 int spill_start_index_;
601 LiveRange* last_child_; 611 LiveRange* last_child_;
602 LiveRange* last_insertion_point_; 612 UsePosition* last_pos_;
613 TopLevelLiveRange* splinter_;
603 614
604 DISALLOW_COPY_AND_ASSIGN(TopLevelLiveRange); 615 DISALLOW_COPY_AND_ASSIGN(TopLevelLiveRange);
605 }; 616 };
606 617
607 618
608 struct PrintableLiveRange { 619 struct PrintableLiveRange {
609 const RegisterConfiguration* register_configuration_; 620 const RegisterConfiguration* register_configuration_;
610 const LiveRange* range_; 621 const LiveRange* range_;
611 }; 622 };
612 623
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 RegisterAllocationData* const data_; 1097 RegisterAllocationData* const data_;
1087 1098
1088 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); 1099 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector);
1089 }; 1100 };
1090 1101
1091 } // namespace compiler 1102 } // namespace compiler
1092 } // namespace internal 1103 } // namespace internal
1093 } // namespace v8 1104 } // namespace v8
1094 1105
1095 #endif // V8_REGISTER_ALLOCATOR_H_ 1106 #endif // V8_REGISTER_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698