[heap] Remove Marking::MarkBlack and some minor cleanups.

BUG=chromium:694255

Review-Url: https://codereview.chromium.org/2720133005
Cr-Commit-Position: refs/heads/master@{#43519}
This commit is contained in:
hpayer 2017-03-01 06:53:20 -08:00 committed by Commit bot
parent b23b2c107b
commit c45d065edc
4 changed files with 16 additions and 46 deletions

View File

@ -390,14 +390,7 @@ void MarkCompactCollector::ClearMarkbits() {
ClearMarkbitsInPagedSpace(heap_->map_space()); ClearMarkbitsInPagedSpace(heap_->map_space());
ClearMarkbitsInPagedSpace(heap_->old_space()); ClearMarkbitsInPagedSpace(heap_->old_space());
ClearMarkbitsInNewSpace(heap_->new_space()); ClearMarkbitsInNewSpace(heap_->new_space());
heap_->lo_space()->ClearMarkingStateOfLiveObjects();
LargeObjectIterator it(heap_->lo_space());
for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) {
ObjectMarking::ClearMarkBit(obj);
MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
chunk->ResetProgressBar();
chunk->ResetLiveBytes();
}
} }
class MarkCompactCollector::Sweeper::SweeperTask : public v8::Task { class MarkCompactCollector::Sweeper::SweeperTask : public v8::Task {

View File

@ -298,14 +298,9 @@ class Marking : public AllStatic {
// objects. // objects.
INLINE(static bool IsBlackOrGrey(MarkBit mark_bit)) { return mark_bit.Get(); } INLINE(static bool IsBlackOrGrey(MarkBit mark_bit)) { return mark_bit.Get(); }
INLINE(static void MarkBlack(MarkBit mark_bit)) { INLINE(static void MarkWhite(MarkBit markbit)) {
mark_bit.Set(); markbit.Clear();
mark_bit.Next().Set(); markbit.Next().Clear();
}
INLINE(static void MarkWhite(MarkBit mark_bit)) {
mark_bit.Clear();
mark_bit.Next().Clear();
} }
INLINE(static void BlackToWhite(MarkBit markbit)) { INLINE(static void BlackToWhite(MarkBit markbit)) {

View File

@ -3062,14 +3062,15 @@ LargePage* LargeObjectSpace::FindPage(Address a) {
void LargeObjectSpace::ClearMarkingStateOfLiveObjects() { void LargeObjectSpace::ClearMarkingStateOfLiveObjects() {
LargePage* current = first_page_; LargeObjectIterator it(this);
while (current != NULL) { for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) {
HeapObject* object = current->GetObject(); if (ObjectMarking::IsBlackOrGrey(obj)) {
DCHECK(ObjectMarking::IsBlack(object)); ObjectMarking::ClearMarkBit(obj);
ObjectMarking::ClearMarkBit(object); MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
Page::FromAddress(object->address())->ResetProgressBar(); chunk->ResetProgressBar();
Page::FromAddress(object->address())->ResetLiveBytes(); chunk->ResetLiveBytes();
current = current->next_page(); }
DCHECK(ObjectMarking::IsWhite(obj));
} }
} }

View File

@ -11,25 +11,6 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
TEST(Marking, MarkWhiteBlackWhite) {
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::MarkBlack(mark_bit);
CHECK(Marking::IsBlack(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit));
Marking::MarkWhite(mark_bit);
CHECK(Marking::IsWhite(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit));
}
free(bitmap);
}
TEST(Marking, TransitionWhiteBlackWhite) { TEST(Marking, TransitionWhiteBlackWhite) {
Bitmap* bitmap = reinterpret_cast<Bitmap*>( Bitmap* bitmap = reinterpret_cast<Bitmap*>(
@ -65,7 +46,7 @@ TEST(Marking, TransitionAnyToGrey) {
CHECK(Marking::IsGrey(mark_bit)); CHECK(Marking::IsGrey(mark_bit));
CHECK(Marking::IsBlackOrGrey(mark_bit)); CHECK(Marking::IsBlackOrGrey(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit)); CHECK(!Marking::IsImpossible(mark_bit));
Marking::MarkBlack(mark_bit); Marking::GreyToBlack(mark_bit);
CHECK(Marking::IsBlack(mark_bit)); CHECK(Marking::IsBlack(mark_bit));
CHECK(Marking::IsBlackOrGrey(mark_bit)); CHECK(Marking::IsBlackOrGrey(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit)); CHECK(!Marking::IsImpossible(mark_bit));
@ -73,7 +54,7 @@ TEST(Marking, TransitionAnyToGrey) {
CHECK(Marking::IsGrey(mark_bit)); CHECK(Marking::IsGrey(mark_bit));
CHECK(Marking::IsBlackOrGrey(mark_bit)); CHECK(Marking::IsBlackOrGrey(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit)); CHECK(!Marking::IsImpossible(mark_bit));
Marking::MarkWhite(mark_bit); Marking::GreyToWhite(mark_bit);
CHECK(Marking::IsWhite(mark_bit)); CHECK(Marking::IsWhite(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit)); CHECK(!Marking::IsImpossible(mark_bit));
} }
@ -103,7 +84,7 @@ TEST(Marking, TransitionWhiteGreyBlackGrey) {
CHECK(Marking::IsGrey(mark_bit)); CHECK(Marking::IsGrey(mark_bit));
CHECK(Marking::IsBlackOrGrey(mark_bit)); CHECK(Marking::IsBlackOrGrey(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit)); CHECK(!Marking::IsImpossible(mark_bit));
Marking::MarkWhite(mark_bit); Marking::GreyToWhite(mark_bit);
CHECK(Marking::IsWhite(mark_bit)); CHECK(Marking::IsWhite(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit)); CHECK(!Marking::IsImpossible(mark_bit));
} }