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

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

Issue 892843002: Add mistagging-readbarrier to weak cell Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
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 2664 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 } 2675 }
2676 2676
2677 2677
2678 void MarkCompactCollector::ProcessAndClearWeakCells() { 2678 void MarkCompactCollector::ProcessAndClearWeakCells() {
2679 HeapObject* undefined = heap()->undefined_value(); 2679 HeapObject* undefined = heap()->undefined_value();
2680 Object* weak_cell_obj = heap()->encountered_weak_cells(); 2680 Object* weak_cell_obj = heap()->encountered_weak_cells();
2681 while (weak_cell_obj != Smi::FromInt(0)) { 2681 while (weak_cell_obj != Smi::FromInt(0)) {
2682 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj); 2682 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj);
2683 // We do not insert cleared weak cells into the list, so the value 2683 // We do not insert cleared weak cells into the list, so the value
2684 // cannot be a Smi here. 2684 // cannot be a Smi here.
2685 HeapObject* value = HeapObject::cast(weak_cell->value()); 2685 Object* value = ReadBarrierUntag(
2686 if (!MarkCompactCollector::IsMarked(value)) { 2686 *HeapObject::RawField(weak_cell,
2687 WeakCell::kValueOffsetDontForgetTheReadBarrier));
2688 if (!MarkCompactCollector::IsMarked(HeapObject::cast(weak_cell->value()))) {
2687 weak_cell->clear(); 2689 weak_cell->clear();
2688 } else { 2690 } else {
2689 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset); 2691 Object** slot = HeapObject::RawField(
2690 heap()->mark_compact_collector()->RecordSlot(slot, slot, value); 2692 weak_cell, WeakCell::kValueOffsetDontForgetTheReadBarrier);
2693 if (value != Smi::FromInt(0)) {
2694 heap()->mark_compact_collector()->RecordSlot(slot, slot, value);
2695 // Tag for the next round of GC.
2696 *HeapObject::RawField(weak_cell,
2697 WeakCell::kValueOffsetDontForgetTheReadBarrier) =
2698 ReadBarrierTag(value);
2699 }
2691 } 2700 }
2692 weak_cell_obj = weak_cell->next(); 2701 weak_cell_obj = weak_cell->next();
2693 weak_cell->set_next(undefined, SKIP_WRITE_BARRIER); 2702 weak_cell->set_next(undefined, SKIP_WRITE_BARRIER);
2694 } 2703 }
2695 heap()->set_encountered_weak_cells(Smi::FromInt(0)); 2704 heap()->set_encountered_weak_cells(Smi::FromInt(0));
2696 } 2705 }
2697 2706
2698 2707
2699 void MarkCompactCollector::AbortWeakCells() { 2708 void MarkCompactCollector::AbortWeakCells() {
2700 Object* undefined = heap()->undefined_value(); 2709 Object* undefined = heap()->undefined_value();
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
4403 SlotsBuffer* buffer = *buffer_address; 4412 SlotsBuffer* buffer = *buffer_address;
4404 while (buffer != NULL) { 4413 while (buffer != NULL) {
4405 SlotsBuffer* next_buffer = buffer->next(); 4414 SlotsBuffer* next_buffer = buffer->next();
4406 DeallocateBuffer(buffer); 4415 DeallocateBuffer(buffer);
4407 buffer = next_buffer; 4416 buffer = next_buffer;
4408 } 4417 }
4409 *buffer_address = NULL; 4418 *buffer_address = NULL;
4410 } 4419 }
4411 } 4420 }
4412 } // namespace v8::internal 4421 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/hydrogen-instructions.h » ('j') | src/ia32/macro-assembler-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698