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

Unified Diff: third_party/WebKit/Source/platform/heap/PageMemory.cpp

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.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: third_party/WebKit/Source/platform/heap/PageMemory.cpp
diff --git a/third_party/WebKit/Source/platform/heap/PageMemory.cpp b/third_party/WebKit/Source/platform/heap/PageMemory.cpp
index 5efe1fcede7eb3036afbf20179a5dcfb76e7911d..ac2ca841c254cbc6f78d2516080ca4bbae41f095 100644
--- a/third_party/WebKit/Source/platform/heap/PageMemory.cpp
+++ b/third_party/WebKit/Source/platform/heap/PageMemory.cpp
@@ -28,19 +28,20 @@ void MemoryRegion::decommit()
}
-PageMemoryRegion::PageMemoryRegion(Address base, size_t size, unsigned numPages)
+PageMemoryRegion::PageMemoryRegion(Address base, size_t size, unsigned numPages, Heap* heap)
: MemoryRegion(base, size)
, m_isLargePage(numPages == 1)
, m_numPages(numPages)
+ , m_heap(heap)
{
- Heap::addPageMemoryRegion(this);
+ m_heap->addPageMemoryRegion(this);
for (size_t i = 0; i < blinkPagesPerRegion; ++i)
m_inUse[i] = false;
}
PageMemoryRegion::~PageMemoryRegion()
{
- Heap::removePageMemoryRegion(this);
+ m_heap->removePageMemoryRegion(this);
release();
}
@@ -52,14 +53,14 @@ static NEVER_INLINE void blinkGCOutOfMemory()
IMMEDIATE_CRASH();
}
-PageMemoryRegion* PageMemoryRegion::allocate(size_t size, unsigned numPages)
+PageMemoryRegion* PageMemoryRegion::allocate(size_t size, unsigned numPages, Heap* heap)
{
// Round size up to the allocation granularity.
size = (size + WTF::kPageAllocationGranularityOffsetMask) & WTF::kPageAllocationGranularityBaseMask;
Address base = static_cast<Address>(WTF::allocPages(nullptr, size, blinkPageSize, WTF::PageInaccessible));
if (!base)
blinkGCOutOfMemory();
- return new PageMemoryRegion(base, size, numPages);
+ return new PageMemoryRegion(base, size, numPages, heap);
}
PageMemoryRegion* RegionTree::lookup(Address address)
@@ -145,7 +146,7 @@ static size_t roundToOsPageSize(size_t size)
return (size + WTF::kSystemPageSize - 1) & ~(WTF::kSystemPageSize - 1);
}
-PageMemory* PageMemory::allocate(size_t payloadSize)
+PageMemory* PageMemory::allocate(size_t payloadSize, Heap* heap)
{
ASSERT(payloadSize > 0);
@@ -156,7 +157,7 @@ PageMemory* PageMemory::allocate(size_t payloadSize)
// Overallocate by 2 times OS page size to have space for a
// guard page at the beginning and end of blink heap page.
size_t allocationSize = payloadSize + 2 * blinkGuardPageSize;
- PageMemoryRegion* pageMemoryRegion = PageMemoryRegion::allocateLargePage(allocationSize);
+ PageMemoryRegion* pageMemoryRegion = PageMemoryRegion::allocateLargePage(allocationSize, heap);
haraken 2016/02/29 11:17:45 A better fix would be to call heap->addPageMemoryR
keishi 2016/03/02 06:01:03 We need to call removePageMemoryRegion from ~PageM
haraken 2016/03/02 07:21:07 ~PageMemoryRegion is called only by 'delete curren
keishi 2016/03/02 10:19:31 Done.
PageMemory* storage = setupPageMemoryInRegion(pageMemoryRegion, 0, payloadSize);
RELEASE_ASSERT(storage->commit());
return storage;

Powered by Google App Engine
This is Rietveld 408576698