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

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

Issue 2074323002: [Turbofan] Merge SpillRanges by byte_width rather than kind. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review comments. Created 4 years, 5 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 | « src/compiler/register-allocator.h ('k') | 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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 1184
1185 while (interval != nullptr) { 1185 while (interval != nullptr) {
1186 os << '[' << interval->start() << ", " << interval->end() << ')' 1186 os << '[' << interval->start() << ", " << interval->end() << ')'
1187 << std::endl; 1187 << std::endl;
1188 interval = interval->next(); 1188 interval = interval->next();
1189 } 1189 }
1190 os << "}"; 1190 os << "}";
1191 return os; 1191 return os;
1192 } 1192 }
1193 1193
1194
1195 SpillRange::SpillRange(TopLevelLiveRange* parent, Zone* zone) 1194 SpillRange::SpillRange(TopLevelLiveRange* parent, Zone* zone)
1196 : live_ranges_(zone), 1195 : live_ranges_(zone),
1197 assigned_slot_(kUnassignedSlot), 1196 assigned_slot_(kUnassignedSlot),
1198 byte_width_(GetByteWidth(parent->representation())), 1197 byte_width_(GetByteWidth(parent->representation())) {
1199 kind_(parent->kind()) {
1200 // Spill ranges are created for top level, non-splintered ranges. This is so 1198 // Spill ranges are created for top level, non-splintered ranges. This is so
1201 // that, when merging decisions are made, we consider the full extent of the 1199 // that, when merging decisions are made, we consider the full extent of the
1202 // virtual register, and avoid clobbering it. 1200 // virtual register, and avoid clobbering it.
1203 DCHECK(!parent->IsSplinter()); 1201 DCHECK(!parent->IsSplinter());
1204 UseInterval* result = nullptr; 1202 UseInterval* result = nullptr;
1205 UseInterval* node = nullptr; 1203 UseInterval* node = nullptr;
1206 // Copy the intervals for all ranges. 1204 // Copy the intervals for all ranges.
1207 for (LiveRange* range = parent; range != nullptr; range = range->next()) { 1205 for (LiveRange* range = parent; range != nullptr; range = range->next()) {
1208 UseInterval* src = range->first_interval(); 1206 UseInterval* src = range->first_interval();
1209 while (src != nullptr) { 1207 while (src != nullptr) {
(...skipping 18 matching lines...) Expand all
1228 this->End() <= other->use_interval_->start() || 1226 this->End() <= other->use_interval_->start() ||
1229 other->End() <= this->use_interval_->start()) { 1227 other->End() <= this->use_interval_->start()) {
1230 return false; 1228 return false;
1231 } 1229 }
1232 return AreUseIntervalsIntersecting(use_interval_, other->use_interval_); 1230 return AreUseIntervalsIntersecting(use_interval_, other->use_interval_);
1233 } 1231 }
1234 1232
1235 1233
1236 bool SpillRange::TryMerge(SpillRange* other) { 1234 bool SpillRange::TryMerge(SpillRange* other) {
1237 if (HasSlot() || other->HasSlot()) return false; 1235 if (HasSlot() || other->HasSlot()) return false;
1238 // TODO(dcarney): byte widths should be compared here not kinds. 1236 if (byte_width() != other->byte_width() || IsIntersectingWith(other))
1239 if (live_ranges_[0]->kind() != other->live_ranges_[0]->kind() ||
1240 IsIntersectingWith(other)) {
1241 return false; 1237 return false;
1242 }
1243 1238
1244 LifetimePosition max = LifetimePosition::MaxPosition(); 1239 LifetimePosition max = LifetimePosition::MaxPosition();
1245 if (End() < other->End() && other->End() != max) { 1240 if (End() < other->End() && other->End() != max) {
1246 end_position_ = other->End(); 1241 end_position_ = other->End();
1247 } 1242 }
1248 other->end_position_ = max; 1243 other->end_position_ = max;
1249 1244
1250 MergeDisjointIntervals(other->use_interval_); 1245 MergeDisjointIntervals(other->use_interval_);
1251 other->use_interval_ = nullptr; 1246 other->use_interval_ = nullptr;
1252 1247
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after
3785 } 3780 }
3786 } 3781 }
3787 } 3782 }
3788 } 3783 }
3789 } 3784 }
3790 3785
3791 3786
3792 } // namespace compiler 3787 } // namespace compiler
3793 } // namespace internal 3788 } // namespace internal
3794 } // namespace v8 3789 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/register-allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698