[heap] Reland "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
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_rel_ng

Review-Url: https://codereview.chromium.org/2863933002
Cr-Commit-Position: refs/heads/master@{#45139}
This commit is contained in:
ulan 2017-05-05 07:56:12 -07:00 committed by Commit bot
parent b1d96fa1d4
commit 02a7c020bd
2 changed files with 13 additions and 5 deletions

View File

@ -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(

View File

@ -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();