Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Unified Diff: src/heap/mark-compact.cc

Issue 1293773002: [heap] Simplify MarkingDeque implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/mark-compact-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index e34dbfd2337cc0bec932e2729d51ae1aeb5d1787..95f762c05cc09b6d23400f02114e0a1f1623cd97 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -1734,21 +1734,18 @@ class MarkCompactWeakObjectRetainer : public WeakObjectRetainer {
// iterator. Stop when the marking stack is filled or the end of the space
// is reached, whichever comes first.
template <class T>
-static void DiscoverGreyObjectsWithIterator(Heap* heap,
- MarkingDeque* marking_deque,
- T* it) {
+void MarkCompactCollector::DiscoverGreyObjectsWithIterator(T* it) {
// The caller should ensure that the marking stack is initially not full,
// so that we don't waste effort pointlessly scanning for objects.
- DCHECK(!marking_deque->IsFull());
+ DCHECK(!marking_deque()->IsFull());
- Map* filler_map = heap->one_pointer_filler_map();
+ Map* filler_map = heap()->one_pointer_filler_map();
for (HeapObject* object = it->Next(); object != NULL; object = it->Next()) {
MarkBit markbit = Marking::MarkBitFrom(object);
if ((object->map() != filler_map) && Marking::IsGrey(markbit)) {
Marking::GreyToBlack(markbit);
- MemoryChunk::IncrementLiveBytesFromGC(object, object->Size());
- marking_deque->PushBlack(object);
- if (marking_deque->IsFull()) return;
+ PushBlack(object);
+ if (marking_deque()->IsFull()) return;
}
}
}
@@ -1757,9 +1754,8 @@ static void DiscoverGreyObjectsWithIterator(Heap* heap,
static inline int MarkWordToObjectStarts(uint32_t mark_bits, int* starts);
-static void DiscoverGreyObjectsOnPage(MarkingDeque* marking_deque,
- MemoryChunk* p) {
- DCHECK(!marking_deque->IsFull());
+void MarkCompactCollector::DiscoverGreyObjectsOnPage(MemoryChunk* p) {
+ DCHECK(!marking_deque()->IsFull());
DCHECK(strcmp(Marking::kWhiteBitPattern, "00") == 0);
DCHECK(strcmp(Marking::kBlackBitPattern, "10") == 0);
DCHECK(strcmp(Marking::kGreyBitPattern, "11") == 0);
@@ -1791,9 +1787,8 @@ static void DiscoverGreyObjectsOnPage(MarkingDeque* marking_deque,
Marking::GreyToBlack(markbit);
Address addr = cell_base + offset * kPointerSize;
HeapObject* object = HeapObject::FromAddress(addr);
- MemoryChunk::IncrementLiveBytesFromGC(object, object->Size());
- marking_deque->PushBlack(object);
- if (marking_deque->IsFull()) return;
+ PushBlack(object);
+ if (marking_deque()->IsFull()) return;
offset += 2;
grey_objects >>= 2;
}
@@ -1866,25 +1861,23 @@ int MarkCompactCollector::DiscoverAndEvacuateBlackObjectsOnPage(
}
-static void DiscoverGreyObjectsInSpace(Heap* heap, MarkingDeque* marking_deque,
- PagedSpace* space) {
+void MarkCompactCollector::DiscoverGreyObjectsInSpace(PagedSpace* space) {
PageIterator it(space);
while (it.has_next()) {
Page* p = it.next();
- DiscoverGreyObjectsOnPage(marking_deque, p);
- if (marking_deque->IsFull()) return;
+ DiscoverGreyObjectsOnPage(p);
+ if (marking_deque()->IsFull()) return;
}
}
-static void DiscoverGreyObjectsInNewSpace(Heap* heap,
- MarkingDeque* marking_deque) {
- NewSpace* space = heap->new_space();
+void MarkCompactCollector::DiscoverGreyObjectsInNewSpace() {
+ NewSpace* space = heap()->new_space();
NewSpacePageIterator it(space->bottom(), space->top());
while (it.has_next()) {
NewSpacePage* page = it.next();
- DiscoverGreyObjectsOnPage(marking_deque, page);
- if (marking_deque->IsFull()) return;
+ DiscoverGreyObjectsOnPage(page);
+ if (marking_deque()->IsFull()) return;
}
}
@@ -2009,20 +2002,20 @@ void MarkCompactCollector::RefillMarkingDeque() {
isolate()->CountUsage(v8::Isolate::UseCounterFeature::kMarkDequeOverflow);
DCHECK(marking_deque_.overflowed());
- DiscoverGreyObjectsInNewSpace(heap(), &marking_deque_);
+ DiscoverGreyObjectsInNewSpace();
if (marking_deque_.IsFull()) return;
- DiscoverGreyObjectsInSpace(heap(), &marking_deque_, heap()->old_space());
+ DiscoverGreyObjectsInSpace(heap()->old_space());
if (marking_deque_.IsFull()) return;
- DiscoverGreyObjectsInSpace(heap(), &marking_deque_, heap()->code_space());
+ DiscoverGreyObjectsInSpace(heap()->code_space());
if (marking_deque_.IsFull()) return;
- DiscoverGreyObjectsInSpace(heap(), &marking_deque_, heap()->map_space());
+ DiscoverGreyObjectsInSpace(heap()->map_space());
if (marking_deque_.IsFull()) return;
LargeObjectIterator lo_it(heap()->lo_space());
- DiscoverGreyObjectsWithIterator(heap(), &marking_deque_, &lo_it);
+ DiscoverGreyObjectsWithIterator(&lo_it);
if (marking_deque_.IsFull()) return;
marking_deque_.ClearOverflowed();
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/mark-compact-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698