OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 | 630 |
631 enum SweepingParallelism { | 631 enum SweepingParallelism { |
632 SWEEP_SEQUENTIALLY, | 632 SWEEP_SEQUENTIALLY, |
633 SWEEP_IN_PARALLEL | 633 SWEEP_IN_PARALLEL |
634 }; | 634 }; |
635 | 635 |
636 #ifdef VERIFY_HEAP | 636 #ifdef VERIFY_HEAP |
637 void VerifyMarkbitsAreClean(); | 637 void VerifyMarkbitsAreClean(); |
638 static void VerifyMarkbitsAreClean(PagedSpace* space); | 638 static void VerifyMarkbitsAreClean(PagedSpace* space); |
639 static void VerifyMarkbitsAreClean(NewSpace* space); | 639 static void VerifyMarkbitsAreClean(NewSpace* space); |
640 void VerifyWeakEmbeddedMapsInOptimizedCode(); | 640 void VerifyWeakEmbeddedMapsAndObjectsInOptimizedCode(); |
641 void VerifyOmittedMapChecks(); | 641 void VerifyOmittedMapChecks(); |
642 #endif | 642 #endif |
643 | 643 |
644 // Sweep a single page from the given space conservatively. | 644 // Sweep a single page from the given space conservatively. |
645 // Return a number of reclaimed bytes. | 645 // Return a number of reclaimed bytes. |
646 template<SweepingParallelism type> | 646 template<SweepingParallelism type> |
647 static intptr_t SweepConservatively(PagedSpace* space, | 647 static intptr_t SweepConservatively(PagedSpace* space, |
648 FreeList* free_list, | 648 FreeList* free_list, |
649 Page* p); | 649 Page* p); |
650 | 650 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 bool IsConcurrentSweepingInProgress(); | 728 bool IsConcurrentSweepingInProgress(); |
729 | 729 |
730 void set_sequential_sweeping(bool sequential_sweeping) { | 730 void set_sequential_sweeping(bool sequential_sweeping) { |
731 sequential_sweeping_ = sequential_sweeping; | 731 sequential_sweeping_ = sequential_sweeping; |
732 } | 732 } |
733 | 733 |
734 bool sequential_sweeping() const { | 734 bool sequential_sweeping() const { |
735 return sequential_sweeping_; | 735 return sequential_sweeping_; |
736 } | 736 } |
737 | 737 |
| 738 // Mark the global table which maps weak objects to dependent code without |
| 739 // marking its contents. |
| 740 void MarkWeakObjectToCodeTable(); |
| 741 |
738 private: | 742 private: |
739 MarkCompactCollector(); | 743 MarkCompactCollector(); |
740 ~MarkCompactCollector(); | 744 ~MarkCompactCollector(); |
741 | 745 |
742 bool MarkInvalidatedCode(); | 746 bool MarkInvalidatedCode(); |
743 bool WillBeDeoptimized(Code* code); | 747 bool WillBeDeoptimized(Code* code); |
744 void RemoveDeadInvalidatedCode(); | 748 void RemoveDeadInvalidatedCode(); |
745 void ProcessInvalidatedCode(ObjectVisitor* visitor); | 749 void ProcessInvalidatedCode(ObjectVisitor* visitor); |
746 | 750 |
747 void UnlinkEvacuationCandidates(); | 751 void UnlinkEvacuationCandidates(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 // heap object. | 881 // heap object. |
878 static bool IsUnmarkedHeapObject(Object** p); | 882 static bool IsUnmarkedHeapObject(Object** p); |
879 static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p); | 883 static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p); |
880 | 884 |
881 // Map transitions from a live map to a dead map must be killed. | 885 // Map transitions from a live map to a dead map must be killed. |
882 // We replace them with a null descriptor, with the same key. | 886 // We replace them with a null descriptor, with the same key. |
883 void ClearNonLiveReferences(); | 887 void ClearNonLiveReferences(); |
884 void ClearNonLivePrototypeTransitions(Map* map); | 888 void ClearNonLivePrototypeTransitions(Map* map); |
885 void ClearNonLiveMapTransitions(Map* map, MarkBit map_mark); | 889 void ClearNonLiveMapTransitions(Map* map, MarkBit map_mark); |
886 | 890 |
887 void ClearAndDeoptimizeDependentCode(Map* map); | 891 void ClearAndDeoptimizeDependentCode(DependentCode* dependent_code); |
888 void ClearNonLiveDependentCode(DependentCode* dependent_code); | 892 void ClearNonLiveDependentCode(DependentCode* dependent_code); |
889 | 893 |
890 // Marking detaches initial maps from SharedFunctionInfo objects | 894 // Marking detaches initial maps from SharedFunctionInfo objects |
891 // to make this reference weak. We need to reattach initial maps | 895 // to make this reference weak. We need to reattach initial maps |
892 // back after collection. This is either done during | 896 // back after collection. This is either done during |
893 // ClearNonLiveTransitions pass or by calling this function. | 897 // ClearNonLiveTransitions pass or by calling this function. |
894 void ReattachInitialMaps(); | 898 void ReattachInitialMaps(); |
895 | 899 |
896 // Mark all values associated with reachable keys in weak collections | 900 // Mark all values associated with reachable keys in weak collections |
897 // encountered so far. This might push new object or even new weak maps onto | 901 // encountered so far. This might push new object or even new weak maps onto |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 private: | 1015 private: |
1012 MarkCompactCollector* collector_; | 1016 MarkCompactCollector* collector_; |
1013 }; | 1017 }; |
1014 | 1018 |
1015 | 1019 |
1016 const char* AllocationSpaceName(AllocationSpace space); | 1020 const char* AllocationSpaceName(AllocationSpace space); |
1017 | 1021 |
1018 } } // namespace v8::internal | 1022 } } // namespace v8::internal |
1019 | 1023 |
1020 #endif // V8_MARK_COMPACT_H_ | 1024 #endif // V8_MARK_COMPACT_H_ |
OLD | NEW |