Commit 0bfb773d authored by hpayer's avatar hpayer Committed by Commit bot

[heap] Process live weak cells directly in the marking visitor.

This reduces the pause time of weak cells processing during a full GC.

BUG=

Review URL: https://codereview.chromium.org/1363553002

Cr-Commit-Position: refs/heads/master@{#30864}
parent 0ee53fdd
...@@ -354,9 +354,21 @@ void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, ...@@ -354,9 +354,21 @@ void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map,
// We can ignore weak cells with cleared values because they will always // We can ignore weak cells with cleared values because they will always
// contain smi zero. // contain smi zero.
if (weak_cell->next_cleared() && !weak_cell->cleared()) { if (weak_cell->next_cleared() && !weak_cell->cleared()) {
weak_cell->set_next(heap->encountered_weak_cells(), HeapObject* value = HeapObject::cast(weak_cell->value());
UPDATE_WEAK_WRITE_BARRIER); if (MarkCompactCollector::IsMarked(value)) {
heap->set_encountered_weak_cells(weak_cell); // Weak cells with live values are directly processed here to reduce
// the processing time of weak cells during the main GC pause.
Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset);
map->GetHeap()->mark_compact_collector()->RecordSlot(weak_cell, slot,
*slot);
} else {
// If we do not know about liveness of values of weak cells, we have to
// process them when we know the liveness of the whole transitive
// closure.
weak_cell->set_next(heap->encountered_weak_cells(),
UPDATE_WEAK_WRITE_BARRIER);
heap->set_encountered_weak_cells(weak_cell);
}
} }
} }
......
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