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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_maps() { return encountered_weak_maps_; } |
699 inline void set_encountered_weak_maps(Object* weak_map) { | 699 inline void set_encountered_weak_maps(Object* weak_map) { |
700 encountered_weak_maps_ = weak_map; | 700 encountered_weak_maps_ = weak_map; |
701 } | 701 } |
702 | 702 |
| 703 inline Object* encountered_array_buffers() { |
| 704 return encountered_array_buffers_; |
| 705 } |
| 706 inline void set_encountered_array_buffers(Object* array_buffer) { |
| 707 encountered_array_buffers_ = array_buffer; |
| 708 } |
| 709 |
703 void InvalidateCode(Code* code); | 710 void InvalidateCode(Code* code); |
704 | 711 |
705 void ClearMarkbits(); | 712 void ClearMarkbits(); |
706 | 713 |
707 bool abort_incremental_marking() const { return abort_incremental_marking_; } | 714 bool abort_incremental_marking() const { return abort_incremental_marking_; } |
708 | 715 |
709 bool is_compacting() const { return compacting_; } | 716 bool is_compacting() const { return compacting_; } |
710 | 717 |
711 MarkingParity marking_parity() { return marking_parity_; } | 718 MarkingParity marking_parity() { return marking_parity_; } |
712 | 719 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 // MarkCompactCollector::Prepare() and is otherwise in its | 810 // MarkCompactCollector::Prepare() and is otherwise in its |
804 // normal state. | 811 // normal state. |
805 // | 812 // |
806 // After: Live objects are marked and non-live objects are unmarked. | 813 // After: Live objects are marked and non-live objects are unmarked. |
807 | 814 |
808 friend class RootMarkingVisitor; | 815 friend class RootMarkingVisitor; |
809 friend class MarkingVisitor; | 816 friend class MarkingVisitor; |
810 friend class MarkCompactMarkingVisitor; | 817 friend class MarkCompactMarkingVisitor; |
811 friend class CodeMarkingVisitor; | 818 friend class CodeMarkingVisitor; |
812 friend class SharedFunctionInfoMarkingVisitor; | 819 friend class SharedFunctionInfoMarkingVisitor; |
| 820 friend class IncrementalMarking; |
813 | 821 |
814 // Mark code objects that are active on the stack to prevent them | 822 // Mark code objects that are active on the stack to prevent them |
815 // from being flushed. | 823 // from being flushed. |
816 void PrepareThreadForCodeFlushing(Isolate* isolate, ThreadLocalTop* top); | 824 void PrepareThreadForCodeFlushing(Isolate* isolate, ThreadLocalTop* top); |
817 | 825 |
818 void PrepareForCodeFlushing(); | 826 void PrepareForCodeFlushing(); |
819 | 827 |
820 // Marking operations for objects reachable from roots. | 828 // Marking operations for objects reachable from roots. |
821 void MarkLiveObjects(); | 829 void MarkLiveObjects(); |
822 | 830 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 // Mark all values associated with reachable keys in weak maps encountered | 895 // Mark all values associated with reachable keys in weak maps encountered |
888 // so far. This might push new object or even new weak maps onto the | 896 // so far. This might push new object or even new weak maps onto the |
889 // marking stack. | 897 // marking stack. |
890 void ProcessWeakMaps(); | 898 void ProcessWeakMaps(); |
891 | 899 |
892 // After all reachable objects have been marked those weak map entries | 900 // After all reachable objects have been marked those weak map entries |
893 // with an unreachable key are removed from all encountered weak maps. | 901 // with an unreachable key are removed from all encountered weak maps. |
894 // The linked list of all encountered weak maps is destroyed. | 902 // The linked list of all encountered weak maps is destroyed. |
895 void ClearWeakMaps(); | 903 void ClearWeakMaps(); |
896 | 904 |
| 905 void ProcessArrayBuffers(); |
| 906 void ClearArrayBuffersOnAbort(); |
| 907 |
897 // ----------------------------------------------------------------------- | 908 // ----------------------------------------------------------------------- |
898 // 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 |
899 // a non-compacting collection. | 910 // a non-compacting collection. |
900 // | 911 // |
901 // Before: Live objects are marked and non-live objects are unmarked. | 912 // Before: Live objects are marked and non-live objects are unmarked. |
902 // | 913 // |
903 // 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 |
904 // their space's free list. Active eden semispace is compacted by | 915 // their space's free list. Active eden semispace is compacted by |
905 // evacuation. | 916 // evacuation. |
906 // | 917 // |
(...skipping 18 matching lines...) Expand all Loading... |
925 static void VisitObject(HeapObject* obj); | 936 static void VisitObject(HeapObject* obj); |
926 | 937 |
927 friend class UnmarkObjectVisitor; | 938 friend class UnmarkObjectVisitor; |
928 static void UnmarkObject(HeapObject* obj); | 939 static void UnmarkObject(HeapObject* obj); |
929 #endif | 940 #endif |
930 | 941 |
931 Heap* heap_; | 942 Heap* heap_; |
932 MarkingDeque marking_deque_; | 943 MarkingDeque marking_deque_; |
933 CodeFlusher* code_flusher_; | 944 CodeFlusher* code_flusher_; |
934 Object* encountered_weak_maps_; | 945 Object* encountered_weak_maps_; |
| 946 Object* encountered_array_buffers_; |
935 | 947 |
936 List<Page*> evacuation_candidates_; | 948 List<Page*> evacuation_candidates_; |
937 List<Code*> invalidated_code_; | 949 List<Code*> invalidated_code_; |
938 | 950 |
939 friend class Heap; | 951 friend class Heap; |
940 }; | 952 }; |
941 | 953 |
942 | 954 |
943 class SequentialSweepingScope BASE_EMBEDDED { | 955 class SequentialSweepingScope BASE_EMBEDDED { |
944 public: | 956 public: |
945 explicit SequentialSweepingScope(MarkCompactCollector *collector) : | 957 explicit SequentialSweepingScope(MarkCompactCollector *collector) : |
946 collector_(collector) { | 958 collector_(collector) { |
947 collector_->set_sequential_sweeping(true); | 959 collector_->set_sequential_sweeping(true); |
948 } | 960 } |
949 | 961 |
950 ~SequentialSweepingScope() { | 962 ~SequentialSweepingScope() { |
951 collector_->set_sequential_sweeping(false); | 963 collector_->set_sequential_sweeping(false); |
952 } | 964 } |
953 | 965 |
954 private: | 966 private: |
955 MarkCompactCollector* collector_; | 967 MarkCompactCollector* collector_; |
956 }; | 968 }; |
957 | 969 |
958 | 970 |
959 const char* AllocationSpaceName(AllocationSpace space); | 971 const char* AllocationSpaceName(AllocationSpace space); |
960 | 972 |
961 } } // namespace v8::internal | 973 } } // namespace v8::internal |
962 | 974 |
963 #endif // V8_MARK_COMPACT_H_ | 975 #endif // V8_MARK_COMPACT_H_ |
OLD | NEW |