Changeset 173538 in webkit
- Timestamp:
- Sep 11, 2014, 1:58:02 PM (12 years ago)
- Location:
- trunk/Source/bmalloc
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
bmalloc/Allocator.cpp (modified) (4 diffs)
-
bmalloc/Allocator.h (modified) (1 diff)
-
bmalloc/Sizes.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/bmalloc/ChangeLog
r173525 r173538 1 2014-09-11 Geoffrey Garen <ggaren@apple.com> 2 3 bmalloc should segregate medium-sized objects by line like it does for small-sized objects 4 https://bugs.webkit.org/show_bug.cgi?id=136693 5 6 Reviewed by Gavin Barraclough. 7 8 4% reduction in heap size on the MallocBench *_memory_warning benchmarks. 9 10 No throughput change. 11 12 We keep an array of medium allocators, just like our array of small 13 allocators. 14 15 In future, we can simplify the allocation fast path by merging the small 16 and medium allocator arrays. For now, this is the simplest change that 17 gets the win. 18 19 * bmalloc/Allocator.cpp: 20 (bmalloc::Allocator::Allocator): 21 (bmalloc::Allocator::scavenge): 22 (bmalloc::Allocator::allocateMedium): 23 * bmalloc/Allocator.h: 24 * bmalloc/Sizes.h: 25 (bmalloc::Sizes::mediumSizeClassFor): 26 1 27 2014-09-11 Geoffrey Garen <ggaren@apple.com> 2 28 -
trunk/Source/bmalloc/bmalloc/Allocator.cpp
r173525 r173538 39 39 : m_deallocator(deallocator) 40 40 , m_smallAllocators() 41 , m_mediumAllocator ()41 , m_mediumAllocators() 42 42 , m_smallAllocatorLog() 43 43 , m_mediumAllocatorLog() … … 54 54 scavenge(); 55 55 } 56 56 57 57 void Allocator::scavenge() 58 58 { … … 63 63 processSmallAllocatorLog(); 64 64 65 retire(m_mediumAllocator); 66 m_mediumAllocator.clear(); 65 for (auto& allocator : m_mediumAllocators) { 66 retire(allocator); 67 allocator.clear(); 68 } 67 69 processMediumAllocatorLog(); 68 70 } … … 130 132 void* Allocator::allocateMedium(size_t size) 131 133 { 132 MediumAllocator& allocator = m_mediumAllocator ;134 MediumAllocator& allocator = m_mediumAllocators[mediumSizeClassFor(size)]; 133 135 size = roundUpToMultipleOf<alignment>(size); 134 136 -
trunk/Source/bmalloc/bmalloc/Allocator.h
r173525 r173538 66 66 67 67 std::array<SmallAllocator, smallMax / alignment> m_smallAllocators; 68 MediumAllocator m_mediumAllocator;68 std::array<MediumAllocator, mediumMax / alignment> m_mediumAllocators; 69 69 70 70 FixedVector<std::pair<SmallLine*, unsigned char>, smallAllocatorLogCapacity> m_smallAllocatorLog; -
trunk/Source/bmalloc/bmalloc/Sizes.h
r173224 r173538 72 72 static_assert(1 << largeAlignmentShift == largeAlignment, "largeAlignmentShift be log2(largeAlignment)."); 73 73 static const size_t largeMax = largeChunkSize * 99 / 100; // Plenty of room for metadata. 74 static const size_t largeMin = 1024;74 static const size_t largeMin = mediumMax; 75 75 76 76 static const size_t segregatedFreeListSearchDepth = 16; … … 98 98 return mask((size - 1ul) / alignment, smallSizeClassMask); 99 99 } 100 101 inline size_t mediumSizeClassFor(size_t size) 102 { 103 static const size_t mediumSizeClassMask = (mediumMax / alignment) - 1; 104 return mask((size - 1ul) / alignment, mediumSizeClassMask); 105 } 100 106 }; 101 107
Note:
See TracChangeset
for help on using the changeset viewer.