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

Unified Diff: src/heap/spaces.h

Issue 1420423009: [heap] Black allocation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
Index: src/heap/spaces.h
diff --git a/src/heap/spaces.h b/src/heap/spaces.h
index e233b328511601a46e9a6815763997175cdd9aa1..9289f9d060d3a083520042bac52a3237df3b388e 100644
--- a/src/heap/spaces.h
+++ b/src/heap/spaces.h
@@ -203,6 +203,8 @@ class Bitmap {
static inline void Clear(MemoryChunk* chunk);
+ static inline void SetAllBits(MemoryChunk* chunk);
+
static void PrintWord(uint32_t word, uint32_t himask = 0) {
for (uint32_t mask = 1; mask != 0; mask <<= 1) {
if ((mask & himask) != 0) PrintF("[");
@@ -314,6 +316,11 @@ class MemoryChunk {
// to grey transition is performed in the value.
HAS_PROGRESS_BAR,
+ // A black page has all mark bits set to 1 (black). A black page currently
+ // cannot be iterated because it is not swept. Moreover live bytes are also
+ // not updated.
+ BLACK_PAGE,
+
// This flag is intended to be used for testing. Works only when both
// FLAG_stress_compaction and FLAG_manual_evacuation_candidates_selection
// are set. It forces the page to become an evacuation candidate at next
@@ -573,6 +580,7 @@ class MemoryChunk {
}
void IncrementLiveBytes(int by) {
+ if (IsFlagSet(BLACK_PAGE)) return;
if (FLAG_gc_verbose) {
printf("UpdateLiveBytes:%p:%x%c=%x->%x\n", static_cast<void*>(this),
live_byte_count_, ((by < 0) ? '-' : '+'), ((by < 0) ? -by : by),
@@ -585,10 +593,12 @@ class MemoryChunk {
int LiveBytes() {
DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_);
+ DCHECK(!IsFlagSet(BLACK_PAGE) || live_byte_count_ == 0);
return live_byte_count_;
}
void SetLiveBytes(int live_bytes) {
+ if (IsFlagSet(BLACK_PAGE)) return;
DCHECK_GE(live_bytes, 0);
DCHECK_LE(static_cast<unsigned>(live_bytes), size_);
live_byte_count_ = live_bytes;
@@ -2181,6 +2191,7 @@ class PagedSpace : public Space {
// Mutex guarding any concurrent access to the space.
base::Mutex space_mutex_;
+ friend class IncrementalMarking;
friend class MarkCompactCollector;
friend class PageIterator;

Powered by Google App Engine
This is Rietveld 408576698