Commit 350cbaab authored by hpayer's avatar hpayer Committed by Commit bot

Introduce ProcessYoungWeakReferences and process weak list of allocation sites...

Introduce ProcessYoungWeakReferences and process weak list of allocation sites just during full GCs.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#26330}
parent f5ca4145
...@@ -1597,7 +1597,7 @@ void Heap::Scavenge() { ...@@ -1597,7 +1597,7 @@ void Heap::Scavenge() {
incremental_marking()->UpdateMarkingDequeAfterScavenge(); incremental_marking()->UpdateMarkingDequeAfterScavenge();
ScavengeWeakObjectRetainer weak_object_retainer(this); ScavengeWeakObjectRetainer weak_object_retainer(this);
ProcessWeakReferences(&weak_object_retainer); ProcessYoungWeakReferences(&weak_object_retainer);
DCHECK(new_space_front == new_space_.top()); DCHECK(new_space_front == new_space_.top());
...@@ -1684,11 +1684,9 @@ void Heap::UpdateReferencesInExternalStringTable( ...@@ -1684,11 +1684,9 @@ void Heap::UpdateReferencesInExternalStringTable(
} }
void Heap::ProcessWeakReferences(WeakObjectRetainer* retainer) { void Heap::ProcessAllWeakReferences(WeakObjectRetainer* retainer) {
ProcessArrayBuffers(retainer); ProcessArrayBuffers(retainer);
ProcessNativeContexts(retainer); ProcessNativeContexts(retainer);
// TODO(mvstanton): AllocationSites only need to be processed during
// MARK_COMPACT, as they live in old space. Verify and address.
ProcessAllocationSites(retainer); ProcessAllocationSites(retainer);
// Collects callback info for handles that are pending (about to be // Collects callback info for handles that are pending (about to be
// collected) and either phantom or internal-fields. Releases the global // collected) and either phantom or internal-fields. Releases the global
...@@ -1697,6 +1695,16 @@ void Heap::ProcessWeakReferences(WeakObjectRetainer* retainer) { ...@@ -1697,6 +1695,16 @@ void Heap::ProcessWeakReferences(WeakObjectRetainer* retainer) {
} }
void Heap::ProcessYoungWeakReferences(WeakObjectRetainer* retainer) {
ProcessArrayBuffers(retainer);
ProcessNativeContexts(retainer);
// Collects callback info for handles that are pending (about to be
// collected) and either phantom or internal-fields. Releases the global
// handles. See also PostGarbageCollectionProcessing.
isolate()->global_handles()->CollectPhantomCallbackData();
}
void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer) { void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer) {
Object* head = VisitWeakList<Context>(this, native_contexts_list(), retainer); Object* head = VisitWeakList<Context>(this, native_contexts_list(), retainer);
// Update the head of the list of contexts. // Update the head of the list of contexts.
......
...@@ -1224,7 +1224,8 @@ class Heap { ...@@ -1224,7 +1224,8 @@ class Heap {
void UpdateReferencesInExternalStringTable( void UpdateReferencesInExternalStringTable(
ExternalStringTableUpdaterCallback updater_func); ExternalStringTableUpdaterCallback updater_func);
void ProcessWeakReferences(WeakObjectRetainer* retainer); void ProcessAllWeakReferences(WeakObjectRetainer* retainer);
void ProcessYoungWeakReferences(WeakObjectRetainer* retainer);
void VisitExternalResources(v8::ExternalResourceVisitor* visitor); void VisitExternalResources(v8::ExternalResourceVisitor* visitor);
......
...@@ -2276,7 +2276,7 @@ void MarkCompactCollector::AfterMarking() { ...@@ -2276,7 +2276,7 @@ void MarkCompactCollector::AfterMarking() {
// Process the weak references. // Process the weak references.
MarkCompactWeakObjectRetainer mark_compact_object_retainer; MarkCompactWeakObjectRetainer mark_compact_object_retainer;
heap()->ProcessWeakReferences(&mark_compact_object_retainer); heap()->ProcessAllWeakReferences(&mark_compact_object_retainer);
// Remove object groups after marking phase. // Remove object groups after marking phase.
heap()->isolate()->global_handles()->RemoveObjectGroups(); heap()->isolate()->global_handles()->RemoveObjectGroups();
...@@ -3546,7 +3546,7 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() { ...@@ -3546,7 +3546,7 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
&UpdateReferenceInExternalStringTableEntry); &UpdateReferenceInExternalStringTableEntry);
EvacuationWeakObjectRetainer evacuation_object_retainer; EvacuationWeakObjectRetainer evacuation_object_retainer;
heap()->ProcessWeakReferences(&evacuation_object_retainer); heap()->ProcessAllWeakReferences(&evacuation_object_retainer);
// Visit invalidated code (we ignored all slots on it) and clear mark-bits // Visit invalidated code (we ignored all slots on it) and clear mark-bits
// under it. // under it.
......
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