| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 | 323 |
| 324 // Defined in isolate.h. | 324 // Defined in isolate.h. |
| 325 class ThreadLocalTop; | 325 class ThreadLocalTop; |
| 326 | 326 |
| 327 | 327 |
| 328 // ------------------------------------------------------------------------- | 328 // ------------------------------------------------------------------------- |
| 329 // Mark-Compact collector | 329 // Mark-Compact collector |
| 330 class MarkCompactCollector { | 330 class MarkCompactCollector { |
| 331 public: | 331 public: |
| 332 enum IterationMode { |
| 333 kKeepMarking, |
| 334 kClearMarkbits, |
| 335 }; |
| 336 |
| 337 class HeapObjectVisitor; |
| 338 class EvacuateNewSpaceVisitor; |
| 339 class EvacuateOldSpaceVisitor; |
| 340 |
| 332 static void Initialize(); | 341 static void Initialize(); |
| 333 | 342 |
| 334 void SetUp(); | 343 void SetUp(); |
| 335 | 344 |
| 336 void TearDown(); | 345 void TearDown(); |
| 337 | 346 |
| 338 void CollectEvacuationCandidates(PagedSpace* space); | 347 void CollectEvacuationCandidates(PagedSpace* space); |
| 339 | 348 |
| 340 void AddEvacuationCandidate(Page* p); | 349 void AddEvacuationCandidate(Page* p); |
| 341 | 350 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 // After: Live objects are unmarked, non-live regions have been added to | 701 // After: Live objects are unmarked, non-live regions have been added to |
| 693 // their space's free list. Active eden semispace is compacted by | 702 // their space's free list. Active eden semispace is compacted by |
| 694 // evacuation. | 703 // evacuation. |
| 695 // | 704 // |
| 696 | 705 |
| 697 // If we are not compacting the heap, we simply sweep the spaces except | 706 // If we are not compacting the heap, we simply sweep the spaces except |
| 698 // for the large object space, clearing mark bits and adding unmarked | 707 // for the large object space, clearing mark bits and adding unmarked |
| 699 // regions to each space's free list. | 708 // regions to each space's free list. |
| 700 void SweepSpaces(); | 709 void SweepSpaces(); |
| 701 | 710 |
| 702 int DiscoverAndEvacuateBlackObjectsOnPage(NewSpace* new_space, | 711 void IterateLiveObjectsOnPage(MemoryChunk* page, HeapObjectVisitor* visitor, |
| 703 NewSpacePage* p); | 712 IterationMode mode); |
| 704 | 713 |
| 705 void EvacuateNewSpace(); | 714 void EvacuateNewSpace(); |
| 706 | 715 |
| 707 bool EvacuateLiveObjectsFromPage(Page* p, PagedSpace* target_space, | |
| 708 SlotsBuffer** evacuation_slots_buffer); | |
| 709 | |
| 710 void AddEvacuationSlotsBufferSynchronized( | 716 void AddEvacuationSlotsBufferSynchronized( |
| 711 SlotsBuffer* evacuation_slots_buffer); | 717 SlotsBuffer* evacuation_slots_buffer); |
| 712 | 718 |
| 713 void EvacuatePages(CompactionSpaceCollection* compaction_spaces, | 719 void EvacuatePages(CompactionSpaceCollection* compaction_spaces, |
| 714 SlotsBuffer** evacuation_slots_buffer); | 720 SlotsBuffer** evacuation_slots_buffer); |
| 715 | 721 |
| 716 void EvacuatePagesInParallel(); | 722 void EvacuatePagesInParallel(); |
| 717 | 723 |
| 718 // The number of parallel compaction tasks, including the main thread. | 724 // The number of parallel compaction tasks, including the main thread. |
| 719 int NumberOfParallelCompactionTasks(); | 725 int NumberOfParallelCompactionTasks(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 private: | 863 private: |
| 858 MarkCompactCollector* collector_; | 864 MarkCompactCollector* collector_; |
| 859 }; | 865 }; |
| 860 | 866 |
| 861 | 867 |
| 862 const char* AllocationSpaceName(AllocationSpace space); | 868 const char* AllocationSpaceName(AllocationSpace space); |
| 863 } // namespace internal | 869 } // namespace internal |
| 864 } // namespace v8 | 870 } // namespace v8 |
| 865 | 871 |
| 866 #endif // V8_HEAP_MARK_COMPACT_H_ | 872 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |