Reviewers: Hannes Payer,
Description:
[heap] Unify MarkingDeque push and unshift operations.
[email protected]
Please review this at https://codereview.chromium.org/1294093003/
Base URL:
https://chromium.googlesource.com/v8/v8.git@local_cleanup-includes-heap-2
Affected files (+13, -30 lines):
M src/heap/incremental-marking.cc
M src/heap/incremental-marking-inl.h
M src/heap/mark-compact.h
M src/heap/mark-compact-inl.h
Index: src/heap/incremental-marking-inl.h
diff --git a/src/heap/incremental-marking-inl.h
b/src/heap/incremental-marking-inl.h
index
d523841a872e36e8247b7dd4d89df0d78260748c..fabf59d0167b462063913a5f3013d79c62bc43c5
100644
--- a/src/heap/incremental-marking-inl.h
+++ b/src/heap/incremental-marking-inl.h
@@ -105,13 +105,13 @@ void
IncrementalMarking::BlackToGreyAndUnshift(HeapObject* obj,
}
}
- heap_->mark_compact_collector()->marking_deque()->UnshiftGrey(obj);
+ heap_->mark_compact_collector()->marking_deque()->Unshift(obj);
}
void IncrementalMarking::WhiteToGreyAndPush(HeapObject* obj, MarkBit
mark_bit) {
Marking::WhiteToGrey(mark_bit);
- heap_->mark_compact_collector()->marking_deque()->PushGrey(obj);
+ heap_->mark_compact_collector()->marking_deque()->Push(obj);
}
}
} // namespace v8::internal
Index: src/heap/incremental-marking.cc
diff --git a/src/heap/incremental-marking.cc
b/src/heap/incremental-marking.cc
index
14e52bada1d28fb2fd98409c3522ad08aeb33dc0..0d365f089b235037446707a693530c50816070dc
100644
--- a/src/heap/incremental-marking.cc
+++ b/src/heap/incremental-marking.cc
@@ -199,7 +199,7 @@ class IncrementalMarkingMarkingVisitor
chunk->set_progress_bar(start_offset);
if (start_offset < object_size) {
if (Marking::IsGrey(Marking::MarkBitFrom(object))) {
-
heap->mark_compact_collector()->marking_deque()->UnshiftGrey(object);
+ heap->mark_compact_collector()->marking_deque()->Unshift(object);
} else {
DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object)));
heap->mark_compact_collector()->UnshiftBlack(object);
Index: src/heap/mark-compact-inl.h
diff --git a/src/heap/mark-compact-inl.h b/src/heap/mark-compact-inl.h
index
2d2feb29e5b169828569497bf7213460da0e0ab3..b5f58462dad24bd1d1400ec7eafd366cd05e2ad8
100644
--- a/src/heap/mark-compact-inl.h
+++ b/src/heap/mark-compact-inl.h
@@ -24,7 +24,8 @@ void MarkCompactCollector::SetFlags(int flags) {
void MarkCompactCollector::PushBlack(HeapObject* obj) {
- if (marking_deque_.PushBlack(obj)) {
+ DCHECK(Marking::IsBlack(Marking::MarkBitFrom(obj)));
+ if (marking_deque_.Push(obj)) {
MemoryChunk::IncrementLiveBytesFromGC(obj, obj->Size());
} else {
Marking::BlackToGrey(obj);
@@ -33,7 +34,8 @@ void MarkCompactCollector::PushBlack(HeapObject* obj) {
void MarkCompactCollector::UnshiftBlack(HeapObject* obj) {
- if (!marking_deque_.UnshiftBlack(obj)) {
+ DCHECK(Marking::IsBlack(Marking::MarkBitFrom(obj)));
+ if (!marking_deque_.Unshift(obj)) {
MemoryChunk::IncrementLiveBytesFromGC(obj, -obj->Size());
Marking::BlackToGrey(obj);
}
Index: src/heap/mark-compact.h
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h
index
443c5efb33006a9e5ba080419de5f7f57697987c..6b9708e095d44227590fc3bd894e6eeeb6c434c0
100644
--- a/src/heap/mark-compact.h
+++ b/src/heap/mark-compact.h
@@ -205,9 +205,9 @@ class MarkingDeque {
void SetOverflowed() { overflowed_ = true; }
- // 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)) {
+ // Push the 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 Push(HeapObject* object)) {
DCHECK(object->IsHeapObject());
if (IsFull()) {
SetOverflowed();
@@ -219,16 +219,6 @@ class MarkingDeque {
}
}
- INLINE(void PushGrey(HeapObject* object)) {
- DCHECK(object->IsHeapObject());
- if (IsFull()) {
- SetOverflowed();
- } else {
- array_[top_] = object;
- top_ = ((top_ + 1) & mask_);
- }
- }
-
INLINE(HeapObject* Pop()) {
DCHECK(!IsEmpty());
top_ = ((top_ - 1) & mask_);
@@ -237,19 +227,10 @@ class MarkingDeque {
return object;
}
- INLINE(void UnshiftGrey(HeapObject* object)) {
- DCHECK(object->IsHeapObject());
- if (IsFull()) {
- SetOverflowed();
- } else {
- bottom_ = ((bottom_ - 1) & mask_);
- array_[bottom_] = object;
- }
- }
-
- INLINE(bool UnshiftBlack(HeapObject* object)) {
+ // Unshift the object into the marking stack if there is room, otherwise
mark
+ // the deque as overflowed and wait for a rescan of the heap.
+ INLINE(bool Unshift(HeapObject* object)) {
DCHECK(object->IsHeapObject());
- DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object)));
if (IsFull()) {
SetOverflowed();
return false;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.