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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 358 |
359 static inline bool IsMarked(Object* obj); | 359 static inline bool IsMarked(Object* obj); |
360 static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p); | 360 static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p); |
361 | 361 |
362 inline Heap* heap() const { return heap_; } | 362 inline Heap* heap() const { return heap_; } |
363 inline Isolate* isolate() const; | 363 inline Isolate* isolate() const; |
364 | 364 |
365 CodeFlusher* code_flusher() { return code_flusher_; } | 365 CodeFlusher* code_flusher() { return code_flusher_; } |
366 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } | 366 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } |
367 | 367 |
368 enum SweeperType { | |
369 CONCURRENT_SWEEPING, | |
370 SEQUENTIAL_SWEEPING | |
371 }; | |
372 | |
373 enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL }; | 368 enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL }; |
374 | 369 |
375 #ifdef VERIFY_HEAP | 370 #ifdef VERIFY_HEAP |
376 void VerifyValidStoreAndSlotsBufferEntries(); | 371 void VerifyValidStoreAndSlotsBufferEntries(); |
377 void VerifyMarkbitsAreClean(); | 372 void VerifyMarkbitsAreClean(); |
378 static void VerifyMarkbitsAreClean(PagedSpace* space); | 373 static void VerifyMarkbitsAreClean(PagedSpace* space); |
379 static void VerifyMarkbitsAreClean(NewSpace* space); | 374 static void VerifyMarkbitsAreClean(NewSpace* space); |
380 void VerifyWeakEmbeddedObjectsInCode(); | 375 void VerifyWeakEmbeddedObjectsInCode(); |
381 void VerifyOmittedMapChecks(); | 376 void VerifyOmittedMapChecks(); |
382 #endif | 377 #endif |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 // After: Live objects are unmarked, non-live regions have been added to | 681 // After: Live objects are unmarked, non-live regions have been added to |
687 // their space's free list. Active eden semispace is compacted by | 682 // their space's free list. Active eden semispace is compacted by |
688 // evacuation. | 683 // evacuation. |
689 // | 684 // |
690 | 685 |
691 // If we are not compacting the heap, we simply sweep the spaces except | 686 // If we are not compacting the heap, we simply sweep the spaces except |
692 // for the large object space, clearing mark bits and adding unmarked | 687 // for the large object space, clearing mark bits and adding unmarked |
693 // regions to each space's free list. | 688 // regions to each space's free list. |
694 void SweepSpaces(); | 689 void SweepSpaces(); |
695 | 690 |
696 | |
697 void EvacuateNewSpace(); | 691 void EvacuateNewSpace(); |
698 | 692 |
699 void AddEvacuationSlotsBufferSynchronized( | 693 void AddEvacuationSlotsBufferSynchronized( |
700 SlotsBuffer* evacuation_slots_buffer); | 694 SlotsBuffer* evacuation_slots_buffer); |
701 | 695 |
702 void EvacuatePages(CompactionSpaceCollection* compaction_spaces, | 696 void EvacuatePages(CompactionSpaceCollection* compaction_spaces, |
703 SlotsBuffer** evacuation_slots_buffer); | 697 SlotsBuffer** evacuation_slots_buffer); |
704 | 698 |
705 void EvacuatePagesInParallel(); | 699 void EvacuatePagesInParallel(); |
706 | 700 |
(...skipping 17 matching lines...) Expand all Loading... |
724 void VisitLiveObjectsBody(Page* page, ObjectVisitor* visitor); | 718 void VisitLiveObjectsBody(Page* page, ObjectVisitor* visitor); |
725 | 719 |
726 void SweepAbortedPages(); | 720 void SweepAbortedPages(); |
727 | 721 |
728 void ReleaseEvacuationCandidates(); | 722 void ReleaseEvacuationCandidates(); |
729 | 723 |
730 // Moves the pages of the evacuation_candidates_ list to the end of their | 724 // Moves the pages of the evacuation_candidates_ list to the end of their |
731 // corresponding space pages list. | 725 // corresponding space pages list. |
732 void MoveEvacuationCandidatesToEndOfPagesList(); | 726 void MoveEvacuationCandidatesToEndOfPagesList(); |
733 | 727 |
734 void SweepSpace(PagedSpace* space, SweeperType sweeper); | 728 // Starts sweeping of a space by contributing on the main thread and setting |
| 729 // up other pages for sweeping. |
| 730 void StartSweepSpace(PagedSpace* space); |
735 | 731 |
736 // Finalizes the parallel sweeping phase. Marks all the pages that were | 732 // Finalizes the parallel sweeping phase. Marks all the pages that were |
737 // swept in parallel. | 733 // swept in parallel. |
738 void ParallelSweepSpacesComplete(); | 734 void ParallelSweepSpacesComplete(); |
739 | 735 |
740 void ParallelSweepSpaceComplete(PagedSpace* space); | 736 void ParallelSweepSpaceComplete(PagedSpace* space); |
741 | 737 |
742 // Updates store buffer and slot buffer for a pointer in a migrating object. | 738 // Updates store buffer and slot buffer for a pointer in a migrating object. |
743 void RecordMigratedSlot(Object* value, Address slot, | 739 void RecordMigratedSlot(Object* value, Address slot, |
744 SlotsBuffer** evacuation_slots_buffer); | 740 SlotsBuffer** evacuation_slots_buffer); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 private: | 850 private: |
855 MarkCompactCollector* collector_; | 851 MarkCompactCollector* collector_; |
856 }; | 852 }; |
857 | 853 |
858 | 854 |
859 const char* AllocationSpaceName(AllocationSpace space); | 855 const char* AllocationSpaceName(AllocationSpace space); |
860 } // namespace internal | 856 } // namespace internal |
861 } // namespace v8 | 857 } // namespace v8 |
862 | 858 |
863 #endif // V8_HEAP_MARK_COMPACT_H_ | 859 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |