Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Unified Diff: src/heap/objects-visiting-inl.h

Issue 1363553002: [heap] Process live weak cells directly in the marking visitor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/objects-visiting-inl.h
diff --git a/src/heap/objects-visiting-inl.h b/src/heap/objects-visiting-inl.h
index 29a5afc320a370d4e9ee2802865353eb8054fe80..55734fd463a4e538baa0ad353167f2091bb148de 100644
--- a/src/heap/objects-visiting-inl.h
+++ b/src/heap/objects-visiting-inl.h
@@ -354,9 +354,21 @@ void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map,
// We can ignore weak cells with cleared values because they will always
// contain smi zero.
if (weak_cell->next_cleared() && !weak_cell->cleared()) {
- weak_cell->set_next(heap->encountered_weak_cells(),
- UPDATE_WEAK_WRITE_BARRIER);
- heap->set_encountered_weak_cells(weak_cell);
+ HeapObject* value = HeapObject::cast(weak_cell->value());
+ if (MarkCompactCollector::IsMarked(value)) {
+ // 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);
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698