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

Unified Diff: third_party/WebKit/Source/platform/heap/HeapPage.h

Issue 2531973002: Simple BlinkGC heap compaction. (Closed)
Patch Set: add pointer alignment handling to SparseHeapBitmap Created 4 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
Index: third_party/WebKit/Source/platform/heap/HeapPage.h
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.h b/third_party/WebKit/Source/platform/heap/HeapPage.h
index a006d41adf842693779de4f04436644eacf6caf0..a32a938dab97f5cb493949e3ea30c7caa6b66c86 100644
--- a/third_party/WebKit/Source/platform/heap/HeapPage.h
+++ b/third_party/WebKit/Source/platform/heap/HeapPage.h
@@ -308,6 +308,9 @@ class FreeListEntry final : public HeapObjectHeader {
FreeListEntry* next() const { return m_next; }
NO_SANITIZE_ADDRESS
+ FreeListEntry** prevNext() { return &m_next; }
haraken 2016/12/09 07:25:56 This is unused.
sof 2016/12/09 21:44:04 Thanks, removed the leftover.
+
+ NO_SANITIZE_ADDRESS
void append(FreeListEntry* next) {
ASSERT(!m_next);
m_next = next;
@@ -512,6 +515,26 @@ class NormalPage final : public BasePage {
inline NormalPageArena* arenaForNormalPage() const;
+ // Context object holding the state of the arena page compaction pass,
+ // passed in when compacting individual pages.
+ class CompactionContext {
haraken 2016/12/09 07:25:56 Thanks, this is much more readable :)
+ STACK_ALLOCATED();
+
+ public:
+ // Page compacting into.
+ NormalPage* m_currentPage = nullptr;
+ // Offset into |m_currentPage| to the next free address.
+ size_t m_allocationPoint = 0;
+ // Chain of available pages to use for compaction. Page compaction
+ // picks the next one when the current one is exhausted.
+ BasePage* m_availablePages = nullptr;
+ // Chain of pages that have been compacted. Page compaction will
+ // add compacted pages once the current one becomes exhausted.
+ BasePage** m_compactedPages = nullptr;
+ };
+
+ void sweepAndCompact(CompactionContext&);
+
private:
HeapObjectHeader* findHeaderFromAddress(Address);
void populateObjectStartBitMap();
@@ -665,6 +688,8 @@ class FreeList {
// All FreeListEntries in the nth list have size >= 2^n.
FreeListEntry* m_freeLists[blinkPageSizeLog2];
+ size_t freeListSize() const;
+
friend class NormalPageArena;
};
@@ -761,8 +786,15 @@ class PLATFORM_EXPORT NormalPageArena final : public BaseArena {
bool isLazySweeping() const { return m_isLazySweeping; }
void setIsLazySweeping(bool flag) { m_isLazySweeping = flag; }
+ size_t arenaSize();
+ size_t freeListSize();
+
+ void sweepAndCompact();
+
private:
- void allocatePage();
+ NormalPage* allocatePage();
+ void allocateAndAddPage();
haraken 2016/12/09 07:25:56 What's the point of splitting the method into the
sof 2016/12/09 21:44:04 Thanks for catching that, that's a remnant of supp
+
Address outOfLineAllocate(size_t allocationSize, size_t gcInfoIndex);
Address allocateFromFreeList(size_t, size_t gcInfoIndex);

Powered by Google App Engine
This is Rietveld 408576698