| 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 // If sweeper threads are not active this method will return true. If | 636 // If sweeper threads are not active this method will return true. If |
| 637 // this is a latency issue we should be smarter here. Otherwise, it will | 637 // this is a latency issue we should be smarter here. Otherwise, it will |
| 638 // return true if the sweeper threads are done processing the pages. | 638 // return true if the sweeper threads are done processing the pages. |
| 639 bool IsSweepingCompleted(); | 639 bool IsSweepingCompleted(); |
| 640 | 640 |
| 641 void RefillFreeList(PagedSpace* space); | 641 void RefillFreeList(PagedSpace* space); |
| 642 | 642 |
| 643 // Checks if sweeping is in progress right now on any space. | 643 // Checks if sweeping is in progress right now on any space. |
| 644 bool sweeping_in_progress() { return sweeping_in_progress_; } | 644 bool sweeping_in_progress() { return sweeping_in_progress_; } |
| 645 | 645 |
| 646 void set_sequential_sweeping(bool sequential_sweeping) { | 646 void set_evacuation(bool evacuation) { evacuation_ = evacuation; } |
| 647 sequential_sweeping_ = sequential_sweeping; | |
| 648 } | |
| 649 | 647 |
| 650 bool sequential_sweeping() const { return sequential_sweeping_; } | 648 bool evacuation() const { return evacuation_; } |
| 651 | 649 |
| 652 // Mark the global table which maps weak objects to dependent code without | 650 // Mark the global table which maps weak objects to dependent code without |
| 653 // marking its contents. | 651 // marking its contents. |
| 654 void MarkWeakObjectToCodeTable(); | 652 void MarkWeakObjectToCodeTable(); |
| 655 | 653 |
| 656 // Special case for processing weak references in a full collection. We need | 654 // Special case for processing weak references in a full collection. We need |
| 657 // to artificially keep AllocationSites alive for a time. | 655 // to artificially keep AllocationSites alive for a time. |
| 658 void MarkAllocationSite(AllocationSite* site); | 656 void MarkAllocationSite(AllocationSite* site); |
| 659 | 657 |
| 660 bool IsMarkingDequeEmpty(); | 658 bool IsMarkingDequeEmpty(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 // candidates. | 695 // candidates. |
| 698 bool compacting_; | 696 bool compacting_; |
| 699 | 697 |
| 700 bool was_marked_incrementally_; | 698 bool was_marked_incrementally_; |
| 701 | 699 |
| 702 // True if concurrent or parallel sweeping is currently in progress. | 700 // True if concurrent or parallel sweeping is currently in progress. |
| 703 bool sweeping_in_progress_; | 701 bool sweeping_in_progress_; |
| 704 | 702 |
| 705 base::Semaphore pending_sweeper_jobs_semaphore_; | 703 base::Semaphore pending_sweeper_jobs_semaphore_; |
| 706 | 704 |
| 707 bool sequential_sweeping_; | 705 bool evacuation_; |
| 708 | 706 |
| 709 SlotsBufferAllocator slots_buffer_allocator_; | 707 SlotsBufferAllocator slots_buffer_allocator_; |
| 710 | 708 |
| 711 SlotsBuffer* migration_slots_buffer_; | 709 SlotsBuffer* migration_slots_buffer_; |
| 712 | 710 |
| 713 // Finishes GC, performs heap verification if enabled. | 711 // Finishes GC, performs heap verification if enabled. |
| 714 void Finish(); | 712 void Finish(); |
| 715 | 713 |
| 716 // ----------------------------------------------------------------------- | 714 // ----------------------------------------------------------------------- |
| 717 // Phase 1: Marking live objects. | 715 // Phase 1: Marking live objects. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 925 |
| 928 private: | 926 private: |
| 929 MemoryChunk* chunk_; | 927 MemoryChunk* chunk_; |
| 930 MarkBit::CellType* cells_; | 928 MarkBit::CellType* cells_; |
| 931 unsigned int last_cell_index_; | 929 unsigned int last_cell_index_; |
| 932 unsigned int cell_index_; | 930 unsigned int cell_index_; |
| 933 Address cell_base_; | 931 Address cell_base_; |
| 934 }; | 932 }; |
| 935 | 933 |
| 936 | 934 |
| 937 class SequentialSweepingScope BASE_EMBEDDED { | 935 class EvacuationScope BASE_EMBEDDED { |
| 938 public: | 936 public: |
| 939 explicit SequentialSweepingScope(MarkCompactCollector* collector) | 937 explicit EvacuationScope(MarkCompactCollector* collector) |
| 940 : collector_(collector) { | 938 : collector_(collector) { |
| 941 collector_->set_sequential_sweeping(true); | 939 collector_->set_evacuation(true); |
| 942 } | 940 } |
| 943 | 941 |
| 944 ~SequentialSweepingScope() { collector_->set_sequential_sweeping(false); } | 942 ~EvacuationScope() { collector_->set_evacuation(false); } |
| 945 | 943 |
| 946 private: | 944 private: |
| 947 MarkCompactCollector* collector_; | 945 MarkCompactCollector* collector_; |
| 948 }; | 946 }; |
| 949 | 947 |
| 950 | 948 |
| 951 const char* AllocationSpaceName(AllocationSpace space); | 949 const char* AllocationSpaceName(AllocationSpace space); |
| 952 } | 950 } |
| 953 } // namespace v8::internal | 951 } // namespace v8::internal |
| 954 | 952 |
| 955 #endif // V8_HEAP_MARK_COMPACT_H_ | 953 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |