| 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 } | 504 } |
| 505 | 505 |
| 506 private: | 506 private: |
| 507 class CompactionTask; | 507 class CompactionTask; |
| 508 class EvacuateNewSpaceVisitor; | 508 class EvacuateNewSpaceVisitor; |
| 509 class EvacuateOldSpaceVisitor; | 509 class EvacuateOldSpaceVisitor; |
| 510 class EvacuateVisitorBase; | 510 class EvacuateVisitorBase; |
| 511 class HeapObjectVisitor; | 511 class HeapObjectVisitor; |
| 512 class SweeperTask; | 512 class SweeperTask; |
| 513 | 513 |
| 514 static const int kInitialLocalPretenuringFeedbackCapacity = 256; |
| 515 |
| 514 explicit MarkCompactCollector(Heap* heap); | 516 explicit MarkCompactCollector(Heap* heap); |
| 515 | 517 |
| 516 bool WillBeDeoptimized(Code* code); | 518 bool WillBeDeoptimized(Code* code); |
| 517 void EvictPopularEvacuationCandidate(Page* page); | 519 void EvictPopularEvacuationCandidate(Page* page); |
| 518 void ClearInvalidStoreAndSlotsBufferEntries(); | 520 void ClearInvalidStoreAndSlotsBufferEntries(); |
| 519 | 521 |
| 520 void StartSweeperThreads(); | 522 void StartSweeperThreads(); |
| 521 | 523 |
| 522 void ComputeEvacuationHeuristics(int area_size, | 524 void ComputeEvacuationHeuristics(int area_size, |
| 523 int* target_fragmentation_percent, | 525 int* target_fragmentation_percent, |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 // After: Live objects are unmarked, non-live regions have been added to | 691 // After: Live objects are unmarked, non-live regions have been added to |
| 690 // their space's free list. Active eden semispace is compacted by | 692 // their space's free list. Active eden semispace is compacted by |
| 691 // evacuation. | 693 // evacuation. |
| 692 // | 694 // |
| 693 | 695 |
| 694 // If we are not compacting the heap, we simply sweep the spaces except | 696 // If we are not compacting the heap, we simply sweep the spaces except |
| 695 // for the large object space, clearing mark bits and adding unmarked | 697 // for the large object space, clearing mark bits and adding unmarked |
| 696 // regions to each space's free list. | 698 // regions to each space's free list. |
| 697 void SweepSpaces(); | 699 void SweepSpaces(); |
| 698 | 700 |
| 699 void EvacuateNewSpace(); | 701 void EvacuateNewSpacePrologue(); |
| 702 |
| 703 // Returns local pretenuring feedback. |
| 704 HashMap* EvacuateNewSpaceInParallel(); |
| 700 | 705 |
| 701 void AddEvacuationSlotsBufferSynchronized( | 706 void AddEvacuationSlotsBufferSynchronized( |
| 702 SlotsBuffer* evacuation_slots_buffer); | 707 SlotsBuffer* evacuation_slots_buffer); |
| 703 | 708 |
| 704 void EvacuatePages(CompactionSpaceCollection* compaction_spaces, | 709 void EvacuatePages(CompactionSpaceCollection* compaction_spaces, |
| 705 SlotsBuffer** evacuation_slots_buffer); | 710 SlotsBuffer** evacuation_slots_buffer); |
| 706 | 711 |
| 707 void EvacuatePagesInParallel(); | 712 void EvacuatePagesInParallel(); |
| 708 | 713 |
| 709 // The number of parallel compaction tasks, including the main thread. | 714 // The number of parallel compaction tasks, including the main thread. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 | 770 |
| 766 Heap* heap_; | 771 Heap* heap_; |
| 767 base::VirtualMemory* marking_deque_memory_; | 772 base::VirtualMemory* marking_deque_memory_; |
| 768 size_t marking_deque_memory_committed_; | 773 size_t marking_deque_memory_committed_; |
| 769 MarkingDeque marking_deque_; | 774 MarkingDeque marking_deque_; |
| 770 CodeFlusher* code_flusher_; | 775 CodeFlusher* code_flusher_; |
| 771 bool have_code_to_deoptimize_; | 776 bool have_code_to_deoptimize_; |
| 772 | 777 |
| 773 List<Page*> evacuation_candidates_; | 778 List<Page*> evacuation_candidates_; |
| 774 | 779 |
| 780 List<MemoryChunk*> newspace_evacuation_candidates_; |
| 781 |
| 775 // The evacuation_slots_buffers_ are used by the compaction threads. | 782 // The evacuation_slots_buffers_ are used by the compaction threads. |
| 776 // When a compaction task finishes, it uses | 783 // When a compaction task finishes, it uses |
| 777 // AddEvacuationSlotsbufferSynchronized to adds its slots buffer to the | 784 // AddEvacuationSlotsbufferSynchronized to adds its slots buffer to the |
| 778 // evacuation_slots_buffers_ list using the evacuation_slots_buffers_mutex_ | 785 // evacuation_slots_buffers_ list using the evacuation_slots_buffers_mutex_ |
| 779 // lock. | 786 // lock. |
| 780 base::Mutex evacuation_slots_buffers_mutex_; | 787 base::Mutex evacuation_slots_buffers_mutex_; |
| 781 List<SlotsBuffer*> evacuation_slots_buffers_; | 788 List<SlotsBuffer*> evacuation_slots_buffers_; |
| 782 | 789 |
| 783 base::SmartPointer<FreeList> free_list_old_space_; | 790 base::SmartPointer<FreeList> free_list_old_space_; |
| 784 base::SmartPointer<FreeList> free_list_code_space_; | 791 base::SmartPointer<FreeList> free_list_code_space_; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 private: | 873 private: |
| 867 MarkCompactCollector* collector_; | 874 MarkCompactCollector* collector_; |
| 868 }; | 875 }; |
| 869 | 876 |
| 870 | 877 |
| 871 const char* AllocationSpaceName(AllocationSpace space); | 878 const char* AllocationSpaceName(AllocationSpace space); |
| 872 } // namespace internal | 879 } // namespace internal |
| 873 } // namespace v8 | 880 } // namespace v8 |
| 874 | 881 |
| 875 #endif // V8_HEAP_MARK_COMPACT_H_ | 882 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |