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

Unified Diff: src/compiler/coalesced-live-ranges.cc

Issue 1219063017: [turbofan] Unit tests for live range conflicts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporated feedback. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/coalesced-live-ranges.cc
diff --git a/src/compiler/coalesced-live-ranges.cc b/src/compiler/coalesced-live-ranges.cc
index e81f5518bd636908b93cd2a6bfc57f4f8f64e5f0..fc53140aa64e3e24075659074d08aacb160cd406 100644
--- a/src/compiler/coalesced-live-ranges.cc
+++ b/src/compiler/coalesced-live-ranges.cc
@@ -10,16 +10,8 @@ namespace v8 {
namespace internal {
namespace compiler {
-#define TRACE(...) \
- do { \
- if (FLAG_trace_alloc) PrintF(__VA_ARGS__); \
- } while (false)
-
-
-const float CoalescedLiveRanges::kAllocatedRangeMultiplier = 10.0;
void CoalescedLiveRanges::AllocateRange(LiveRange* range) {
- UpdateWeightAtAllocation(range);
for (auto interval = range->first_interval(); interval != nullptr;
interval = interval->next()) {
storage().insert({interval->start(), interval->end(), range});
@@ -32,62 +24,10 @@ void CoalescedLiveRanges::Remove(LiveRange* range) {
interval = interval->next()) {
storage().erase({interval->start(), interval->end(), nullptr});
}
- range->UnsetAssignedRegister();
-}
-
-
-float CoalescedLiveRanges::GetMaximumConflictingWeight(
- const LiveRange* range) const {
- float ret = LiveRange::kInvalidWeight;
- auto end = storage().end();
- for (auto query = range->first_interval(); query != nullptr;
- query = query->next()) {
- auto conflict = GetFirstConflict(query);
-
- if (conflict == end) continue;
- for (; QueryIntersectsAllocatedInterval(query, conflict); ++conflict) {
- // It is possible we'll visit the same range multiple times, because
- // successive (not necessarily consecutive) intervals belong to the same
- // range, or because different intervals of the query range have the same
- // range as conflict.
- DCHECK_NE(conflict->range->weight(), LiveRange::kInvalidWeight);
- ret = Max(ret, conflict->range->weight());
- if (ret == LiveRange::kMaxWeight) break;
- }
- }
- return ret;
}
-void CoalescedLiveRanges::EvictAndRescheduleConflicts(
- LiveRange* range, AllocationScheduler* scheduler) {
- auto end = storage().end();
-
- for (auto query = range->first_interval(); query != nullptr;
- query = query->next()) {
- auto conflict = GetFirstConflict(query);
- if (conflict == end) continue;
- while (QueryIntersectsAllocatedInterval(query, conflict)) {
- LiveRange* range_to_evict = conflict->range;
- // Bypass successive intervals belonging to the same range, because we're
- // about to remove this range, and we don't want the storage iterator to
- // become invalid.
- while (conflict != end && conflict->range == range_to_evict) {
- ++conflict;
- }
-
- DCHECK(range_to_evict->HasRegisterAssigned());
- CHECK(!range_to_evict->IsFixed());
- Remove(range_to_evict);
- UpdateWeightAtEviction(range_to_evict);
- TRACE("Evicted range %d.\n", range_to_evict->id());
- scheduler->Schedule(range_to_evict);
- }
- }
-}
-
-
-bool CoalescedLiveRanges::VerifyAllocationsAreValid() const {
+bool CoalescedLiveRanges::TestOnlyVerifyAllocationsAreValid() const {
LifetimePosition last_end = LifetimePosition::GapFromInstructionIndex(0);
for (auto i : storage_) {
if (i.start < last_end) {
@@ -99,18 +39,6 @@ bool CoalescedLiveRanges::VerifyAllocationsAreValid() const {
}
-void CoalescedLiveRanges::UpdateWeightAtAllocation(LiveRange* range) {
- DCHECK_NE(range->weight(), LiveRange::kInvalidWeight);
- range->set_weight(range->weight() * kAllocatedRangeMultiplier);
-}
-
-
-void CoalescedLiveRanges::UpdateWeightAtEviction(LiveRange* range) {
- DCHECK_NE(range->weight(), LiveRange::kInvalidWeight);
- range->set_weight(range->weight() / kAllocatedRangeMultiplier);
-}
-
-
CoalescedLiveRanges::interval_iterator CoalescedLiveRanges::GetFirstConflict(
const UseInterval* query) const {
DCHECK(query != nullptr);

Powered by Google App Engine
This is Rietveld 408576698