Chromium Code Reviews| 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 #include "src/heap/store-buffer.h" | 10 #include "src/heap/store-buffer.h" |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 MarkingParity marking_parity() { return marking_parity_; } | 491 MarkingParity marking_parity() { return marking_parity_; } |
| 492 | 492 |
| 493 // Concurrent and parallel sweeping support. If required_freed_bytes was set | 493 // Concurrent and parallel sweeping support. If required_freed_bytes was set |
| 494 // to a value larger than 0, then sweeping returns after a block of at least | 494 // to a value larger than 0, then sweeping returns after a block of at least |
| 495 // required_freed_bytes was freed. If required_freed_bytes was set to zero | 495 // required_freed_bytes was freed. If required_freed_bytes was set to zero |
| 496 // then the whole given space is swept. It returns the size of the maximum | 496 // then the whole given space is swept. It returns the size of the maximum |
| 497 // continuous freed memory chunk. | 497 // continuous freed memory chunk. |
| 498 int SweepInParallel(PagedSpace* space, int required_freed_bytes, | 498 int SweepInParallel(PagedSpace* space, int required_freed_bytes, |
| 499 int max_pages = 0); | 499 int max_pages = 0); |
| 500 | 500 |
| 501 int SweepInParallel(std::vector<Page*>& pages, PagedSpace* space, | |
| 502 int required_freed_bytes, int max_pages = 0); | |
| 503 | |
| 501 // Sweeps a given page concurrently to the sweeper threads. It returns the | 504 // Sweeps a given page concurrently to the sweeper threads. It returns the |
| 502 // size of the maximum continuous freed memory chunk. | 505 // size of the maximum continuous freed memory chunk. |
| 503 int SweepInParallel(Page* page, PagedSpace* space); | 506 int SweepInParallel(Page* page, PagedSpace* space); |
| 504 | 507 |
| 505 // Ensures that sweeping is finished. | 508 // Ensures that sweeping is finished. |
| 506 // | 509 // |
| 507 // Note: Can only be called safely from main thread. | 510 // Note: Can only be called safely from main thread. |
| 508 void EnsureSweepingCompleted(); | 511 void EnsureSweepingCompleted(); |
| 509 | 512 |
| 510 void SweepOrWaitUntilSweepingCompleted(Page* page); | 513 void SweepOrWaitUntilSweepingCompleted(Page* page); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 return &swept_code_space_pages_; | 574 return &swept_code_space_pages_; |
| 572 case MAP_SPACE: | 575 case MAP_SPACE: |
| 573 return &swept_map_space_pages_; | 576 return &swept_map_space_pages_; |
| 574 default: | 577 default: |
| 575 UNREACHABLE(); | 578 UNREACHABLE(); |
| 576 } | 579 } |
| 577 return nullptr; | 580 return nullptr; |
| 578 } | 581 } |
| 579 | 582 |
| 580 private: | 583 private: |
| 584 class EvacuateNewSpacePageVisitor; | |
| 581 class EvacuateNewSpaceVisitor; | 585 class EvacuateNewSpaceVisitor; |
| 582 class EvacuateOldSpaceVisitor; | 586 class EvacuateOldSpaceVisitor; |
| 583 class EvacuateVisitorBase; | 587 class EvacuateVisitorBase; |
| 584 class HeapObjectVisitor; | 588 class HeapObjectVisitor; |
| 585 class SweeperTask; | 589 class SweeperTask; |
| 586 | 590 |
| 587 typedef std::vector<Page*> SweepingList; | 591 typedef std::vector<Page*> SweepingList; |
| 588 | 592 |
| 589 explicit MarkCompactCollector(Heap* heap); | 593 explicit MarkCompactCollector(Heap* heap); |
| 590 | 594 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 820 List<NewSpacePage*> newspace_evacuation_candidates_; | 824 List<NewSpacePage*> newspace_evacuation_candidates_; |
| 821 | 825 |
| 822 base::Mutex swept_pages_mutex_; | 826 base::Mutex swept_pages_mutex_; |
| 823 List<Page*> swept_old_space_pages_; | 827 List<Page*> swept_old_space_pages_; |
| 824 List<Page*> swept_code_space_pages_; | 828 List<Page*> swept_code_space_pages_; |
| 825 List<Page*> swept_map_space_pages_; | 829 List<Page*> swept_map_space_pages_; |
| 826 | 830 |
| 827 SweepingList sweeping_list_old_space_; | 831 SweepingList sweeping_list_old_space_; |
| 828 SweepingList sweeping_list_code_space_; | 832 SweepingList sweeping_list_code_space_; |
| 829 SweepingList sweeping_list_map_space_; | 833 SweepingList sweeping_list_map_space_; |
| 834 SweepingList* sweeping_list_shared_; | |
|
Michael Lippautz
2016/04/08 07:09:58
Not too happy about cluttering up all the sweeper
Hannes Payer (out of office)
2016/04/08 10:42:40
Yeah, that does not really scale. You can do that
Michael Lippautz
2016/04/08 11:30:00
It's sweeping_list_promoted_pages_ for now.
| |
| 830 | 835 |
| 831 // True if we are collecting slots to perform evacuation from evacuation | 836 // True if we are collecting slots to perform evacuation from evacuation |
| 832 // candidates. | 837 // candidates. |
| 833 bool compacting_; | 838 bool compacting_; |
| 834 | 839 |
| 835 // True if concurrent or parallel sweeping is currently in progress. | 840 // True if concurrent or parallel sweeping is currently in progress. |
| 836 bool sweeping_in_progress_; | 841 bool sweeping_in_progress_; |
| 837 | 842 |
| 838 // Semaphore used to synchronize sweeper tasks. | 843 // Semaphore used to synchronize sweeper tasks. |
| 839 base::Semaphore pending_sweeper_tasks_semaphore_; | 844 base::Semaphore pending_sweeper_tasks_semaphore_; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 860 private: | 865 private: |
| 861 MarkCompactCollector* collector_; | 866 MarkCompactCollector* collector_; |
| 862 }; | 867 }; |
| 863 | 868 |
| 864 | 869 |
| 865 const char* AllocationSpaceName(AllocationSpace space); | 870 const char* AllocationSpaceName(AllocationSpace space); |
| 866 } // namespace internal | 871 } // namespace internal |
| 867 } // namespace v8 | 872 } // namespace v8 |
| 868 | 873 |
| 869 #endif // V8_HEAP_MARK_COMPACT_H_ | 874 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |