| Index: src/heap/incremental-marking.cc
 | 
| diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc
 | 
| index db17d3844f2b0c01be85800e47eb503fcdf5d93f..b5d023512f2c62609862ea02c2c84af4753fe9b8 100644
 | 
| --- a/src/heap/incremental-marking.cc
 | 
| +++ b/src/heap/incremental-marking.cc
 | 
| @@ -48,7 +48,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;
 | 
| @@ -119,12 +121,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,
 | 
| @@ -145,31 +144,11 @@
 | 
|    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_deque()->Push(to);
 | 
| -      RestartIfNotMarking();
 | 
| -    }
 | 
| +    Marking::WhiteToGrey(new_mark_bit);
 | 
| +    marking_deque()->Push(to);
 | 
| +    RestartIfNotMarking();
 | 
|    }
 | 
|  }
 | 
|  
 | 
| @@ -239,9 +218,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);
 | 
| @@ -268,15 +250,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;
 | 
|    }
 | 
|  };
 | 
|  
 | 
| @@ -288,7 +276,7 @@
 | 
|        page->ResetProgressBar();
 | 
|      }
 | 
|      Map* map = object->map();
 | 
| -    WhiteToGreyAndPush(map);
 | 
| +    MarkGrey(map);
 | 
|      IncrementalMarkingMarkingVisitor::IterateBody(map, object);
 | 
|    }
 | 
|  }
 | 
| @@ -312,7 +300,7 @@
 | 
|      Object* obj = *p;
 | 
|      if (!obj->IsHeapObject()) return;
 | 
|  
 | 
| -    heap_->incremental_marking()->WhiteToGreyAndPush(HeapObject::cast(obj));
 | 
| +    heap_->incremental_marking()->MarkGrey(HeapObject::cast(obj));
 | 
|    }
 | 
|  
 | 
|    Heap* heap_;
 | 
| @@ -703,7 +691,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() &&
 | 
| @@ -823,7 +811,7 @@
 | 
|  
 | 
|  
 | 
|  void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) {
 | 
| -  WhiteToGreyAndPush(map);
 | 
| +  MarkGrey(map);
 | 
|  
 | 
|    IncrementalMarkingMarkingVisitor::IterateBody(map, obj);
 | 
|  
 | 
| @@ -834,6 +822,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));
 | 
|  }
 | 
|  
 | 
| @@ -902,9 +901,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();
 | 
|    }
 | 
| 
 |