Reland of [heap] Cleanup mark bit usage. (patchset #1 id:1 of https://codereview.chromium.org/1490753003/ )

Reason for revert:
Reland after fixing the potential root cause of the canary crasher.

Original issue's description:
> Revert of [heap] Cleanup mark bit usage. (patchset #1 id:1 of https://codereview.chromium.org/1474203003/ )
>
> Reason for revert:
> Still investigating bad canary.
>
> Original issue's description:
> > [heap] Cleanup mark bit usage.
> >
> > BUG=
> >
> > Committed: https://crrev.com/5874ac783ff9bc4bb4b2fda81f5077f06619f96c
> > Cr-Commit-Position: refs/heads/master@{#32362}
>
> TBR=mlippautz@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=
>
> Committed: https://crrev.com/d3faef8658598e68331208b5a1846ac1c250cb49
> Cr-Commit-Position: refs/heads/master@{#32461}

TBR=mlippautz@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

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

Cr-Commit-Position: refs/heads/master@{#32502}
This commit is contained in:
hpayer 2015-12-02 03:05:19 -08:00 committed by Commit bot
parent 7ea8ac98f6
commit 0240d20265
3 changed files with 10 additions and 13 deletions

View File

@ -1439,8 +1439,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())) {
@ -2370,8 +2371,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);
}
@ -2381,7 +2382,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;
}

View File

@ -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();

View File

@ -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 {