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

Side by Side Diff: src/heap/objects-visiting-inl.h

Issue 637253004: Use smi zero instead of undefine_value to zap dead weak cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_OBJECTS_VISITING_INL_H_ 5 #ifndef V8_OBJECTS_VISITING_INL_H_
6 #define V8_OBJECTS_VISITING_INL_H_ 6 #define V8_OBJECTS_VISITING_INL_H_
7 7
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 352 }
353 353
354 354
355 template <typename StaticVisitor> 355 template <typename StaticVisitor>
356 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, 356 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map,
357 HeapObject* object) { 357 HeapObject* object) {
358 Heap* heap = map->GetHeap(); 358 Heap* heap = map->GetHeap();
359 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object); 359 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object);
360 Object* undefined = heap->undefined_value(); 360 Object* undefined = heap->undefined_value();
361 // Enqueue weak cell in linked list of encountered weak collections. 361 // Enqueue weak cell in linked list of encountered weak collections.
362 // We can ignore weak cells with cleared values because they will always point 362 // We can ignore weak cells with cleared values because they will always
363 // to the undefined_value. 363 // contain smi zero.
364 if (weak_cell->next() == undefined && weak_cell->value() != undefined) { 364 if (weak_cell->next() == undefined && !weak_cell->cleared()) {
365 weak_cell->set_next(heap->encountered_weak_cells()); 365 weak_cell->set_next(heap->encountered_weak_cells());
366 heap->set_encountered_weak_cells(weak_cell); 366 heap->set_encountered_weak_cells(weak_cell);
367 } 367 }
368 } 368 }
369 369
370 370
371 template <typename StaticVisitor> 371 template <typename StaticVisitor>
372 void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite( 372 void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite(
373 Map* map, HeapObject* object) { 373 Map* map, HeapObject* object) {
374 Heap* heap = map->GetHeap(); 374 Heap* heap = map->GetHeap();
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 944
945 RelocIterator it(this, mode_mask); 945 RelocIterator it(this, mode_mask);
946 for (; !it.done(); it.next()) { 946 for (; !it.done(); it.next()) {
947 it.rinfo()->template Visit<StaticVisitor>(heap); 947 it.rinfo()->template Visit<StaticVisitor>(heap);
948 } 948 }
949 } 949 }
950 } 950 }
951 } // namespace v8::internal 951 } // namespace v8::internal
952 952
953 #endif // V8_OBJECTS_VISITING_INL_H_ 953 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698