[heap] Remove Marking::AnyToGrey and change its callers to use simple marking functions.
BUG=chromium:694255 Review-Url: https://codereview.chromium.org/2728113002 Cr-Commit-Position: refs/heads/master@{#43586}
This commit is contained in:
parent
f302c3012c
commit
b7944a5cd5
@ -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);
|
||||
}
|
||||
|
@ -121,15 +121,6 @@ class ObjectMarking : public AllStatic {
|
||||
MemoryChunk::IncrementLiveBytes<mode>(obj, obj->Size());
|
||||
}
|
||||
|
||||
template <MarkingMode mode = MarkingMode::FULL>
|
||||
V8_INLINE static void AnyToGrey(HeapObject* obj) {
|
||||
MarkBit markbit = MarkBitFrom<mode>(obj);
|
||||
if (Marking::IsBlack(markbit)) {
|
||||
MemoryChunk::IncrementLiveBytes<mode>(obj, -obj->Size());
|
||||
}
|
||||
Marking::AnyToGrey(markbit);
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectMarking);
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -32,35 +32,6 @@ TEST(Marking, TransitionWhiteBlackWhite) {
|
||||
free(bitmap);
|
||||
}
|
||||
|
||||
TEST(Marking, TransitionAnyToGrey) {
|
||||
Bitmap* bitmap = reinterpret_cast<Bitmap*>(
|
||||
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<Bitmap*>(
|
||||
calloc(Bitmap::kSize / kPointerSize, kPointerSize));
|
||||
|
Loading…
Reference in New Issue
Block a user