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

Unified Diff: Source/platform/heap/Heap.cpp

Issue 711173004: Oilpan: Try to allocate from a smaller FreeListEntry. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index b3dcd33f8589d92965b49790f7e419433b177516..060ec5dfd4f22dbd3e2f68e2caca1da477b4a560 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -729,8 +729,13 @@ bool ThreadHeap<Header>::allocateFromFreeList(size_t minSize)
size_t bucketSize = 1 << m_freeList.m_biggestFreeListIndex;
int i = m_freeList.m_biggestFreeListIndex;
for (; i > 0; i--, bucketSize >>= 1) {
- if (bucketSize < minSize)
- break;
+ if (bucketSize < minSize) {
+ // A FreeListEntry for bucketSize might be larger than minSize.
+ // FIXME: We check only the first FreeListEntry because searching
+ // the entire list is costly.
+ if (!m_freeList.m_freeLists[i] || m_freeList.m_freeLists[i]->size() < minSize)
+ break;
+ }
FreeListEntry* entry = m_freeList.m_freeLists[i];
if (entry) {
m_freeList.m_biggestFreeListIndex = i;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698