Commit 5874ac78 authored by hpayer's avatar hpayer Committed by Commit bot

[heap] Cleanup mark bit usage.

BUG=

Review URL: https://codereview.chromium.org/1474203003

Cr-Commit-Position: refs/heads/master@{#32362}
parent 97f1bac4
......@@ -1461,8 +1461,9 @@ typedef StringTableCleaner<true> ExternalStringTableCleaner;
class MarkCompactWeakObjectRetainer : public WeakObjectRetainer {
public:
virtual Object* RetainAs(Object* object) {
if (Marking::IsBlackOrGrey(
Marking::MarkBitFrom(HeapObject::cast(object)))) {
MarkBit mark_bit = Marking::MarkBitFrom(HeapObject::cast(object));
DCHECK(!Marking::IsGrey(mark_bit));
if (Marking::IsBlack(mark_bit)) {
return object;
} else if (object->IsAllocationSite() &&
!(AllocationSite::cast(object)->IsZombie())) {
......@@ -2371,8 +2372,8 @@ void MarkCompactCollector::ClearNonLiveMapTransitions(Map* map) {
// Follow back pointer, check whether we are dealing with a map transition
// from a live map to a dead path and in case clear transitions of parent.
DCHECK(!Marking::IsBlackOrGrey(Marking::MarkBitFrom(map)));
bool parent_is_alive = Marking::IsBlackOrGrey(Marking::MarkBitFrom(parent));
DCHECK(!Marking::IsGrey(Marking::MarkBitFrom(map)));
bool parent_is_alive = Marking::IsBlack(Marking::MarkBitFrom(parent));
if (parent_is_alive) {
ClearMapTransitions(parent, map);
}
......@@ -2382,7 +2383,8 @@ void MarkCompactCollector::ClearNonLiveMapTransitions(Map* map) {
// Clear a possible back pointer in case the transition leads to a dead map.
// Return true in case a back pointer has been cleared and false otherwise.
bool MarkCompactCollector::ClearMapBackPointer(Map* target) {
if (Marking::IsBlackOrGrey(Marking::MarkBitFrom(target))) return false;
DCHECK(!Marking::IsGrey(Marking::MarkBitFrom(target)));
if (Marking::IsBlack(Marking::MarkBitFrom(target))) return false;
target->SetBackPointer(heap_->undefined_value(), SKIP_WRITE_BARRIER);
return true;
}
......
......@@ -83,12 +83,6 @@ class Marking : public AllStatic {
markbit.Clear();
}
INLINE(static void GreyToWhite(MarkBit markbit)) {
DCHECK(IsGrey(markbit));
markbit.Clear();
markbit.Next().Clear();
}
INLINE(static void BlackToGrey(MarkBit markbit)) {
DCHECK(IsBlack(markbit));
markbit.Next().Set();
......
......@@ -3146,7 +3146,7 @@ void LargeObjectSpace::ClearMarkingStateOfLiveObjects() {
while (current != NULL) {
HeapObject* object = current->GetObject();
MarkBit mark_bit = Marking::MarkBitFrom(object);
DCHECK(Marking::IsBlackOrGrey(mark_bit));
DCHECK(Marking::IsBlack(mark_bit));
Marking::BlackToWhite(mark_bit);
Page::FromAddress(object->address())->ResetProgressBar();
Page::FromAddress(object->address())->ResetLiveBytes();
......@@ -3161,7 +3161,8 @@ void LargeObjectSpace::FreeUnmarkedObjects() {
while (current != NULL) {
HeapObject* object = current->GetObject();
MarkBit mark_bit = Marking::MarkBitFrom(object);
if (Marking::IsBlackOrGrey(mark_bit)) {
DCHECK(!Marking::IsGrey(mark_bit));
if (Marking::IsBlack(mark_bit)) {
previous = current;
current = current->next_page();
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment