Changeset 195575 in webkit
- Timestamp:
- Jan 25, 2016 6:57:51 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r195563 r195575 1 2016-01-25 Andreas Kling <akling@apple.com> 2 3 MarkedSpace should have more precise allocators. 4 <https://webkit.org/b/153448> 5 <rdar://problem/23897477> 6 7 Reviewed by Geoffrey Garen. 8 9 The four classes responsible for the bulk of MarkedBlock allocations today are: 10 11 - FunctionCodeBlock (640 bytes) 12 - UnlinkedFunctionCodeBlock (304 bytes) 13 - FunctionExecutable (168 bytes) 14 - UnlinkedFunctionExecutable (144 bytes) 15 16 Due to the size class distribution in MarkedSpace, we've been wasting quite a lot 17 of heap space on these objects. Our "precise" allocators allowed allocation sizes 18 in 16-byte increments up to 128 bytes, but after that point, we'd only allocate 19 in 256-byte size increments. 20 21 Thus each instance of those classes would waste space as follows: 22 23 - FunctionCodeBlock (768-byte cell, 128 bytes wasted) 24 - UnlinkedFunctionCodeBlock (512-byte cell, 208 bytes wasted) 25 - FunctionExecutable(256-byte cell, 88 bytes wasted) 26 - UnlinkedFunctionExecutable(256-byte cell, 112 bytes wasted) 27 28 This patch raises the limit for precise allocations from 128 to 768, allowing us 29 to allocate these objects with far better space efficiency. 30 31 The cost of this is 7kB worth of MarkedAllocators and 70 (~2x) more allocators to 32 iterate whenever we iterate all the allocators. 33 34 * heap/MarkedSpace.h: 35 * heap/MarkedSpace.cpp: 36 (JSC::MarkedSpace::MarkedSpace): 37 (JSC::MarkedSpace::resetAllocators): 38 (JSC::MarkedSpace::forEachAllocator): 39 (JSC::MarkedSpace::isPagedOut): 40 1 41 2016-01-25 Filip Pizlo <fpizlo@apple.com> 2 42 -
trunk/Source/JavaScriptCore/heap/MarkedSpace.cpp
r191849 r195575 63 63 } 64 64 65 for (size_t cellSize = impreciseSt ep; cellSize <= impreciseCutoff; cellSize += impreciseStep) {65 for (size_t cellSize = impreciseStart; cellSize <= impreciseCutoff; cellSize += impreciseStep) { 66 66 allocatorFor(cellSize).init(heap, this, cellSize, false); 67 67 destructorAllocatorFor(cellSize).init(heap, this, cellSize, true); … … 110 110 } 111 111 112 for (size_t cellSize = impreciseSt ep; cellSize <= impreciseCutoff; cellSize += impreciseStep) {112 for (size_t cellSize = impreciseStart; cellSize <= impreciseCutoff; cellSize += impreciseStep) { 113 113 allocatorFor(cellSize).reset(); 114 114 destructorAllocatorFor(cellSize).reset(); … … 155 155 } 156 156 157 for (size_t cellSize = impreciseSt ep; cellSize <= impreciseCutoff; cellSize += impreciseStep) {157 for (size_t cellSize = impreciseStart; cellSize <= impreciseCutoff; cellSize += impreciseStep) { 158 158 functor(allocatorFor(cellSize)); 159 159 functor(destructorAllocatorFor(cellSize)); … … 192 192 } 193 193 194 for (size_t cellSize = impreciseSt ep; cellSize <= impreciseCutoff; cellSize += impreciseStep) {194 for (size_t cellSize = impreciseStart; cellSize <= impreciseCutoff; cellSize += impreciseStep) { 195 195 if (allocatorFor(cellSize).isPagedOut(deadline) 196 196 || destructorAllocatorFor(cellSize).isPagedOut(deadline)) -
trunk/Source/JavaScriptCore/heap/MarkedSpace.h
r191159 r195575 68 68 WTF_MAKE_NONCOPYABLE(MarkedSpace); 69 69 public: 70 // [ 16 ... 128 ]70 // [ 16 ... 768 ] 71 71 static const size_t preciseStep = MarkedBlock::atomSize; 72 static const size_t preciseCutoff = 128;72 static const size_t preciseCutoff = 768; 73 73 static const size_t preciseCount = preciseCutoff / preciseStep; 74 74 75 // [ 256 ... blockSize/2 ] 76 static const size_t impreciseStep = 2 * preciseCutoff; 75 // [ 1024 ... blockSize/2 ] 76 static const size_t impreciseStart = 1024; 77 static const size_t impreciseStep = 256; 77 78 static const size_t impreciseCutoff = MarkedBlock::blockSize / 2; 78 79 static const size_t impreciseCount = impreciseCutoff / impreciseStep;
Note: See TracChangeset
for help on using the changeset viewer.