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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 ensureCurrentAllocation(allocationSize, gcInfo); 722 ensureCurrentAllocation(allocationSize, gcInfo);
723 return allocate(size, gcInfo); 723 return allocate(size, gcInfo);
724 } 724 }
725 725
726 template<typename Header> 726 template<typename Header>
727 bool ThreadHeap<Header>::allocateFromFreeList(size_t minSize) 727 bool ThreadHeap<Header>::allocateFromFreeList(size_t minSize)
728 { 728 {
729 size_t bucketSize = 1 << m_freeList.m_biggestFreeListIndex; 729 size_t bucketSize = 1 << m_freeList.m_biggestFreeListIndex;
730 int i = m_freeList.m_biggestFreeListIndex; 730 int i = m_freeList.m_biggestFreeListIndex;
731 for (; i > 0; i--, bucketSize >>= 1) { 731 for (; i > 0; i--, bucketSize >>= 1) {
732 if (bucketSize < minSize) 732 if (bucketSize < minSize) {
733 break; 733 // A FreeListEntry for bucketSize might be larger than minSize.
734 // FIXME: We check only the first FreeListEntry because searching
735 // the entire list is costly.
736 if (!m_freeList.m_freeLists[i] || m_freeList.m_freeLists[i]->size() < minSize)
737 break;
738 }
734 FreeListEntry* entry = m_freeList.m_freeLists[i]; 739 FreeListEntry* entry = m_freeList.m_freeLists[i];
735 if (entry) { 740 if (entry) {
736 m_freeList.m_biggestFreeListIndex = i; 741 m_freeList.m_biggestFreeListIndex = i;
737 entry->unlink(&m_freeList.m_freeLists[i]); 742 entry->unlink(&m_freeList.m_freeLists[i]);
738 setAllocationPoint(entry->address(), entry->size()); 743 setAllocationPoint(entry->address(), entry->size());
739 ASSERT(currentAllocationPoint() && remainingAllocationSize() >= minS ize); 744 ASSERT(currentAllocationPoint() && remainingAllocationSize() >= minS ize);
740 return true; 745 return true;
741 } 746 }
742 } 747 }
743 m_freeList.m_biggestFreeListIndex = i; 748 m_freeList.m_biggestFreeListIndex = i;
sof 2014/11/11 08:29:36 I don't understand m_biggestFreeListIndex and this
tkent 2014/11/11 08:46:59 We always allocate from a FreeListEntry in the lar
744 return false; 749 return false;
745 } 750 }
746 751
747 template<typename Header> 752 template<typename Header>
748 void ThreadHeap<Header>::ensureCurrentAllocation(size_t minSize, const GCInfo* g cInfo) 753 void ThreadHeap<Header>::ensureCurrentAllocation(size_t minSize, const GCInfo* g cInfo)
749 { 754 {
750 ASSERT(minSize >= allocationGranularity); 755 ASSERT(minSize >= allocationGranularity);
751 if (allocateFromFreeList(minSize)) 756 if (allocateFromFreeList(minSize))
752 return; 757 return;
753 if (coalesce(minSize) && allocateFromFreeList(minSize)) 758 if (coalesce(minSize) && allocateFromFreeList(minSize))
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 CallbackStack* Heap::s_weakCallbackStack; 2966 CallbackStack* Heap::s_weakCallbackStack;
2962 CallbackStack* Heap::s_ephemeronStack; 2967 CallbackStack* Heap::s_ephemeronStack;
2963 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; 2968 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache;
2964 bool Heap::s_shutdownCalled = false; 2969 bool Heap::s_shutdownCalled = false;
2965 bool Heap::s_lastGCWasConservative = false; 2970 bool Heap::s_lastGCWasConservative = false;
2966 FreePagePool* Heap::s_freePagePool; 2971 FreePagePool* Heap::s_freePagePool;
2967 OrphanedPagePool* Heap::s_orphanedPagePool; 2972 OrphanedPagePool* Heap::s_orphanedPagePool;
2968 Heap::RegionTree* Heap::s_regionTree = 0; 2973 Heap::RegionTree* Heap::s_regionTree = 0;
2969 2974
2970 } // namespace blink 2975 } // namespace blink
OLDNEW
« 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