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

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: 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
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 351 }
352 352
353 353
354 template <typename StaticVisitor> 354 template <typename StaticVisitor>
355 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, 355 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map,
356 HeapObject* object) { 356 HeapObject* object) {
357 Heap* heap = map->GetHeap(); 357 Heap* heap = map->GetHeap();
358 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object); 358 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object);
359 Object* undefined = heap->undefined_value(); 359 Object* undefined = heap->undefined_value();
360 // Enqueue weak cell in linked list of encountered weak collections. 360 // Enqueue weak cell in linked list of encountered weak collections.
361 // We can ignore weak cells with cleared values because they will always point 361 // We can ignore weak cells with cleared values because they will always
362 // to the undefined_value. 362 // contain smi zero.
363 if (weak_cell->next() == undefined && weak_cell->value() != undefined) { 363 if (weak_cell->next() == undefined && !weak_cell->cleared()) {
Erik Corry Chromium.org 2014/10/20 08:00:18 Perhaps this should just check for Sminess instead
ulan 2014/10/20 12:30:18 Since the initialization function of the weak cell
364 weak_cell->set_next(heap->encountered_weak_cells()); 364 weak_cell->set_next(heap->encountered_weak_cells());
365 heap->set_encountered_weak_cells(weak_cell); 365 heap->set_encountered_weak_cells(weak_cell);
366 } 366 }
367 } 367 }
368 368
369 369
370 template <typename StaticVisitor> 370 template <typename StaticVisitor>
371 void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite( 371 void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite(
372 Map* map, HeapObject* object) { 372 Map* map, HeapObject* object) {
373 Heap* heap = map->GetHeap(); 373 Heap* heap = map->GetHeap();
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 943
944 RelocIterator it(this, mode_mask); 944 RelocIterator it(this, mode_mask);
945 for (; !it.done(); it.next()) { 945 for (; !it.done(); it.next()) {
946 it.rinfo()->template Visit<StaticVisitor>(heap); 946 it.rinfo()->template Visit<StaticVisitor>(heap);
947 } 947 }
948 } 948 }
949 } 949 }
950 } // namespace v8::internal 950 } // namespace v8::internal
951 951
952 #endif // V8_OBJECTS_VISITING_INL_H_ 952 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698