| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // For hinting only. | 268 // For hinting only. |
| 269 void set_assigned_register(int register_code) { | 269 void set_assigned_register(int register_code) { |
| 270 flags_ = AssignedRegisterField::update(flags_, register_code); | 270 flags_ = AssignedRegisterField::update(flags_, register_code); |
| 271 } | 271 } |
| 272 | 272 |
| 273 UsePositionHintType hint_type() const { | 273 UsePositionHintType hint_type() const { |
| 274 return HintTypeField::decode(flags_); | 274 return HintTypeField::decode(flags_); |
| 275 } | 275 } |
| 276 bool HasHint() const; | 276 bool HasHint() const; |
| 277 bool HintRegister(int* register_code) const; | 277 bool HintRegister(int* register_code) const; |
| 278 void SetHint(UsePosition* use_pos); |
| 278 void ResolveHint(UsePosition* use_pos); | 279 void ResolveHint(UsePosition* use_pos); |
| 279 bool IsResolved() const { | 280 bool IsResolved() const { |
| 280 return hint_type() != UsePositionHintType::kUnresolved; | 281 return hint_type() != UsePositionHintType::kUnresolved; |
| 281 } | 282 } |
| 282 static UsePositionHintType HintTypeForOperand(const InstructionOperand& op); | 283 static UsePositionHintType HintTypeForOperand(const InstructionOperand& op); |
| 283 | 284 |
| 284 private: | 285 private: |
| 285 typedef BitField<UsePositionType, 0, 2> TypeField; | 286 typedef BitField<UsePositionType, 0, 2> TypeField; |
| 286 typedef BitField<UsePositionHintType, 2, 3> HintTypeField; | 287 typedef BitField<UsePositionHintType, 2, 3> HintTypeField; |
| 287 typedef BitField<bool, 5, 1> RegisterBeneficialField; | 288 typedef BitField<bool, 5, 1> RegisterBeneficialField; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // Can this live range be spilled at this position. | 362 // Can this live range be spilled at this position. |
| 362 bool CanBeSpilled(LifetimePosition pos) const; | 363 bool CanBeSpilled(LifetimePosition pos) const; |
| 363 | 364 |
| 364 // Splitting primitive used by both splitting and splintering members. | 365 // Splitting primitive used by both splitting and splintering members. |
| 365 // Performs the split, but does not link the resulting ranges. | 366 // Performs the split, but does not link the resulting ranges. |
| 366 // The given position must follow the start of the range. | 367 // The given position must follow the start of the range. |
| 367 // All uses following the given position will be moved from this | 368 // All uses following the given position will be moved from this |
| 368 // live range to the result live range. | 369 // live range to the result live range. |
| 369 // The current range will terminate at position, while result will start from | 370 // The current range will terminate at position, while result will start from |
| 370 // position. | 371 // position. |
| 372 enum HintConnectionOption : bool { |
| 373 DoNotConnectHints = false, |
| 374 ConnectHints = true |
| 375 }; |
| 371 UsePosition* DetachAt(LifetimePosition position, LiveRange* result, | 376 UsePosition* DetachAt(LifetimePosition position, LiveRange* result, |
| 372 Zone* zone); | 377 Zone* zone, HintConnectionOption connect_hints); |
| 373 | 378 |
| 374 // Detaches at position, and then links the resulting ranges. Returns the | 379 // Detaches at position, and then links the resulting ranges. Returns the |
| 375 // child, which starts at position. | 380 // child, which starts at position. |
| 376 LiveRange* SplitAt(LifetimePosition position, Zone* zone); | 381 LiveRange* SplitAt(LifetimePosition position, Zone* zone); |
| 377 | 382 |
| 378 // Returns nullptr when no register is hinted, otherwise sets register_index. | 383 // Returns nullptr when no register is hinted, otherwise sets register_index. |
| 379 UsePosition* FirstHintPosition(int* register_index) const; | 384 UsePosition* FirstHintPosition(int* register_index) const; |
| 380 UsePosition* FirstHintPosition() const { | 385 UsePosition* FirstHintPosition() const { |
| 381 int register_index; | 386 int register_index; |
| 382 return FirstHintPosition(®ister_index); | 387 return FirstHintPosition(®ister_index); |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 RegisterAllocationData* const data_; | 1173 RegisterAllocationData* const data_; |
| 1169 | 1174 |
| 1170 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); | 1175 DISALLOW_COPY_AND_ASSIGN(LiveRangeConnector); |
| 1171 }; | 1176 }; |
| 1172 | 1177 |
| 1173 } // namespace compiler | 1178 } // namespace compiler |
| 1174 } // namespace internal | 1179 } // namespace internal |
| 1175 } // namespace v8 | 1180 } // namespace v8 |
| 1176 | 1181 |
| 1177 #endif // V8_REGISTER_ALLOCATOR_H_ | 1182 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |