Index: src/global-handles.cc |
diff --git a/src/global-handles.cc b/src/global-handles.cc |
index 9ff16affe4f948114ee18d1558dfe259da6dc079..1acb9d60c8296daf60763e1ec6edf9d95bbaa248 100644 |
--- a/src/global-handles.cc |
+++ b/src/global-handles.cc |
@@ -719,7 +719,7 @@ void GlobalHandles::MarkNewSpaceWeakUnmodifiedObjectsPending( |
} |
} |
- |
+template <GlobalHandles::IterationMode mode> |
void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots(ObjectVisitor* v) { |
for (int i = 0; i < new_space_nodes_.length(); ++i) { |
Node* node = new_space_nodes_[i]; |
@@ -728,18 +728,35 @@ void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots(ObjectVisitor* v) { |
node->IsWeakRetainer()) { |
// Pending weak phantom handles die immediately. Everything else survives. |
if (node->IsPendingPhantomResetHandle()) { |
- node->ResetPhantomHandle(); |
- ++number_of_phantom_handle_resets_; |
+ if (mode == IterationMode::HANDLE_PHANTOM_NODES || |
+ mode == IterationMode::HANDLE_PHANTOM_NODES_VISIT_OTHERS) { |
+ node->ResetPhantomHandle(); |
+ ++number_of_phantom_handle_resets_; |
+ } |
} else if (node->IsPendingPhantomCallback()) { |
- node->CollectPhantomCallbackData(isolate(), |
- &pending_phantom_callbacks_); |
+ if (mode == IterationMode::HANDLE_PHANTOM_NODES || |
+ mode == IterationMode::HANDLE_PHANTOM_NODES_VISIT_OTHERS) { |
+ node->CollectPhantomCallbackData(isolate(), |
+ &pending_phantom_callbacks_); |
+ } |
} else { |
- v->VisitPointer(node->location()); |
+ if (mode == IterationMode::VISIT_OTHERS || |
+ mode == IterationMode::HANDLE_PHANTOM_NODES_VISIT_OTHERS) { |
+ v->VisitPointer(node->location()); |
+ } |
} |
} |
} |
} |
+template void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots< |
+ GlobalHandles::HANDLE_PHANTOM_NODES>(ObjectVisitor* v); |
+ |
+template void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots< |
+ GlobalHandles::VISIT_OTHERS>(ObjectVisitor* v); |
+ |
+template void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots< |
+ GlobalHandles::HANDLE_PHANTOM_NODES_VISIT_OTHERS>(ObjectVisitor* v); |
DISABLE_CFI_PERF |
bool GlobalHandles::IterateObjectGroups(ObjectVisitor* v, |