Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Side by Side Diff: src/heap/objects-visiting.cc

Issue 1080303002: Revert "Remove early bail-out in VisitWeakList to investigate chrasher." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/heap/objects-visiting.h" 7 #include "src/heap/objects-visiting.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 bool stop_after_young) { 195 bool stop_after_young) {
196 Object* undefined = heap->undefined_value(); 196 Object* undefined = heap->undefined_value();
197 Object* head = undefined; 197 Object* head = undefined;
198 T* tail = NULL; 198 T* tail = NULL;
199 MarkCompactCollector* collector = heap->mark_compact_collector(); 199 MarkCompactCollector* collector = heap->mark_compact_collector();
200 bool record_slots = MustRecordSlots(heap); 200 bool record_slots = MustRecordSlots(heap);
201 201
202 while (list != undefined) { 202 while (list != undefined) {
203 // Check whether to keep the candidate in the list. 203 // Check whether to keep the candidate in the list.
204 T* candidate = reinterpret_cast<T*>(list); 204 T* candidate = reinterpret_cast<T*>(list);
205 T* original_candidate = candidate;
205 206
206 Object* retained = retainer->RetainAs(list); 207 Object* retained = retainer->RetainAs(list);
207 if (retained != NULL) { 208 if (retained != NULL) {
208 if (head == undefined) { 209 if (head == undefined) {
209 // First element in the list. 210 // First element in the list.
210 head = retained; 211 head = retained;
211 } else { 212 } else {
212 // Subsequent elements in the list. 213 // Subsequent elements in the list.
213 DCHECK(tail != NULL); 214 DCHECK(tail != NULL);
214 WeakListVisitor<T>::SetWeakNext(tail, retained); 215 WeakListVisitor<T>::SetWeakNext(tail, retained);
215 if (record_slots) { 216 if (record_slots) {
216 Object** next_slot = 217 Object** next_slot =
217 HeapObject::RawField(tail, WeakListVisitor<T>::WeakNextOffset()); 218 HeapObject::RawField(tail, WeakListVisitor<T>::WeakNextOffset());
218 collector->RecordSlot(next_slot, next_slot, retained); 219 collector->RecordSlot(next_slot, next_slot, retained);
219 } 220 }
220 } 221 }
221 // Retained object is new tail. 222 // Retained object is new tail.
222 DCHECK(!retained->IsUndefined()); 223 DCHECK(!retained->IsUndefined());
223 candidate = reinterpret_cast<T*>(retained); 224 candidate = reinterpret_cast<T*>(retained);
224 tail = candidate; 225 tail = candidate;
225 226
226 // tail is a live object, visit it. 227 // tail is a live object, visit it.
227 WeakListVisitor<T>::VisitLiveObject(heap, tail, retainer); 228 WeakListVisitor<T>::VisitLiveObject(heap, tail, retainer);
228 229
230 // The list of weak objects is usually order. It starts with objects
231 // recently allocated in the young generation followed by objects
232 // allocated in the old generation. When a migration failure happened,
233 // the list is not ordered until the next GC that has no migration
234 // failure.
235 // For young generation collections we just have to visit until the last
236 // young generation objects.
237 if (stop_after_young && !heap->migration_failure() &&
238 !heap->previous_migration_failure() &&
239 !heap->InNewSpace(original_candidate)) {
240 return head;
241 }
229 } else { 242 } else {
230 WeakListVisitor<T>::VisitPhantomObject(heap, candidate); 243 WeakListVisitor<T>::VisitPhantomObject(heap, candidate);
231 } 244 }
232 245
233 // Move to next element in the list. 246 // Move to next element in the list.
234 list = WeakListVisitor<T>::WeakNext(candidate); 247 list = WeakListVisitor<T>::WeakNext(candidate);
235 } 248 }
236 249
237 // Terminate the list if there is one or more elements. 250 // Terminate the list if there is one or more elements.
238 if (tail != NULL) { 251 if (tail != NULL) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 477
465 template Object* VisitWeakList<JSArrayBufferView>(Heap* heap, Object* list, 478 template Object* VisitWeakList<JSArrayBufferView>(Heap* heap, Object* list,
466 WeakObjectRetainer* retainer, 479 WeakObjectRetainer* retainer,
467 bool stop_after_young); 480 bool stop_after_young);
468 481
469 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, 482 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list,
470 WeakObjectRetainer* retainer, 483 WeakObjectRetainer* retainer,
471 bool stop_after_young); 484 bool stop_after_young);
472 } 485 }
473 } // namespace v8::internal 486 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698