Index: src/heap/incremental-marking.cc |
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc |
index 0bfc60e2afbd68b5dc4c947fc29fbd0e5339bb2f..d4a1b64bb6a233b312c2f2ae2d1fcd04dabeb9cf 100644 |
--- a/src/heap/incremental-marking.cc |
+++ b/src/heap/incremental-marking.cc |
@@ -193,6 +193,14 @@ |
Marking::ObjectColor new_color = Marking::Color(new_mark_bit); |
DCHECK(new_color == old_color); |
#endif |
+} |
+ |
+static inline void MarkBlackOrKeepBlack(HeapObject* heap_object, |
+ MarkBit mark_bit, int size) { |
+ DCHECK(!Marking::IsImpossible(mark_bit)); |
+ if (Marking::IsBlack(mark_bit)) return; |
+ Marking::MarkBlack(mark_bit); |
+ MemoryChunk::IncrementLiveBytesFromGC(heap_object, size); |
} |
class IncrementalMarkingMarkingVisitor |
@@ -286,7 +294,7 @@ |
// Marks the object grey and pushes it on the marking stack. |
INLINE(static void MarkObject(Heap* heap, Object* obj)) { |
- IncrementalMarking::MarkGrey(heap, HeapObject::cast(obj)); |
+ IncrementalMarking::MarkObject(heap, HeapObject::cast(obj)); |
} |
// Marks the object black without pushing it on the marking stack. |
@@ -331,7 +339,7 @@ |
Object* obj = *p; |
if (!obj->IsHeapObject()) return; |
- IncrementalMarking::MarkGrey(heap_, HeapObject::cast(obj)); |
+ IncrementalMarking::MarkObject(heap_, HeapObject::cast(obj)); |
} |
Heap* heap_; |
@@ -625,7 +633,7 @@ |
DCHECK(IsMarking()); |
IncrementalMarkingRootMarkingVisitor visitor(this); |
- heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkGrey); |
+ heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject); |
heap_->isolate()->global_handles()->IterateObjectGroups( |
&visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); |
heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); |
@@ -712,7 +720,7 @@ |
if (i >= number_of_disposed_maps && !map_retaining_is_disabled && |
Marking::IsWhite(map_mark)) { |
if (ShouldRetainMap(map, age)) { |
- MarkGrey(heap(), map); |
+ MarkObject(heap(), map); |
} |
Object* prototype = map->prototype(); |
if (age > 0 && prototype->IsHeapObject() && |
@@ -855,34 +863,29 @@ |
void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) { |
- MarkGrey(heap_, map); |
+ MarkObject(heap_, map); |
IncrementalMarkingMarkingVisitor::IterateBody(map, obj); |
+ MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); |
#if ENABLE_SLOW_DCHECKS |
- MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); |
MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); |
SLOW_DCHECK(Marking::IsGrey(mark_bit) || |
(obj->IsFiller() && Marking::IsWhite(mark_bit)) || |
(chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && |
Marking::IsBlack(mark_bit))); |
#endif |
- MarkBlack(obj, size); |
-} |
- |
-void IncrementalMarking::MarkGrey(Heap* heap, HeapObject* object) { |
- MarkBit mark_bit = ObjectMarking::MarkBitFrom(object); |
+ MarkBlackOrKeepBlack(obj, mark_bit, size); |
+} |
+ |
+ |
+void IncrementalMarking::MarkObject(Heap* heap, HeapObject* obj) { |
+ MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); |
if (Marking::IsWhite(mark_bit)) { |
- heap->incremental_marking()->WhiteToGreyAndPush(object, mark_bit); |
- } |
-} |
- |
-void IncrementalMarking::MarkBlack(HeapObject* obj, int size) { |
- MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj); |
- if (Marking::IsBlack(mark_bit)) return; |
- Marking::GreyToBlack(mark_bit); |
- MemoryChunk::IncrementLiveBytesFromGC(obj, size); |
-} |
+ heap->incremental_marking()->WhiteToGreyAndPush(obj, mark_bit); |
+ } |
+} |
+ |
intptr_t IncrementalMarking::ProcessMarkingDeque(intptr_t bytes_to_process) { |
intptr_t bytes_processed = 0; |