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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 688 |
689 INLINE(void RecordSlot(Object** anchor_slot, Object** slot, Object* object)); | 689 INLINE(void RecordSlot(Object** anchor_slot, Object** slot, Object* object)); |
690 | 690 |
691 void MigrateObject(Address dst, | 691 void MigrateObject(Address dst, |
692 Address src, | 692 Address src, |
693 int size, | 693 int size, |
694 AllocationSpace to_old_space); | 694 AllocationSpace to_old_space); |
695 | 695 |
696 bool TryPromoteObject(HeapObject* object, int object_size); | 696 bool TryPromoteObject(HeapObject* object, int object_size); |
697 | 697 |
698 inline Object* encountered_weak_maps() { return encountered_weak_maps_; } | 698 inline Object* encountered_weak_collections() { |
699 inline void set_encountered_weak_maps(Object* weak_map) { | 699 return encountered_weak_collections_; |
700 encountered_weak_maps_ = weak_map; | 700 } |
| 701 inline void set_encountered_weak_collections(Object* weak_collection) { |
| 702 encountered_weak_collections_ = weak_collection; |
701 } | 703 } |
702 | 704 |
703 void InvalidateCode(Code* code); | 705 void InvalidateCode(Code* code); |
704 | 706 |
705 void ClearMarkbits(); | 707 void ClearMarkbits(); |
706 | 708 |
707 bool abort_incremental_marking() const { return abort_incremental_marking_; } | 709 bool abort_incremental_marking() const { return abort_incremental_marking_; } |
708 | 710 |
709 bool is_compacting() const { return compacting_; } | 711 bool is_compacting() const { return compacting_; } |
710 | 712 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 | 888 |
887 void ClearAndDeoptimizeDependentCode(Map* map); | 889 void ClearAndDeoptimizeDependentCode(Map* map); |
888 void ClearNonLiveDependentCode(DependentCode* dependent_code); | 890 void ClearNonLiveDependentCode(DependentCode* dependent_code); |
889 | 891 |
890 // Marking detaches initial maps from SharedFunctionInfo objects | 892 // Marking detaches initial maps from SharedFunctionInfo objects |
891 // to make this reference weak. We need to reattach initial maps | 893 // to make this reference weak. We need to reattach initial maps |
892 // back after collection. This is either done during | 894 // back after collection. This is either done during |
893 // ClearNonLiveTransitions pass or by calling this function. | 895 // ClearNonLiveTransitions pass or by calling this function. |
894 void ReattachInitialMaps(); | 896 void ReattachInitialMaps(); |
895 | 897 |
896 // Mark all values associated with reachable keys in weak maps encountered | 898 // Mark all values associated with reachable keys in weak collections |
897 // so far. This might push new object or even new weak maps onto the | 899 // encountered so far. This might push new object or even new weak maps onto |
898 // marking stack. | 900 // the marking stack. |
899 void ProcessWeakMaps(); | 901 void ProcessWeakCollections(); |
900 | 902 |
901 // After all reachable objects have been marked those weak map entries | 903 // After all reachable objects have been marked those weak map entries |
902 // with an unreachable key are removed from all encountered weak maps. | 904 // with an unreachable key are removed from all encountered weak maps. |
903 // The linked list of all encountered weak maps is destroyed. | 905 // The linked list of all encountered weak maps is destroyed. |
904 void ClearWeakMaps(); | 906 void ClearWeakCollections(); |
905 | 907 |
906 // ----------------------------------------------------------------------- | 908 // ----------------------------------------------------------------------- |
907 // Phase 2: Sweeping to clear mark bits and free non-live objects for | 909 // Phase 2: Sweeping to clear mark bits and free non-live objects for |
908 // a non-compacting collection. | 910 // a non-compacting collection. |
909 // | 911 // |
910 // Before: Live objects are marked and non-live objects are unmarked. | 912 // Before: Live objects are marked and non-live objects are unmarked. |
911 // | 913 // |
912 // After: Live objects are unmarked, non-live regions have been added to | 914 // After: Live objects are unmarked, non-live regions have been added to |
913 // their space's free list. Active eden semispace is compacted by | 915 // their space's free list. Active eden semispace is compacted by |
914 // evacuation. | 916 // evacuation. |
(...skipping 21 matching lines...) Expand all Loading... |
936 friend class MarkObjectVisitor; | 938 friend class MarkObjectVisitor; |
937 static void VisitObject(HeapObject* obj); | 939 static void VisitObject(HeapObject* obj); |
938 | 940 |
939 friend class UnmarkObjectVisitor; | 941 friend class UnmarkObjectVisitor; |
940 static void UnmarkObject(HeapObject* obj); | 942 static void UnmarkObject(HeapObject* obj); |
941 #endif | 943 #endif |
942 | 944 |
943 Heap* heap_; | 945 Heap* heap_; |
944 MarkingDeque marking_deque_; | 946 MarkingDeque marking_deque_; |
945 CodeFlusher* code_flusher_; | 947 CodeFlusher* code_flusher_; |
946 Object* encountered_weak_maps_; | 948 Object* encountered_weak_collections_; |
947 | 949 |
948 List<Page*> evacuation_candidates_; | 950 List<Page*> evacuation_candidates_; |
949 List<Code*> invalidated_code_; | 951 List<Code*> invalidated_code_; |
950 | 952 |
951 friend class Heap; | 953 friend class Heap; |
952 }; | 954 }; |
953 | 955 |
954 | 956 |
955 class MarkBitCellIterator BASE_EMBEDDED { | 957 class MarkBitCellIterator BASE_EMBEDDED { |
956 public: | 958 public: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 private: | 1012 private: |
1011 MarkCompactCollector* collector_; | 1013 MarkCompactCollector* collector_; |
1012 }; | 1014 }; |
1013 | 1015 |
1014 | 1016 |
1015 const char* AllocationSpaceName(AllocationSpace space); | 1017 const char* AllocationSpaceName(AllocationSpace space); |
1016 | 1018 |
1017 } } // namespace v8::internal | 1019 } } // namespace v8::internal |
1018 | 1020 |
1019 #endif // V8_MARK_COMPACT_H_ | 1021 #endif // V8_MARK_COMPACT_H_ |
OLD | NEW |