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_MARK_COMPACT_H_ | 5 #ifndef V8_MARK_COMPACT_H_ |
6 #define V8_MARK_COMPACT_H_ | 6 #define V8_MARK_COMPACT_H_ |
7 | 7 |
8 #include "src/compiler-intrinsics.h" | 8 #include "src/compiler-intrinsics.h" |
9 #include "src/spaces.h" | 9 #include "src/spaces.h" |
10 | 10 |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 static inline bool IsMarked(Object* obj); | 563 static inline bool IsMarked(Object* obj); |
564 | 564 |
565 inline Heap* heap() const { return heap_; } | 565 inline Heap* heap() const { return heap_; } |
566 inline Isolate* isolate() const; | 566 inline Isolate* isolate() const; |
567 | 567 |
568 CodeFlusher* code_flusher() { return code_flusher_; } | 568 CodeFlusher* code_flusher() { return code_flusher_; } |
569 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } | 569 inline bool is_code_flushing_enabled() const { return code_flusher_ != NULL; } |
570 void EnableCodeFlushing(bool enable); | 570 void EnableCodeFlushing(bool enable); |
571 | 571 |
572 enum SweeperType { | 572 enum SweeperType { |
| 573 CONSERVATIVE, |
573 PARALLEL_CONSERVATIVE, | 574 PARALLEL_CONSERVATIVE, |
574 CONCURRENT_CONSERVATIVE, | 575 CONCURRENT_CONSERVATIVE, |
575 PRECISE | 576 PRECISE |
576 }; | 577 }; |
577 | 578 |
578 enum SweepingParallelism { | 579 enum SweepingParallelism { |
579 SWEEP_ON_MAIN_THREAD, | 580 SWEEP_ON_MAIN_THREAD, |
580 SWEEP_IN_PARALLEL | 581 SWEEP_IN_PARALLEL |
581 }; | 582 }; |
582 | 583 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 bool is_compacting() const { return compacting_; } | 658 bool is_compacting() const { return compacting_; } |
658 | 659 |
659 MarkingParity marking_parity() { return marking_parity_; } | 660 MarkingParity marking_parity() { return marking_parity_; } |
660 | 661 |
661 // Concurrent and parallel sweeping support. If required_freed_bytes was set | 662 // Concurrent and parallel sweeping support. If required_freed_bytes was set |
662 // to a value larger than 0, then sweeping returns after a block of at least | 663 // to a value larger than 0, then sweeping returns after a block of at least |
663 // required_freed_bytes was freed. If required_freed_bytes was set to zero | 664 // required_freed_bytes was freed. If required_freed_bytes was set to zero |
664 // then the whole given space is swept. | 665 // then the whole given space is swept. |
665 int SweepInParallel(PagedSpace* space, int required_freed_bytes); | 666 int SweepInParallel(PagedSpace* space, int required_freed_bytes); |
666 | 667 |
667 void EnsureSweepingCompleted(); | 668 void WaitUntilSweepingCompleted(); |
668 | 669 |
669 // If sweeper threads are not active this method will return true. If | |
670 // this is a latency issue we should be smarter here. Otherwise, it will | |
671 // return true if the sweeper threads are done processing the pages. | |
672 bool IsSweepingCompleted(); | 670 bool IsSweepingCompleted(); |
673 | 671 |
674 void RefillFreeList(PagedSpace* space); | 672 void RefillFreeList(PagedSpace* space); |
675 | 673 |
676 bool AreSweeperThreadsActivated(); | 674 bool AreSweeperThreadsActivated(); |
677 | 675 |
678 // Checks if sweeping is in progress right now on any space. | 676 // If a paged space is passed in, this method checks if the given space is |
679 bool sweeping_in_progress() { return sweeping_in_progress_; } | 677 // swept concurrently. Otherwise, this method checks if concurrent sweeping |
| 678 // is in progress right now on any space. |
| 679 bool IsConcurrentSweepingInProgress(PagedSpace* space = NULL); |
680 | 680 |
681 void set_sequential_sweeping(bool sequential_sweeping) { | 681 void set_sequential_sweeping(bool sequential_sweeping) { |
682 sequential_sweeping_ = sequential_sweeping; | 682 sequential_sweeping_ = sequential_sweeping; |
683 } | 683 } |
684 | 684 |
685 bool sequential_sweeping() const { | 685 bool sequential_sweeping() const { |
686 return sequential_sweeping_; | 686 return sequential_sweeping_; |
687 } | 687 } |
688 | 688 |
689 // Mark the global table which maps weak objects to dependent code without | 689 // Mark the global table which maps weak objects to dependent code without |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 | 732 |
733 MarkingParity marking_parity_; | 733 MarkingParity marking_parity_; |
734 | 734 |
735 // True if we are collecting slots to perform evacuation from evacuation | 735 // True if we are collecting slots to perform evacuation from evacuation |
736 // candidates. | 736 // candidates. |
737 bool compacting_; | 737 bool compacting_; |
738 | 738 |
739 bool was_marked_incrementally_; | 739 bool was_marked_incrementally_; |
740 | 740 |
741 // True if concurrent or parallel sweeping is currently in progress. | 741 // True if concurrent or parallel sweeping is currently in progress. |
742 bool sweeping_in_progress_; | 742 bool sweeping_pending_; |
743 | 743 |
744 base::Semaphore pending_sweeper_jobs_semaphore_; | 744 base::Semaphore pending_sweeper_jobs_semaphore_; |
745 | 745 |
746 bool sequential_sweeping_; | 746 bool sequential_sweeping_; |
747 | 747 |
748 // A pointer to the current stack-allocated GC tracer object during a full | 748 // A pointer to the current stack-allocated GC tracer object during a full |
749 // collection (NULL before and after). | 749 // collection (NULL before and after). |
750 GCTracer* tracer_; | 750 GCTracer* tracer_; |
751 | 751 |
752 SlotsBufferAllocator slots_buffer_allocator_; | 752 SlotsBufferAllocator slots_buffer_allocator_; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 private: | 985 private: |
986 MarkCompactCollector* collector_; | 986 MarkCompactCollector* collector_; |
987 }; | 987 }; |
988 | 988 |
989 | 989 |
990 const char* AllocationSpaceName(AllocationSpace space); | 990 const char* AllocationSpaceName(AllocationSpace space); |
991 | 991 |
992 } } // namespace v8::internal | 992 } } // namespace v8::internal |
993 | 993 |
994 #endif // V8_MARK_COMPACT_H_ | 994 #endif // V8_MARK_COMPACT_H_ |
OLD | NEW |