Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 28 matching lines...) Expand all Loading... | |
| 39 // the gap with the given index. | 39 // the gap with the given index. |
| 40 static LifetimePosition GapFromInstructionIndex(int index) { | 40 static LifetimePosition GapFromInstructionIndex(int index) { |
| 41 return LifetimePosition(index * kStep); | 41 return LifetimePosition(index * kStep); |
| 42 } | 42 } |
| 43 // Return the lifetime position that corresponds to the beginning of | 43 // Return the lifetime position that corresponds to the beginning of |
| 44 // the instruction with the given index. | 44 // the instruction with the given index. |
| 45 static LifetimePosition InstructionFromInstructionIndex(int index) { | 45 static LifetimePosition InstructionFromInstructionIndex(int index) { |
| 46 return LifetimePosition(index * kStep + kHalfStep); | 46 return LifetimePosition(index * kStep + kHalfStep); |
| 47 } | 47 } |
| 48 | 48 |
| 49 static bool ExistsGapPositionBetween(LifetimePosition pos1, | |
| 50 LifetimePosition pos2) { | |
| 51 if (pos1 > pos2) std::swap(pos1, pos2); | |
| 52 LifetimePosition next(pos1.value_ + 1); | |
| 53 LifetimePosition next_gap = | |
|
titzer
2016/03/29 08:12:06
Clearer with an explicit if?
if(next.IsGapPositio
Mircea Trofin
2016/04/18 05:18:37
Done.
| |
| 54 next.IsGapPosition() ? next : next.NextFullStart(); | |
| 55 return next_gap < pos2; | |
| 56 } | |
| 57 | |
| 49 // Returns a numeric representation of this lifetime position. | 58 // Returns a numeric representation of this lifetime position. |
| 50 int value() const { return value_; } | 59 int value() const { return value_; } |
| 51 | 60 |
| 52 // Returns the index of the instruction to which this lifetime position | 61 // Returns the index of the instruction to which this lifetime position |
| 53 // corresponds. | 62 // corresponds. |
| 54 int ToInstructionIndex() const { | 63 int ToInstructionIndex() const { |
| 55 DCHECK(IsValid()); | 64 DCHECK(IsValid()); |
| 56 return value_ / kStep; | 65 return value_ / kStep; |
| 57 } | 66 } |
| 58 | 67 |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1189 RegisterAllocationData* const data_; | 1198 RegisterAllocationData* const data_; |
| 1190 | 1199 |
| 1191 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 1200 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
| 1192 }; | 1201 }; |
| 1193 | 1202 |
| 1194 } // namespace compiler | 1203 } // namespace compiler |
| 1195 } // namespace internal | 1204 } // namespace internal |
| 1196 } // namespace v8 | 1205 } // namespace v8 |
| 1197 | 1206 |
| 1198 #endif // V8_REGISTER_ALLOCATOR_H_ | 1207 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |