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

Unified Diff: third_party/WebKit/Source/wtf/PartitionAlloc.cpp

Issue 1622553004: PartitionAlloc: Increase the number of pages per bucket (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/wtf/PartitionAlloc.cpp
diff --git a/third_party/WebKit/Source/wtf/PartitionAlloc.cpp b/third_party/WebKit/Source/wtf/PartitionAlloc.cpp
index fbecfbb6349d92b1daffa9df8ac5308997c0128a..fedf8c91d426e67734c0e53eb9cf32a9c8620bab 100644
--- a/third_party/WebKit/Source/wtf/PartitionAlloc.cpp
+++ b/third_party/WebKit/Source/wtf/PartitionAlloc.cpp
@@ -62,7 +62,7 @@ void (*PartitionRootBase::gOomHandlingFunction)() = nullptr;
PartitionAllocHooks::AllocationHook* PartitionAllocHooks::m_allocationHook = nullptr;
PartitionAllocHooks::FreeHook* PartitionAllocHooks::m_freeHook = nullptr;
-static uint16_t partitionBucketNumSystemPages(size_t size)
+static uint8_t partitionBucketNumSystemPages(size_t size)
{
// This works out reasonably for the current bucket sizes of the generic
// allocator, and the current values of partition page size and constants.
@@ -78,7 +78,9 @@ static uint16_t partitionBucketNumSystemPages(size_t size)
uint16_t bestPages = 0;
if (size > kMaxSystemPagesPerSlotSpan * kSystemPageSize) {
ASSERT(!(size % kSystemPageSize));
- return static_cast<uint16_t>(size / kSystemPageSize);
+ bestPages = static_cast<uint16_t>(size / kSystemPageSize);
+ RELEASE_ASSERT(bestPages < (1 << 8));
bashi 2016/01/26 23:52:37 RELEASE_ASSERT(bestPages <= kMaxSystemPagesPerSlot
haraken 2016/01/27 01:19:32 No, what I really want to assert here is that the
bashi 2016/01/27 01:34:07 I think it's not the most important thing to ensur
+ return static_cast<uint8_t>(bestPages);
}
ASSERT(size <= kMaxSystemPagesPerSlotSpan * kSystemPageSize);
for (uint16_t i = kNumSystemPagesPerPartitionPage - 1; i <= kMaxSystemPagesPerSlotSpan; ++i) {
@@ -97,7 +99,8 @@ static uint16_t partitionBucketNumSystemPages(size_t size)
}
}
ASSERT(bestPages > 0);
- return bestPages;
+ RELEASE_ASSERT(bestPages < (1 << 8));
bashi 2016/01/26 23:52:37 ditto.
+ return static_cast<uint8_t>(bestPages);
}
static void partitionAllocBaseInit(PartitionRootBase* root)

Powered by Google App Engine
This is Rietveld 408576698