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 #include "src/heap/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/heap/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 idle_marking_delay_counter_(0), | 42 idle_marking_delay_counter_(0), |
43 unscanned_bytes_of_large_object_(0), | 43 unscanned_bytes_of_large_object_(0), |
44 was_activated_(false), | 44 was_activated_(false), |
45 black_allocation_(false), | 45 black_allocation_(false), |
46 finalize_marking_completed_(false), | 46 finalize_marking_completed_(false), |
47 incremental_marking_finalization_rounds_(0), | 47 incremental_marking_finalization_rounds_(0), |
48 request_type_(NONE) {} | 48 request_type_(NONE) {} |
49 | 49 |
50 bool IncrementalMarking::BaseRecordWrite(HeapObject* obj, Object* value) { | 50 bool IncrementalMarking::BaseRecordWrite(HeapObject* obj, Object* value) { |
51 HeapObject* value_heap_obj = HeapObject::cast(value); | 51 HeapObject* value_heap_obj = HeapObject::cast(value); |
52 MarkBit value_bit = Marking::MarkBitFrom(value_heap_obj); | 52 MarkBit value_bit = ObjectMarking::MarkBitFrom(value_heap_obj); |
53 DCHECK(!Marking::IsImpossible(value_bit)); | 53 DCHECK(!Marking::IsImpossible(value_bit)); |
54 | 54 |
55 MarkBit obj_bit = Marking::MarkBitFrom(obj); | 55 MarkBit obj_bit = ObjectMarking::MarkBitFrom(obj); |
56 DCHECK(!Marking::IsImpossible(obj_bit)); | 56 DCHECK(!Marking::IsImpossible(obj_bit)); |
57 bool is_black = Marking::IsBlack(obj_bit); | 57 bool is_black = Marking::IsBlack(obj_bit); |
58 | 58 |
59 if (is_black && Marking::IsWhite(value_bit)) { | 59 if (is_black && Marking::IsWhite(value_bit)) { |
60 WhiteToGreyAndPush(value_heap_obj, value_bit); | 60 WhiteToGreyAndPush(value_heap_obj, value_bit); |
61 RestartIfNotMarking(); | 61 RestartIfNotMarking(); |
62 } | 62 } |
63 return is_compacting_ && is_black; | 63 return is_compacting_ && is_black; |
64 } | 64 } |
65 | 65 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { | 144 void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit mark_bit) { |
145 Marking::WhiteToGrey(mark_bit); | 145 Marking::WhiteToGrey(mark_bit); |
146 heap_->mark_compact_collector()->marking_deque()->Push(obj); | 146 heap_->mark_compact_collector()->marking_deque()->Push(obj); |
147 } | 147 } |
148 | 148 |
149 | 149 |
150 static void MarkObjectGreyDoNotEnqueue(Object* obj) { | 150 static void MarkObjectGreyDoNotEnqueue(Object* obj) { |
151 if (obj->IsHeapObject()) { | 151 if (obj->IsHeapObject()) { |
152 HeapObject* heap_obj = HeapObject::cast(obj); | 152 HeapObject* heap_obj = HeapObject::cast(obj); |
153 MarkBit mark_bit = Marking::MarkBitFrom(HeapObject::cast(obj)); | 153 MarkBit mark_bit = ObjectMarking::MarkBitFrom(HeapObject::cast(obj)); |
154 if (Marking::IsBlack(mark_bit)) { | 154 if (Marking::IsBlack(mark_bit)) { |
155 MemoryChunk::IncrementLiveBytesFromGC(heap_obj, -heap_obj->Size()); | 155 MemoryChunk::IncrementLiveBytesFromGC(heap_obj, -heap_obj->Size()); |
156 } | 156 } |
157 Marking::AnyToGrey(mark_bit); | 157 Marking::AnyToGrey(mark_bit); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
| 161 void IncrementalMarking::TransferMark(Heap* heap, Address old_start, |
| 162 Address new_start) { |
| 163 // This is only used when resizing an object. |
| 164 DCHECK(MemoryChunk::FromAddress(old_start) == |
| 165 MemoryChunk::FromAddress(new_start)); |
| 166 |
| 167 if (!heap->incremental_marking()->IsMarking() || |
| 168 Page::FromAddress(old_start)->IsFlagSet(Page::BLACK_PAGE)) |
| 169 return; |
| 170 |
| 171 // If the mark doesn't move, we don't check the color of the object. |
| 172 // It doesn't matter whether the object is black, since it hasn't changed |
| 173 // size, so the adjustment to the live data count will be zero anyway. |
| 174 if (old_start == new_start) return; |
| 175 |
| 176 MarkBit new_mark_bit = ObjectMarking::MarkBitFrom(new_start); |
| 177 MarkBit old_mark_bit = ObjectMarking::MarkBitFrom(old_start); |
| 178 |
| 179 #ifdef DEBUG |
| 180 Marking::ObjectColor old_color = Marking::Color(old_mark_bit); |
| 181 #endif |
| 182 |
| 183 if (Marking::IsBlack(old_mark_bit)) { |
| 184 Marking::BlackToWhite(old_mark_bit); |
| 185 Marking::MarkBlack(new_mark_bit); |
| 186 return; |
| 187 } else if (Marking::IsGrey(old_mark_bit)) { |
| 188 Marking::GreyToWhite(old_mark_bit); |
| 189 heap->incremental_marking()->WhiteToGreyAndPush( |
| 190 HeapObject::FromAddress(new_start), new_mark_bit); |
| 191 heap->incremental_marking()->RestartIfNotMarking(); |
| 192 } |
| 193 |
| 194 #ifdef DEBUG |
| 195 Marking::ObjectColor new_color = Marking::Color(new_mark_bit); |
| 196 DCHECK(new_color == old_color); |
| 197 #endif |
| 198 } |
161 | 199 |
162 static inline void MarkBlackOrKeepBlack(HeapObject* heap_object, | 200 static inline void MarkBlackOrKeepBlack(HeapObject* heap_object, |
163 MarkBit mark_bit, int size) { | 201 MarkBit mark_bit, int size) { |
164 DCHECK(!Marking::IsImpossible(mark_bit)); | 202 DCHECK(!Marking::IsImpossible(mark_bit)); |
165 if (Marking::IsBlack(mark_bit)) return; | 203 if (Marking::IsBlack(mark_bit)) return; |
166 Marking::MarkBlack(mark_bit); | 204 Marking::MarkBlack(mark_bit); |
167 MemoryChunk::IncrementLiveBytesFromGC(heap_object, size); | 205 MemoryChunk::IncrementLiveBytesFromGC(heap_object, size); |
168 } | 206 } |
169 | 207 |
170 | |
171 class IncrementalMarkingMarkingVisitor | 208 class IncrementalMarkingMarkingVisitor |
172 : public StaticMarkingVisitor<IncrementalMarkingMarkingVisitor> { | 209 : public StaticMarkingVisitor<IncrementalMarkingMarkingVisitor> { |
173 public: | 210 public: |
174 static void Initialize() { | 211 static void Initialize() { |
175 StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize(); | 212 StaticMarkingVisitor<IncrementalMarkingMarkingVisitor>::Initialize(); |
176 table_.Register(kVisitFixedArray, &VisitFixedArrayIncremental); | 213 table_.Register(kVisitFixedArray, &VisitFixedArrayIncremental); |
177 table_.Register(kVisitNativeContext, &VisitNativeContextIncremental); | 214 table_.Register(kVisitNativeContext, &VisitNativeContextIncremental); |
178 table_.Register(kVisitJSRegExp, &VisitJSRegExp); | 215 table_.Register(kVisitJSRegExp, &VisitJSRegExp); |
179 if (FLAG_track_gc_object_stats) { | 216 if (FLAG_track_gc_object_stats) { |
180 IncrementalMarkingObjectStatsVisitor::Initialize(&table_); | 217 IncrementalMarkingObjectStatsVisitor::Initialize(&table_); |
(...skipping 26 matching lines...) Expand all Loading... |
207 do { | 244 do { |
208 VisitPointers(heap, object, HeapObject::RawField(object, start_offset), | 245 VisitPointers(heap, object, HeapObject::RawField(object, start_offset), |
209 HeapObject::RawField(object, end_offset)); | 246 HeapObject::RawField(object, end_offset)); |
210 start_offset = end_offset; | 247 start_offset = end_offset; |
211 end_offset = Min(object_size, end_offset + kProgressBarScanningChunk); | 248 end_offset = Min(object_size, end_offset + kProgressBarScanningChunk); |
212 scan_until_end = | 249 scan_until_end = |
213 heap->mark_compact_collector()->marking_deque()->IsFull(); | 250 heap->mark_compact_collector()->marking_deque()->IsFull(); |
214 } while (scan_until_end && start_offset < object_size); | 251 } while (scan_until_end && start_offset < object_size); |
215 chunk->set_progress_bar(start_offset); | 252 chunk->set_progress_bar(start_offset); |
216 if (start_offset < object_size) { | 253 if (start_offset < object_size) { |
217 if (Marking::IsGrey(Marking::MarkBitFrom(object))) { | 254 if (Marking::IsGrey(ObjectMarking::MarkBitFrom(object))) { |
218 heap->mark_compact_collector()->marking_deque()->Unshift(object); | 255 heap->mark_compact_collector()->marking_deque()->Unshift(object); |
219 } else { | 256 } else { |
220 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); | 257 DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(object))); |
221 heap->mark_compact_collector()->UnshiftBlack(object); | 258 heap->mark_compact_collector()->UnshiftBlack(object); |
222 } | 259 } |
223 heap->incremental_marking()->NotifyIncompleteScanOfObject( | 260 heap->incremental_marking()->NotifyIncompleteScanOfObject( |
224 object_size - (start_offset - already_scanned_offset)); | 261 object_size - (start_offset - already_scanned_offset)); |
225 } | 262 } |
226 } else { | 263 } else { |
227 FixedArrayVisitor::Visit(map, object); | 264 FixedArrayVisitor::Visit(map, object); |
228 } | 265 } |
229 } | 266 } |
230 | 267 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 299 |
263 // Marks the object grey and pushes it on the marking stack. | 300 // Marks the object grey and pushes it on the marking stack. |
264 INLINE(static void MarkObject(Heap* heap, Object* obj)) { | 301 INLINE(static void MarkObject(Heap* heap, Object* obj)) { |
265 IncrementalMarking::MarkObject(heap, HeapObject::cast(obj)); | 302 IncrementalMarking::MarkObject(heap, HeapObject::cast(obj)); |
266 } | 303 } |
267 | 304 |
268 // Marks the object black without pushing it on the marking stack. | 305 // Marks the object black without pushing it on the marking stack. |
269 // Returns true if object needed marking and false otherwise. | 306 // Returns true if object needed marking and false otherwise. |
270 INLINE(static bool MarkObjectWithoutPush(Heap* heap, Object* obj)) { | 307 INLINE(static bool MarkObjectWithoutPush(Heap* heap, Object* obj)) { |
271 HeapObject* heap_object = HeapObject::cast(obj); | 308 HeapObject* heap_object = HeapObject::cast(obj); |
272 MarkBit mark_bit = Marking::MarkBitFrom(heap_object); | 309 MarkBit mark_bit = ObjectMarking::MarkBitFrom(heap_object); |
273 if (Marking::IsWhite(mark_bit)) { | 310 if (Marking::IsWhite(mark_bit)) { |
274 Marking::MarkBlack(mark_bit); | 311 Marking::MarkBlack(mark_bit); |
275 MemoryChunk::IncrementLiveBytesFromGC(heap_object, heap_object->Size()); | 312 MemoryChunk::IncrementLiveBytesFromGC(heap_object, heap_object->Size()); |
276 return true; | 313 return true; |
277 } | 314 } |
278 return false; | 315 return false; |
279 } | 316 } |
280 }; | 317 }; |
281 | 318 |
282 void IncrementalMarking::IterateBlackObject(HeapObject* object) { | 319 void IncrementalMarking::IterateBlackObject(HeapObject* object) { |
283 if (IsMarking() && Marking::IsBlack(Marking::MarkBitFrom(object))) { | 320 if (IsMarking() && Marking::IsBlack(ObjectMarking::MarkBitFrom(object))) { |
284 Page* page = Page::FromAddress(object->address()); | 321 Page* page = Page::FromAddress(object->address()); |
285 if ((page->owner() != nullptr) && (page->owner()->identity() == LO_SPACE)) { | 322 if ((page->owner() != nullptr) && (page->owner()->identity() == LO_SPACE)) { |
286 // IterateBlackObject requires us to visit the whole object. | 323 // IterateBlackObject requires us to visit the whole object. |
287 page->ResetProgressBar(); | 324 page->ResetProgressBar(); |
288 } | 325 } |
289 IncrementalMarkingMarkingVisitor::IterateBody(object->map(), object); | 326 IncrementalMarkingMarkingVisitor::IterateBody(object->map(), object); |
290 } | 327 } |
291 } | 328 } |
292 | 329 |
293 class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { | 330 class IncrementalMarkingRootMarkingVisitor : public ObjectVisitor { |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 } | 684 } |
648 | 685 |
649 | 686 |
650 bool ShouldRetainMap(Map* map, int age) { | 687 bool ShouldRetainMap(Map* map, int age) { |
651 if (age == 0) { | 688 if (age == 0) { |
652 // The map has aged. Do not retain this map. | 689 // The map has aged. Do not retain this map. |
653 return false; | 690 return false; |
654 } | 691 } |
655 Object* constructor = map->GetConstructor(); | 692 Object* constructor = map->GetConstructor(); |
656 if (!constructor->IsHeapObject() || | 693 if (!constructor->IsHeapObject() || |
657 Marking::IsWhite(Marking::MarkBitFrom(HeapObject::cast(constructor)))) { | 694 Marking::IsWhite( |
| 695 ObjectMarking::MarkBitFrom(HeapObject::cast(constructor)))) { |
658 // The constructor is dead, no new objects with this map can | 696 // The constructor is dead, no new objects with this map can |
659 // be created. Do not retain this map. | 697 // be created. Do not retain this map. |
660 return false; | 698 return false; |
661 } | 699 } |
662 return true; | 700 return true; |
663 } | 701 } |
664 | 702 |
665 | 703 |
666 void IncrementalMarking::RetainMaps() { | 704 void IncrementalMarking::RetainMaps() { |
667 // Do not retain dead maps if flag disables it or there is | 705 // Do not retain dead maps if flag disables it or there is |
668 // - memory pressure (reduce_memory_footprint_), | 706 // - memory pressure (reduce_memory_footprint_), |
669 // - GC is requested by tests or dev-tools (abort_incremental_marking_). | 707 // - GC is requested by tests or dev-tools (abort_incremental_marking_). |
670 bool map_retaining_is_disabled = heap()->ShouldReduceMemory() || | 708 bool map_retaining_is_disabled = heap()->ShouldReduceMemory() || |
671 heap()->ShouldAbortIncrementalMarking() || | 709 heap()->ShouldAbortIncrementalMarking() || |
672 FLAG_retain_maps_for_n_gc == 0; | 710 FLAG_retain_maps_for_n_gc == 0; |
673 ArrayList* retained_maps = heap()->retained_maps(); | 711 ArrayList* retained_maps = heap()->retained_maps(); |
674 int length = retained_maps->Length(); | 712 int length = retained_maps->Length(); |
675 // The number_of_disposed_maps separates maps in the retained_maps | 713 // The number_of_disposed_maps separates maps in the retained_maps |
676 // array that were created before and after context disposal. | 714 // array that were created before and after context disposal. |
677 // We do not age and retain disposed maps to avoid memory leaks. | 715 // We do not age and retain disposed maps to avoid memory leaks. |
678 int number_of_disposed_maps = heap()->number_of_disposed_maps_; | 716 int number_of_disposed_maps = heap()->number_of_disposed_maps_; |
679 for (int i = 0; i < length; i += 2) { | 717 for (int i = 0; i < length; i += 2) { |
680 DCHECK(retained_maps->Get(i)->IsWeakCell()); | 718 DCHECK(retained_maps->Get(i)->IsWeakCell()); |
681 WeakCell* cell = WeakCell::cast(retained_maps->Get(i)); | 719 WeakCell* cell = WeakCell::cast(retained_maps->Get(i)); |
682 if (cell->cleared()) continue; | 720 if (cell->cleared()) continue; |
683 int age = Smi::cast(retained_maps->Get(i + 1))->value(); | 721 int age = Smi::cast(retained_maps->Get(i + 1))->value(); |
684 int new_age; | 722 int new_age; |
685 Map* map = Map::cast(cell->value()); | 723 Map* map = Map::cast(cell->value()); |
686 MarkBit map_mark = Marking::MarkBitFrom(map); | 724 MarkBit map_mark = ObjectMarking::MarkBitFrom(map); |
687 if (i >= number_of_disposed_maps && !map_retaining_is_disabled && | 725 if (i >= number_of_disposed_maps && !map_retaining_is_disabled && |
688 Marking::IsWhite(map_mark)) { | 726 Marking::IsWhite(map_mark)) { |
689 if (ShouldRetainMap(map, age)) { | 727 if (ShouldRetainMap(map, age)) { |
690 MarkObject(heap(), map); | 728 MarkObject(heap(), map); |
691 } | 729 } |
692 Object* prototype = map->prototype(); | 730 Object* prototype = map->prototype(); |
693 if (age > 0 && prototype->IsHeapObject() && | 731 if (age > 0 && prototype->IsHeapObject() && |
694 Marking::IsWhite(Marking::MarkBitFrom(HeapObject::cast(prototype)))) { | 732 Marking::IsWhite( |
| 733 ObjectMarking::MarkBitFrom(HeapObject::cast(prototype)))) { |
695 // The prototype is not marked, age the map. | 734 // The prototype is not marked, age the map. |
696 new_age = age - 1; | 735 new_age = age - 1; |
697 } else { | 736 } else { |
698 // The prototype and the constructor are marked, this map keeps only | 737 // The prototype and the constructor are marked, this map keeps only |
699 // transition tree alive, not JSObjects. Do not age the map. | 738 // transition tree alive, not JSObjects. Do not age the map. |
700 new_age = age; | 739 new_age = age; |
701 } | 740 } |
702 } else { | 741 } else { |
703 new_age = FLAG_retain_maps_for_n_gc; | 742 new_age = FLAG_retain_maps_for_n_gc; |
704 } | 743 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 // entries will not point to forwarding addresses. Hence, we can discard | 835 // entries will not point to forwarding addresses. Hence, we can discard |
797 // them. | 836 // them. |
798 if (map_word.IsForwardingAddress()) { | 837 if (map_word.IsForwardingAddress()) { |
799 HeapObject* dest = map_word.ToForwardingAddress(); | 838 HeapObject* dest = map_word.ToForwardingAddress(); |
800 if (Page::FromAddress(dest->address())->IsFlagSet(Page::BLACK_PAGE)) | 839 if (Page::FromAddress(dest->address())->IsFlagSet(Page::BLACK_PAGE)) |
801 continue; | 840 continue; |
802 array[new_top] = dest; | 841 array[new_top] = dest; |
803 new_top = ((new_top + 1) & mask); | 842 new_top = ((new_top + 1) & mask); |
804 DCHECK(new_top != marking_deque->bottom()); | 843 DCHECK(new_top != marking_deque->bottom()); |
805 #ifdef DEBUG | 844 #ifdef DEBUG |
806 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 845 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); |
807 DCHECK(Marking::IsGrey(mark_bit) || | 846 DCHECK(Marking::IsGrey(mark_bit) || |
808 (obj->IsFiller() && Marking::IsWhite(mark_bit))); | 847 (obj->IsFiller() && Marking::IsWhite(mark_bit))); |
809 #endif | 848 #endif |
810 } | 849 } |
811 } else if (obj->map() != filler_map) { | 850 } else if (obj->map() != filler_map) { |
812 // Skip one word filler objects that appear on the | 851 // Skip one word filler objects that appear on the |
813 // stack when we perform in place array shift. | 852 // stack when we perform in place array shift. |
814 array[new_top] = obj; | 853 array[new_top] = obj; |
815 new_top = ((new_top + 1) & mask); | 854 new_top = ((new_top + 1) & mask); |
816 DCHECK(new_top != marking_deque->bottom()); | 855 DCHECK(new_top != marking_deque->bottom()); |
817 #ifdef DEBUG | 856 #ifdef DEBUG |
818 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 857 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); |
819 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); | 858 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); |
820 DCHECK(Marking::IsGrey(mark_bit) || | 859 DCHECK(Marking::IsGrey(mark_bit) || |
821 (obj->IsFiller() && Marking::IsWhite(mark_bit)) || | 860 (obj->IsFiller() && Marking::IsWhite(mark_bit)) || |
822 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && | 861 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && |
823 Marking::IsBlack(mark_bit))); | 862 Marking::IsBlack(mark_bit))); |
824 #endif | 863 #endif |
825 } | 864 } |
826 } | 865 } |
827 marking_deque->set_top(new_top); | 866 marking_deque->set_top(new_top); |
828 } | 867 } |
829 | 868 |
830 | 869 |
831 void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) { | 870 void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) { |
832 MarkObject(heap_, map); | 871 MarkObject(heap_, map); |
833 | 872 |
834 IncrementalMarkingMarkingVisitor::IterateBody(map, obj); | 873 IncrementalMarkingMarkingVisitor::IterateBody(map, obj); |
835 | 874 |
836 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 875 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); |
837 #if ENABLE_SLOW_DCHECKS | 876 #if ENABLE_SLOW_DCHECKS |
838 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); | 877 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); |
839 SLOW_DCHECK(Marking::IsGrey(mark_bit) || | 878 SLOW_DCHECK(Marking::IsGrey(mark_bit) || |
840 (obj->IsFiller() && Marking::IsWhite(mark_bit)) || | 879 (obj->IsFiller() && Marking::IsWhite(mark_bit)) || |
841 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && | 880 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && |
842 Marking::IsBlack(mark_bit))); | 881 Marking::IsBlack(mark_bit))); |
843 #endif | 882 #endif |
844 MarkBlackOrKeepBlack(obj, mark_bit, size); | 883 MarkBlackOrKeepBlack(obj, mark_bit, size); |
845 } | 884 } |
846 | 885 |
847 | 886 |
848 void IncrementalMarking::MarkObject(Heap* heap, HeapObject* obj) { | 887 void IncrementalMarking::MarkObject(Heap* heap, HeapObject* obj) { |
849 MarkBit mark_bit = Marking::MarkBitFrom(obj); | 888 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); |
850 if (Marking::IsWhite(mark_bit)) { | 889 if (Marking::IsWhite(mark_bit)) { |
851 heap->incremental_marking()->WhiteToGreyAndPush(obj, mark_bit); | 890 heap->incremental_marking()->WhiteToGreyAndPush(obj, mark_bit); |
852 } | 891 } |
853 } | 892 } |
854 | 893 |
855 | 894 |
856 intptr_t IncrementalMarking::ProcessMarkingDeque(intptr_t bytes_to_process) { | 895 intptr_t IncrementalMarking::ProcessMarkingDeque(intptr_t bytes_to_process) { |
857 intptr_t bytes_processed = 0; | 896 intptr_t bytes_processed = 0; |
858 Map* one_pointer_filler_map = heap_->one_pointer_filler_map(); | 897 Map* one_pointer_filler_map = heap_->one_pointer_filler_map(); |
859 Map* two_pointer_filler_map = heap_->two_pointer_filler_map(); | 898 Map* two_pointer_filler_map = heap_->two_pointer_filler_map(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 } | 965 } |
927 } | 966 } |
928 | 967 |
929 Object* context = heap_->native_contexts_list(); | 968 Object* context = heap_->native_contexts_list(); |
930 while (!context->IsUndefined(heap_->isolate())) { | 969 while (!context->IsUndefined(heap_->isolate())) { |
931 // GC can happen when the context is not fully initialized, | 970 // GC can happen when the context is not fully initialized, |
932 // so the cache can be undefined. | 971 // so the cache can be undefined. |
933 HeapObject* cache = HeapObject::cast( | 972 HeapObject* cache = HeapObject::cast( |
934 Context::cast(context)->get(Context::NORMALIZED_MAP_CACHE_INDEX)); | 973 Context::cast(context)->get(Context::NORMALIZED_MAP_CACHE_INDEX)); |
935 if (!cache->IsUndefined(heap_->isolate())) { | 974 if (!cache->IsUndefined(heap_->isolate())) { |
936 MarkBit mark_bit = Marking::MarkBitFrom(cache); | 975 MarkBit mark_bit = ObjectMarking::MarkBitFrom(cache); |
937 if (Marking::IsGrey(mark_bit)) { | 976 if (Marking::IsGrey(mark_bit)) { |
938 Marking::GreyToBlack(mark_bit); | 977 Marking::GreyToBlack(mark_bit); |
939 MemoryChunk::IncrementLiveBytesFromGC(cache, cache->Size()); | 978 MemoryChunk::IncrementLiveBytesFromGC(cache, cache->Size()); |
940 } | 979 } |
941 } | 980 } |
942 context = Context::cast(context)->next_context_link(); | 981 context = Context::cast(context)->next_context_link(); |
943 } | 982 } |
944 } | 983 } |
945 | 984 |
946 | 985 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1281 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1243 idle_marking_delay_counter_++; | 1282 idle_marking_delay_counter_++; |
1244 } | 1283 } |
1245 | 1284 |
1246 | 1285 |
1247 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1286 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1248 idle_marking_delay_counter_ = 0; | 1287 idle_marking_delay_counter_ = 0; |
1249 } | 1288 } |
1250 } // namespace internal | 1289 } // namespace internal |
1251 } // namespace v8 | 1290 } // namespace v8 |
OLD | NEW |