Commit a1de6262 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] MinorMC: Use different recursion strategy

Only use recursion for objects with more than
kMinRangeForMarkingRecursion (8) pointers.

Bug: chromium:651354
Change-Id: Ic71967ef535f6a32268c7097301a313db2335bf8
Reviewed-on: https://chromium-review.googlesource.com/505615Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45326}
parent 724d8dfe
......@@ -2419,6 +2419,10 @@ class YoungGenerationMarkingVisitor final
: heap_(heap), marking_deque_(marking_deque) {}
void VisitPointers(HeapObject* host, Object** start, Object** end) final {
const int kMinRangeForMarkingRecursion = 64;
if (end - start >= kMinRangeForMarkingRecursion) {
if (MarkRecursively(host, start, end)) return;
}
for (Object** p = start; p < end; p++) {
VisitPointer(host, p);
}
......@@ -2428,7 +2432,6 @@ class YoungGenerationMarkingVisitor final
Object* target = *slot;
if (heap_->InNewSpace(target)) {
HeapObject* target_object = HeapObject::cast(target);
if (MarkRecursively(target_object)) return;
MarkObjectViaMarkingDeque(target_object);
}
}
......@@ -2481,13 +2484,18 @@ class YoungGenerationMarkingVisitor final
}
}
inline bool MarkRecursively(HeapObject* object) {
StackLimitCheck check(heap_->isolate());
if (check.HasOverflowed()) return false;
if (ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(
object, marking_state(object))) {
Visit(object);
inline bool MarkRecursively(HeapObject* host, Object** start, Object** end) {
// TODO(mlippautz): Stack check on background tasks. We cannot do a reliable
// stack check on background tasks yet.
for (Object** p = start; p < end; p++) {
Object* target = *p;
if (heap_->InNewSpace(target)) {
HeapObject* target_object = HeapObject::cast(target);
if (ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(
target_object, marking_state(target_object))) {
Visit(target_object);
}
}
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment