| 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 <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 void CollectEvacuationCandidates(PagedSpace* space); | 429 void CollectEvacuationCandidates(PagedSpace* space); |
| 430 | 430 |
| 431 void AddEvacuationCandidate(Page* p); | 431 void AddEvacuationCandidate(Page* p); |
| 432 | 432 |
| 433 // Prepares for GC by resetting relocation info in old and map spaces and | 433 // Prepares for GC by resetting relocation info in old and map spaces and |
| 434 // choosing spaces to compact. | 434 // choosing spaces to compact. |
| 435 void Prepare(); | 435 void Prepare(); |
| 436 | 436 |
| 437 // Performs a global garbage collection. | 437 // Performs a global garbage collection. |
| 438 void CollectGarbage(); | 438 void CollectGarbage(); |
| 439 // Performs a garbage collection in the young generation. |
| 440 void CollectGarbageInYoungGeneration(); |
| 439 | 441 |
| 440 bool StartCompaction(); | 442 bool StartCompaction(); |
| 441 | 443 |
| 442 void AbortCompaction(); | 444 void AbortCompaction(); |
| 443 | 445 |
| 444 // Determine type of object and emit deletion log event. | 446 // Determine type of object and emit deletion log event. |
| 445 static void ReportDeleteIfNeeded(HeapObject* obj, Isolate* isolate); | 447 static void ReportDeleteIfNeeded(HeapObject* obj, Isolate* isolate); |
| 446 | 448 |
| 447 // Distinguishable invalid map encodings (for single word and multiple words) | 449 // Distinguishable invalid map encodings (for single word and multiple words) |
| 448 // that indicate free regions. | 450 // that indicate free regions. |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 void DiscoverGreyObjectsInSpace(PagedSpace* space); | 654 void DiscoverGreyObjectsInSpace(PagedSpace* space); |
| 653 void DiscoverGreyObjectsInNewSpace(); | 655 void DiscoverGreyObjectsInNewSpace(); |
| 654 | 656 |
| 655 // Callback function for telling whether the object *p is an unmarked | 657 // Callback function for telling whether the object *p is an unmarked |
| 656 // heap object. | 658 // heap object. |
| 657 static bool IsUnmarkedHeapObject(Object** p); | 659 static bool IsUnmarkedHeapObject(Object** p); |
| 658 | 660 |
| 659 // Clear non-live references in weak cells, transition and descriptor arrays, | 661 // Clear non-live references in weak cells, transition and descriptor arrays, |
| 660 // and deoptimize dependent code of non-live maps. | 662 // and deoptimize dependent code of non-live maps. |
| 661 void ClearNonLiveReferences(); | 663 void ClearNonLiveReferences(); |
| 664 void ClearNonLiveReferencesInYoungGeneration(); |
| 662 void MarkDependentCodeForDeoptimization(DependentCode* list); | 665 void MarkDependentCodeForDeoptimization(DependentCode* list); |
| 663 // Find non-live targets of simple transitions in the given list. Clear | 666 // Find non-live targets of simple transitions in the given list. Clear |
| 664 // transitions to non-live targets and if needed trim descriptors arrays. | 667 // transitions to non-live targets and if needed trim descriptors arrays. |
| 665 void ClearSimpleMapTransitions(Object* non_live_map_list); | 668 void ClearSimpleMapTransitions(Object* non_live_map_list); |
| 666 void ClearSimpleMapTransition(Map* map, Map* dead_transition); | 669 void ClearSimpleMapTransition(Map* map, Map* dead_transition); |
| 667 // Compact every array in the global list of transition arrays and | 670 // Compact every array in the global list of transition arrays and |
| 668 // trim the corresponding descriptor array if a transition target is non-live. | 671 // trim the corresponding descriptor array if a transition target is non-live. |
| 669 void ClearFullMapTransitions(); | 672 void ClearFullMapTransitions(); |
| 670 bool CompactTransitionArray(Map* map, TransitionArray* transitions, | 673 bool CompactTransitionArray(Map* map, TransitionArray* transitions, |
| 671 DescriptorArray* descriptors); | 674 DescriptorArray* descriptors); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 692 | 695 |
| 693 void AbortTransitionArrays(); | 696 void AbortTransitionArrays(); |
| 694 | 697 |
| 695 // Starts sweeping of spaces by contributing on the main thread and setting | 698 // Starts sweeping of spaces by contributing on the main thread and setting |
| 696 // up other pages for sweeping. Does not start sweeper tasks. | 699 // up other pages for sweeping. Does not start sweeper tasks. |
| 697 void StartSweepSpaces(); | 700 void StartSweepSpaces(); |
| 698 void StartSweepSpace(PagedSpace* space); | 701 void StartSweepSpace(PagedSpace* space); |
| 699 | 702 |
| 700 void EvacuateNewSpacePrologue(); | 703 void EvacuateNewSpacePrologue(); |
| 701 | 704 |
| 705 template <MarkCompactMode mode> |
| 702 void EvacuatePagesInParallel(); | 706 void EvacuatePagesInParallel(); |
| 703 | 707 |
| 704 // The number of parallel compaction tasks, including the main thread. | 708 // The number of parallel compaction tasks, including the main thread. |
| 705 int NumberOfParallelCompactionTasks(int pages, intptr_t live_bytes); | 709 int NumberOfParallelCompactionTasks(int pages, intptr_t live_bytes); |
| 706 | 710 |
| 711 template <MarkCompactMode mode> |
| 707 void EvacuateNewSpaceAndCandidates(); | 712 void EvacuateNewSpaceAndCandidates(); |
| 708 | 713 |
| 714 template <MarkCompactMode mode> |
| 709 void UpdatePointersAfterEvacuation(); | 715 void UpdatePointersAfterEvacuation(); |
| 710 | 716 |
| 711 // Iterates through all live objects on a page using marking information. | 717 // Iterates through all live objects on a page using marking information. |
| 712 // Returns whether all objects have successfully been visited. | 718 // Returns whether all objects have successfully been visited. |
| 713 template <class Visitor> | 719 template <class Visitor> |
| 714 bool VisitLiveObjects(MemoryChunk* page, Visitor* visitor, | 720 bool VisitLiveObjects(MemoryChunk* page, Visitor* visitor, |
| 715 IterationMode mode); | 721 IterationMode mode); |
| 716 | 722 |
| 717 void RecomputeLiveBytes(MemoryChunk* page); | 723 void RecomputeLiveBytes(MemoryChunk* page); |
| 718 | 724 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 791 |
| 786 private: | 792 private: |
| 787 MarkCompactCollector* collector_; | 793 MarkCompactCollector* collector_; |
| 788 }; | 794 }; |
| 789 | 795 |
| 790 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); | 796 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); |
| 791 } // namespace internal | 797 } // namespace internal |
| 792 } // namespace v8 | 798 } // namespace v8 |
| 793 | 799 |
| 794 #endif // V8_HEAP_MARK_COMPACT_H_ | 800 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |