Revert "Remove early bail-out in VisitWeakList to investigate chrasher."
authorjochen <jochen@chromium.org>
Tue, 14 Apr 2015 10:55:22 +0000 (03:55 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 14 Apr 2015 10:55:16 +0000 (10:55 +0000)
>  BUG=468601
>  LOG=n
>
>  Review URL: https://codereview.chromium.org/1016353002
>
>  Cr-Commit-Position: refs/heads/master@{#27317}

R=hpayer@chromium.org
BUG=v8:3996,chromium:468601
LOG=n

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

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

src/heap/objects-visiting.cc

index cf71fb2bdaf540423a3ec3c8f46c03771d1a888b..91901003292c496e692fa7d029ac7a098f5b075f 100644 (file)
@@ -202,6 +202,7 @@ Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer,
   while (list != undefined) {
     // Check whether to keep the candidate in the list.
     T* candidate = reinterpret_cast<T*>(list);
+    T* original_candidate = candidate;
 
     Object* retained = retainer->RetainAs(list);
     if (retained != NULL) {
@@ -226,6 +227,18 @@ Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer,
       // tail is a live object, visit it.
       WeakListVisitor<T>::VisitLiveObject(heap, tail, retainer);
 
+      // The list of weak objects is usually order. It starts with objects
+      // recently allocated in the young generation followed by objects
+      // allocated in the old generation. When a migration failure happened,
+      // the list is not ordered until the next GC that has no migration
+      // failure.
+      // For young generation collections we just have to visit until the last
+      // young generation objects.
+      if (stop_after_young && !heap->migration_failure() &&
+          !heap->previous_migration_failure() &&
+          !heap->InNewSpace(original_candidate)) {
+        return head;
+      }
     } else {
       WeakListVisitor<T>::VisitPhantomObject(heap, candidate);
     }