Title: [195575] trunk/Source/_javascript_Core
Revision
195575
Author
[email protected]
Date
2016-01-25 18:57:51 -0800 (Mon, 25 Jan 2016)

Log Message

MarkedSpace should have more precise allocators.
<https://webkit.org/b/153448>
<rdar://problem/23897477>

Reviewed by Geoffrey Garen.

The four classes responsible for the bulk of MarkedBlock allocations today are:

    - FunctionCodeBlock (640 bytes)
    - UnlinkedFunctionCodeBlock (304 bytes)
    - FunctionExecutable (168 bytes)
    - UnlinkedFunctionExecutable (144 bytes)

Due to the size class distribution in MarkedSpace, we've been wasting quite a lot
of heap space on these objects. Our "precise" allocators allowed allocation sizes
in 16-byte increments up to 128 bytes, but after that point, we'd only allocate
in 256-byte size increments.

Thus each instance of those classes would waste space as follows:

    - FunctionCodeBlock (768-byte cell, 128 bytes wasted)
    - UnlinkedFunctionCodeBlock (512-byte cell, 208 bytes wasted)
    - FunctionExecutable(256-byte cell, 88 bytes wasted)
    - UnlinkedFunctionExecutable(256-byte cell, 112 bytes wasted)

This patch raises the limit for precise allocations from 128 to 768, allowing us
to allocate these objects with far better space efficiency.

The cost of this is 7kB worth of MarkedAllocators and 70 (~2x) more allocators to
iterate whenever we iterate all the allocators.

* heap/MarkedSpace.h:
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::MarkedSpace):
(JSC::MarkedSpace::resetAllocators):
(JSC::MarkedSpace::forEachAllocator):
(JSC::MarkedSpace::isPagedOut):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (195574 => 195575)


--- trunk/Source/_javascript_Core/ChangeLog	2016-01-26 02:18:13 UTC (rev 195574)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-01-26 02:57:51 UTC (rev 195575)
@@ -1,3 +1,43 @@
+2016-01-25  Andreas Kling  <[email protected]>
+
+        MarkedSpace should have more precise allocators.
+        <https://webkit.org/b/153448>
+        <rdar://problem/23897477>
+
+        Reviewed by Geoffrey Garen.
+
+        The four classes responsible for the bulk of MarkedBlock allocations today are:
+
+            - FunctionCodeBlock (640 bytes)
+            - UnlinkedFunctionCodeBlock (304 bytes)
+            - FunctionExecutable (168 bytes)
+            - UnlinkedFunctionExecutable (144 bytes)
+
+        Due to the size class distribution in MarkedSpace, we've been wasting quite a lot
+        of heap space on these objects. Our "precise" allocators allowed allocation sizes
+        in 16-byte increments up to 128 bytes, but after that point, we'd only allocate
+        in 256-byte size increments.
+
+        Thus each instance of those classes would waste space as follows:
+
+            - FunctionCodeBlock (768-byte cell, 128 bytes wasted)
+            - UnlinkedFunctionCodeBlock (512-byte cell, 208 bytes wasted)
+            - FunctionExecutable(256-byte cell, 88 bytes wasted)
+            - UnlinkedFunctionExecutable(256-byte cell, 112 bytes wasted)
+
+        This patch raises the limit for precise allocations from 128 to 768, allowing us
+        to allocate these objects with far better space efficiency.
+
+        The cost of this is 7kB worth of MarkedAllocators and 70 (~2x) more allocators to
+        iterate whenever we iterate all the allocators.
+
+        * heap/MarkedSpace.h:
+        * heap/MarkedSpace.cpp:
+        (JSC::MarkedSpace::MarkedSpace):
+        (JSC::MarkedSpace::resetAllocators):
+        (JSC::MarkedSpace::forEachAllocator):
+        (JSC::MarkedSpace::isPagedOut):
+
 2016-01-25  Filip Pizlo  <[email protected]>
 
         Fix the comment about FTL_USES_B3.

Modified: trunk/Source/_javascript_Core/heap/MarkedSpace.cpp (195574 => 195575)


--- trunk/Source/_javascript_Core/heap/MarkedSpace.cpp	2016-01-26 02:18:13 UTC (rev 195574)
+++ trunk/Source/_javascript_Core/heap/MarkedSpace.cpp	2016-01-26 02:57:51 UTC (rev 195575)
@@ -62,7 +62,7 @@
         destructorAllocatorFor(cellSize).init(heap, this, cellSize, true);
     }
 
-    for (size_t cellSize = impreciseStep; cellSize <= impreciseCutoff; cellSize += impreciseStep) {
+    for (size_t cellSize = impreciseStart; cellSize <= impreciseCutoff; cellSize += impreciseStep) {
         allocatorFor(cellSize).init(heap, this, cellSize, false);
         destructorAllocatorFor(cellSize).init(heap, this, cellSize, true);
     }
@@ -109,7 +109,7 @@
         destructorAllocatorFor(cellSize).reset();
     }
 
-    for (size_t cellSize = impreciseStep; cellSize <= impreciseCutoff; cellSize += impreciseStep) {
+    for (size_t cellSize = impreciseStart; cellSize <= impreciseCutoff; cellSize += impreciseStep) {
         allocatorFor(cellSize).reset();
         destructorAllocatorFor(cellSize).reset();
     }
@@ -154,7 +154,7 @@
         functor(destructorAllocatorFor(cellSize));
     }
 
-    for (size_t cellSize = impreciseStep; cellSize <= impreciseCutoff; cellSize += impreciseStep) {
+    for (size_t cellSize = impreciseStart; cellSize <= impreciseCutoff; cellSize += impreciseStep) {
         functor(allocatorFor(cellSize));
         functor(destructorAllocatorFor(cellSize));
     }
@@ -191,7 +191,7 @@
             return true;
     }
 
-    for (size_t cellSize = impreciseStep; cellSize <= impreciseCutoff; cellSize += impreciseStep) {
+    for (size_t cellSize = impreciseStart; cellSize <= impreciseCutoff; cellSize += impreciseStep) {
         if (allocatorFor(cellSize).isPagedOut(deadline) 
             || destructorAllocatorFor(cellSize).isPagedOut(deadline))
             return true;

Modified: trunk/Source/_javascript_Core/heap/MarkedSpace.h (195574 => 195575)


--- trunk/Source/_javascript_Core/heap/MarkedSpace.h	2016-01-26 02:18:13 UTC (rev 195574)
+++ trunk/Source/_javascript_Core/heap/MarkedSpace.h	2016-01-26 02:57:51 UTC (rev 195575)
@@ -67,13 +67,14 @@
 class MarkedSpace {
     WTF_MAKE_NONCOPYABLE(MarkedSpace);
 public:
-    // [ 16 ... 128 ]
+    // [ 16 ... 768 ]
     static const size_t preciseStep = MarkedBlock::atomSize;
-    static const size_t preciseCutoff = 128;
+    static const size_t preciseCutoff = 768;
     static const size_t preciseCount = preciseCutoff / preciseStep;
 
-    // [ 256 ... blockSize/2 ]
-    static const size_t impreciseStep = 2 * preciseCutoff;
+    // [ 1024 ... blockSize/2 ]
+    static const size_t impreciseStart = 1024;
+    static const size_t impreciseStep = 256;
     static const size_t impreciseCutoff = MarkedBlock::blockSize / 2;
     static const size_t impreciseCount = impreciseCutoff / impreciseStep;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to