| Index: src/heap/incremental-marking.cc
|
| diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc
|
| index 5947e587dbd1d82730181e29d95f48efff10edb5..a9a71cfb6367f7d9ef5882db7bf02f245501b625 100644
|
| --- a/src/heap/incremental-marking.cc
|
| +++ b/src/heap/incremental-marking.cc
|
| @@ -57,7 +57,9 @@
|
| DCHECK(!ObjectMarking::IsImpossible(obj, marking_state(obj)));
|
| const bool is_black = ObjectMarking::IsBlack(obj, marking_state(obj));
|
|
|
| - if (is_black && WhiteToGreyAndPush(value_heap_obj)) {
|
| + if (is_black &&
|
| + ObjectMarking::IsWhite(value_heap_obj, marking_state(value_heap_obj))) {
|
| + WhiteToGreyAndPush(value_heap_obj);
|
| RestartIfNotMarking();
|
| }
|
| return is_compacting_ && is_black;
|
| @@ -128,12 +130,9 @@
|
| }
|
| }
|
|
|
| -bool IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj) {
|
| - if (ObjectMarking::WhiteToGrey(obj, marking_state(obj))) {
|
| - marking_deque()->Push(obj);
|
| - return true;
|
| - }
|
| - return false;
|
| +void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj) {
|
| + ObjectMarking::WhiteToGrey(obj, marking_state(obj));
|
| + marking_deque()->Push(obj);
|
| }
|
|
|
| void IncrementalMarking::TransferMark(Heap* heap, HeapObject* from,
|
| @@ -154,29 +153,9 @@
|
| MarkBit old_mark_bit = ObjectMarking::MarkBitFrom(from, marking_state(from));
|
|
|
| if (Marking::IsBlack(old_mark_bit)) {
|
| - if (from->address() + kPointerSize == to->address()) {
|
| - // The old and the new markbits overlap. The |to| object has the
|
| - // grey color. To make it black, we need to set second bit.
|
| - DCHECK(new_mark_bit.Get());
|
| - new_mark_bit.Next().Set();
|
| - } else {
|
| - bool success = Marking::WhiteToBlack(new_mark_bit);
|
| - DCHECK(success);
|
| - USE(success);
|
| - }
|
| + Marking::MarkBlack(new_mark_bit);
|
| } else if (Marking::IsGrey(old_mark_bit)) {
|
| - if (from->address() + kPointerSize == to->address()) {
|
| - // The old and the new markbits overlap. The |to| object has the
|
| - // white color. To make it black, we need to set both bits.
|
| - // Note that Marking::WhiteToGrey does not work here because
|
| - // old_mark_bit.Next() can be set by the concurrent marker at any time.
|
| - new_mark_bit.Set();
|
| - new_mark_bit.Next().Set();
|
| - } else {
|
| - bool success = Marking::WhiteToGrey(new_mark_bit);
|
| - DCHECK(success);
|
| - USE(success);
|
| - }
|
| + Marking::WhiteToGrey(new_mark_bit);
|
| marking_deque()->Push(to);
|
| RestartIfNotMarking();
|
| }
|
| @@ -248,9 +227,12 @@
|
| // Mark the object grey if it is white, do not enque it into the marking
|
| // deque.
|
| Heap* heap = map->GetHeap();
|
| - bool ignored = ObjectMarking::WhiteToGrey(
|
| - heap_obj, heap->incremental_marking()->marking_state(heap_obj));
|
| - USE(ignored);
|
| + if (ObjectMarking::IsWhite(
|
| + heap_obj,
|
| + heap->incremental_marking()->marking_state(heap_obj))) {
|
| + ObjectMarking::WhiteToGrey(
|
| + heap_obj, heap->incremental_marking()->marking_state(heap_obj));
|
| + }
|
| }
|
| }
|
| VisitNativeContext(map, context);
|
| @@ -277,15 +259,21 @@
|
|
|
| // Marks the object grey and pushes it on the marking stack.
|
| INLINE(static void MarkObject(Heap* heap, Object* obj)) {
|
| - heap->incremental_marking()->WhiteToGreyAndPush(HeapObject::cast(obj));
|
| + heap->incremental_marking()->MarkGrey(HeapObject::cast(obj));
|
| }
|
|
|
| // Marks the object black without pushing it on the marking stack.
|
| // Returns true if object needed marking and false otherwise.
|
| INLINE(static bool MarkObjectWithoutPush(Heap* heap, Object* obj)) {
|
| HeapObject* heap_object = HeapObject::cast(obj);
|
| - return ObjectMarking::WhiteToBlack(
|
| - heap_object, heap->incremental_marking()->marking_state(heap_object));
|
| + if (ObjectMarking::IsWhite(
|
| + heap_object,
|
| + heap->incremental_marking()->marking_state(heap_object))) {
|
| + ObjectMarking::WhiteToBlack(
|
| + heap_object, heap->incremental_marking()->marking_state(heap_object));
|
| + return true;
|
| + }
|
| + return false;
|
| }
|
| };
|
|
|
| @@ -297,7 +285,7 @@
|
| page->ResetProgressBar();
|
| }
|
| Map* map = object->map();
|
| - WhiteToGreyAndPush(map);
|
| + MarkGrey(map);
|
| IncrementalMarkingMarkingVisitor::IterateBody(map, object);
|
| }
|
| }
|
| @@ -321,7 +309,7 @@
|
| Object* obj = *p;
|
| if (!obj->IsHeapObject()) return;
|
|
|
| - heap_->incremental_marking()->WhiteToGreyAndPush(HeapObject::cast(obj));
|
| + heap_->incremental_marking()->MarkGrey(HeapObject::cast(obj));
|
| }
|
|
|
| Heap* heap_;
|
| @@ -712,7 +700,7 @@
|
| if (i >= number_of_disposed_maps && !map_retaining_is_disabled &&
|
| ObjectMarking::IsWhite(map, marking_state(map))) {
|
| if (ShouldRetainMap(map, age)) {
|
| - WhiteToGreyAndPush(map);
|
| + MarkGrey(map);
|
| }
|
| Object* prototype = map->prototype();
|
| if (age > 0 && prototype->IsHeapObject() &&
|
| @@ -832,7 +820,7 @@
|
|
|
|
|
| void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) {
|
| - WhiteToGreyAndPush(map);
|
| + MarkGrey(map);
|
|
|
| IncrementalMarkingMarkingVisitor::IterateBody(map, obj);
|
|
|
| @@ -843,6 +831,17 @@
|
| (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) &&
|
| Marking::IsBlack(mark_bit)));
|
| #endif
|
| + MarkBlack(obj, size);
|
| +}
|
| +
|
| +void IncrementalMarking::MarkGrey(HeapObject* object) {
|
| + if (ObjectMarking::IsWhite(object, marking_state(object))) {
|
| + WhiteToGreyAndPush(object);
|
| + }
|
| +}
|
| +
|
| +void IncrementalMarking::MarkBlack(HeapObject* obj, int size) {
|
| + if (ObjectMarking::IsBlack(obj, marking_state(obj))) return;
|
| ObjectMarking::GreyToBlack(obj, marking_state(obj));
|
| }
|
|
|
| @@ -911,9 +910,9 @@
|
| HeapObject* cache = HeapObject::cast(
|
| Context::cast(context)->get(Context::NORMALIZED_MAP_CACHE_INDEX));
|
| if (!cache->IsUndefined(heap_->isolate())) {
|
| - // Mark the cache black if it is grey.
|
| - bool ignored = ObjectMarking::GreyToBlack(cache, marking_state(cache));
|
| - USE(ignored);
|
| + if (ObjectMarking::IsGrey(cache, marking_state(cache))) {
|
| + ObjectMarking::GreyToBlack(cache, marking_state(cache));
|
| + }
|
| }
|
| context = Context::cast(context)->next_context_link();
|
| }
|
|
|