OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compiler/coalesced-live-ranges.h" | 5 #include "src/compiler/coalesced-live-ranges.h" |
6 #include "src/compiler/greedy-allocator.h" | 6 #include "src/compiler/greedy-allocator.h" |
7 #include "src/compiler/register-allocator.h" | 7 #include "src/compiler/register-allocator.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
11 namespace compiler { | 11 namespace compiler { |
12 | 12 |
13 | 13 |
14 LiveRangeConflictIterator::LiveRangeConflictIterator(const LiveRange* range, | 14 LiveRangeConflictIterator::LiveRangeConflictIterator(const LiveRange* range, |
15 IntervalStore* storage) | 15 IntervalStore* storage) |
16 : query_(range->first_interval()), | 16 : query_(range->first_interval()), |
17 pos_(storage->end()), | 17 pos_(storage->end()), |
18 intervals_(storage) { | 18 intervals_(storage) { |
19 MovePosAndQueryToFirstConflict(); | 19 MovePosAndQueryToFirstConflict(); |
20 } | 20 } |
21 | 21 |
22 | 22 |
23 LiveRange* LiveRangeConflictIterator::Current() const { | 23 LiveRange* LiveRangeConflictIterator::Current() const { |
24 if (IsFinished()) return nullptr; | 24 if (IsFinished()) return nullptr; |
25 return pos_->range_; | 25 return pos_->range_; |
26 } | 26 } |
27 | 27 |
28 | 28 |
29 void LiveRangeConflictIterator::MovePosToFirstConflictForQuery() { | 29 void LiveRangeConflictIterator::MovePosToFirstConflictForQuery() { |
30 DCHECK(query_ != nullptr); | 30 DCHECK_NOT_NULL(query_); |
31 auto end = intervals_->end(); | 31 auto end = intervals_->end(); |
32 LifetimePosition q_start = query_->start(); | 32 LifetimePosition q_start = query_->start(); |
33 LifetimePosition q_end = query_->end(); | 33 LifetimePosition q_end = query_->end(); |
34 | 34 |
35 if (intervals_->empty() || intervals_->rbegin()->end_ <= q_start || | 35 if (intervals_->empty() || intervals_->rbegin()->end_ <= q_start || |
36 intervals_->begin()->start_ >= q_end) { | 36 intervals_->begin()->start_ >= q_end) { |
37 pos_ = end; | 37 pos_ = end; |
38 return; | 38 return; |
39 } | 39 } |
40 | 40 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 last_end = i.end_; | 135 last_end = i.end_; |
136 } | 136 } |
137 return true; | 137 return true; |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 } // namespace compiler | 141 } // namespace compiler |
142 } // namespace internal | 142 } // namespace internal |
143 } // namespace v8 | 143 } // namespace v8 |
OLD | NEW |