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

Unified Diff: src/heap/mark-compact-inl.h

Issue 2647873002: Revert of [heap] Provide ObjectMarking with marking transitions (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact-inl.h
diff --git a/src/heap/mark-compact-inl.h b/src/heap/mark-compact-inl.h
index 648bf4673c5bade4d14a3c8bf88610d91f51b150..1973753b0c3ae9ed0234b68b7d663135da155add 100644
--- a/src/heap/mark-compact-inl.h
+++ b/src/heap/mark-compact-inl.h
@@ -13,38 +13,48 @@
namespace internal {
void MarkCompactCollector::PushBlack(HeapObject* obj) {
- DCHECK(ObjectMarking::IsBlack(obj));
- if (!marking_deque()->Push(obj)) {
- ObjectMarking::BlackToGrey(obj);
+ DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(obj)));
+ if (marking_deque()->Push(obj)) {
+ MemoryChunk::IncrementLiveBytes(obj, obj->Size());
+ } else {
+ MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj);
+ Marking::BlackToGrey(mark_bit);
}
}
void MarkCompactCollector::UnshiftBlack(HeapObject* obj) {
- DCHECK(ObjectMarking::IsBlack(obj));
+ DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(obj)));
if (!marking_deque()->Unshift(obj)) {
- ObjectMarking::BlackToGrey(obj);
+ MemoryChunk::IncrementLiveBytes(obj, -obj->Size());
+ MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj);
+ Marking::BlackToGrey(mark_bit);
}
}
void MarkCompactCollector::MarkObject(HeapObject* obj, MarkBit mark_bit) {
DCHECK(ObjectMarking::MarkBitFrom(obj) == mark_bit);
- if (ObjectMarking::IsWhite(obj)) {
- ObjectMarking::WhiteToBlack(obj);
+ if (Marking::IsWhite(mark_bit)) {
+ Marking::WhiteToBlack(mark_bit);
+ DCHECK(obj->GetIsolate()->heap()->Contains(obj));
PushBlack(obj);
}
}
-void MarkCompactCollector::SetMark(HeapObject* obj) {
- DCHECK(ObjectMarking::IsWhite(obj));
- ObjectMarking::WhiteToBlack(obj);
+
+void MarkCompactCollector::SetMark(HeapObject* obj, MarkBit mark_bit) {
+ DCHECK(Marking::IsWhite(mark_bit));
+ DCHECK(ObjectMarking::MarkBitFrom(obj) == mark_bit);
+ Marking::WhiteToBlack(mark_bit);
+ MemoryChunk::IncrementLiveBytes(obj, obj->Size());
}
bool MarkCompactCollector::IsMarked(Object* obj) {
DCHECK(obj->IsHeapObject());
- return ObjectMarking::IsBlackOrGrey(HeapObject::cast(obj));
+ HeapObject* heap_object = HeapObject::cast(obj);
+ return Marking::IsBlackOrGrey(ObjectMarking::MarkBitFrom(heap_object));
}
@@ -54,7 +64,7 @@
Page* source_page = Page::FromAddress(reinterpret_cast<Address>(object));
if (target_page->IsEvacuationCandidate() &&
!ShouldSkipEvacuationSlotRecording(object)) {
- DCHECK(IsMarked(object));
+ DCHECK(Marking::IsBlackOrGrey(ObjectMarking::MarkBitFrom(object)));
RememberedSet<OLD_TO_OLD>::Insert(source_page,
reinterpret_cast<Address>(slot));
}
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698