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

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

Issue 1293773002: [heap] Simplify MarkingDeque implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moar work. 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
Index: src/heap/mark-compact.h
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h
index 6168436ee06d684986d9ad208aece45e8ebf4547..51a117d43d69ac22a9fb8d0a6c37bc77dc92ea76 100644
--- a/src/heap/mark-compact.h
+++ b/src/heap/mark-compact.h
@@ -205,18 +205,17 @@ class MarkingDeque {
void SetOverflowed() { overflowed_ = true; }
- // Push the (marked) object on the marking stack if there is room,
- // otherwise mark the object as overflowed and wait for a rescan of the
- // heap.
- INLINE(void PushBlack(HeapObject* object)) {
+ // Push the (marked) object on the marking stack if there is room, otherwise
+ // mark the deque as overflowed and wait for a rescan of the heap.
+ INLINE(bool PushBlack(HeapObject* object)) {
Michael Starzinger 2015/08/14 12:08:23 Note that {PushBlack} and {PushGrey} can now be un
Hannes Payer (out of office) 2015/08/17 09:39:10 I like it, you can do it in a separate cl.
DCHECK(object->IsHeapObject());
if (IsFull()) {
- Marking::BlackToGrey(object);
- MemoryChunk::IncrementLiveBytesFromGC(object, -object->Size());
SetOverflowed();
+ return false;
} else {
array_[top_] = object;
top_ = ((top_ + 1) & mask_);
+ return true;
}
}
@@ -248,16 +247,16 @@ class MarkingDeque {
}
}
- INLINE(void UnshiftBlack(HeapObject* object)) {
+ INLINE(bool UnshiftBlack(HeapObject* object)) {
DCHECK(object->IsHeapObject());
DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object)));
if (IsFull()) {
- Marking::BlackToGrey(object);
- MemoryChunk::IncrementLiveBytesFromGC(object, -object->Size());
SetOverflowed();
+ return false;
} else {
bottom_ = ((bottom_ - 1) & mask_);
array_[bottom_] = object;
+ return true;
}
}
@@ -778,6 +777,9 @@ class MarkCompactCollector {
void AfterMarking();
+ // Pushes a black object onto the marking stack and accounts for live bytes.
+ INLINE(void PushBlack(HeapObject* obj));
+
// Marks the object black and pushes it on the marking stack.
// This is for non-incremental marking only.
INLINE(void MarkObject(HeapObject* obj, MarkBit mark_bit));
@@ -826,6 +828,14 @@ class MarkCompactCollector {
// flag on the marking stack.
void RefillMarkingDeque();
+ // Helper methods for refilling the marking stack by discovering grey objects
+ // on various pages of the heap. Used by {RefillMarkingDeque} only.
+ template <class T>
+ void DiscoverGreyObjectsWithIterator(T* it);
+ void DiscoverGreyObjectsOnPage(MemoryChunk* p);
+ void DiscoverGreyObjectsInSpace(PagedSpace* space);
+ void DiscoverGreyObjectsInNewSpace();
+
// Callback function for telling whether the object *p is an unmarked
// heap object.
static bool IsUnmarkedHeapObject(Object** p);

Powered by Google App Engine
This is Rietveld 408576698