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

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

Issue 2074323002: [Turbofan] Merge SpillRanges by byte_width rather than kind. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 std::ostream& operator<<(std::ostream& os, 671 std::ostream& operator<<(std::ostream& os,
672 const PrintableLiveRange& printable_range); 672 const PrintableLiveRange& printable_range);
673 673
674 674
675 class SpillRange final : public ZoneObject { 675 class SpillRange final : public ZoneObject {
676 public: 676 public:
677 static const int kUnassignedSlot = -1; 677 static const int kUnassignedSlot = -1;
678 SpillRange(TopLevelLiveRange* range, Zone* zone); 678 SpillRange(TopLevelLiveRange* range, Zone* zone);
679 679
680 UseInterval* interval() const { return use_interval_; } 680 UseInterval* interval() const { return use_interval_; }
681 // Currently, only 4 or 8 byte slots are supported.
682 int ByteWidth() const;
683 bool IsEmpty() const { return live_ranges_.empty(); } 681 bool IsEmpty() const { return live_ranges_.empty(); }
684 bool TryMerge(SpillRange* other); 682 bool TryMerge(SpillRange* other);
685 bool HasSlot() const { return assigned_slot_ != kUnassignedSlot; } 683 bool HasSlot() const { return assigned_slot_ != kUnassignedSlot; }
686 684
687 void set_assigned_slot(int index) { 685 void set_assigned_slot(int index) {
688 DCHECK_EQ(kUnassignedSlot, assigned_slot_); 686 DCHECK_EQ(kUnassignedSlot, assigned_slot_);
689 assigned_slot_ = index; 687 assigned_slot_ = index;
690 } 688 }
691 int assigned_slot() { 689 int assigned_slot() {
692 DCHECK_NE(kUnassignedSlot, assigned_slot_); 690 DCHECK_NE(kUnassignedSlot, assigned_slot_);
693 return assigned_slot_; 691 return assigned_slot_;
694 } 692 }
695 const ZoneVector<TopLevelLiveRange*>& live_ranges() const { 693 const ZoneVector<TopLevelLiveRange*>& live_ranges() const {
696 return live_ranges_; 694 return live_ranges_;
697 } 695 }
698 ZoneVector<TopLevelLiveRange*>& live_ranges() { return live_ranges_; } 696 ZoneVector<TopLevelLiveRange*>& live_ranges() { return live_ranges_; }
697 // Currently, only 4 or 8 byte slots are supported.
699 int byte_width() const { return byte_width_; } 698 int byte_width() const { return byte_width_; }
700 RegisterKind kind() const { return kind_; } 699 MachineRepresentation representation() const { return representation_; }
Mircea Trofin 2016/06/18 23:27:56 Check indentation here (may be just something weir
bbudge 2016/06/18 23:33:22 Seems OK.
701 void Print() const; 700 void Print() const;
702 701
703 private: 702 private:
704 LifetimePosition End() const { return end_position_; } 703 LifetimePosition End() const { return end_position_; }
705 bool IsIntersectingWith(SpillRange* other) const; 704 bool IsIntersectingWith(SpillRange* other) const;
706 // Merge intervals, making sure the use intervals are sorted 705 // Merge intervals, making sure the use intervals are sorted
707 void MergeDisjointIntervals(UseInterval* other); 706 void MergeDisjointIntervals(UseInterval* other);
708 707
709 ZoneVector<TopLevelLiveRange*> live_ranges_; 708 ZoneVector<TopLevelLiveRange*> live_ranges_;
710 UseInterval* use_interval_; 709 UseInterval* use_interval_;
711 LifetimePosition end_position_; 710 LifetimePosition end_position_;
712 int assigned_slot_; 711 int assigned_slot_;
712 MachineRepresentation representation_;
713 int byte_width_; 713 int byte_width_;
714 RegisterKind kind_;
715 714
716 DISALLOW_COPY_AND_ASSIGN(SpillRange); 715 DISALLOW_COPY_AND_ASSIGN(SpillRange);
717 }; 716 };
718 717
719 718
720 class RegisterAllocationData final : public ZoneObject { 719 class RegisterAllocationData final : public ZoneObject {
721 public: 720 public:
722 class PhiMapValue : public ZoneObject { 721 class PhiMapValue : public ZoneObject {
723 public: 722 public:
724 PhiMapValue(PhiInstruction* phi, const InstructionBlock* block, Zone* zone); 723 PhiMapValue(PhiInstruction* phi, const InstructionBlock* block, Zone* zone);
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 RegisterAllocationData* const data_; 1166 RegisterAllocationData* const data_;
1168 1167
1169 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); 1168 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector);
1170 }; 1169 };
1171 1170
1172 } // namespace compiler 1171 } // namespace compiler
1173 } // namespace internal 1172 } // namespace internal
1174 } // namespace v8 1173 } // namespace v8
1175 1174
1176 #endif // V8_REGISTER_ALLOCATOR_H_ 1175 #endif // V8_REGISTER_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698