OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 const Vector<LiveRange*>* fixed_live_ranges() const { | 427 const Vector<LiveRange*>* fixed_live_ranges() const { |
428 return &fixed_live_ranges_; | 428 return &fixed_live_ranges_; |
429 } | 429 } |
430 const Vector<LiveRange*>* fixed_double_live_ranges() const { | 430 const Vector<LiveRange*>* fixed_double_live_ranges() const { |
431 return &fixed_double_live_ranges_; | 431 return &fixed_double_live_ranges_; |
432 } | 432 } |
433 | 433 |
434 LPlatformChunk* chunk() const { return chunk_; } | 434 LPlatformChunk* chunk() const { return chunk_; } |
435 HGraph* graph() const { return graph_; } | 435 HGraph* graph() const { return graph_; } |
436 Isolate* isolate() const { return graph_->isolate(); } | 436 Isolate* isolate() const { return graph_->isolate(); } |
437 Zone* zone() const { return zone_; } | 437 Zone* zone() { return &zone_; } |
438 | 438 |
439 int GetVirtualRegister() { | 439 int GetVirtualRegister() { |
440 if (next_virtual_register_ >= LUnallocated::kMaxVirtualRegisters) { | 440 if (next_virtual_register_ >= LUnallocated::kMaxVirtualRegisters) { |
441 allocation_ok_ = false; | 441 allocation_ok_ = false; |
442 // Maintain the invariant that we return something below the maximum. | 442 // Maintain the invariant that we return something below the maximum. |
443 return 0; | 443 return 0; |
444 } | 444 } |
445 return next_virtual_register_++; | 445 return next_virtual_register_++; |
446 } | 446 } |
447 | 447 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 void Spill(LiveRange* range); | 563 void Spill(LiveRange* range); |
564 bool IsBlockBoundary(LifetimePosition pos); | 564 bool IsBlockBoundary(LifetimePosition pos); |
565 | 565 |
566 // Helper methods for resolving control flow. | 566 // Helper methods for resolving control flow. |
567 void ResolveControlFlow(LiveRange* range, | 567 void ResolveControlFlow(LiveRange* range, |
568 HBasicBlock* block, | 568 HBasicBlock* block, |
569 HBasicBlock* pred); | 569 HBasicBlock* pred); |
570 | 570 |
571 inline void SetLiveRangeAssignedRegister(LiveRange* range, | 571 inline void SetLiveRangeAssignedRegister(LiveRange* range, |
572 int reg, | 572 int reg, |
573 RegisterKind register_kind, | 573 RegisterKind register_kind); |
574 Zone* zone); | |
575 | 574 |
576 // Return parallel move that should be used to connect ranges split at the | 575 // Return parallel move that should be used to connect ranges split at the |
577 // given position. | 576 // given position. |
578 LParallelMove* GetConnectingParallelMove(LifetimePosition pos); | 577 LParallelMove* GetConnectingParallelMove(LifetimePosition pos); |
579 | 578 |
580 // Return the block which contains give lifetime position. | 579 // Return the block which contains give lifetime position. |
581 HBasicBlock* GetBlock(LifetimePosition pos); | 580 HBasicBlock* GetBlock(LifetimePosition pos); |
582 | 581 |
583 // Helper methods for the fixed registers. | 582 // Helper methods for the fixed registers. |
584 int RegisterCount() const; | 583 int RegisterCount() const; |
585 static int FixedLiveRangeID(int index) { return -index - 1; } | 584 static int FixedLiveRangeID(int index) { return -index - 1; } |
586 static int FixedDoubleLiveRangeID(int index); | 585 static int FixedDoubleLiveRangeID(int index); |
587 LiveRange* FixedLiveRangeFor(int index); | 586 LiveRange* FixedLiveRangeFor(int index); |
588 LiveRange* FixedDoubleLiveRangeFor(int index); | 587 LiveRange* FixedDoubleLiveRangeFor(int index); |
589 LiveRange* LiveRangeFor(int index); | 588 LiveRange* LiveRangeFor(int index); |
590 HPhi* LookupPhi(LOperand* operand) const; | 589 HPhi* LookupPhi(LOperand* operand) const; |
591 LGap* GetLastGap(HBasicBlock* block); | 590 LGap* GetLastGap(HBasicBlock* block); |
592 | 591 |
593 const char* RegisterName(int allocation_index); | 592 const char* RegisterName(int allocation_index); |
594 | 593 |
595 inline bool IsGapAt(int index); | 594 inline bool IsGapAt(int index); |
596 | 595 |
597 inline LInstruction* InstructionAt(int index); | 596 inline LInstruction* InstructionAt(int index); |
598 | 597 |
599 inline LGap* GapAt(int index); | 598 inline LGap* GapAt(int index); |
600 | 599 |
601 Zone* zone_; | 600 Zone zone_; |
602 | 601 |
603 LPlatformChunk* chunk_; | 602 LPlatformChunk* chunk_; |
604 | 603 |
605 // During liveness analysis keep a mapping from block id to live_in sets | 604 // During liveness analysis keep a mapping from block id to live_in sets |
606 // for blocks already analyzed. | 605 // for blocks already analyzed. |
607 ZoneList<BitVector*> live_in_sets_; | 606 ZoneList<BitVector*> live_in_sets_; |
608 | 607 |
609 // Liveness analysis results. | 608 // Liveness analysis results. |
610 ZoneList<LiveRange*> live_ranges_; | 609 ZoneList<LiveRange*> live_ranges_; |
611 | 610 |
(...skipping 28 matching lines...) Expand all Loading... |
640 #ifdef DEBUG | 639 #ifdef DEBUG |
641 LifetimePosition allocation_finger_; | 640 LifetimePosition allocation_finger_; |
642 #endif | 641 #endif |
643 | 642 |
644 DISALLOW_COPY_AND_ASSIGN(LAllocator); | 643 DISALLOW_COPY_AND_ASSIGN(LAllocator); |
645 }; | 644 }; |
646 | 645 |
647 | 646 |
648 class LAllocatorPhase : public CompilationPhase { | 647 class LAllocatorPhase : public CompilationPhase { |
649 public: | 648 public: |
650 LAllocatorPhase(const char* name, LAllocator* allocator) | 649 LAllocatorPhase(const char* name, LAllocator* allocator); |
651 : CompilationPhase(name, allocator->graph()->info()), | |
652 allocator_(allocator) { } | |
653 ~LAllocatorPhase(); | 650 ~LAllocatorPhase(); |
654 | 651 |
655 private: | 652 private: |
656 LAllocator* allocator_; | 653 LAllocator* allocator_; |
| 654 unsigned allocator_zone_start_allocation_size_; |
657 | 655 |
658 DISALLOW_COPY_AND_ASSIGN(LAllocatorPhase); | 656 DISALLOW_COPY_AND_ASSIGN(LAllocatorPhase); |
659 }; | 657 }; |
660 | 658 |
661 | 659 |
662 } } // namespace v8::internal | 660 } } // namespace v8::internal |
663 | 661 |
664 #endif // V8_LITHIUM_ALLOCATOR_H_ | 662 #endif // V8_LITHIUM_ALLOCATOR_H_ |
OLD | NEW |