diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc index 64d8c056c8..b8ab1e926b 100644 --- a/src/heap/incremental-marking.cc +++ b/src/heap/incremental-marking.cc @@ -121,14 +121,6 @@ void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj) { heap_->mark_compact_collector()->marking_deque()->Push(obj); } - -static void MarkObjectGreyDoNotEnqueue(Object* obj) { - if (obj->IsHeapObject()) { - HeapObject* heap_obj = HeapObject::cast(obj); - ObjectMarking::AnyToGrey(heap_obj); - } -} - void IncrementalMarking::TransferMark(Heap* heap, HeapObject* from, HeapObject* to) { DCHECK(MemoryChunk::FromAddress(from->address())->SweepingDone()); @@ -227,7 +219,14 @@ class IncrementalMarkingMarkingVisitor // so the cache can be undefined. Object* cache = context->get(Context::NORMALIZED_MAP_CACHE_INDEX); if (!cache->IsUndefined(map->GetIsolate())) { - MarkObjectGreyDoNotEnqueue(cache); + if (cache->IsHeapObject()) { + HeapObject* heap_obj = HeapObject::cast(cache); + // Mark the object grey if it is white, do not enque it into the marking + // deque. + if (ObjectMarking::IsWhite(heap_obj)) { + ObjectMarking::WhiteToGrey(heap_obj); + } + } } VisitNativeContext(map, context); } diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h index 12c9d04373..8fec443c1b 100644 --- a/src/heap/mark-compact.h +++ b/src/heap/mark-compact.h @@ -121,15 +121,6 @@ class ObjectMarking : public AllStatic { MemoryChunk::IncrementLiveBytes(obj, obj->Size()); } - template - V8_INLINE static void AnyToGrey(HeapObject* obj) { - MarkBit markbit = MarkBitFrom(obj); - if (Marking::IsBlack(markbit)) { - MemoryChunk::IncrementLiveBytes(obj, -obj->Size()); - } - Marking::AnyToGrey(markbit); - } - private: DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking); }; diff --git a/src/heap/marking.h b/src/heap/marking.h index 88128145e4..b80162b48d 100644 --- a/src/heap/marking.h +++ b/src/heap/marking.h @@ -336,11 +336,6 @@ class Marking : public AllStatic { markbit.Next().Set(); } - INLINE(static void AnyToGrey(MarkBit markbit)) { - markbit.Set(); - markbit.Next().Clear(); - } - enum ObjectColor { BLACK_OBJECT, WHITE_OBJECT, diff --git a/test/unittests/heap/marking-unittest.cc b/test/unittests/heap/marking-unittest.cc index edb39c87fc..4f80d384dd 100644 --- a/test/unittests/heap/marking-unittest.cc +++ b/test/unittests/heap/marking-unittest.cc @@ -32,35 +32,6 @@ TEST(Marking, TransitionWhiteBlackWhite) { free(bitmap); } -TEST(Marking, TransitionAnyToGrey) { - Bitmap* bitmap = reinterpret_cast( - calloc(Bitmap::kSize / kPointerSize, kPointerSize)); - const int kLocationsSize = 3; - int position[kLocationsSize] = { - Bitmap::kBitsPerCell - 2, Bitmap::kBitsPerCell - 1, Bitmap::kBitsPerCell}; - for (int i = 0; i < kLocationsSize; i++) { - MarkBit mark_bit = bitmap->MarkBitFromIndex(position[i]); - CHECK(Marking::IsWhite(mark_bit)); - CHECK(!Marking::IsImpossible(mark_bit)); - Marking::AnyToGrey(mark_bit); - CHECK(Marking::IsGrey(mark_bit)); - CHECK(Marking::IsBlackOrGrey(mark_bit)); - CHECK(!Marking::IsImpossible(mark_bit)); - Marking::GreyToBlack(mark_bit); - CHECK(Marking::IsBlack(mark_bit)); - CHECK(Marking::IsBlackOrGrey(mark_bit)); - CHECK(!Marking::IsImpossible(mark_bit)); - Marking::AnyToGrey(mark_bit); - CHECK(Marking::IsGrey(mark_bit)); - CHECK(Marking::IsBlackOrGrey(mark_bit)); - CHECK(!Marking::IsImpossible(mark_bit)); - Marking::GreyToWhite(mark_bit); - CHECK(Marking::IsWhite(mark_bit)); - CHECK(!Marking::IsImpossible(mark_bit)); - } - free(bitmap); -} - TEST(Marking, TransitionWhiteGreyBlackGrey) { Bitmap* bitmap = reinterpret_cast( calloc(Bitmap::kSize / kPointerSize, kPointerSize));