Chromium Code Reviews| 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) |