Commit 4ea91a01 authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] MinorMC: Only iterate new space global handles for ptr updates

The reason we need this mode is that IterateRoots for the Scavenger only
captures dependent weak nodes. This is also what we do for marking for the
minor MC.

Since the regular marking might also mark objects that are weakly
(non-dependently) pointed to by nodes we need to capture all of them during
pointers updating. The reason this works for the Scavenger is because we do one
pass at the end of the scavenger (combined with resetting) that captures all
those nodes.

BUG=chromium:651354

Review-Url: https://codereview.chromium.org/2869413002
Cr-Commit-Position: refs/heads/master@{#45248}
parent f9c4fc0d
...@@ -945,6 +945,15 @@ void GlobalHandles::IterateAllRoots(RootVisitor* v) { ...@@ -945,6 +945,15 @@ void GlobalHandles::IterateAllRoots(RootVisitor* v) {
} }
} }
DISABLE_CFI_PERF
void GlobalHandles::IterateAllNewSpaceRoots(RootVisitor* v) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
if (node->IsRetainer()) {
v->VisitRootPointer(Root::kGlobalHandles, node->location());
}
}
}
DISABLE_CFI_PERF DISABLE_CFI_PERF
void GlobalHandles::ApplyPersistentHandleVisitor( void GlobalHandles::ApplyPersistentHandleVisitor(
......
...@@ -130,6 +130,8 @@ class GlobalHandles { ...@@ -130,6 +130,8 @@ class GlobalHandles {
// Iterates over all handles. // Iterates over all handles.
void IterateAllRoots(RootVisitor* v); void IterateAllRoots(RootVisitor* v);
void IterateAllNewSpaceRoots(RootVisitor* v);
// Iterates over all handles that have embedder-assigned class ID. // Iterates over all handles that have embedder-assigned class ID.
void IterateAllRootsWithClassIds(v8::PersistentHandleVisitor* v); void IterateAllRootsWithClassIds(v8::PersistentHandleVisitor* v);
......
...@@ -590,6 +590,7 @@ enum Executability { NOT_EXECUTABLE, EXECUTABLE }; ...@@ -590,6 +590,7 @@ enum Executability { NOT_EXECUTABLE, EXECUTABLE };
enum VisitMode { enum VisitMode {
VISIT_ALL, VISIT_ALL,
VISIT_ALL_IN_MINOR_MC_UPDATE,
VISIT_ALL_IN_SCAVENGE, VISIT_ALL_IN_SCAVENGE,
VISIT_ALL_IN_SWEEP_NEWSPACE, VISIT_ALL_IN_SWEEP_NEWSPACE,
VISIT_ONLY_STRONG, VISIT_ONLY_STRONG,
......
...@@ -5108,7 +5108,7 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) { ...@@ -5108,7 +5108,7 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) {
// Iterate over the builtin code objects and code stubs in the // Iterate over the builtin code objects and code stubs in the
// heap. Note that it is not necessary to iterate over code objects // heap. Note that it is not necessary to iterate over code objects
// on scavenge collections. // on scavenge collections.
if (mode != VISIT_ALL_IN_SCAVENGE) { if (mode != VISIT_ALL_IN_SCAVENGE && mode != VISIT_ALL_IN_MINOR_MC_UPDATE) {
isolate_->builtins()->IterateBuiltins(v); isolate_->builtins()->IterateBuiltins(v);
v->Synchronize(VisitorSynchronization::kBuiltins); v->Synchronize(VisitorSynchronization::kBuiltins);
isolate_->interpreter()->IterateDispatchTable(v); isolate_->interpreter()->IterateDispatchTable(v);
...@@ -5128,6 +5128,9 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) { ...@@ -5128,6 +5128,9 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) {
case VISIT_ALL_IN_SCAVENGE: case VISIT_ALL_IN_SCAVENGE:
isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v); isolate_->global_handles()->IterateNewSpaceStrongAndDependentRoots(v);
break; break;
case VISIT_ALL_IN_MINOR_MC_UPDATE:
isolate_->global_handles()->IterateAllNewSpaceRoots(v);
break;
case VISIT_ALL_IN_SWEEP_NEWSPACE: case VISIT_ALL_IN_SWEEP_NEWSPACE:
case VISIT_ALL: case VISIT_ALL:
isolate_->global_handles()->IterateAllRoots(v); isolate_->global_handles()->IterateAllRoots(v);
...@@ -5136,7 +5139,7 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) { ...@@ -5136,7 +5139,7 @@ void Heap::IterateStrongRoots(RootVisitor* v, VisitMode mode) {
v->Synchronize(VisitorSynchronization::kGlobalHandles); v->Synchronize(VisitorSynchronization::kGlobalHandles);
// Iterate over eternal handles. // Iterate over eternal handles.
if (mode == VISIT_ALL_IN_SCAVENGE) { if (mode == VISIT_ALL_IN_SCAVENGE || mode == VISIT_ALL_IN_MINOR_MC_UPDATE) {
isolate_->eternal_handles()->IterateNewSpaceRoots(v); isolate_->eternal_handles()->IterateNewSpaceRoots(v);
} else { } else {
isolate_->eternal_handles()->IterateAllRoots(v); isolate_->eternal_handles()->IterateAllRoots(v);
......
...@@ -4377,10 +4377,7 @@ void MinorMarkCompactCollector::UpdatePointersAfterEvacuation() { ...@@ -4377,10 +4377,7 @@ void MinorMarkCompactCollector::UpdatePointersAfterEvacuation() {
GCTracer::Scope::MC_EVACUATE_UPDATE_POINTERS_TO_NEW); GCTracer::Scope::MC_EVACUATE_UPDATE_POINTERS_TO_NEW);
UpdateToSpacePointersInParallel(heap_, &page_parallel_job_semaphore_, UpdateToSpacePointersInParallel(heap_, &page_parallel_job_semaphore_,
*this); *this);
// TODO(mlippautz): Iteration mode is not optimal as we process all heap_->IterateRoots(&updating_visitor, VISIT_ALL_IN_MINOR_MC_UPDATE);
// global handles. Find a way to only process the ones related to new
// space.
heap_->IterateRoots(&updating_visitor, VISIT_ALL_IN_SWEEP_NEWSPACE);
UpdatePointersInParallel<OLD_TO_NEW>(heap_, &page_parallel_job_semaphore_, UpdatePointersInParallel<OLD_TO_NEW>(heap_, &page_parallel_job_semaphore_,
this); this);
} }
......
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