Title: [197542] trunk/Source/_javascript_Core
Revision
197542
Author
fpi...@apple.com
Date
2016-03-03 18:43:53 -0800 (Thu, 03 Mar 2016)

Log Message

Octane/regexp's Exec function should benefit from array length accessor inlining
https://bugs.webkit.org/show_bug.cgi?id=154994

Reviewed by Benjamin Poulain.

It does:

    var thingy = blahbitty.blah;
    if (thingy)
        foo = thingy.length;

So, 'thingy' is SpecArray | SpecOther, which prevents the array length accessor inlining from
kicking in. Our strategy for this elsewhere in the DFG is to allow a one-time speculation that
we won't see SpecOther, since *usually* we see SpecOther mixed with other stuff in cases like
this where there is some null check guarding the code.

This gives another slight speed-up on Octane/regexp.

* bytecode/SpeculatedType.h:
(JSC::isCellSpeculation):
(JSC::isCellOrOtherSpeculation):
(JSC::isNotCellSpeculation):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNode.h:
(JSC::DFG::Node::shouldSpeculateCell):
(JSC::DFG::Node::shouldSpeculateCellOrOther):
(JSC::DFG::Node::shouldSpeculateNotCell):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (197541 => 197542)


--- trunk/Source/_javascript_Core/ChangeLog	2016-03-04 02:26:49 UTC (rev 197541)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-03-04 02:43:53 UTC (rev 197542)
@@ -1,3 +1,34 @@
+2016-03-03  Filip Pizlo  <fpi...@apple.com>
+
+        Octane/regexp's Exec function should benefit from array length accessor inlining
+        https://bugs.webkit.org/show_bug.cgi?id=154994
+
+        Reviewed by Benjamin Poulain.
+
+        It does:
+
+            var thingy = blahbitty.blah;
+            if (thingy)
+                foo = thingy.length;
+
+        So, 'thingy' is SpecArray | SpecOther, which prevents the array length accessor inlining from
+        kicking in. Our strategy for this elsewhere in the DFG is to allow a one-time speculation that
+        we won't see SpecOther, since *usually* we see SpecOther mixed with other stuff in cases like
+        this where there is some null check guarding the code.
+
+        This gives another slight speed-up on Octane/regexp.
+
+        * bytecode/SpeculatedType.h:
+        (JSC::isCellSpeculation):
+        (JSC::isCellOrOtherSpeculation):
+        (JSC::isNotCellSpeculation):
+        * dfg/DFGFixupPhase.cpp:
+        (JSC::DFG::FixupPhase::fixupNode):
+        * dfg/DFGNode.h:
+        (JSC::DFG::Node::shouldSpeculateCell):
+        (JSC::DFG::Node::shouldSpeculateCellOrOther):
+        (JSC::DFG::Node::shouldSpeculateNotCell):
+
 2016-03-03  Saam Barati  <sbar...@apple.com>
 
         Add Proxy tests for exceptions that depend on an object being non-extensible and having configurable properties

Modified: trunk/Source/_javascript_Core/bytecode/SpeculatedType.h (197541 => 197542)


--- trunk/Source/_javascript_Core/bytecode/SpeculatedType.h	2016-03-04 02:26:49 UTC (rev 197541)
+++ trunk/Source/_javascript_Core/bytecode/SpeculatedType.h	2016-03-04 02:43:53 UTC (rev 197542)
@@ -104,6 +104,11 @@
     return !!(value & SpecCell) && !(value & ~SpecCell);
 }
 
+inline bool isCellOrOtherSpeculation(SpeculatedType value)
+{
+    return !!value && !(value & ~(SpecCell | SpecOther));
+}
+
 inline bool isNotCellSpeculation(SpeculatedType value)
 {
     return !(value & SpecCell) && value;

Modified: trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp (197541 => 197542)


--- trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp	2016-03-04 02:26:49 UTC (rev 197541)
+++ trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp	2016-03-04 02:43:53 UTC (rev 197542)
@@ -1064,12 +1064,12 @@
 
         case GetById:
         case GetByIdFlush: {
-            if (!node->child1()->shouldSpeculateCell())
-                break;
-
-            // If we hadn't exited because of BadCache, BadIndexingType, or ExoticObjectMode, then
-            // leave this as a GetById.
-            if (!m_graph.hasExitSite(node->origin.semantic, BadCache)
+            // FIXME: This should be done in the ByteCodeParser based on reading the
+            // PolymorphicAccess, which will surely tell us that this is a AccessCase::ArrayLength.
+            // https://bugs.webkit.org/show_bug.cgi?id=154990
+            if (node->child1()->shouldSpeculateCellOrOther()
+                && !m_graph.hasExitSite(node->origin.semantic, BadType)
+                && !m_graph.hasExitSite(node->origin.semantic, BadCache)
                 && !m_graph.hasExitSite(node->origin.semantic, BadIndexingType)
                 && !m_graph.hasExitSite(node->origin.semantic, ExoticObjectMode)) {
                 auto uid = m_graph.identifiers()[node->identifierNumber()];
@@ -1078,7 +1078,9 @@
                     break;
                 }
             }
-            fixEdge<CellUse>(node->child1());
+
+            if (node->child1()->shouldSpeculateCell())
+                fixEdge<CellUse>(node->child1());
             break;
         }
             

Modified: trunk/Source/_javascript_Core/dfg/DFGNode.h (197541 => 197542)


--- trunk/Source/_javascript_Core/dfg/DFGNode.h	2016-03-04 02:26:49 UTC (rev 197541)
+++ trunk/Source/_javascript_Core/dfg/DFGNode.h	2016-03-04 02:43:53 UTC (rev 197542)
@@ -2067,6 +2067,11 @@
         return isCellSpeculation(prediction());
     }
     
+    bool shouldSpeculateCellOrOther()
+    {
+        return isCellOrOtherSpeculation(prediction());
+    }
+    
     bool shouldSpeculateNotCell()
     {
         return isNotCellSpeculation(prediction());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to