| 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/zone-containers.h" | 9 #include "src/zone-containers.h" |
| 10 | 10 |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 void AddToUnhandledSorted(LiveRange* range); | 459 void AddToUnhandledSorted(LiveRange* range); |
| 460 void AddToUnhandledUnsorted(LiveRange* range); | 460 void AddToUnhandledUnsorted(LiveRange* range); |
| 461 void SortUnhandled(); | 461 void SortUnhandled(); |
| 462 bool UnhandledIsSorted(); | 462 bool UnhandledIsSorted(); |
| 463 void ActiveToHandled(LiveRange* range); | 463 void ActiveToHandled(LiveRange* range); |
| 464 void ActiveToInactive(LiveRange* range); | 464 void ActiveToInactive(LiveRange* range); |
| 465 void InactiveToHandled(LiveRange* range); | 465 void InactiveToHandled(LiveRange* range); |
| 466 void InactiveToActive(LiveRange* range); | 466 void InactiveToActive(LiveRange* range); |
| 467 | 467 |
| 468 // Helper methods for allocating registers. | 468 // Helper methods for allocating registers. |
| 469 bool TryReuseSpillForPhi(LiveRange* range); |
| 469 bool TryAllocateFreeReg(LiveRange* range); | 470 bool TryAllocateFreeReg(LiveRange* range); |
| 470 void AllocateBlockedReg(LiveRange* range); | 471 void AllocateBlockedReg(LiveRange* range); |
| 471 SpillRange* AssignSpillRangeToLiveRange(LiveRange* range); | 472 SpillRange* AssignSpillRangeToLiveRange(LiveRange* range); |
| 472 void FreeSpillSlot(LiveRange* range); | 473 void FreeSpillSlot(LiveRange* range); |
| 473 InstructionOperand* TryReuseSpillSlot(LiveRange* range); | 474 InstructionOperand* TryReuseSpillSlot(LiveRange* range); |
| 474 | 475 |
| 475 // Live range splitting helpers. | 476 // Live range splitting helpers. |
| 476 | 477 |
| 477 // Split the given range at the given position. | 478 // Split the given range at the given position. |
| 478 // If range starts at or after the given position then the | 479 // If range starts at or after the given position then the |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 GapInstruction* GetLastGap(const InstructionBlock* block); | 540 GapInstruction* GetLastGap(const InstructionBlock* block); |
| 540 | 541 |
| 541 const char* RegisterName(int allocation_index); | 542 const char* RegisterName(int allocation_index); |
| 542 | 543 |
| 543 Instruction* InstructionAt(int index) { return code()->InstructionAt(index); } | 544 Instruction* InstructionAt(int index) { return code()->InstructionAt(index); } |
| 544 | 545 |
| 545 Frame* frame() const { return frame_; } | 546 Frame* frame() const { return frame_; } |
| 546 const char* debug_name() const { return debug_name_; } | 547 const char* debug_name() const { return debug_name_; } |
| 547 const RegisterConfiguration* config() const { return config_; } | 548 const RegisterConfiguration* config() const { return config_; } |
| 548 | 549 |
| 550 struct PhiMapValue { |
| 551 PhiMapValue(PhiInstruction* phi, const InstructionBlock* block) |
| 552 : phi(phi), block(block) {} |
| 553 PhiInstruction* const phi; |
| 554 const InstructionBlock* const block; |
| 555 }; |
| 556 typedef std::map<int, PhiMapValue, std::less<int>, |
| 557 zone_allocator<std::pair<int, PhiMapValue>>> PhiMap; |
| 558 |
| 549 Zone* const local_zone_; | 559 Zone* const local_zone_; |
| 550 Frame* const frame_; | 560 Frame* const frame_; |
| 551 InstructionSequence* const code_; | 561 InstructionSequence* const code_; |
| 552 const char* const debug_name_; | 562 const char* const debug_name_; |
| 553 | 563 |
| 554 const RegisterConfiguration* config_; | 564 const RegisterConfiguration* config_; |
| 555 | 565 |
| 566 PhiMap phi_map_; |
| 567 |
| 556 // During liveness analysis keep a mapping from block id to live_in sets | 568 // During liveness analysis keep a mapping from block id to live_in sets |
| 557 // for blocks already analyzed. | 569 // for blocks already analyzed. |
| 558 ZoneVector<BitVector*> live_in_sets_; | 570 ZoneVector<BitVector*> live_in_sets_; |
| 559 | 571 |
| 560 // Liveness analysis results. | 572 // Liveness analysis results. |
| 561 ZoneVector<LiveRange*> live_ranges_; | 573 ZoneVector<LiveRange*> live_ranges_; |
| 562 | 574 |
| 563 // Lists of live ranges | 575 // Lists of live ranges |
| 564 ZoneVector<LiveRange*> fixed_live_ranges_; | 576 ZoneVector<LiveRange*> fixed_live_ranges_; |
| 565 ZoneVector<LiveRange*> fixed_double_live_ranges_; | 577 ZoneVector<LiveRange*> fixed_double_live_ranges_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 583 #endif | 595 #endif |
| 584 | 596 |
| 585 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); | 597 DISALLOW_COPY_AND_ASSIGN(RegisterAllocator); |
| 586 }; | 598 }; |
| 587 | 599 |
| 588 } // namespace compiler | 600 } // namespace compiler |
| 589 } // namespace internal | 601 } // namespace internal |
| 590 } // namespace v8 | 602 } // namespace v8 |
| 591 | 603 |
| 592 #endif // V8_REGISTER_ALLOCATOR_H_ | 604 #endif // V8_REGISTER_ALLOCATOR_H_ |
| OLD | NEW |