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

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

Issue 1420423009: [heap] Black allocation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/remembered-set.cc » ('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 0c4c57d6488b1aeea462c491d54ea8d14031dbf9..9df79746ee64a12eea471412115f5bf70303303b 100644
--- a/src/heap/mark-compact-inl.h
+++ b/src/heap/mark-compact-inl.h
@@ -143,10 +143,21 @@ template <LiveObjectIterationMode T>
HeapObject* LiveObjectIterator<T>::Next() {
while (!it_.Done()) {
HeapObject* object = nullptr;
+ if (T == kGreyObjectsOnBlackPage) {
+ // Black objects will have most of the mark bits set to 1. If we invert
+ // the mark bits, grey objects will be left but the mark bit is moved by
+ // one position. We can just substract one word from the found location
+ // to obtain the grey object.
+ current_cell_ = ~current_cell_;
+ }
while (current_cell_ != 0) {
uint32_t trailing_zeros = base::bits::CountTrailingZeros32(current_cell_);
Address addr = cell_base_ + trailing_zeros * kPointerSize;
+ if (T == kGreyObjectsOnBlackPage) {
+ addr -= kPointerSize;
+ }
+
// Clear the first bit of the found object..
current_cell_ &= ~(1u << trailing_zeros);
@@ -168,6 +179,8 @@ HeapObject* LiveObjectIterator<T>::Next() {
object = HeapObject::FromAddress(addr);
} else if (T == kAllLiveObjects) {
object = HeapObject::FromAddress(addr);
+ } else if (T == kGreyObjectsOnBlackPage) {
+ object = HeapObject::FromAddress(addr);
}
// Clear the second bit of the found object.
current_cell_ &= ~second_bit_index;
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/remembered-set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698