[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_->old_space());
ClearMarkbitsInNewSpace(heap_->new_space());
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();
}
heap_->lo_space()->ClearMarkingStateOfLiveObjects();
}
class MarkCompactCollector::Sweeper::SweeperTask : public v8::Task {

View File

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

View File

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

View File

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