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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 | 580 |
581 inline Heap* heap() const { return heap_; } | 581 inline Heap* heap() const { return heap_; } |
582 | 582 |
583 CodeFlusher* code_flusher() { return code_flusher_; } | 583 CodeFlusher* code_flusher() { return code_flusher_; } |
584 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } | 584 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } |
585 void EnableCodeFlushing(bool enable); | 585 void EnableCodeFlushing(bool enable); |
586 | 586 |
587 enum SweeperType { | 587 enum SweeperType { |
588 CONSERVATIVE, | 588 CONSERVATIVE, |
589 LAZY_CONSERVATIVE, | 589 LAZY_CONSERVATIVE, |
590 PARALLEL_CONSERVATIVE, | |
590 PRECISE | 591 PRECISE |
591 }; | 592 }; |
592 | 593 |
594 enum SweepingParallelism { | |
595 SWEEP_SEQUENTIALLY, | |
596 SWEEP_IN_PARALLEL | |
597 }; | |
598 | |
593 #ifdef VERIFY_HEAP | 599 #ifdef VERIFY_HEAP |
594 void VerifyMarkbitsAreClean(); | 600 void VerifyMarkbitsAreClean(); |
595 static void VerifyMarkbitsAreClean(PagedSpace* space); | 601 static void VerifyMarkbitsAreClean(PagedSpace* space); |
596 static void VerifyMarkbitsAreClean(NewSpace* space); | 602 static void VerifyMarkbitsAreClean(NewSpace* space); |
597 #endif | 603 #endif |
598 | 604 |
599 // Sweep a single page from the given space conservatively. | 605 // Sweep a single page from the given space conservatively. |
600 // Return a number of reclaimed bytes. | 606 // Return a number of reclaimed bytes. |
601 static intptr_t SweepConservatively(PagedSpace* space, Page* p); | 607 template<SweepingParallelism type> |
608 static intptr_t SweepConservatively(PagedSpace* space, | |
609 FreeList* free_list, | |
610 Page* p); | |
602 | 611 |
603 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) { | 612 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) { |
604 return Page::FromAddress(reinterpret_cast<Address>(anchor))-> | 613 return Page::FromAddress(reinterpret_cast<Address>(anchor))-> |
605 ShouldSkipEvacuationSlotRecording(); | 614 ShouldSkipEvacuationSlotRecording(); |
606 } | 615 } |
607 | 616 |
608 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object* host)) { | 617 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object* host)) { |
609 return Page::FromAddress(reinterpret_cast<Address>(host))-> | 618 return Page::FromAddress(reinterpret_cast<Address>(host))-> |
610 ShouldSkipEvacuationSlotRecording(); | 619 ShouldSkipEvacuationSlotRecording(); |
611 } | 620 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
657 void InvalidateCode(Code* code); | 666 void InvalidateCode(Code* code); |
658 | 667 |
659 void ClearMarkbits(); | 668 void ClearMarkbits(); |
660 | 669 |
661 bool abort_incremental_marking() const { return abort_incremental_marking_; } | 670 bool abort_incremental_marking() const { return abort_incremental_marking_; } |
662 | 671 |
663 bool is_compacting() const { return compacting_; } | 672 bool is_compacting() const { return compacting_; } |
664 | 673 |
665 MarkingParity marking_parity() { return marking_parity_; } | 674 MarkingParity marking_parity() { return marking_parity_; } |
666 | 675 |
676 void SweepInParallel(PagedSpace* space, | |
677 FreeList* private_free_list, | |
678 FreeList* free_list); | |
679 | |
680 void WaitUntilSweepingCompleted(); | |
681 | |
682 intptr_t StealMemoryFromSweeperThreads(PagedSpace* space); | |
683 | |
684 bool AreSweeperThreadsActivated(); | |
685 | |
667 private: | 686 private: |
668 MarkCompactCollector(); | 687 MarkCompactCollector(); |
669 ~MarkCompactCollector(); | 688 ~MarkCompactCollector(); |
670 | 689 |
671 bool MarkInvalidatedCode(); | 690 bool MarkInvalidatedCode(); |
672 void RemoveDeadInvalidatedCode(); | 691 void RemoveDeadInvalidatedCode(); |
673 void ProcessInvalidatedCode(ObjectVisitor* visitor); | 692 void ProcessInvalidatedCode(ObjectVisitor* visitor); |
674 | 693 |
694 void StartSweeperThreads(); | |
675 | 695 |
676 #ifdef DEBUG | 696 #ifdef DEBUG |
677 enum CollectorState { | 697 enum CollectorState { |
678 IDLE, | 698 IDLE, |
679 PREPARE_GC, | 699 PREPARE_GC, |
680 MARK_LIVE_OBJECTS, | 700 MARK_LIVE_OBJECTS, |
681 SWEEP_SPACES, | 701 SWEEP_SPACES, |
682 ENCODE_FORWARDING_ADDRESSES, | 702 ENCODE_FORWARDING_ADDRESSES, |
683 UPDATE_POINTERS, | 703 UPDATE_POINTERS, |
684 RELOCATE_OBJECTS | 704 RELOCATE_OBJECTS |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
829 void EvacuateNewSpace(); | 849 void EvacuateNewSpace(); |
830 | 850 |
831 void EvacuateLiveObjectsFromPage(Page* p); | 851 void EvacuateLiveObjectsFromPage(Page* p); |
832 | 852 |
833 void EvacuatePages(); | 853 void EvacuatePages(); |
834 | 854 |
835 void EvacuateNewSpaceAndCandidates(); | 855 void EvacuateNewSpaceAndCandidates(); |
836 | 856 |
837 void SweepSpace(PagedSpace* space, SweeperType sweeper); | 857 void SweepSpace(PagedSpace* space, SweeperType sweeper); |
838 | 858 |
859 void PrepareParallelSweeping(PagedSpace* space); | |
Michael Starzinger
2013/01/30 11:01:19
The implementation of this method is gone, let's a
Hannes Payer (out of office)
2013/01/30 12:07:32
Done.
| |
860 | |
839 #ifdef DEBUG | 861 #ifdef DEBUG |
840 friend class MarkObjectVisitor; | 862 friend class MarkObjectVisitor; |
841 static void VisitObject(HeapObject* obj); | 863 static void VisitObject(HeapObject* obj); |
842 | 864 |
843 friend class UnmarkObjectVisitor; | 865 friend class UnmarkObjectVisitor; |
844 static void UnmarkObject(HeapObject* obj); | 866 static void UnmarkObject(HeapObject* obj); |
845 #endif | 867 #endif |
846 | 868 |
847 Heap* heap_; | 869 Heap* heap_; |
848 MarkingDeque marking_deque_; | 870 MarkingDeque marking_deque_; |
849 CodeFlusher* code_flusher_; | 871 CodeFlusher* code_flusher_; |
850 Object* encountered_weak_maps_; | 872 Object* encountered_weak_maps_; |
851 | 873 |
852 List<Page*> evacuation_candidates_; | 874 List<Page*> evacuation_candidates_; |
853 List<Code*> invalidated_code_; | 875 List<Code*> invalidated_code_; |
854 | 876 |
855 friend class Heap; | 877 friend class Heap; |
856 }; | 878 }; |
857 | 879 |
858 | 880 |
859 const char* AllocationSpaceName(AllocationSpace space); | 881 const char* AllocationSpaceName(AllocationSpace space); |
860 | 882 |
861 } } // namespace v8::internal | 883 } } // namespace v8::internal |
862 | 884 |
863 #endif // V8_MARK_COMPACT_H_ | 885 #endif // V8_MARK_COMPACT_H_ |
OLD | NEW |