Ignore:
Timestamp:
Dec 22, 2011, 9:47:17 PM (13 years ago)
Author:
[email protected]
Message:

DFG should not speculate array even when predictions say that the base is not an array
https://bugs.webkit.org/show_bug.cgi?id=75160
<rdar://problem/10622646>
<rdar://problem/10622649>

Reviewed by Oliver Hunt.

Added the ability to call slow path when the base is known to not be an array.
Also rationalized the logic for deciding when the index is not an int, and
cleaned up the logic for deciding when to speculate typed array.

Neutral for the most part, with odd speed-ups and slow-downs. The slow-downs can
likely be mitigated by having the notion of a polymorphic array access, where we
try, but don't speculate, to access the array one way before either trying some
other ways or calling slow path.

  • bytecode/PredictedType.h:

(JSC::isActionableMutableArrayPrediction):
(JSC::isActionableArrayPrediction):

  • dfg/DFGAbstractState.cpp:

(JSC::DFG::AbstractState::execute):

  • dfg/DFGNode.h:

(JSC::DFG::Node::shouldSpeculateInt8Array):
(JSC::DFG::Node::shouldSpeculateInt16Array):
(JSC::DFG::Node::shouldSpeculateInt32Array):
(JSC::DFG::Node::shouldSpeculateUint8Array):
(JSC::DFG::Node::shouldSpeculateUint16Array):
(JSC::DFG::Node::shouldSpeculateUint32Array):
(JSC::DFG::Node::shouldSpeculateFloat32Array):
(JSC::DFG::Node::shouldSpeculateFloat64Array):

  • dfg/DFGPropagator.cpp:

(JSC::DFG::Propagator::byValIsPure):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGAbstractState.cpp

    r103594 r103604  
    403403           
    404404    case GetByVal: {
    405         PredictedType indexPrediction = m_graph[node.child2()].prediction();
    406         if (!(indexPrediction & PredictInt32) && indexPrediction) {
     405        if (!node.prediction() || !m_graph[node.child1()].prediction() || !m_graph[node.child2()].prediction()) {
     406            m_isValid = false;
     407            break;
     408        }
     409        if (!isActionableArrayPrediction(m_graph[node.child1()].prediction()) || !m_graph[node.child2()].shouldSpeculateInteger()) {
    407410            clobberStructures(nodeIndex);
    408411            forNode(nodeIndex).makeTop();
     
    470473            break;
    471474        }
     475        ASSERT(m_graph[node.child1()].shouldSpeculateArray());
    472476        forNode(node.child1()).filter(PredictArray);
    473477        forNode(node.child2()).filter(PredictInt32);
     
    478482    case PutByVal:
    479483    case PutByValAlias: {
    480         PredictedType indexPrediction = m_graph[node.child2()].prediction();
    481         if (!(indexPrediction & PredictInt32) && indexPrediction) {
     484        if (!m_graph[node.child1()].prediction() || !m_graph[node.child2()].prediction()) {
     485            m_isValid = false;
     486            break;
     487        }
     488        if (!m_graph[node.child2()].shouldSpeculateInteger() || !isActionableMutableArrayPrediction(m_graph[node.child1()].prediction())) {
     489            ASSERT(node.op == PutByVal);
    482490            clobberStructures(nodeIndex);
    483491            forNode(nodeIndex).makeTop();
     
    539547            break;
    540548        }
    541            
     549        ASSERT(m_graph[node.child1()].shouldSpeculateArray());
    542550        forNode(node.child1()).filter(PredictArray);
    543551        forNode(node.child2()).filter(PredictInt32);
Note: See TracChangeset for help on using the changeset viewer.