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

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

Issue 1322623007: [turbofan] Optimize Splinter by remembering where it left off. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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 #include "src/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/compiler/linkage.h" 6 #include "src/compiler/linkage.h"
7 #include "src/compiler/register-allocator.h" 7 #include "src/compiler/register-allocator.h"
8 #include "src/string-stream.h" 8 #include "src/string-stream.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 818
819 819
820 void TopLevelLiveRange::Splinter(LifetimePosition start, LifetimePosition end, 820 void TopLevelLiveRange::Splinter(LifetimePosition start, LifetimePosition end,
821 TopLevelLiveRange* result, Zone* zone) { 821 TopLevelLiveRange* result, Zone* zone) {
822 DCHECK(start != Start() || end != End()); 822 DCHECK(start != Start() || end != End());
823 DCHECK(start < end); 823 DCHECK(start < end);
824 824
825 result->set_spill_type(spill_type()); 825 result->set_spill_type(spill_type());
826 826
827 if (start <= Start()) { 827 if (start <= Start()) {
828 // TODO(mtrofin): here, the TopLevel part is in the deferred range, so we
829 // may want to continue processing the splinter. However, if the value is
830 // defined in a cold block, and then used in a hot block, it follows that
831 // it should terminate on the RHS of a phi, defined on the hot path. We
832 // should check this, however, this may not be the place, because we don't
833 // have access to the instruction sequence.
828 DCHECK(end < End()); 834 DCHECK(end < End());
829 DetachAt(end, result, zone); 835 DetachAt(end, result, zone);
830 next_ = nullptr; 836 next_ = nullptr;
831 } else if (end >= End()) { 837 } else if (end >= End()) {
832 DCHECK(start > Start()); 838 DCHECK(start > Start());
833 DetachAt(start, result, zone); 839 DetachAt(start, result, zone);
834 next_ = nullptr; 840 next_ = nullptr;
835 } else { 841 } else {
836 DCHECK(start < End() && Start() < end); 842 DCHECK(start < End() && Start() < end);
837 843
838 const int kInvalidId = std::numeric_limits<int>::max(); 844 const int kInvalidId = std::numeric_limits<int>::max();
839 845
840 DetachAt(start, result, zone); 846 DetachAt(start, result, zone);
841 847
842 LiveRange end_part(kInvalidId, this->machine_type(), nullptr); 848 LiveRange end_part(kInvalidId, this->machine_type(), nullptr);
843 result->DetachAt(end, &end_part, zone); 849 result->DetachAt(end, &end_part, zone);
844 850
845 next_ = end_part.next_; 851 next_ = end_part.next_;
846 last_interval_->set_next(end_part.first_interval_); 852 last_interval_->set_next(end_part.first_interval_);
853 // The next splinter will happen either at or after the current interval.
854 // We can optimize DetachAt by setting current_interval_ accordingly,
855 // which will then be picked up by FirstSearchIntervalForPosition.
856 current_interval_ = last_interval_;
847 last_interval_ = end_part.last_interval_; 857 last_interval_ = end_part.last_interval_;
848 858
849 859
850 if (first_pos_ == nullptr) { 860 if (first_pos_ == nullptr) {
851 first_pos_ = end_part.first_pos_; 861 first_pos_ = end_part.first_pos_;
852 } else { 862 } else {
853 UsePosition* pos = first_pos_; 863 UsePosition* pos = first_pos_;
854 for (; pos->next() != nullptr; pos = pos->next()) { 864 for (; pos->next() != nullptr; pos = pos->next()) {
855 } 865 }
856 pos->set_next(end_part.first_pos_); 866 pos->set_next(end_part.first_pos_);
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 auto eliminate = moves->PrepareInsertAfter(move); 3317 auto eliminate = moves->PrepareInsertAfter(move);
3308 to_insert.push_back(move); 3318 to_insert.push_back(move);
3309 if (eliminate != nullptr) to_eliminate.push_back(eliminate); 3319 if (eliminate != nullptr) to_eliminate.push_back(eliminate);
3310 } 3320 }
3311 } 3321 }
3312 3322
3313 3323
3314 } // namespace compiler 3324 } // namespace compiler
3315 } // namespace internal 3325 } // namespace internal
3316 } // namespace v8 3326 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698