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

Unified Diff: src/heap/mark-compact.cc

Issue 2859093004: Revert of [heap] Make non-atomic markbit operations consistent with atomic ones. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/mark-compact-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 9f6b47f1e8b3231ca51dad3513c4a782593c30a8..f6d98bed55126cc86cfe0e779855bcb0fbee145a 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -1176,10 +1176,12 @@
StackLimitCheck check(heap->isolate());
if (check.HasOverflowed()) return false;
- if (ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(
- object, MarkingState::External(object))) {
- IterateBody(object->map(), object);
- }
+ if (ObjectMarking::IsBlackOrGrey<MarkBit::NON_ATOMIC>(
+ object, MarkingState::External(object)))
+ return true;
+ ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(
+ object, MarkingState::External(object));
+ IterateBody(object->map(), object);
return true;
}
};
@@ -1215,7 +1217,11 @@
// Marks the object black without pushing it on the marking stack.
// Returns true if object needed marking and false otherwise.
INLINE(static bool MarkObjectWithoutPush(Heap* heap, HeapObject* object)) {
- return ObjectMarking::WhiteToBlack(object, MarkingState::Internal(object));
+ if (ObjectMarking::IsWhite(object, MarkingState::Internal(object))) {
+ ObjectMarking::WhiteToBlack(object, MarkingState::Internal(object));
+ return true;
+ }
+ return false;
}
// Mark object pointed to by p.
@@ -1233,15 +1239,14 @@
HeapObject* obj)) {
#ifdef DEBUG
DCHECK(collector->heap()->Contains(obj));
+ DCHECK(ObjectMarking::IsWhite(obj, MarkingState::Internal(obj)));
#endif
- if (ObjectMarking::WhiteToBlack(obj, MarkingState::Internal(obj))) {
- Map* map = obj->map();
- Heap* heap = obj->GetHeap();
- ObjectMarking::WhiteToBlack(obj, MarkingState::Internal(obj));
- // Mark the map pointer and the body.
- heap->mark_compact_collector()->MarkObject(map);
- IterateBody(map, obj);
- }
+ Map* map = obj->map();
+ Heap* heap = obj->GetHeap();
+ ObjectMarking::WhiteToBlack(obj, MarkingState::Internal(obj));
+ // Mark the map pointer and the body.
+ heap->mark_compact_collector()->MarkObject(map);
+ IterateBody(map, obj);
}
// Visit all unmarked objects pointed to by [start, end).
@@ -1259,6 +1264,8 @@
if (!o->IsHeapObject()) continue;
collector->RecordSlot(object, p, o);
HeapObject* obj = HeapObject::cast(o);
+ if (ObjectMarking::IsBlackOrGrey(obj, MarkingState::Internal(obj)))
+ continue;
VisitUnmarkedObject(collector, obj);
}
return true;
@@ -1455,12 +1462,16 @@
if (!collector_->heap()->InNewSpace(object)) return;
- if (ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(
- object, MarkingState::External(object))) {
- Map* map = object->map();
- StaticYoungGenerationMarkingVisitor::IterateBody(map, object);
- collector_->EmptyMarkingDeque();
- }
+ if (ObjectMarking::IsBlackOrGrey<MarkBit::NON_ATOMIC>(
+ object, MarkingState::External(object)))
+ return;
+
+ Map* map = object->map();
+ ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(
+ object, MarkingState::External(object));
+ StaticYoungGenerationMarkingVisitor::IterateBody(map, object);
+
+ collector_->EmptyMarkingDeque();
}
MinorMarkCompactCollector* collector_;
@@ -1501,16 +1512,22 @@
HeapObject* object = HeapObject::cast(*p);
- if (ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(
- object, MarkingState::Internal(object))) {
- Map* map = object->map();
- // Mark the map pointer and body, and push them on the marking stack.
- collector_->MarkObject(map);
- MarkCompactMarkingVisitor::IterateBody(map, object);
- // Mark all the objects reachable from the map and body. May leave
- // overflowed objects in the heap.
- collector_->EmptyMarkingDeque();
- }
+ if (ObjectMarking::IsBlackOrGrey<MarkBit::NON_ATOMIC>(
+ object, MarkingState::Internal(object)))
+ return;
+
+ Map* map = object->map();
+ // Mark the object.
+ ObjectMarking::WhiteToBlack<MarkBit::NON_ATOMIC>(
+ object, MarkingState::Internal(object));
+
+ // Mark the map pointer and body, and push them on the marking stack.
+ collector_->MarkObject(map);
+ MarkCompactMarkingVisitor::IterateBody(map, object);
+
+ // Mark all the objects reachable from the map and body. May leave
+ // overflowed objects in the heap.
+ collector_->EmptyMarkingDeque();
}
MarkCompactCollector* collector_;
@@ -1621,7 +1638,8 @@
Map* filler_map = heap()->one_pointer_filler_map();
for (HeapObject* object = it->Next(); object != NULL; object = it->Next()) {
if ((object->map() != filler_map) &&
- ObjectMarking::GreyToBlack(object, MarkingState::Internal(object))) {
+ ObjectMarking::IsGrey(object, MarkingState::Internal(object))) {
+ ObjectMarking::GreyToBlack(object, MarkingState::Internal(object));
PushBlack(object);
if (marking_deque()->IsFull()) return;
}
@@ -1633,10 +1651,8 @@
LiveObjectIterator<kGreyObjects> it(p, MarkingState::Internal(p));
HeapObject* object = NULL;
while ((object = it.Next()) != NULL) {
- bool success =
- ObjectMarking::GreyToBlack(object, MarkingState::Internal(object));
- DCHECK(success);
- USE(success);
+ DCHECK(ObjectMarking::IsGrey(object, MarkingState::Internal(object)));
+ ObjectMarking::GreyToBlack(object, MarkingState::Internal(object));
PushBlack(object);
if (marking_deque()->IsFull()) return;
}
@@ -2130,12 +2146,15 @@
void MarkCompactCollector::MarkStringTable(RootMarkingVisitor* visitor) {
StringTable* string_table = heap()->string_table();
// Mark the string table itself.
- if (ObjectMarking::WhiteToBlack(string_table,
- MarkingState::Internal(string_table))) {
- // Explicitly mark the prefix.
- string_table->IteratePrefix(visitor);
- ProcessMarkingDeque();
- }
+ if (ObjectMarking::IsWhite(string_table,
+ MarkingState::Internal(string_table))) {
+ // String table could have already been marked by visiting the handles list.
+ ObjectMarking::WhiteToBlack(string_table,
+ MarkingState::Internal(string_table));
+ }
+ // Explicitly mark the prefix.
+ string_table->IteratePrefix(visitor);
+ ProcessMarkingDeque();
}
void MarkCompactCollector::MarkRoots(RootMarkingVisitor* visitor) {
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/mark-compact-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698