Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: src/heap/mark-compact.h

Issue 1488593003: Optimize clearing of map transitions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comment Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 template <class T> 642 template <class T>
643 void DiscoverGreyObjectsWithIterator(T* it); 643 void DiscoverGreyObjectsWithIterator(T* it);
644 void DiscoverGreyObjectsOnPage(MemoryChunk* p); 644 void DiscoverGreyObjectsOnPage(MemoryChunk* p);
645 void DiscoverGreyObjectsInSpace(PagedSpace* space); 645 void DiscoverGreyObjectsInSpace(PagedSpace* space);
646 void DiscoverGreyObjectsInNewSpace(); 646 void DiscoverGreyObjectsInNewSpace();
647 647
648 // Callback function for telling whether the object *p is an unmarked 648 // Callback function for telling whether the object *p is an unmarked
649 // heap object. 649 // heap object.
650 static bool IsUnmarkedHeapObject(Object** p); 650 static bool IsUnmarkedHeapObject(Object** p);
651 651
652 // Map transitions from a live map to a dead map must be killed. 652 // Clear non-live references in weak cells, transition and descriptor arrays,
653 // We replace them with a null descriptor, with the same key. 653 // and deoptimize dependent code of non-live maps.
654 void ClearNonLiveReferences(); 654 void ClearNonLiveReferences();
655 void ClearNonLiveMapTransitions(Map* map); 655 void MarkDependentCodeForDeoptimization(DependentCode* list);
656 void ClearMapTransitions(Map* map, Map* dead_transition); 656 // Find non-live targets of simple transitions in the given list. Clear
657 bool ClearMapBackPointer(Map* map); 657 // transitions to non-live targets and if needed trim descriptors arrays.
658 void MarkDependentCodeListForDeoptimization(DependentCode* list_head); 658 void ClearSimpleMapTransitions(Object* non_live_map_list);
659 void TrimDescriptorArray(Map* map, DescriptorArray* descriptors, 659 void ClearSimpleMapTransition(Map* map, Map* dead_transition);
660 int number_of_own_descriptors); 660 // Compact every array in the global list of transition arrays and
661 // trim the corresponding descriptor array if a transition target is non-live.
662 void ClearFullMapTransitions();
663 bool CompactTransitionArray(Map* map, TransitionArray* transitions,
664 DescriptorArray* descriptors);
665 void TrimDescriptorArray(Map* map, DescriptorArray* descriptors);
661 void TrimEnumCache(Map* map, DescriptorArray* descriptors); 666 void TrimEnumCache(Map* map, DescriptorArray* descriptors);
662 667
663 // Mark all values associated with reachable keys in weak collections 668 // Mark all values associated with reachable keys in weak collections
664 // encountered so far. This might push new object or even new weak maps onto 669 // encountered so far. This might push new object or even new weak maps onto
665 // the marking stack. 670 // the marking stack.
666 void ProcessWeakCollections(); 671 void ProcessWeakCollections();
667 672
668 // After all reachable objects have been marked those weak map entries 673 // After all reachable objects have been marked those weak map entries
669 // with an unreachable key are removed from all encountered weak maps. 674 // with an unreachable key are removed from all encountered weak maps.
670 // The linked list of all encountered weak maps is destroyed. 675 // The linked list of all encountered weak maps is destroyed.
671 void ClearWeakCollections(); 676 void ClearWeakCollections();
672 677
673 // We have to remove all encountered weak maps from the list of weak 678 // We have to remove all encountered weak maps from the list of weak
674 // collections when incremental marking is aborted. 679 // collections when incremental marking is aborted.
675 void AbortWeakCollections(); 680 void AbortWeakCollections();
676 681
677 void ProcessAndClearWeakCells(); 682 void ClearWeakCells(Object** non_live_map_list,
683 DependentCode** dependent_code_list);
678 void AbortWeakCells(); 684 void AbortWeakCells();
679 685
680 void ProcessAndClearTransitionArrays();
681 void AbortTransitionArrays(); 686 void AbortTransitionArrays();
682 687
683 // After all reachable objects have been marked, those entries within 688 // After all reachable objects have been marked, those entries within
684 // optimized code maps that became unreachable are removed, potentially 689 // optimized code maps that became unreachable are removed, potentially
685 // trimming or clearing out the entire optimized code map. 690 // trimming or clearing out the entire optimized code map.
686 void ProcessAndClearOptimizedCodeMaps(); 691 void ProcessAndClearOptimizedCodeMaps();
687 692
688 // Process non-live references in maps and optimized code.
689 void ProcessWeakReferences();
690
691 // ----------------------------------------------------------------------- 693 // -----------------------------------------------------------------------
692 // Phase 2: Sweeping to clear mark bits and free non-live objects for 694 // Phase 2: Sweeping to clear mark bits and free non-live objects for
693 // a non-compacting collection. 695 // a non-compacting collection.
694 // 696 //
695 // Before: Live objects are marked and non-live objects are unmarked. 697 // Before: Live objects are marked and non-live objects are unmarked.
696 // 698 //
697 // After: Live objects are unmarked, non-live regions have been added to 699 // After: Live objects are unmarked, non-live regions have been added to
698 // their space's free list. Active eden semispace is compacted by 700 // their space's free list. Active eden semispace is compacted by
699 // evacuation. 701 // evacuation.
700 // 702 //
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 private: 864 private:
863 MarkCompactCollector* collector_; 865 MarkCompactCollector* collector_;
864 }; 866 };
865 867
866 868
867 const char* AllocationSpaceName(AllocationSpace space); 869 const char* AllocationSpaceName(AllocationSpace space);
868 } // namespace internal 870 } // namespace internal
869 } // namespace v8 871 } // namespace v8
870 872
871 #endif // V8_HEAP_MARK_COMPACT_H_ 873 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698