Chromium Code Reviews| Index: Source/wtf/PartitionAlloc.cpp |
| diff --git a/Source/wtf/PartitionAlloc.cpp b/Source/wtf/PartitionAlloc.cpp |
| index 3ba965297d9ba85cbd9dd873a8778b2de68e049e..647407d0bb8657cfa3b4a6596cf319c16efa0909 100644 |
| --- a/Source/wtf/PartitionAlloc.cpp |
| +++ b/Source/wtf/PartitionAlloc.cpp |
| @@ -329,6 +329,8 @@ static ALWAYS_INLINE void* partitionAllocPartitionPages(PartitionRootBase* root, |
| RELEASE_ASSERT(numPartitionPages <= kNumPartitionPagesPerSuperPage); |
| size_t totalSize = kPartitionPageSize * numPartitionPages; |
| root->totalSizeOfCommittedPages += totalSize; |
| + if (root->totalSizeOfCommittedPages > kMaxPartitionSize) |
| + partitionFull(); |
| size_t numPartitionPagesLeft = (root->nextPartitionPageEnd - root->nextPartitionPage) >> kPartitionPageShift; |
| if (LIKELY(numPartitionPagesLeft >= numPartitionPages)) { |
| // In this case, we can still hand out pages from the current super page |
| @@ -340,8 +342,6 @@ static ALWAYS_INLINE void* partitionAllocPartitionPages(PartitionRootBase* root, |
| // Need a new super page. |
| root->totalSizeOfSuperPages += kSuperPageSize; |
| - if (root->totalSizeOfSuperPages > kMaxPartitionSize) |
| - partitionFull(); |
| char* requestedAddress = root->nextSuperPage; |
| char* superPage = reinterpret_cast<char*>(allocPages(requestedAddress, kSuperPageSize, kSuperPageSize)); |
| if (UNLIKELY(!superPage)) { |
| @@ -578,6 +578,10 @@ static ALWAYS_INLINE void* partitionDirectMap(PartitionRootBase* root, int flags |
| mapSize += kPageAllocationGranularityOffsetMask; |
| mapSize &= kPageAllocationGranularityBaseMask; |
| + root->totalSizeOfCommittedPages += size; |
|
Chris Evans
2014/10/15 22:06:16
I think we might as well try and be fully accurate
Jens Widell
2014/10/16 11:09:53
Done.
|
| + if (root->totalSizeOfCommittedPages > kMaxPartitionSize) |
| + partitionFull(); |
| + |
| // TODO: we may want to let the operating system place these allocations |
| // where it pleases. On 32-bit, this might limit address space |
| // fragmentation and on 64-bit, this might have useful savings for TLB |
| @@ -634,6 +638,9 @@ static ALWAYS_INLINE void partitionDirectUnmap(PartitionPage* page) |
| // page. |
| unmapSize += kPartitionPageSize + kSystemPageSize; |
| + PartitionRootBase* root = partitionPageToRoot(page); |
| + root->totalSizeOfCommittedPages -= page->bucket->slotSize; |
|
Chris Evans
2014/10/15 22:06:16
+ kSystemPageSize as per above?
Jens Widell
2014/10/16 11:09:53
Done.
|
| + |
| ASSERT(!(unmapSize & kPageAllocationGranularityOffsetMask)); |
| char* ptr = reinterpret_cast<char*>(partitionPageToPointer(page)); |