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

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

Issue 1535933002: Revert of [heap] delete Heap::LeftTrimFixedAray (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Bring back GreyToWhite Created 5 years 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') | no next file » | 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 81fc924050c406a680fb395097eebee89066cf10..8cd0c699d36bc44f38981c762f60d59a25b11e8b 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -599,6 +599,43 @@ bool MarkCompactCollector::IsSweepingCompleted() {
}
+void Marking::TransferMark(Heap* heap, Address old_start, Address new_start) {
+ // This is only used when resizing an object.
+ DCHECK(MemoryChunk::FromAddress(old_start) ==
+ MemoryChunk::FromAddress(new_start));
+
+ if (!heap->incremental_marking()->IsMarking()) return;
+
+ // If the mark doesn't move, we don't check the color of the object.
+ // It doesn't matter whether the object is black, since it hasn't changed
+ // size, so the adjustment to the live data count will be zero anyway.
+ if (old_start == new_start) return;
+
+ MarkBit new_mark_bit = MarkBitFrom(new_start);
+ MarkBit old_mark_bit = MarkBitFrom(old_start);
+
+#ifdef DEBUG
+ ObjectColor old_color = Color(old_mark_bit);
+#endif
+
+ if (Marking::IsBlack(old_mark_bit)) {
+ Marking::BlackToWhite(old_mark_bit);
+ Marking::MarkBlack(new_mark_bit);
+ return;
+ } else if (Marking::IsGrey(old_mark_bit)) {
+ Marking::GreyToWhite(old_mark_bit);
+ heap->incremental_marking()->WhiteToGreyAndPush(
+ HeapObject::FromAddress(new_start), new_mark_bit);
+ heap->incremental_marking()->RestartIfNotMarking();
+ }
+
+#ifdef DEBUG
+ ObjectColor new_color = Color(new_mark_bit);
+ DCHECK(new_color == old_color);
+#endif
+}
+
+
const char* AllocationSpaceName(AllocationSpace space) {
switch (space) {
case NEW_SPACE:
« no previous file with comments | « src/heap/mark-compact.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698