Commit 00d1e2cf authored by ulan's avatar ulan Committed by Commit bot

[heap] Prepare IncrementalMarking::VisitObject for concurrent marking.

Currently the VisitObject function iterates the object and then colors
it black. This does not work well with concurrent marking. The function
should instead first try to mark the object black and iterate its body
only if the color transition succeeds.

BUG=chromium:694255

Review-Url: https://codereview.chromium.org/2853323003
Cr-Commit-Position: refs/heads/master@{#45095}
parent 2ec36b67
......@@ -835,12 +835,13 @@ void IncrementalMarking::UpdateMarkingDequeAfterScavenge() {
});
}
bool IncrementalMarking::IsFixedArrayWithProgressBar(HeapObject* obj) {
if (!obj->IsFixedArray()) return false;
MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
return chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR);
}
void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) {
WhiteToGreyAndPush(map);
IncrementalMarkingMarkingVisitor::IterateBody(map, obj);
#if ENABLE_SLOW_DCHECKS
MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj, marking_state(obj));
MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
......@@ -848,7 +849,13 @@ void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) {
(chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) &&
Marking::IsBlack<kAtomicity>(mark_bit)));
#endif
ObjectMarking::GreyToBlack<kAtomicity>(obj, marking_state(obj));
if (ObjectMarking::GreyToBlack<kAtomicity>(obj, marking_state(obj))) {
WhiteToGreyAndPush(map);
IncrementalMarkingMarkingVisitor::IterateBody(map, obj);
} else if (IsFixedArrayWithProgressBar(obj)) {
DCHECK(ObjectMarking::IsBlack<kAtomicity>(obj, marking_state(obj)));
IncrementalMarkingMarkingVisitor::VisitFixedArrayIncremental(map, obj);
}
}
intptr_t IncrementalMarking::ProcessMarkingDeque(
......
......@@ -312,6 +312,7 @@ class V8_EXPORT_PRIVATE IncrementalMarking {
intptr_t bytes_to_process,
ForceCompletionAction completion = DO_NOT_FORCE_COMPLETION));
INLINE(bool IsFixedArrayWithProgressBar(HeapObject* object));
INLINE(void VisitObject(Map* map, HeapObject* obj, int size));
void IncrementIdleMarkingDelayCounter();
......
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