OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_HEAP_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ |
6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
10 | 10 |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 bool IsSlotInBlackObject(Page* p, Address slot, HeapObject** out_object); | 661 bool IsSlotInBlackObject(Page* p, Address slot, HeapObject** out_object); |
662 bool IsSlotInBlackObjectSlow(Page* p, Address slot); | 662 bool IsSlotInBlackObjectSlow(Page* p, Address slot); |
663 bool IsSlotInLiveObject(Address slot); | 663 bool IsSlotInLiveObject(Address slot); |
664 void VerifyIsSlotInLiveObject(Address slot, HeapObject* object); | 664 void VerifyIsSlotInLiveObject(Address slot, HeapObject* object); |
665 | 665 |
666 // Removes all the slots in the slot buffers that are within the given | 666 // Removes all the slots in the slot buffers that are within the given |
667 // address range. | 667 // address range. |
668 void RemoveObjectSlots(Address start_slot, Address end_slot); | 668 void RemoveObjectSlots(Address start_slot, Address end_slot); |
669 | 669 |
670 private: | 670 private: |
| 671 class CompactionTask; |
671 class SweeperTask; | 672 class SweeperTask; |
672 | 673 |
673 explicit MarkCompactCollector(Heap* heap); | 674 explicit MarkCompactCollector(Heap* heap); |
674 ~MarkCompactCollector(); | 675 ~MarkCompactCollector(); |
675 | 676 |
676 bool WillBeDeoptimized(Code* code); | 677 bool WillBeDeoptimized(Code* code); |
677 void EvictPopularEvacuationCandidate(Page* page); | 678 void EvictPopularEvacuationCandidate(Page* page); |
678 void ClearInvalidStoreAndSlotsBufferEntries(); | 679 void ClearInvalidStoreAndSlotsBufferEntries(); |
679 | 680 |
680 void StartSweeperThreads(); | 681 void StartSweeperThreads(); |
(...skipping 17 matching lines...) Expand all Loading... |
698 | 699 |
699 // True if we are collecting slots to perform evacuation from evacuation | 700 // True if we are collecting slots to perform evacuation from evacuation |
700 // candidates. | 701 // candidates. |
701 bool compacting_; | 702 bool compacting_; |
702 | 703 |
703 bool was_marked_incrementally_; | 704 bool was_marked_incrementally_; |
704 | 705 |
705 // True if concurrent or parallel sweeping is currently in progress. | 706 // True if concurrent or parallel sweeping is currently in progress. |
706 bool sweeping_in_progress_; | 707 bool sweeping_in_progress_; |
707 | 708 |
| 709 // Synchronize sweeper threads. |
708 base::Semaphore pending_sweeper_jobs_semaphore_; | 710 base::Semaphore pending_sweeper_jobs_semaphore_; |
709 | 711 |
| 712 // Synchronize compaction threads. |
| 713 base::Semaphore pending_compaction_jobs_semaphore_; |
| 714 |
710 bool evacuation_; | 715 bool evacuation_; |
711 | 716 |
712 SlotsBufferAllocator slots_buffer_allocator_; | 717 SlotsBufferAllocator slots_buffer_allocator_; |
713 | 718 |
714 SlotsBuffer* migration_slots_buffer_; | 719 SlotsBuffer* migration_slots_buffer_; |
715 | 720 |
716 // Finishes GC, performs heap verification if enabled. | 721 // Finishes GC, performs heap verification if enabled. |
717 void Finish(); | 722 void Finish(); |
718 | 723 |
719 // ----------------------------------------------------------------------- | 724 // ----------------------------------------------------------------------- |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 | 863 |
859 int DiscoverAndEvacuateBlackObjectsOnPage(NewSpace* new_space, | 864 int DiscoverAndEvacuateBlackObjectsOnPage(NewSpace* new_space, |
860 NewSpacePage* p); | 865 NewSpacePage* p); |
861 | 866 |
862 void EvacuateNewSpace(); | 867 void EvacuateNewSpace(); |
863 | 868 |
864 void EvacuateLiveObjectsFromPage(Page* p); | 869 void EvacuateLiveObjectsFromPage(Page* p); |
865 | 870 |
866 void EvacuatePages(); | 871 void EvacuatePages(); |
867 | 872 |
| 873 void EvacuatePagesInParallel(); |
| 874 |
868 void EvacuateNewSpaceAndCandidates(); | 875 void EvacuateNewSpaceAndCandidates(); |
869 | 876 |
870 void ReleaseEvacuationCandidates(); | 877 void ReleaseEvacuationCandidates(); |
871 | 878 |
872 // Moves the pages of the evacuation_candidates_ list to the end of their | 879 // Moves the pages of the evacuation_candidates_ list to the end of their |
873 // corresponding space pages list. | 880 // corresponding space pages list. |
874 void MoveEvacuationCandidatesToEndOfPagesList(); | 881 void MoveEvacuationCandidatesToEndOfPagesList(); |
875 | 882 |
876 void SweepSpace(PagedSpace* space, SweeperType sweeper); | 883 void SweepSpace(PagedSpace* space, SweeperType sweeper); |
877 | 884 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 private: | 969 private: |
963 MarkCompactCollector* collector_; | 970 MarkCompactCollector* collector_; |
964 }; | 971 }; |
965 | 972 |
966 | 973 |
967 const char* AllocationSpaceName(AllocationSpace space); | 974 const char* AllocationSpaceName(AllocationSpace space); |
968 } | 975 } |
969 } // namespace v8::internal | 976 } // namespace v8::internal |
970 | 977 |
971 #endif // V8_HEAP_MARK_COMPACT_H_ | 978 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |