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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index fa127db6129c0f1598eb2140f3d1fdb294ff4e90..d20377753b47505c014d7d8b2f8caaf0285ecc7c 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -2682,12 +2682,21 @@ void MarkCompactCollector::ProcessAndClearWeakCells() {
WeakCell* weak_cell = reinterpret_cast<WeakCell*>(weak_cell_obj);
// We do not insert cleared weak cells into the list, so the value
// cannot be a Smi here.
- HeapObject* value = HeapObject::cast(weak_cell->value());
- if (!MarkCompactCollector::IsMarked(value)) {
+ Object* value = ReadBarrierUntag(
+ *HeapObject::RawField(weak_cell,
+ WeakCell::kValueOffsetDontForgetTheReadBarrier));
+ if (!MarkCompactCollector::IsMarked(HeapObject::cast(weak_cell->value()))) {
weak_cell->clear();
} else {
- Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset);
- heap()->mark_compact_collector()->RecordSlot(slot, slot, value);
+ Object** slot = HeapObject::RawField(
+ weak_cell, WeakCell::kValueOffsetDontForgetTheReadBarrier);
+ if (value != Smi::FromInt(0)) {
+ heap()->mark_compact_collector()->RecordSlot(slot, slot, value);
+ // Tag for the next round of GC.
+ *HeapObject::RawField(weak_cell,
+ WeakCell::kValueOffsetDontForgetTheReadBarrier) =
+ ReadBarrierTag(value);
+ }
}
weak_cell_obj = weak_cell->next();
weak_cell->set_next(undefined, SKIP_WRITE_BARRIER);
« 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