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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 UPDATE_POINTERS, | 535 UPDATE_POINTERS, |
536 RELOCATE_OBJECTS | 536 RELOCATE_OBJECTS |
537 }; | 537 }; |
538 | 538 |
539 // The current stage of the collector. | 539 // The current stage of the collector. |
540 CollectorState state_; | 540 CollectorState state_; |
541 #endif | 541 #endif |
542 | 542 |
543 MarkingParity marking_parity_; | 543 MarkingParity marking_parity_; |
544 | 544 |
545 // True if we are collecting slots to perform evacuation from evacuation | |
546 // candidates. | |
547 bool compacting_; | |
548 | |
549 bool was_marked_incrementally_; | 545 bool was_marked_incrementally_; |
550 | 546 |
551 // True if concurrent or parallel sweeping is currently in progress. | |
552 bool sweeping_in_progress_; | |
553 | |
554 // True if parallel compaction is currently in progress. | |
555 bool parallel_compaction_in_progress_; | |
556 | |
557 // Synchronize sweeper threads. | |
558 base::Semaphore pending_sweeper_jobs_semaphore_; | |
559 | |
560 // Synchronize compaction tasks. | |
561 base::Semaphore pending_compaction_tasks_semaphore_; | |
562 | |
563 // Number of active compaction tasks (including main thread). | |
564 intptr_t concurrent_compaction_tasks_active_; | |
565 | |
566 bool evacuation_; | 547 bool evacuation_; |
567 | 548 |
568 SlotsBufferAllocator* slots_buffer_allocator_; | 549 SlotsBufferAllocator* slots_buffer_allocator_; |
569 | 550 |
570 SlotsBuffer* migration_slots_buffer_; | 551 SlotsBuffer* migration_slots_buffer_; |
571 | 552 |
572 // Finishes GC, performs heap verification if enabled. | 553 // Finishes GC, performs heap verification if enabled. |
573 void Finish(); | 554 void Finish(); |
574 | 555 |
575 // ----------------------------------------------------------------------- | 556 // ----------------------------------------------------------------------- |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 // AddEvacuationSlotsbufferSynchronized to adds its slots buffer to the | 767 // AddEvacuationSlotsbufferSynchronized to adds its slots buffer to the |
787 // evacuation_slots_buffers_ list using the evacuation_slots_buffers_mutex_ | 768 // evacuation_slots_buffers_ list using the evacuation_slots_buffers_mutex_ |
788 // lock. | 769 // lock. |
789 base::Mutex evacuation_slots_buffers_mutex_; | 770 base::Mutex evacuation_slots_buffers_mutex_; |
790 List<SlotsBuffer*> evacuation_slots_buffers_; | 771 List<SlotsBuffer*> evacuation_slots_buffers_; |
791 | 772 |
792 base::SmartPointer<FreeList> free_list_old_space_; | 773 base::SmartPointer<FreeList> free_list_old_space_; |
793 base::SmartPointer<FreeList> free_list_code_space_; | 774 base::SmartPointer<FreeList> free_list_code_space_; |
794 base::SmartPointer<FreeList> free_list_map_space_; | 775 base::SmartPointer<FreeList> free_list_map_space_; |
795 | 776 |
| 777 // True if we are collecting slots to perform evacuation from evacuation |
| 778 // candidates. |
| 779 bool compacting_; |
| 780 |
| 781 // True if concurrent or parallel sweeping is currently in progress. |
| 782 bool sweeping_in_progress_; |
| 783 |
| 784 // True if parallel compaction is currently in progress. |
| 785 bool compaction_in_progress_; |
| 786 |
| 787 // Semaphore used to synchronize sweeper tasks. |
| 788 base::Semaphore pending_sweeper_tasks_semaphore_; |
| 789 |
| 790 // Semaphore used to synchronize compaction tasks. |
| 791 base::Semaphore pending_compaction_tasks_semaphore_; |
| 792 |
| 793 // Number of active compaction tasks (including main thread). |
| 794 intptr_t concurrent_compaction_tasks_active_; |
| 795 |
796 friend class Heap; | 796 friend class Heap; |
797 }; | 797 }; |
798 | 798 |
799 | 799 |
800 class MarkBitCellIterator BASE_EMBEDDED { | 800 class MarkBitCellIterator BASE_EMBEDDED { |
801 public: | 801 public: |
802 explicit MarkBitCellIterator(MemoryChunk* chunk) : chunk_(chunk) { | 802 explicit MarkBitCellIterator(MemoryChunk* chunk) : chunk_(chunk) { |
803 last_cell_index_ = Bitmap::IndexToCell(Bitmap::CellAlignIndex( | 803 last_cell_index_ = Bitmap::IndexToCell(Bitmap::CellAlignIndex( |
804 chunk_->AddressToMarkbitIndex(chunk_->area_end()))); | 804 chunk_->AddressToMarkbitIndex(chunk_->area_end()))); |
805 cell_base_ = chunk_->area_start(); | 805 cell_base_ = chunk_->area_start(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 private: | 850 private: |
851 MarkCompactCollector* collector_; | 851 MarkCompactCollector* collector_; |
852 }; | 852 }; |
853 | 853 |
854 | 854 |
855 const char* AllocationSpaceName(AllocationSpace space); | 855 const char* AllocationSpaceName(AllocationSpace space); |
856 } | 856 } |
857 } // namespace v8::internal | 857 } // namespace v8::internal |
858 | 858 |
859 #endif // V8_HEAP_MARK_COMPACT_H_ | 859 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |