Title: [231185] trunk
Revision
231185
Author
fpi...@apple.com
Date
2018-04-30 17:04:44 -0700 (Mon, 30 Apr 2018)

Log Message

LICM shouldn't hoist nodes if hoisted nodes exited in that code block
https://bugs.webkit.org/show_bug.cgi?id=185126

Reviewed by Saam Barati.
        
JSTests:

I found this bug by accident when I was writing this test for something else.
        
This change also speeds up other benchmarks of this case that we already had. They are all called
the licm-dragons tests.

* microbenchmarks/licm-dragons-two-structures.js: Added.
(foo):

Source/_javascript_Core:

This change is just restoring functionality that we've already had for a while. It had been
accidentally broken due to an unrelated CodeBlock refactoring.

* dfg/DFGLICMPhase.cpp:
(JSC::DFG::LICMPhase::attemptHoist):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (231184 => 231185)


--- trunk/JSTests/ChangeLog	2018-05-01 00:03:33 UTC (rev 231184)
+++ trunk/JSTests/ChangeLog	2018-05-01 00:04:44 UTC (rev 231185)
@@ -1,3 +1,18 @@
+2018-04-29  Filip Pizlo  <fpi...@apple.com>
+
+        LICM shouldn't hoist nodes if hoisted nodes exited in that code block
+        https://bugs.webkit.org/show_bug.cgi?id=185126
+
+        Reviewed by Saam Barati.
+        
+        I found this bug by accident when I was writing this test for something else.
+        
+        This change also speeds up other benchmarks of this case that we already had. They are all called
+        the licm-dragons tests.
+
+        * microbenchmarks/licm-dragons-two-structures.js: Added.
+        (foo):
+
 2018-04-29  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r231137.

Added: trunk/JSTests/microbenchmarks/licm-dragons-two-structures.js (0 => 231185)


--- trunk/JSTests/microbenchmarks/licm-dragons-two-structures.js	                        (rev 0)
+++ trunk/JSTests/microbenchmarks/licm-dragons-two-structures.js	2018-05-01 00:04:44 UTC (rev 231185)
@@ -0,0 +1,24 @@
+function foo(o)
+{
+    var result = 0;
+    for (var i = 0; i < 100; ++i) {
+        if (o.p)
+            result += o.f;
+        else
+            result += o.g;
+        if (o.p)
+            o.f = i;
+        else
+            o.g = i;
+    }
+    return result;
+}
+
+noInline(foo);
+
+for (var i = 0; i < 100000; ++i) {
+    var result = foo(i & 1 ? {p:true, f:42} : {p:false, g:42});
+    if (result != (99 * 98) / 2 + 42)
+        throw "Error: bad result: " + result;
+}
+

Modified: trunk/Source/_javascript_Core/ChangeLog (231184 => 231185)


--- trunk/Source/_javascript_Core/ChangeLog	2018-05-01 00:03:33 UTC (rev 231184)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-05-01 00:04:44 UTC (rev 231185)
@@ -1,3 +1,16 @@
+2018-04-29  Filip Pizlo  <fpi...@apple.com>
+
+        LICM shouldn't hoist nodes if hoisted nodes exited in that code block
+        https://bugs.webkit.org/show_bug.cgi?id=185126
+
+        Reviewed by Saam Barati.
+        
+        This change is just restoring functionality that we've already had for a while. It had been
+        accidentally broken due to an unrelated CodeBlock refactoring.
+
+        * dfg/DFGLICMPhase.cpp:
+        (JSC::DFG::LICMPhase::attemptHoist):
+
 2018-04-30  Mark Lam  <mark....@apple.com>
 
         Apply PtrTags to the MetaAllocator and friends.

Modified: trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp (231184 => 231185)


--- trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp	2018-05-01 00:03:33 UTC (rev 231184)
+++ trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp	2018-05-01 00:04:44 UTC (rev 231185)
@@ -281,7 +281,7 @@
             && !m_graph.m_controlEquivalenceAnalysis->dominatesEquivalently(data.preHeader, fromBlock);
         
         if (addsBlindSpeculation
-            && m_graph.hasExitSite(originalOrigin.semantic, HoistingFailed)) {
+            && m_graph.hasGlobalExitSite(originalOrigin.semantic, HoistingFailed)) {
             if (verbose) {
                 dataLog(
                     "    Not hoisting ", node, " because it may exit and the pre-header (",
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to