Title: [152336] branches/dfgFourthTier/Source/_javascript_Core
Revision
152336
Author
[email protected]
Date
2013-07-02 20:45:35 -0700 (Tue, 02 Jul 2013)

Log Message

fourthTier: Have fewer Arrayify's
https://bugs.webkit.org/show_bug.cgi?id=118335

Reviewed by Mark Hahnenberg.
        
A lot of Arrayify's arise because some program saw Int32 arrays early on in
execution, but then they all got converted to Double arrays and the program
will never see Int32 arrays ever again. Prior to this change you would always
have an Arrayify in this case. But with this change, the first time that an
ArrayProfile is about to go polymorphic in computeUpdatedPrediction(), it
instead forcibly monomorphises itself to the latest-seen structure.
Thereafter it will never again perform this monomorphisation. This is
controlled by ArrayProfile::m_didPerformFirstRunPruning. This is a 5%
speed-up on Kraken/imaging-gaussian-blur with the FTL enabled, and it
unblocks a bunch of stuff we want to do in the future because it makes a
bunch of loops effect-free.
        
We will still want to implement Arrayify hoisting in the future, but this is
great anyway because it's better to not have Arrayifications than it is to
have hoisted Arrayifications.

* bytecode/ArrayProfile.cpp:
(JSC::ArrayProfile::computeUpdatedPrediction):
(JSC::ArrayProfile::briefDescription):
(JSC):
(JSC::ArrayProfile::briefDescriptionWithoutUpdating):
* bytecode/ArrayProfile.h:
(JSC::ArrayProfile::ArrayProfile):
(ArrayProfile):

Modified Paths

Diff

Modified: branches/dfgFourthTier/Source/_javascript_Core/ChangeLog (152335 => 152336)


--- branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-07-03 03:19:06 UTC (rev 152335)
+++ branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-07-03 03:45:35 UTC (rev 152336)
@@ -1,5 +1,37 @@
 2013-07-02  Filip Pizlo  <[email protected]>
 
+        fourthTier: Have fewer Arrayify's
+        https://bugs.webkit.org/show_bug.cgi?id=118335
+
+        Reviewed by Mark Hahnenberg.
+        
+        A lot of Arrayify's arise because some program saw Int32 arrays early on in
+        execution, but then they all got converted to Double arrays and the program
+        will never see Int32 arrays ever again. Prior to this change you would always
+        have an Arrayify in this case. But with this change, the first time that an
+        ArrayProfile is about to go polymorphic in computeUpdatedPrediction(), it
+        instead forcibly monomorphises itself to the latest-seen structure.
+        Thereafter it will never again perform this monomorphisation. This is
+        controlled by ArrayProfile::m_didPerformFirstRunPruning. This is a 5%
+        speed-up on Kraken/imaging-gaussian-blur with the FTL enabled, and it
+        unblocks a bunch of stuff we want to do in the future because it makes a
+        bunch of loops effect-free.
+        
+        We will still want to implement Arrayify hoisting in the future, but this is
+        great anyway because it's better to not have Arrayifications than it is to
+        have hoisted Arrayifications.
+
+        * bytecode/ArrayProfile.cpp:
+        (JSC::ArrayProfile::computeUpdatedPrediction):
+        (JSC::ArrayProfile::briefDescription):
+        (JSC):
+        (JSC::ArrayProfile::briefDescriptionWithoutUpdating):
+        * bytecode/ArrayProfile.h:
+        (JSC::ArrayProfile::ArrayProfile):
+        (ArrayProfile):
+
+2013-07-02  Filip Pizlo  <[email protected]>
+
         fourthTier: add option to disable OSR entry in loops
         https://bugs.webkit.org/show_bug.cgi?id=118329
 

Modified: branches/dfgFourthTier/Source/_javascript_Core/bytecode/ArrayProfile.cpp (152335 => 152336)


--- branches/dfgFourthTier/Source/_javascript_Core/bytecode/ArrayProfile.cpp	2013-07-03 03:19:06 UTC (rev 152335)
+++ branches/dfgFourthTier/Source/_javascript_Core/bytecode/ArrayProfile.cpp	2013-07-03 03:45:35 UTC (rev 152336)
@@ -78,6 +78,14 @@
 {
     if (m_lastSeenStructure) {
         m_observedArrayModes |= arrayModeFromStructure(m_lastSeenStructure);
+
+        if (!m_didPerformFirstRunPruning
+            && hasTwoOrMoreBitsSet(m_observedArrayModes)) {
+            m_observedArrayModes = arrayModeFromStructure(m_lastSeenStructure);
+            m_expectedStructure = 0;
+            m_didPerformFirstRunPruning = true;
+        }
+        
         m_mayInterceptIndexedAccesses |=
             m_lastSeenStructure->typeInfo().interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero();
         if (!codeBlock->globalObject()->isOriginalArrayStructure(m_lastSeenStructure))
@@ -103,7 +111,11 @@
 CString ArrayProfile::briefDescription(const ConcurrentJITLocker& locker, CodeBlock* codeBlock)
 {
     computeUpdatedPrediction(locker, codeBlock);
-    
+    return briefDescriptionWithoutUpdating(locker);
+}
+
+CString ArrayProfile::briefDescriptionWithoutUpdating(const ConcurrentJITLocker& locker)
+{
     StringPrintStream out;
     
     bool hasPrinted = false;

Modified: branches/dfgFourthTier/Source/_javascript_Core/bytecode/ArrayProfile.h (152335 => 152336)


--- branches/dfgFourthTier/Source/_javascript_Core/bytecode/ArrayProfile.h	2013-07-03 03:19:06 UTC (rev 152335)
+++ branches/dfgFourthTier/Source/_javascript_Core/bytecode/ArrayProfile.h	2013-07-03 03:45:35 UTC (rev 152336)
@@ -126,6 +126,7 @@
         , m_outOfBounds(false)
         , m_mayInterceptIndexedAccesses(false)
         , m_usesOriginalArrayStructures(true)
+        , m_didPerformFirstRunPruning(false)
         , m_observedArrayModes(0)
     {
     }
@@ -138,6 +139,7 @@
         , m_outOfBounds(false)
         , m_mayInterceptIndexedAccesses(false)
         , m_usesOriginalArrayStructures(true)
+        , m_didPerformFirstRunPruning(false)
         , m_observedArrayModes(0)
     {
     }
@@ -179,6 +181,7 @@
     bool usesOriginalArrayStructures(const ConcurrentJITLocker&) const { return m_usesOriginalArrayStructures; }
     
     CString briefDescription(const ConcurrentJITLocker&, CodeBlock*);
+    CString briefDescriptionWithoutUpdating(const ConcurrentJITLocker&);
     
 private:
     friend class LLIntOffsetsExtractor;
@@ -190,8 +193,9 @@
     Structure* m_expectedStructure;
     bool m_mayStoreToHole; // This flag may become overloaded to indicate other special cases that were encountered during array access, as it depends on indexing type. Since we currently have basically just one indexing type (two variants of ArrayStorage), this flag for now just means exactly what its name implies.
     bool m_outOfBounds;
-    bool m_mayInterceptIndexedAccesses;
-    bool m_usesOriginalArrayStructures;
+    bool m_mayInterceptIndexedAccesses : 1;
+    bool m_usesOriginalArrayStructures : 1;
+    bool m_didPerformFirstRunPruning : 1;
     ArrayModes m_observedArrayModes;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to