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

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

Issue 1426943010: [turbofan] Spill rsi and rdi in their existing locations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 bool HasNoSpillType() const { 525 bool HasNoSpillType() const {
526 return spill_type() == SpillType::kNoSpillType; 526 return spill_type() == SpillType::kNoSpillType;
527 } 527 }
528 bool HasSpillOperand() const { 528 bool HasSpillOperand() const {
529 return spill_type() == SpillType::kSpillOperand; 529 return spill_type() == SpillType::kSpillOperand;
530 } 530 }
531 bool HasSpillRange() const { return spill_type() == SpillType::kSpillRange; } 531 bool HasSpillRange() const { return spill_type() == SpillType::kSpillRange; }
532 532
533 AllocatedOperand GetSpillRangeOperand() const; 533 AllocatedOperand GetSpillRangeOperand() const;
534 534
535 void SpillAtDefinition(Zone* zone, int gap_index, 535 void RecordSpillLocation(Zone* zone, int gap_index,
536 InstructionOperand* operand); 536 InstructionOperand* operand);
537 void SetSpillOperand(InstructionOperand* operand); 537 void SetSpillOperand(InstructionOperand* operand);
538 void SetSpillStartIndex(int start) { 538 void SetSpillStartIndex(int start) {
539 spill_start_index_ = Min(start, spill_start_index_); 539 spill_start_index_ = Min(start, spill_start_index_);
540 } 540 }
541 541
542 void CommitSpillsAtDefinition(InstructionSequence* sequence, 542 void CommitSpillMoves(InstructionSequence* sequence,
543 const InstructionOperand& operand, 543 const InstructionOperand& operand,
544 bool might_be_duplicated); 544 bool might_be_duplicated);
545 545
546 // If all the children of this range are spilled in deferred blocks, and if 546 // 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 547 // 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 548 // is contained in a deferred block, mark the range as
549 // IsSpilledOnlyInDeferredBlocks, so that we avoid spilling at definition, 549 // IsSpilledOnlyInDeferredBlocks, so that we avoid spilling at definition,
550 // and instead let the LiveRangeConnector perform the spills within the 550 // and instead let the LiveRangeConnector perform the spills within the
551 // deferred blocks. If so, we insert here spills for non-spilled ranges 551 // deferred blocks. If so, we insert here spills for non-spilled ranges
552 // with slot use positions. 552 // with slot use positions.
553 void MarkSpilledInDeferredBlock(const InstructionSequence* code); 553 void MarkSpilledInDeferredBlock(const InstructionSequence* code);
554 bool TryCommitSpillInDeferredBlock(InstructionSequence* code, 554 bool TryCommitSpillInDeferredBlock(InstructionSequence* code,
(...skipping 14 matching lines...) Expand all
569 569
570 int GetNextChildId() { 570 int GetNextChildId() {
571 return IsSplinter() ? splintered_from()->GetNextChildId() 571 return IsSplinter() ? splintered_from()->GetNextChildId()
572 : ++last_child_id_; 572 : ++last_child_id_;
573 } 573 }
574 574
575 bool IsSpilledOnlyInDeferredBlocks() const { 575 bool IsSpilledOnlyInDeferredBlocks() const {
576 return spilled_in_deferred_blocks_; 576 return spilled_in_deferred_blocks_;
577 } 577 }
578 578
579 struct SpillAtDefinitionList; 579 struct SpillMoveInsertionList;
580 580
581 SpillAtDefinitionList* spills_at_definition() const { 581 SpillMoveInsertionList* spill_move_insertion_locations() const {
582 return spills_at_definition_; 582 return spill_move_insertion_locations_;
583 } 583 }
584 void set_last_child(LiveRange* range) { last_child_ = range; } 584 void set_last_child(LiveRange* range) { last_child_ = range; }
585 LiveRange* last_child() const { return last_child_; } 585 LiveRange* last_child() const { return last_child_; }
586 TopLevelLiveRange* splinter() const { return splinter_; } 586 TopLevelLiveRange* splinter() const { return splinter_; }
587 void SetSplinter(TopLevelLiveRange* splinter) { 587 void SetSplinter(TopLevelLiveRange* splinter) {
588 DCHECK_NULL(splinter_); 588 DCHECK_NULL(splinter_);
589 DCHECK_NOT_NULL(splinter); 589 DCHECK_NOT_NULL(splinter);
590 590
591 splinter_ = splinter; 591 splinter_ = splinter;
592 splinter->relative_id_ = GetNextChildId(); 592 splinter->relative_id_ = GetNextChildId();
593 splinter->set_spill_type(spill_type()); 593 splinter->set_spill_type(spill_type());
594 splinter->SetSplinteredFrom(this); 594 splinter->SetSplinteredFrom(this);
595 } 595 }
596 596
597 void MarkHasPreassignedSlot() { has_preassigned_slot_ = true; }
598 bool has_preassigned_slot() const { return has_preassigned_slot_; }
599
597 private: 600 private:
598 void SetSplinteredFrom(TopLevelLiveRange* splinter_parent); 601 void SetSplinteredFrom(TopLevelLiveRange* splinter_parent);
599 602
600 typedef BitField<bool, 1, 1> HasSlotUseField; 603 typedef BitField<bool, 1, 1> HasSlotUseField;
601 typedef BitField<bool, 2, 1> IsPhiField; 604 typedef BitField<bool, 2, 1> IsPhiField;
602 typedef BitField<bool, 3, 1> IsNonLoopPhiField; 605 typedef BitField<bool, 3, 1> IsNonLoopPhiField;
603 typedef BitField<SpillType, 4, 2> SpillTypeField; 606 typedef BitField<SpillType, 4, 2> SpillTypeField;
604 607
605 int vreg_; 608 int vreg_;
606 int last_child_id_; 609 int last_child_id_;
607 TopLevelLiveRange* splintered_from_; 610 TopLevelLiveRange* splintered_from_;
608 union { 611 union {
609 // Correct value determined by spill_type() 612 // Correct value determined by spill_type()
610 InstructionOperand* spill_operand_; 613 InstructionOperand* spill_operand_;
611 SpillRange* spill_range_; 614 SpillRange* spill_range_;
612 }; 615 };
613 SpillAtDefinitionList* spills_at_definition_; 616 SpillMoveInsertionList* spill_move_insertion_locations_;
614 // TODO(mtrofin): generalize spilling after definition, currently specialized 617 // TODO(mtrofin): generalize spilling after definition, currently specialized
615 // just for spill in a single deferred block. 618 // just for spill in a single deferred block.
616 bool spilled_in_deferred_blocks_; 619 bool spilled_in_deferred_blocks_;
617 int spill_start_index_; 620 int spill_start_index_;
618 LiveRange* last_child_; 621 LiveRange* last_child_;
619 UsePosition* last_pos_; 622 UsePosition* last_pos_;
620 TopLevelLiveRange* splinter_; 623 TopLevelLiveRange* splinter_;
624 bool has_preassigned_slot_;
621 625
622 DISALLOW_COPY_AND_ASSIGN(TopLevelLiveRange); 626 DISALLOW_COPY_AND_ASSIGN(TopLevelLiveRange);
623 }; 627 };
624 628
625 629
626 struct PrintableLiveRange { 630 struct PrintableLiveRange {
627 const RegisterConfiguration* register_configuration_; 631 const RegisterConfiguration* register_configuration_;
628 const LiveRange* range_; 632 const LiveRange* range_;
629 }; 633 };
630 634
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 RegisterAllocationData* const data_; 1121 RegisterAllocationData* const data_;
1118 1122
1119 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); 1123 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector);
1120 }; 1124 };
1121 1125
1122 } // namespace compiler 1126 } // namespace compiler
1123 } // namespace internal 1127 } // namespace internal
1124 } // namespace v8 1128 } // namespace v8
1125 1129
1126 #endif // V8_REGISTER_ALLOCATOR_H_ 1130 #endif // V8_REGISTER_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698