Title: [170017] branches/ftlopt/Source/_javascript_Core
Revision
170017
Author
[email protected]
Date
2014-06-16 11:20:02 -0700 (Mon, 16 Jun 2014)

Log Message

[ftlopt] Remove the DFG optimization fixpoint and remove some obvious reasons why we previously benefited from it
https://bugs.webkit.org/show_bug.cgi?id=133931

Reviewed by Oliver Hunt.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): Trigger constant-folding for GetMyArgumentByVal (which means turning it into GetLocalUnlinked) and correct the handling of Upsilon so we don't fold them away.
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants): Implement constant-folding for GetMyArgumentByVal.
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThreadImpl): Remove the fixpoint.

Modified Paths

Diff

Modified: branches/ftlopt/Source/_javascript_Core/ChangeLog (170016 => 170017)


--- branches/ftlopt/Source/_javascript_Core/ChangeLog	2014-06-16 18:03:04 UTC (rev 170016)
+++ branches/ftlopt/Source/_javascript_Core/ChangeLog	2014-06-16 18:20:02 UTC (rev 170017)
@@ -1,5 +1,19 @@
 2014-06-15  Filip Pizlo  <[email protected]>
 
+        [ftlopt] Remove the DFG optimization fixpoint and remove some obvious reasons why we previously benefited from it
+        https://bugs.webkit.org/show_bug.cgi?id=133931
+
+        Reviewed by Oliver Hunt.
+
+        * dfg/DFGAbstractInterpreterInlines.h:
+        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): Trigger constant-folding for GetMyArgumentByVal (which means turning it into GetLocalUnlinked) and correct the handling of Upsilon so we don't fold them away.
+        * dfg/DFGConstantFoldingPhase.cpp:
+        (JSC::DFG::ConstantFoldingPhase::foldConstants): Implement constant-folding for GetMyArgumentByVal.
+        * dfg/DFGPlan.cpp:
+        (JSC::DFG::Plan::compileInThreadImpl): Remove the fixpoint.
+
+2014-06-15  Filip Pizlo  <[email protected]>
+
         [ftlopt] DFG OSR entry should have a crystal-clear story for when it's safe to enter at a block with a set of values
         https://bugs.webkit.org/show_bug.cgi?id=133935
 

Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h (170016 => 170017)


--- branches/ftlopt/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2014-06-16 18:03:04 UTC (rev 170016)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2014-06-16 18:20:02 UTC (rev 170017)
@@ -1380,13 +1380,24 @@
         forNode(node).makeHeapTop();
         break;
         
-    case GetMyArgumentByVal:
+    case GetMyArgumentByVal: {
         node->setCanExit(true);
-        // We know that this executable does not escape its arguments, so we can optimize
-        // the arguments a bit. Note that this ends up being further optimized by the
-        // ArgumentsSimplificationPhase.
+        InlineCallFrame* inlineCallFrame = node->origin.semantic.inlineCallFrame;
+        JSValue value = forNode(node->child1()).m_value;
+        if (inlineCallFrame && value && value.isInt32()) {
+            int32_t index = value.asInt32();
+            if (index >= 0
+                && static_cast<size_t>(index + 1) < inlineCallFrame->arguments.size()) {
+                forNode(node) = m_state.variables().operand(
+                    inlineCallFrame->stackOffset +
+                    m_graph.baselineCodeBlockFor(inlineCallFrame)->argumentIndexAfterCapture(index));
+                m_state.setFoundConstants(true);
+                break;
+            }
+        }
         forNode(node).makeHeapTop();
         break;
+    }
         
     case GetMyArgumentByValSafe:
         node->setCanExit(true);
@@ -1860,9 +1871,7 @@
         
     case Upsilon: {
         m_state.createValueForNode(node->phi());
-        AbstractValue value = forNode(node->child1());
-        forNode(node) = value;
-        forNode(node->phi()) = value;
+        forNode(node->phi()) = forNode(node->child1());
         break;
     }
         

Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGConstantFoldingPhase.cpp (170016 => 170017)


--- branches/ftlopt/Source/_javascript_Core/dfg/DFGConstantFoldingPhase.cpp	2014-06-16 18:03:04 UTC (rev 170016)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGConstantFoldingPhase.cpp	2014-06-16 18:20:02 UTC (rev 170017)
@@ -246,6 +246,34 @@
                 node->convertToIdentity();
                 break;
             }
+                
+            case GetMyArgumentByVal: {
+                InlineCallFrame* inlineCallFrame = node->origin.semantic.inlineCallFrame;
+                JSValue value = m_state.forNode(node->child1()).m_value;
+                if (inlineCallFrame && value && value.isInt32()) {
+                    int32_t index = value.asInt32();
+                    if (index >= 0
+                        && static_cast<size_t>(index + 1) < inlineCallFrame->arguments.size()) {
+                        // Roll the interpreter over this.
+                        m_interpreter.execute(indexInBlock);
+                        eliminated = true;
+                        
+                        int operand =
+                            inlineCallFrame->stackOffset +
+                            m_graph.baselineCodeBlockFor(inlineCallFrame)->argumentIndexAfterCapture(index);
+                        
+                        m_insertionSet.insertNode(
+                            indexInBlock, SpecNone, CheckArgumentsNotCreated, node->origin);
+                        m_insertionSet.insertNode(
+                            indexInBlock, SpecNone, Phantom, node->origin, node->children);
+                        
+                        node->convertToGetLocalUnlinked(VirtualRegister(operand));
+                        break;
+                    }
+                }
+                
+                break;
+            }
 
             default:
                 break;

Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGPlan.cpp (170016 => 170017)


--- branches/ftlopt/Source/_javascript_Core/dfg/DFGPlan.cpp	2014-06-16 18:03:04 UTC (rev 170016)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGPlan.cpp	2014-06-16 18:20:02 UTC (rev 170017)
@@ -238,32 +238,35 @@
     performInvalidationPointInjection(dfg);
     performTypeCheckHoisting(dfg);
     
-    unsigned count = 1;
     dfg.m_fixpointState = FixpointNotConverged;
-    for (;; ++count) {
-        if (logCompilationChanges(mode))
-            dataLogF("DFG beginning optimization fixpoint iteration #%u.\n", count);
-        bool changed = false;
+    
+    // For now we're back to avoiding a fixpoint. Note that we've ping-ponged on this decision
+    // many times. For maximum throughput, it's best to fixpoint. But the throughput benefit is
+    // small and not likely to show up in FTL anyway. On the other hand, not fixpointing means
+    // that the compiler compiles more quickly. We want the third tier to compile quickly, which
+    // not fixpointing accomplishes; and the fourth tier shouldn't need a fixpoint.
+    if (validationEnabled())
+        validate(dfg);
         
-        if (validationEnabled())
-            validate(dfg);
-        
-        changed |= performStrengthReduction(dfg);
+    performStrengthReduction(dfg);
+    performCSE(dfg);
+    performArgumentsSimplification(dfg);
+    performCPSRethreading(dfg);
+    performCFA(dfg);
+    performConstantFolding(dfg);
+    bool changed = false;
+    changed |= performCFGSimplification(dfg);
+    changed |= performCSE(dfg);
+    
+    if (validationEnabled())
+        validate(dfg);
+
+    performCPSRethreading(dfg);
+    if (changed) {
         performCFA(dfg);
-        changed |= performConstantFolding(dfg);
-        changed |= performArgumentsSimplification(dfg);
-        changed |= performCFGSimplification(dfg);
-        changed |= performCSE(dfg);
-        
-        if (!changed)
-            break;
-        
-        performCPSRethreading(dfg);
+        performConstantFolding(dfg);
     }
     
-    if (logCompilationChanges(mode))
-        dataLogF("DFG optimization fixpoint converged in %u iterations.\n", count);
-
     // If we're doing validation, then run some analyses, to give them an opportunity
     // to self-validate. Now is as good a time as any to do this.
     if (validationEnabled()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to