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

Unified Diff: src/heap/spaces.h

Issue 1863983002: 🏄 [heap] Add page evacuation mode for new->old (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup Created 4 years, 8 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 2b0fac61969f9d995c219a757b3c53e5db986a66..6079d662eedb5dd9bd78e6fac6894d8b23a05c03 100644
--- a/src/heap/spaces.h
+++ b/src/heap/spaces.h
@@ -419,6 +419,10 @@ class MemoryChunk {
// to grey transition is performed in the value.
HAS_PROGRESS_BAR,
+ // A fast evacuation page has been moved from new space to old space during
+ // evacuation.
+ FAST_EVACUATION,
+
// 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.
@@ -820,6 +824,8 @@ class MemoryChunk {
// Page* p = Page::FromAllocationTop(top);
class Page : public MemoryChunk {
public:
+ static inline Page* Convert(NewSpacePage* old_page, PagedSpace* new_owner);
+
// Returns the page containing a given address. The address ranges
// from [page_addr .. page_addr + kPageSize[
// This only works if the object is in fact in a page. See also MemoryChunk::
@@ -934,6 +940,9 @@ class Page : public MemoryChunk {
inline void ClearEvacuationCandidate();
private:
+ enum InitializationMode { kFreeMemory, kDoNotFreeMemory };
+
+ template <InitializationMode mode = kFreeMemory>
static inline Page* Initialize(Heap* heap, MemoryChunk* chunk,
Executability executable, PagedSpace* owner);
@@ -1037,11 +1046,6 @@ class Space : public Malloced {
}
}
-#ifdef DEBUG
- virtual void Print() = 0;
-#endif
-
- protected:
void AccountCommitted(intptr_t bytes) {
DCHECK_GE(bytes, 0);
committed_ += bytes;
@@ -1056,6 +1060,11 @@ class Space : public Malloced {
DCHECK_GE(committed_, 0);
}
+#ifdef DEBUG
+ virtual void Print() = 0;
+#endif
+
+ protected:
v8::base::SmartPointer<List<AllocationObserver*>> allocation_observers_;
bool allocation_observers_paused_;
@@ -2351,6 +2360,8 @@ class NewSpacePage : public MemoryChunk {
(1 << MemoryChunk::POINTERS_TO_HERE_ARE_INTERESTING) |
(1 << MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING);
+ static const intptr_t kCopyAllFlags = ~0;
+
// Create a NewSpacePage object that is only used as anchor
// for the doubly-linked list of real pages.
explicit NewSpacePage(SemiSpace* owner) { InitializeAsAnchor(owner); }
@@ -2436,6 +2447,8 @@ class SemiSpace : public Space {
// Resets the space to using the first page.
void Reset();
+ void ReplaceWithEmptyPage(NewSpacePage* page);
+
// Age mark accessors.
Address age_mark() { return age_mark_; }
void set_age_mark(Address mark);
@@ -2651,6 +2664,12 @@ class NewSpace : public Space {
// Return the available bytes without growing.
intptr_t Available() override { return Capacity() - Size(); }
+ void ReplaceWithEmptyPage(NewSpacePage* page) {
+ // This method is called after flipping the semispace.
+ DCHECK(page->InFromSpace());
+ from_space_.ReplaceWithEmptyPage(page);
+ }
+
size_t AllocatedSinceLastGC() {
bool seen_age_mark = false;
Address age_mark = to_space_.age_mark();

Powered by Google App Engine
This is Rietveld 408576698