Index: src/heap/spaces.h |
diff --git a/src/heap/spaces.h b/src/heap/spaces.h |
index 0981c3650efe8d9b6fa6b55ac4e8b06de811e6b5..37d43b17c4c72f8ff482f6192466f6f4d16d8672 100644 |
--- a/src/heap/spaces.h |
+++ b/src/heap/spaces.h |
@@ -425,6 +425,10 @@ class MemoryChunk { |
// from new to old space during evacuation. |
PAGE_NEW_OLD_PROMOTION, |
+ // |PAGE_NEW_NEW_PROMOTION|: A page tagged with this flag has been moved |
+ // within the new space during evacuation. |
+ PAGE_NEW_NEW_PROMOTION, |
+ |
// 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. |
@@ -2431,6 +2435,8 @@ class SemiSpace : public Space { |
// than the current capacity. |
bool ShrinkTo(int new_capacity); |
+ bool EnsureCurrentCapacity(); |
+ |
// Returns the start address of the first page of the space. |
Address space_start() { |
DCHECK_NE(anchor_.next_page(), anchor()); |
@@ -2459,7 +2465,8 @@ class SemiSpace : public Space { |
// Resets the space to using the first page. |
void Reset(); |
- bool ReplaceWithEmptyPage(Page* page); |
+ void RemovePage(Page* page); |
+ void PrependPage(Page* page); |
// Age mark accessors. |
Address age_mark() { return age_mark_; } |
@@ -2535,8 +2542,9 @@ class SemiSpace : public Space { |
Page anchor_; |
Page* current_page_; |
- friend class SemiSpaceIterator; |
+ friend class NewSpace; |
friend class NewSpacePageIterator; |
+ friend class SemiSpaceIterator; |
}; |
@@ -2715,12 +2723,15 @@ class NewSpace : public Space { |
return static_cast<size_t>(allocated); |
} |
- bool ReplaceWithEmptyPage(Page* page) { |
- // This method is called after flipping the semispace. |
+ void MovePageFromSpaceToSpace(Page* page) { |
DCHECK(page->InFromSpace()); |
- return from_space_.ReplaceWithEmptyPage(page); |
+ from_space_.RemovePage(page); |
+ to_space_.PrependPage(page); |
+ pages_used_++; |
} |
+ bool Rebalance(); |
+ |
// Return the maximum capacity of a semispace. |
int MaximumCapacity() { |
DCHECK(to_space_.maximum_capacity() == from_space_.maximum_capacity()); |