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

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

Issue 2863953002: Revert of [heap] Reland "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 cd9f548f534f2194a6a0e3451d747bcee5fbe2c9..8e1be75877b4b93ec2a62a211a0d3d7773047830 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -1196,10 +1196,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;
}
};
@@ -1235,7 +1237,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.
@@ -1253,15 +1259,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).
@@ -1279,6 +1284,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;
@@ -1475,12 +1482,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_;
@@ -1521,16 +1532,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_;
@@ -1701,7 +1718,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;
}
@@ -1713,10 +1731,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;
}
@@ -2279,12 +2295,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