Introduce ProcessYoungWeakReferences and process weak list of allocation sites just...
authorhpayer <hpayer@chromium.org>
Thu, 29 Jan 2015 16:54:30 +0000 (08:54 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 29 Jan 2015 16:54:43 +0000 (16:54 +0000)
BUG=

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

Cr-Commit-Position: refs/heads/master@{#26330}

src/heap/heap.cc
src/heap/heap.h
src/heap/mark-compact.cc

index 147d5dd..c76f691 100644 (file)
@@ -1597,7 +1597,7 @@ void Heap::Scavenge() {
   incremental_marking()->UpdateMarkingDequeAfterScavenge();
 
   ScavengeWeakObjectRetainer weak_object_retainer(this);
-  ProcessWeakReferences(&weak_object_retainer);
+  ProcessYoungWeakReferences(&weak_object_retainer);
 
   DCHECK(new_space_front == new_space_.top());
 
@@ -1684,11 +1684,9 @@ void Heap::UpdateReferencesInExternalStringTable(
 }
 
 
-void Heap::ProcessWeakReferences(WeakObjectRetainer* retainer) {
+void Heap::ProcessAllWeakReferences(WeakObjectRetainer* retainer) {
   ProcessArrayBuffers(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);
   // Collects callback info for handles that are pending (about to be
   // collected) and either phantom or internal-fields.  Releases the global
@@ -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) {
   Object* head = VisitWeakList<Context>(this, native_contexts_list(), retainer);
   // Update the head of the list of contexts.
index 4ccbd04..643a151 100644 (file)
@@ -1224,7 +1224,8 @@ class Heap {
   void UpdateReferencesInExternalStringTable(
       ExternalStringTableUpdaterCallback updater_func);
 
-  void ProcessWeakReferences(WeakObjectRetainer* retainer);
+  void ProcessAllWeakReferences(WeakObjectRetainer* retainer);
+  void ProcessYoungWeakReferences(WeakObjectRetainer* retainer);
 
   void VisitExternalResources(v8::ExternalResourceVisitor* visitor);
 
index fa127db..b5e8a1e 100644 (file)
@@ -2276,7 +2276,7 @@ void MarkCompactCollector::AfterMarking() {
 
   // Process the weak references.
   MarkCompactWeakObjectRetainer mark_compact_object_retainer;
-  heap()->ProcessWeakReferences(&mark_compact_object_retainer);
+  heap()->ProcessAllWeakReferences(&mark_compact_object_retainer);
 
   // Remove object groups after marking phase.
   heap()->isolate()->global_handles()->RemoveObjectGroups();
@@ -3546,7 +3546,7 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
       &UpdateReferenceInExternalStringTableEntry);
 
   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
   // under it.