| 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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 void EnableCodeFlushing(bool enable); | 570 void EnableCodeFlushing(bool enable); |
| 571 | 571 |
| 572 enum SweeperType { | 572 enum SweeperType { |
| 573 CONSERVATIVE, | 573 CONSERVATIVE, |
| 574 PARALLEL_CONSERVATIVE, | 574 PARALLEL_CONSERVATIVE, |
| 575 CONCURRENT_CONSERVATIVE, | 575 CONCURRENT_CONSERVATIVE, |
| 576 PRECISE | 576 PRECISE |
| 577 }; | 577 }; |
| 578 | 578 |
| 579 enum SweepingParallelism { | 579 enum SweepingParallelism { |
| 580 SWEEP_SEQUENTIALLY, | 580 SWEEP_ON_MAIN_THREAD, |
| 581 SWEEP_IN_PARALLEL | 581 SWEEP_IN_PARALLEL |
| 582 }; | 582 }; |
| 583 | 583 |
| 584 #ifdef VERIFY_HEAP | 584 #ifdef VERIFY_HEAP |
| 585 void VerifyMarkbitsAreClean(); | 585 void VerifyMarkbitsAreClean(); |
| 586 static void VerifyMarkbitsAreClean(PagedSpace* space); | 586 static void VerifyMarkbitsAreClean(PagedSpace* space); |
| 587 static void VerifyMarkbitsAreClean(NewSpace* space); | 587 static void VerifyMarkbitsAreClean(NewSpace* space); |
| 588 void VerifyWeakEmbeddedObjectsInCode(); | 588 void VerifyWeakEmbeddedObjectsInCode(); |
| 589 void VerifyOmittedMapChecks(); | 589 void VerifyOmittedMapChecks(); |
| 590 #endif | 590 #endif |
| 591 | 591 |
| 592 // Sweep a single page from the given space conservatively. | 592 // Sweep a single page from the given space conservatively. |
| 593 // Return a number of reclaimed bytes. | 593 // Returns the size of the biggest continuous freed memory chunk in bytes. |
| 594 template<SweepingParallelism type> | 594 template<SweepingParallelism type> |
| 595 static intptr_t SweepConservatively(PagedSpace* space, | 595 static intptr_t SweepConservatively(PagedSpace* space, |
| 596 FreeList* free_list, | 596 FreeList* free_list, |
| 597 Page* p); | 597 Page* p); |
| 598 | 598 |
| 599 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) { | 599 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) { |
| 600 return Page::FromAddress(reinterpret_cast<Address>(anchor))-> | 600 return Page::FromAddress(reinterpret_cast<Address>(anchor))-> |
| 601 ShouldSkipEvacuationSlotRecording(); | 601 ShouldSkipEvacuationSlotRecording(); |
| 602 } | 602 } |
| 603 | 603 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 void InvalidateCode(Code* code); | 652 void InvalidateCode(Code* code); |
| 653 | 653 |
| 654 void ClearMarkbits(); | 654 void ClearMarkbits(); |
| 655 | 655 |
| 656 bool abort_incremental_marking() const { return abort_incremental_marking_; } | 656 bool abort_incremental_marking() const { return abort_incremental_marking_; } |
| 657 | 657 |
| 658 bool is_compacting() const { return compacting_; } | 658 bool is_compacting() const { return compacting_; } |
| 659 | 659 |
| 660 MarkingParity marking_parity() { return marking_parity_; } | 660 MarkingParity marking_parity() { return marking_parity_; } |
| 661 | 661 |
| 662 // Concurrent and parallel sweeping support. | 662 // Concurrent and parallel sweeping support. If required_freed_bytes was set |
| 663 void SweepInParallel(PagedSpace* space); | 663 // to a value larger than 0, then sweeping returns after a block of at least |
| 664 // required_freed_bytes was freed. If required_freed_bytes was set to zero |
| 665 // then the whole given space is swept. |
| 666 template<SweepingParallelism type> |
| 667 int SweepInParallel(PagedSpace* space, int required_freed_bytes); |
| 664 | 668 |
| 665 void WaitUntilSweepingCompleted(); | 669 void WaitUntilSweepingCompleted(); |
| 666 | 670 |
| 667 bool IsSweepingCompleted(); | 671 bool IsSweepingCompleted(); |
| 668 | 672 |
| 669 void RefillFreeList(PagedSpace* space); | 673 void RefillFreeList(PagedSpace* space); |
| 670 | 674 |
| 671 bool AreSweeperThreadsActivated(); | 675 bool AreSweeperThreadsActivated(); |
| 672 | 676 |
| 673 // If a paged space is passed in, this method checks if the given space is | 677 // If a paged space is passed in, this method checks if the given space is |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 private: | 986 private: |
| 983 MarkCompactCollector* collector_; | 987 MarkCompactCollector* collector_; |
| 984 }; | 988 }; |
| 985 | 989 |
| 986 | 990 |
| 987 const char* AllocationSpaceName(AllocationSpace space); | 991 const char* AllocationSpaceName(AllocationSpace space); |
| 988 | 992 |
| 989 } } // namespace v8::internal | 993 } } // namespace v8::internal |
| 990 | 994 |
| 991 #endif // V8_MARK_COMPACT_H_ | 995 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |