Title: [151343] branches/dfgFourthTier
Revision
151343
Author
[email protected]
Date
2013-06-07 17:05:52 -0700 (Fri, 07 Jun 2013)

Log Message

fourthTier: don't insert ForceOSRExits except for inadequate coverage
https://bugs.webkit.org/show_bug.cgi?id=117363

Source/_javascript_Core: 

Reviewed by Mark Hahnenberg.
        
Previously (in http://trac.webkit.org/changeset/151303) I made it so that we
inserted ForceOSRExits more eagerly.  I now think it's better to have
contradictions execute normally and exit with full OSR exit profiling.  It's
better at catching the few cases where the DFG will end up with different
types than the baseline engines.
        
This simplifies a bunch of code. For example it gets rid of
ConstantFoldingPhase::paintUnreachableCode().
        
You can think of this as a partial roll-out of r151303, except that it uses
the facilities introduced by that patch to give us run-time assertions that
check the CFA's correctness: if the CFA thought that something was a
contradiction but the code didn't exit, we'll now trap.

* dfg/DFGAbstractState.cpp:
(JSC::DFG::AbstractState::AbstractState):
(JSC::DFG::AbstractState::startExecuting):
(JSC::DFG::AbstractState::executeEffects):
(JSC::DFG::AbstractState::execute):
(JSC::DFG::AbstractState::filter):
(JSC::DFG::AbstractState::filterArrayModes):
(JSC::DFG::AbstractState::filterByValue):
(DFG):
* dfg/DFGAbstractState.h:
(AbstractState):
(JSC::DFG::AbstractState::filter):
(JSC::DFG::AbstractState::filterArrayModes):
(JSC::DFG::AbstractState::filterByValue):
* dfg/DFGCFAPhase.cpp:
(JSC::DFG::CFAPhase::performBlockCFA):
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::run):
(JSC::DFG::ConstantFoldingPhase::foldConstants):
(ConstantFoldingPhase):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):

LayoutTests: 

Reviewed by Mark Hahnenberg.
        
Convert this test, since this was the test originally added for
ConstantFoldingPhase::paintUnreachableCode(). I wanted to make sure that I had good coverage
for this since I am removing that method.

* fast/js/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop-expected.txt:
* fast/js/script-tests/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop.js:

Modified Paths

Diff

Modified: branches/dfgFourthTier/LayoutTests/ChangeLog (151342 => 151343)


--- branches/dfgFourthTier/LayoutTests/ChangeLog	2013-06-07 23:46:31 UTC (rev 151342)
+++ branches/dfgFourthTier/LayoutTests/ChangeLog	2013-06-08 00:05:52 UTC (rev 151343)
@@ -1,3 +1,17 @@
+2013-06-07  Filip Pizlo  <[email protected]>
+
+        fourthTier: don't insert ForceOSRExits except for inadequate coverage
+        https://bugs.webkit.org/show_bug.cgi?id=117363
+
+        Reviewed by Mark Hahnenberg.
+        
+        Convert this test, since this was the test originally added for
+        ConstantFoldingPhase::paintUnreachableCode(). I wanted to make sure that I had good coverage
+        for this since I am removing that method.
+
+        * fast/js/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop-expected.txt:
+        * fast/js/script-tests/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop.js:
+
 2013-06-04  Mark Lam  <[email protected]>
 
         Merged from http://svn.webkit.org/repository/webkit/trunk

Modified: branches/dfgFourthTier/LayoutTests/fast/js/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop-expected.txt (151342 => 151343)


--- branches/dfgFourthTier/LayoutTests/fast/js/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop-expected.txt	2013-06-07 23:46:31 UTC (rev 151342)
+++ branches/dfgFourthTier/LayoutTests/fast/js/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop-expected.txt	2013-06-08 00:05:52 UTC (rev 151343)
@@ -3,207 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS foo(array) is 8746
-PASS successfullyParsed is true
+Passed some tests silently.
 
 TEST COMPLETE
 

Modified: branches/dfgFourthTier/LayoutTests/fast/js/script-tests/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop.js (151342 => 151343)


--- branches/dfgFourthTier/LayoutTests/fast/js/script-tests/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop.js	2013-06-07 23:46:31 UTC (rev 151342)
+++ branches/dfgFourthTier/LayoutTests/fast/js/script-tests/dfg-force-exit-then-sparse-conditional-constant-prop-in-loop.js	2013-06-08 00:05:52 UTC (rev 151343)
@@ -18,5 +18,8 @@
 
 var array = [54, 5432, 1234, 54, 1235, 64, 75, 532, 64, 2];
 
-for (var i = 0; i < 200; ++i)
+silentTestPass = true;
+noInline(foo);
+
+for (var i = 0; i < 2; i = dfgIncrement({f:foo, i:i + 1, n:1}))
     shouldBe("foo(array)", "8746");

Modified: branches/dfgFourthTier/Source/_javascript_Core/ChangeLog (151342 => 151343)


--- branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-06-07 23:46:31 UTC (rev 151342)
+++ branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-06-08 00:05:52 UTC (rev 151343)
@@ -1,3 +1,49 @@
+2013-06-07  Filip Pizlo  <[email protected]>
+
+        fourthTier: don't insert ForceOSRExits except for inadequate coverage
+        https://bugs.webkit.org/show_bug.cgi?id=117363
+
+        Reviewed by Mark Hahnenberg.
+        
+        Previously (in http://trac.webkit.org/changeset/151303) I made it so that we
+        inserted ForceOSRExits more eagerly.  I now think it's better to have
+        contradictions execute normally and exit with full OSR exit profiling.  It's
+        better at catching the few cases where the DFG will end up with different
+        types than the baseline engines.
+        
+        This simplifies a bunch of code. For example it gets rid of
+        ConstantFoldingPhase::paintUnreachableCode().
+        
+        You can think of this as a partial roll-out of r151303, except that it uses
+        the facilities introduced by that patch to give us run-time assertions that
+        check the CFA's correctness: if the CFA thought that something was a
+        contradiction but the code didn't exit, we'll now trap.
+
+        * dfg/DFGAbstractState.cpp:
+        (JSC::DFG::AbstractState::AbstractState):
+        (JSC::DFG::AbstractState::startExecuting):
+        (JSC::DFG::AbstractState::executeEffects):
+        (JSC::DFG::AbstractState::execute):
+        (JSC::DFG::AbstractState::filter):
+        (JSC::DFG::AbstractState::filterArrayModes):
+        (JSC::DFG::AbstractState::filterByValue):
+        (DFG):
+        * dfg/DFGAbstractState.h:
+        (AbstractState):
+        (JSC::DFG::AbstractState::filter):
+        (JSC::DFG::AbstractState::filterArrayModes):
+        (JSC::DFG::AbstractState::filterByValue):
+        * dfg/DFGCFAPhase.cpp:
+        (JSC::DFG::CFAPhase::performBlockCFA):
+        * dfg/DFGConstantFoldingPhase.cpp:
+        (JSC::DFG::ConstantFoldingPhase::run):
+        (JSC::DFG::ConstantFoldingPhase::foldConstants):
+        (ConstantFoldingPhase):
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::LowerDFGToLLVM::compileNode):
+
 2013-06-07  Michael Saboff  <[email protected]>
 
         fourthTier: The baseline jit and LLint should use common slow paths

Modified: branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGAbstractState.cpp (151342 => 151343)


--- branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGAbstractState.cpp	2013-06-07 23:46:31 UTC (rev 151342)
+++ branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGAbstractState.cpp	2013-06-08 00:05:52 UTC (rev 151343)
@@ -43,7 +43,6 @@
     , m_variables(m_codeBlock->numParameters(), graph.m_localVars)
     , m_block(0)
     , m_currentNode(0)
-    , m_executionMode(CleanFiltration)
 {
 }
 
@@ -233,7 +232,7 @@
     return UnknownBooleanResult;
 }
 
-bool AbstractState::startExecuting(Node* node, ExecutionMode executionMode)
+bool AbstractState::startExecuting(Node* node)
 {
     ASSERT(m_block);
     ASSERT(m_isValid);
@@ -244,18 +243,16 @@
     
     if (!node->shouldGenerate()) {
         m_currentNode = 0;
-        m_executionMode = CleanFiltration;
         return false;
     }
     
     m_currentNode = node;
-    m_executionMode = executionMode;
     return true;
 }
 
-bool AbstractState::startExecuting(unsigned indexInBlock, ExecutionMode executionMode)
+bool AbstractState::startExecuting(unsigned indexInBlock)
 {
-    return startExecuting(m_block->at(indexInBlock), executionMode);
+    return startExecuting(m_block->at(indexInBlock));
 }
 
 void AbstractState::executeEdges(Node* node)
@@ -1093,8 +1090,7 @@
             // structure.
             filter(
                 node->child1(),
-                m_graph.globalObjectFor(node->codeOrigin)->stringObjectStructure(),
-                NotStringObject);
+                m_graph.globalObjectFor(node->codeOrigin)->stringObjectStructure());
             node->setCanExit(true); // We could be more precise but it's likely not worth it.
             break;
         case StringOrStringObjectUse:
@@ -1301,7 +1297,7 @@
                         forNode(node).set(m_graph, status.specificValue());
                     else
                         forNode(node).makeTop();
-                    filter(node->child1(), status.structureSet(), BadCache);
+                    filter(node->child1(), status.structureSet());
                     
                     m_foundConstants = true;
                     break;
@@ -1339,12 +1335,6 @@
             break;
         }
 
-        ExitKind exitKind;
-        if (node->child1()->op() == WeakJSConstant)
-            exitKind = BadWeakConstantCache;
-        else
-            exitKind = BadCache;
-
         node->setCanExit(true);
 
         // If this structure check is attempting to prove knowledge already held in
@@ -1353,11 +1343,11 @@
         if (value.m_futurePossibleStructure.isSubsetOf(set)
             && value.m_futurePossibleStructure.hasSingleton()) {
             m_foundConstants = true;
-            filter(value, value.m_futurePossibleStructure.singleton(), exitKind);
+            filter(value, value.m_futurePossibleStructure.singleton());
             break;
         }
 
-        filter(value, set, exitKind);
+        filter(value, set);
         m_haveStructures = true;
         break;
     }
@@ -1366,12 +1356,6 @@
     case ForwardStructureTransitionWatchpoint: {
         AbstractValue& value = forNode(node->child1());
 
-        ExitKind exitKind;
-        if (node->child1()->op() == WeakJSConstant)
-            exitKind = BadWeakConstantCache;
-        else
-            exitKind = BadCache;
-
         // It's only valid to issue a structure transition watchpoint if we already
         // know that the watchpoint covers a superset of the structures known to
         // belong to the set of future structures that this value may have.
@@ -1382,7 +1366,7 @@
             value.m_futurePossibleStructure.isSubsetOf(StructureSet(node->structure()))
             || m_graph.watchpoints().shouldAssumeMixedState(node->structure()->transitionWatchpointSet()));
         
-        filter(value, node->structure(), exitKind);
+        filter(value, node->structure());
         m_haveStructures = true;
         node->setCanExit(true);
         break;
@@ -1477,7 +1461,7 @@
             m_foundConstants = true;
         node->setCanExit(true);
         clobberStructures(indexInBlock);
-        filter(value, set, BadIndexingType);
+        filter(value, set);
         m_haveStructures = true;
         break;
     }
@@ -1503,7 +1487,7 @@
         }
         
         node->setCanExit(true); // Lies! We can do better.
-        filterByValue(node->child1(), node->function(), BadFunction);
+        filterByValue(node->child1(), node->function());
         break;
     }
         
@@ -1518,7 +1502,7 @@
                 m_graph.identifiers()[node->identifierNumber()],
                 node->op() == PutByIdDirect);
             if (status.isSimpleReplace()) {
-                filter(node->child1(), structure, BadCache);
+                filter(node->child1(), structure);
                 m_foundConstants = true;
                 break;
             }
@@ -1607,10 +1591,10 @@
     return executeEffects(indexInBlock, m_block->at(indexInBlock));
 }
 
-bool AbstractState::execute(unsigned indexInBlock, ExecutionMode executionMode)
+bool AbstractState::execute(unsigned indexInBlock)
 {
     Node* node = m_block->at(indexInBlock);
-    if (!startExecuting(node, executionMode))
+    if (!startExecuting(node))
         return true;
     
     executeEdges(node);
@@ -1844,61 +1828,39 @@
     }
 }
 
-FiltrationResult AbstractState::filter(
-    AbstractValue& value, const StructureSet& set, ExitKind exitKind)
+FiltrationResult AbstractState::filter(AbstractValue& value, const StructureSet& set)
 {
     if (value.filter(m_graph, set) == FiltrationOK)
         return FiltrationOK;
-    bail(exitKind);
+    m_isValid = false;
     return Contradiction;
 }
     
-FiltrationResult AbstractState::filterArrayModes(
-    AbstractValue& value, ArrayModes arrayModes, ExitKind exitKind)
+FiltrationResult AbstractState::filterArrayModes(AbstractValue& value, ArrayModes arrayModes)
 {
     if (value.filterArrayModes(arrayModes) == FiltrationOK)
         return FiltrationOK;
-    bail(exitKind);
+    m_isValid = false;
     return Contradiction;
 }
     
-FiltrationResult AbstractState::filter(
-    AbstractValue& value, SpeculatedType type, ExitKind exitKind)
+FiltrationResult AbstractState::filter(AbstractValue& value, SpeculatedType type)
 {
     if (value.filter(type) == FiltrationOK)
         return FiltrationOK;
-    bail(exitKind);
+    m_isValid = false;
     return Contradiction;
 }
     
 FiltrationResult AbstractState::filterByValue(
-    AbstractValue& abstractValue, JSValue concreteValue, ExitKind exitKind)
+    AbstractValue& abstractValue, JSValue concreteValue)
 {
     if (abstractValue.filterByValue(concreteValue) == FiltrationOK)
         return FiltrationOK;
-    bail(exitKind);
+    m_isValid = false;
     return Contradiction;
 }
 
-void AbstractState::bail(ExitKind exitKind)
-{
-    ASSERT(m_currentNode);
-    m_isValid = false;
-    switch (m_executionMode) {
-    case StillConverging:
-        return;
-    case AfterConvergence: {
-        m_graph.baselineCodeBlockFor(m_currentNode->codeOrigin)->addFrequentExitSite(
-            FrequentExitSite(m_currentNode->codeOrigin.bytecodeIndex, exitKind));
-        return;
-    }
-    case CleanFiltration:
-        RELEASE_ASSERT_NOT_REACHED();
-        return;
-    }
-    RELEASE_ASSERT_NOT_REACHED();
-}
-    
 } } // namespace JSC::DFG
 
 #endif // ENABLE(DFG_JIT)

Modified: branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGAbstractState.h (151342 => 151343)


--- branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGAbstractState.h	2013-06-07 23:46:31 UTC (rev 151342)
+++ branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGAbstractState.h	2013-06-08 00:05:52 UTC (rev 151343)
@@ -93,21 +93,6 @@
         MergeToSuccessors
     };
     
-    enum ExecutionMode {
-        // If we encounter a contradiction, assume that this might just
-        // be because we haven't converged yet.
-        StillConverging,
-        
-        // If we encounter a contradition, assume that this contradiction
-        // is real and report it to the profiling infrastructure as if it
-        // happened at run time.
-        AfterConvergence,
-        
-        // Assume that there cannot be any contradictions other than
-        // ForceOSRExit because we have already cleaned the graph.
-        CleanFiltration
-    };
-    
     AbstractState(Graph&);
     
     ~AbstractState();
@@ -191,12 +176,12 @@
     //
     // This is guaranteed to be equivalent to doing:
     //
-    // if (state.startExecuting(index, executionMode)) {
+    // if (state.startExecuting(index)) {
     //     state.executeEdges(index);
     //     result = state.executeEffects(index);
     // } else
     //     result = true;
-    bool execute(unsigned indexInBlock, ExecutionMode);
+    bool execute(unsigned indexInBlock);
     
     // Indicate the start of execution of the node. It resets any state in the node,
     // that is progressively built up by executeEdges() and executeEffects(). In
@@ -204,8 +189,8 @@
     // startExecuting() and executeEdges()/Effects() whether the last run of the
     // analysis concluded that the node can exit, you should probably set that
     // information aside prior to calling startExecuting().
-    bool startExecuting(Node*, ExecutionMode);
-    bool startExecuting(unsigned indexInBlock, ExecutionMode);
+    bool startExecuting(Node*);
+    bool startExecuting(unsigned indexInBlock);
     
     // Abstractly execute the edges of the given node. This runs filterEdgeByUse()
     // on all edges of the node. You can skip this step, if you have already used
@@ -247,37 +232,34 @@
     void dump(PrintStream& out);
     
     template<typename T>
-    FiltrationResult filter(T node, const StructureSet& set, ExitKind exitKind)
+    FiltrationResult filter(T node, const StructureSet& set)
     {
-        return filter(forNode(node), set, exitKind);
+        return filter(forNode(node), set);
     }
     
     template<typename T>
-    FiltrationResult filterArrayModes(
-        T node, ArrayModes arrayModes, ExitKind exitKind = BadIndexingType)
+    FiltrationResult filterArrayModes(T node, ArrayModes arrayModes)
     {
-        return filterArrayModes(forNode(node), arrayModes, exitKind);
+        return filterArrayModes(forNode(node), arrayModes);
     }
     
     template<typename T>
-    FiltrationResult filter(T node, SpeculatedType type, ExitKind exitKind = BadType)
+    FiltrationResult filter(T node, SpeculatedType type)
     {
-        return filter(forNode(node), type, exitKind);
+        return filter(forNode(node), type);
     }
     
     template<typename T>
-    FiltrationResult filterByValue(T node, JSValue value, ExitKind exitKind)
+    FiltrationResult filterByValue(T node, JSValue value)
     {
-        return filterByValue(forNode(node), value, exitKind);
+        return filterByValue(forNode(node), value);
     }
     
-    FiltrationResult filter(AbstractValue&, const StructureSet&, ExitKind);
-    FiltrationResult filterArrayModes(AbstractValue&, ArrayModes, ExitKind = BadIndexingType);
-    FiltrationResult filter(AbstractValue&, SpeculatedType, ExitKind = BadType);
-    FiltrationResult filterByValue(AbstractValue&, JSValue, ExitKind);
+    FiltrationResult filter(AbstractValue&, const StructureSet&);
+    FiltrationResult filterArrayModes(AbstractValue&, ArrayModes);
+    FiltrationResult filter(AbstractValue&, SpeculatedType);
+    FiltrationResult filterByValue(AbstractValue&, JSValue);
     
-    void bail(ExitKind);
-    
 private:
     void clobberWorld(const CodeOrigin&, unsigned indexInBlock);
     void clobberCapturedVars(const CodeOrigin&);
@@ -332,7 +314,6 @@
     Operands<AbstractValue> m_variables;
     BasicBlock* m_block;
     Node* m_currentNode;
-    ExecutionMode m_executionMode;
     
     bool m_haveStructures;
     bool m_foundConstants;

Modified: branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGCFAPhase.cpp (151342 => 151343)


--- branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGCFAPhase.cpp	2013-06-07 23:46:31 UTC (rev 151342)
+++ branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGCFAPhase.cpp	2013-06-08 00:05:52 UTC (rev 151343)
@@ -101,7 +101,7 @@
                 m_state.dump(WTF::dataFile());
                 dataLogF("\n");
             }
-            if (!m_state.execute(i, AbstractState::StillConverging)) {
+            if (!m_state.execute(i)) {
                 if (verbose)
                     dataLogF("         Expect OSR exit.\n");
                 break;

Modified: branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGConstantFoldingPhase.cpp (151342 => 151343)


--- branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGConstantFoldingPhase.cpp	2013-06-07 23:46:31 UTC (rev 151342)
+++ branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGConstantFoldingPhase.cpp	2013-06-08 00:05:52 UTC (rev 151343)
@@ -56,8 +56,6 @@
             BasicBlock* block = m_graph.m_blocks[blockIndex].get();
             if (!block)
                 continue;
-            if (!block->cfaDidFinish)
-                changed |= paintUnreachableCode(blockIndex);
             if (block->cfaFoundConstants)
                 changed |= foldConstants(blockIndex);
         }
@@ -103,7 +101,7 @@
                 else
                     set = node->structureSet();
                 if (value.m_currentKnownStructure.isSubsetOf(set)) {
-                    m_state.execute(indexInBlock, AbstractState::CleanFiltration); // Catch the fact that we may filter on cell.
+                    m_state.execute(indexInBlock); // Catch the fact that we may filter on cell.
                     node->convertToPhantom();
                     eliminated = true;
                     break;
@@ -112,7 +110,7 @@
                 if (structureValue.isSubsetOf(set)
                     && structureValue.hasSingleton()) {
                     Structure* structure = structureValue.singleton();
-                    m_state.execute(indexInBlock, AbstractState::CleanFiltration); // Catch the fact that we may filter on cell.
+                    m_state.execute(indexInBlock); // Catch the fact that we may filter on cell.
                     AdjacencyList children = node->children;
                     children.removeEdge(0);
                     if (!!children.child1()) {
@@ -180,7 +178,7 @@
                 // Now before we do anything else, push the CFA forward over the GetById
                 // and make sure we signal to the loop that it should continue and not
                 // do any eliminations.
-                m_state.execute(indexInBlock, AbstractState::CleanFiltration);
+                m_state.execute(indexInBlock);
                 eliminated = true;
                 
                 if (needsWatchpoint) {
@@ -243,7 +241,7 @@
                 // Now before we do anything else, push the CFA forward over the PutById
                 // and make sure we signal to the loop that it should continue and not
                 // do any eliminations.
-                m_state.execute(indexInBlock, AbstractState::CleanFiltration);
+                m_state.execute(indexInBlock);
                 eliminated = true;
                 
                 if (needsWatchpoint) {
@@ -332,7 +330,7 @@
                 continue;
             }
                 
-            m_state.execute(indexInBlock, AbstractState::CleanFiltration);
+            m_state.execute(indexInBlock);
             if (!node->shouldGenerate() || m_state.didClobber() || node->hasConstant())
                 continue;
             JSValue value = m_state.forNode(node).value();
@@ -420,54 +418,6 @@
             OpInfo(m_graph.addStructureSet(cell->structure())), Edge(weakConstant, CellUse));
     }
     
-    // This is necessary because the CFA may reach conclusions about constants based on its
-    // assumption that certain code must exit, but then those constants may lead future
-    // reexecutions of the CFA to believe that the same code will now no longer exit. Thus
-    // to ensure soundness, we must paint unreachable code as such, by inserting an
-    // unconditional ForceOSRExit wherever we find that a node would have always exited.
-    // This will only happen in cases where we are making static speculations, or we're
-    // making totally wrong speculations due to imprecision in the prediction propagator.
-    bool paintUnreachableCode(BlockIndex blockIndex)
-    {
-        bool changed = false;
-        
-#if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE)
-        dataLogF("Painting unreachable code in Block #%u.\n", blockIndex);
-#endif
-        BasicBlock* block = m_graph.m_blocks[blockIndex].get();
-        m_state.beginBasicBlock(block);
-        
-        for (unsigned indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) {
-            m_state.execute(indexInBlock, AbstractState::AfterConvergence);
-            if (m_state.isValid())
-                continue;
-            
-            Node* node = block->at(indexInBlock);
-            switch (node->op()) {
-            case Return:
-            case Throw:
-            case ThrowReferenceError:
-            case ForceOSRExit:
-            case ForwardForceOSRExit:
-                // Do nothing. These nodes will already do the right thing.
-                break;
-                
-            default:
-                m_insertionSet.insertNode(
-                    indexInBlock, SpecNone,
-                    (node->flags() & NodeExitsForward) ? ForwardForceOSRExit : ForceOSRExit,
-                    node->codeOrigin);
-                changed = true;
-                break;
-            }
-            break;
-        }
-        m_state.reset();
-        m_insertionSet.execute(block);
-        
-        return changed;
-    }
-
     AbstractState m_state;
     InsertionSet m_insertionSet;
 };

Modified: branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (151342 => 151343)


--- branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2013-06-07 23:46:31 UTC (rev 151342)
+++ branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2013-06-08 00:05:52 UTC (rev 151343)
@@ -1641,11 +1641,15 @@
     for (m_indexInBlock = 0; m_indexInBlock < block.size(); ++m_indexInBlock) {
         m_currentNode = block[m_indexInBlock];
         
-        // If there was a contradiction then the constant folder ought to have caught it.
-        RELEASE_ASSERT(m_state.isValid());
+        // We may have his a contradiction that the CFA was aware of but that the JIT
+        // didn't cause directly.
+        if (!m_state.isValid()) {
+            bail();
+            return;
+        }
         
         m_canExit = m_currentNode->canExit();
-        bool shouldExecuteEffects = m_state.startExecuting(m_currentNode, AbstractState::CleanFiltration);
+        bool shouldExecuteEffects = m_state.startExecuting(m_currentNode);
         m_jit.setForNode(m_currentNode);
         m_codeOriginForOSR = m_currentNode->codeOrigin;
         if (!m_currentNode->shouldGenerate()) {

Modified: branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (151342 => 151343)


--- branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2013-06-07 23:46:31 UTC (rev 151342)
+++ branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2013-06-08 00:05:52 UTC (rev 151343)
@@ -265,7 +265,7 @@
         if (verboseCompilationEnabled())
             dataLog("Lowering ", m_node, "\n");
         
-        bool shouldExecuteEffects = m_state.startExecuting(m_node, AbstractState::CleanFiltration);
+        bool shouldExecuteEffects = m_state.startExecuting(m_node);
         
         m_direction = (m_node->flags() & NodeExitsForward) ? ForwardSpeculation : BackwardSpeculation;
         
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to