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

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

Issue 1203973002: Serializer: clear next link in weak cells. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix asan failure Created 5 years, 6 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 | « src/heap/heap.cc ('k') | src/heap/objects-visiting-inl.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 #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 2629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 JSWeakCollection* weak_collection = 2640 JSWeakCollection* weak_collection =
2641 reinterpret_cast<JSWeakCollection*>(weak_collection_obj); 2641 reinterpret_cast<JSWeakCollection*>(weak_collection_obj);
2642 weak_collection_obj = weak_collection->next(); 2642 weak_collection_obj = weak_collection->next();
2643 weak_collection->set_next(heap()->undefined_value()); 2643 weak_collection->set_next(heap()->undefined_value());
2644 } 2644 }
2645 heap()->set_encountered_weak_collections(Smi::FromInt(0)); 2645 heap()->set_encountered_weak_collections(Smi::FromInt(0));
2646 } 2646 }
2647 2647
2648 2648
2649 void MarkCompactCollector::ProcessAndClearWeakCells() { 2649 void MarkCompactCollector::ProcessAndClearWeakCells() {
2650 HeapObject* the_hole = heap()->the_hole_value();
2651 Object* weak_cell_obj = heap()->encountered_weak_cells(); 2650 Object* weak_cell_obj = heap()->encountered_weak_cells();
2652 while (weak_cell_obj != Smi::FromInt(0)) { 2651 while (weak_cell_obj != Smi::FromInt(0)) {
2653 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj); 2652 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj);
2654 // We do not insert cleared weak cells into the list, so the value 2653 // We do not insert cleared weak cells into the list, so the value
2655 // cannot be a Smi here. 2654 // cannot be a Smi here.
2656 HeapObject* value = HeapObject::cast(weak_cell->value()); 2655 HeapObject* value = HeapObject::cast(weak_cell->value());
2657 if (!MarkCompactCollector::IsMarked(value)) { 2656 if (!MarkCompactCollector::IsMarked(value)) {
2658 // Cells for new-space objects embedded in optimized code are wrapped in 2657 // Cells for new-space objects embedded in optimized code are wrapped in
2659 // WeakCell and put into Heap::weak_object_to_code_table. 2658 // WeakCell and put into Heap::weak_object_to_code_table.
2660 // Such cells do not have any strong references but we want to keep them 2659 // Such cells do not have any strong references but we want to keep them
(...skipping 14 matching lines...) Expand all
2675 weak_cell->clear(); 2674 weak_cell->clear();
2676 } 2675 }
2677 } else { 2676 } else {
2678 weak_cell->clear(); 2677 weak_cell->clear();
2679 } 2678 }
2680 } else { 2679 } else {
2681 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset); 2680 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset);
2682 RecordSlot(slot, slot, *slot); 2681 RecordSlot(slot, slot, *slot);
2683 } 2682 }
2684 weak_cell_obj = weak_cell->next(); 2683 weak_cell_obj = weak_cell->next();
2685 weak_cell->set_next(the_hole, SKIP_WRITE_BARRIER); 2684 weak_cell->clear_next(heap());
2686 } 2685 }
2687 heap()->set_encountered_weak_cells(Smi::FromInt(0)); 2686 heap()->set_encountered_weak_cells(Smi::FromInt(0));
2688 } 2687 }
2689 2688
2690 2689
2691 void MarkCompactCollector::AbortWeakCells() { 2690 void MarkCompactCollector::AbortWeakCells() {
2692 Object* the_hole = heap()->the_hole_value();
2693 Object* weak_cell_obj = heap()->encountered_weak_cells(); 2691 Object* weak_cell_obj = heap()->encountered_weak_cells();
2694 while (weak_cell_obj != Smi::FromInt(0)) { 2692 while (weak_cell_obj != Smi::FromInt(0)) {
2695 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj); 2693 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj);
2696 weak_cell_obj = weak_cell->next(); 2694 weak_cell_obj = weak_cell->next();
2697 weak_cell->set_next(the_hole, SKIP_WRITE_BARRIER); 2695 weak_cell->clear_next(heap());
2698 } 2696 }
2699 heap()->set_encountered_weak_cells(Smi::FromInt(0)); 2697 heap()->set_encountered_weak_cells(Smi::FromInt(0));
2700 } 2698 }
2701 2699
2702 2700
2703 void MarkCompactCollector::RecordMigratedSlot(Object* value, Address slot) { 2701 void MarkCompactCollector::RecordMigratedSlot(Object* value, Address slot) {
2704 if (heap_->InNewSpace(value)) { 2702 if (heap_->InNewSpace(value)) {
2705 heap_->store_buffer()->Mark(slot); 2703 heap_->store_buffer()->Mark(slot);
2706 } else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) { 2704 } else if (value->IsHeapObject() && IsOnEvacuationCandidate(value)) {
2707 SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_, 2705 SlotsBuffer::AddTo(&slots_buffer_allocator_, &migration_slots_buffer_,
(...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after
4746 SlotsBuffer* buffer = *buffer_address; 4744 SlotsBuffer* buffer = *buffer_address;
4747 while (buffer != NULL) { 4745 while (buffer != NULL) {
4748 SlotsBuffer* next_buffer = buffer->next(); 4746 SlotsBuffer* next_buffer = buffer->next();
4749 DeallocateBuffer(buffer); 4747 DeallocateBuffer(buffer);
4750 buffer = next_buffer; 4748 buffer = next_buffer;
4751 } 4749 }
4752 *buffer_address = NULL; 4750 *buffer_address = NULL;
4753 } 4751 }
4754 } // namespace internal 4752 } // namespace internal
4755 } // namespace v8 4753 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698