Title: [208317] trunk/Source/_javascript_Core
Revision
208317
Author
[email protected]
Date
2016-11-02 17:44:42 -0700 (Wed, 02 Nov 2016)

Log Message

MarkedSpace should have specialized size classes for popular engine objects.
<https://webkit.org/b/164345>

Reviewed by Filip Pizlo.

The MarkedSpace size classes were recently reworked to minimize wasted space
at the end of MarkedBlocks.

However, we know that some specific objects will be allocated in very high volume.
Adding specialized size classes for those object sizes achieves greater utilization
since we're basically guaranteed to allocate them all the time.

Inject specialized size classes for these four objects:

    - FunctionCodeBlock
        560 bytes instead of 624
        28 per block instead of 26 (+2)

    - FunctionExecutable
        176 bytes instead of 224
        92 per block instead of 72 (+20)

    - UnlinkedFunctionCodeBlock
        256 bytes instead of 320
        63 per block instead of 50 (+13)

    - UnlinkedFunctionExecutable
        192 bytes instead of 224
        84 per block instead of 72 (+12)

* heap/MarkedSpace.cpp:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (208316 => 208317)


--- trunk/Source/_javascript_Core/ChangeLog	2016-11-03 00:37:19 UTC (rev 208316)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-11-03 00:44:42 UTC (rev 208317)
@@ -1,3 +1,37 @@
+2016-11-02  Andreas Kling  <[email protected]>
+
+        MarkedSpace should have specialized size classes for popular engine objects.
+        <https://webkit.org/b/164345>
+
+        Reviewed by Filip Pizlo.
+
+        The MarkedSpace size classes were recently reworked to minimize wasted space
+        at the end of MarkedBlocks.
+
+        However, we know that some specific objects will be allocated in very high volume.
+        Adding specialized size classes for those object sizes achieves greater utilization
+        since we're basically guaranteed to allocate them all the time.
+
+        Inject specialized size classes for these four objects:
+
+            - FunctionCodeBlock
+                560 bytes instead of 624
+                28 per block instead of 26 (+2)
+
+            - FunctionExecutable
+                176 bytes instead of 224
+                92 per block instead of 72 (+20)
+
+            - UnlinkedFunctionCodeBlock
+                256 bytes instead of 320
+                63 per block instead of 50 (+13)
+
+            - UnlinkedFunctionExecutable
+                192 bytes instead of 224
+                84 per block instead of 72 (+12)
+
+        * heap/MarkedSpace.cpp:
+
 2016-11-02  Geoffrey Garen  <[email protected]>
 
         One file per class for UnlinkedCodeBlock.h/.cpp

Modified: trunk/Source/_javascript_Core/heap/MarkedSpace.cpp (208316 => 208317)


--- trunk/Source/_javascript_Core/heap/MarkedSpace.cpp	2016-11-03 00:37:19 UTC (rev 208316)
+++ trunk/Source/_javascript_Core/heap/MarkedSpace.cpp	2016-11-03 00:44:42 UTC (rev 208317)
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "MarkedSpace.h"
 
+#include "FunctionCodeBlock.h"
 #include "IncrementalSweeper.h"
 #include "JSObject.h"
 #include "JSCInlines.h"
@@ -43,6 +44,7 @@
             result = new Vector<size_t>();
             
             auto add = [&] (size_t sizeClass) {
+                sizeClass = WTF::roundUpToMultipleOf<MarkedBlock::atomSize>(sizeClass);
                 if (Options::dumpSizeClasses())
                     dataLog("Adding JSC MarkedSpace size class: ", sizeClass, "\n");
                 // Perform some validation as we go.
@@ -49,8 +51,6 @@
                 RELEASE_ASSERT(!(sizeClass % MarkedSpace::sizeStep));
                 if (result->isEmpty())
                     RELEASE_ASSERT(sizeClass == MarkedSpace::sizeStep);
-                else
-                    RELEASE_ASSERT(sizeClass > result->last());
                 result->append(sizeClass);
             };
             
@@ -129,7 +129,19 @@
                 
                 add(betterSizeClass);
             }
-            
+
+            add(sizeof(UnlinkedFunctionExecutable));
+            add(sizeof(UnlinkedFunctionCodeBlock));
+            add(sizeof(FunctionExecutable));
+            add(sizeof(FunctionCodeBlock));
+
+            {
+                // Sort and deduplicate.
+                std::sort(result->begin(), result->end());
+                auto it = std::unique(result->begin(), result->end());
+                result->shrinkCapacity(it - result->begin());
+            }
+
             if (Options::dumpSizeClasses())
                 dataLog("JSC Heap MarkedSpace size class dump: ", listDump(*result), "\n");
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to