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 if (next.IsGapPosition()) return next < pos2; |
| 54 return next.NextFullStart() < pos2; |
| 55 } |
| 56 |
49 // Returns a numeric representation of this lifetime position. | 57 // Returns a numeric representation of this lifetime position. |
50 int value() const { return value_; } | 58 int value() const { return value_; } |
51 | 59 |
52 // Returns the index of the instruction to which this lifetime position | 60 // Returns the index of the instruction to which this lifetime position |
53 // corresponds. | 61 // corresponds. |
54 int ToInstructionIndex() const { | 62 int ToInstructionIndex() const { |
55 DCHECK(IsValid()); | 63 DCHECK(IsValid()); |
56 return value_ / kStep; | 64 return value_ / kStep; |
57 } | 65 } |
58 | 66 |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 RegisterAllocationData* const data_; | 1197 RegisterAllocationData* const data_; |
1190 | 1198 |
1191 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 1199 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
1192 }; | 1200 }; |
1193 | 1201 |
1194 } // namespace compiler | 1202 } // namespace compiler |
1195 } // namespace internal | 1203 } // namespace internal |
1196 } // namespace v8 | 1204 } // namespace v8 |
1197 | 1205 |
1198 #endif // V8_REGISTER_ALLOCATOR_H_ | 1206 #endif // V8_REGISTER_ALLOCATOR_H_ |
OLD | NEW |