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

Side by Side Diff: src/heap/mark-compact.cc

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
« no previous file with comments | « no previous file | src/heap/objects-visiting-inl.h » ('j') | src/heap/objects-visiting-inl.h » ('J')
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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/atomicops.h" 7 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after
2737 } 2737 }
2738 heap()->set_encountered_weak_collections(Smi::FromInt(0)); 2738 heap()->set_encountered_weak_collections(Smi::FromInt(0));
2739 } 2739 }
2740 2740
2741 2741
2742 void MarkCompactCollector::ProcessAndClearWeakCells() { 2742 void MarkCompactCollector::ProcessAndClearWeakCells() {
2743 HeapObject* undefined = heap()->undefined_value(); 2743 HeapObject* undefined = heap()->undefined_value();
2744 Object* weak_cell_obj = heap()->encountered_weak_cells(); 2744 Object* weak_cell_obj = heap()->encountered_weak_cells();
2745 while (weak_cell_obj != Smi::FromInt(0)) { 2745 while (weak_cell_obj != Smi::FromInt(0)) {
2746 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj); 2746 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj);
2747 HeapObject* value = weak_cell->value(); 2747 Object* value = weak_cell->value();
2748 if (!MarkCompactCollector::IsMarked(value)) { 2748 if (!MarkCompactCollector::IsMarked(value)) {
Erik Corry Chromium.org 2014/10/20 08:00:17 IsMarked will assert that the value is a heap obje
ulan 2014/10/20 12:30:18 Done.
2749 weak_cell->clear(undefined); 2749 weak_cell->clear();
2750 } else { 2750 } else {
2751 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset); 2751 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset);
2752 heap()->mark_compact_collector()->RecordSlot(slot, slot, value); 2752 heap()->mark_compact_collector()->RecordSlot(slot, slot, value);
2753 } 2753 }
2754 weak_cell_obj = weak_cell->next(); 2754 weak_cell_obj = weak_cell->next();
2755 weak_cell->set_next(undefined, SKIP_WRITE_BARRIER); 2755 weak_cell->set_next(undefined, SKIP_WRITE_BARRIER);
2756 } 2756 }
2757 heap()->set_encountered_weak_cells(Smi::FromInt(0)); 2757 heap()->set_encountered_weak_cells(Smi::FromInt(0));
2758 } 2758 }
2759 2759
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
4445 SlotsBuffer* buffer = *buffer_address; 4445 SlotsBuffer* buffer = *buffer_address;
4446 while (buffer != NULL) { 4446 while (buffer != NULL) {
4447 SlotsBuffer* next_buffer = buffer->next(); 4447 SlotsBuffer* next_buffer = buffer->next();
4448 DeallocateBuffer(buffer); 4448 DeallocateBuffer(buffer);
4449 buffer = next_buffer; 4449 buffer = next_buffer;
4450 } 4450 }
4451 *buffer_address = NULL; 4451 *buffer_address = NULL;
4452 } 4452 }
4453 } 4453 }
4454 } // namespace v8::internal 4454 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap/objects-visiting-inl.h » ('j') | src/heap/objects-visiting-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698