Ignore:
Timestamp:
Aug 8, 2011, 5:50:59 AM (14 years ago)
Author:
[email protected]
Message:

DFG JIT does not track speculation decisions for global variables
https://bugs.webkit.org/show_bug.cgi?id=65825

Reviewed by Gavin Barraclough.

Added the capability to track predictions for global variables, and
ensured that code can abstract over the source of prediction (local
versus global variable) wherever it is appropriate to do so. Also
cleaned up the code in SpeculativeJIT that decides how to speculate
based on recorded predictions (for example instead of using isInteger,
which makes sense for local predictions where the GetLocal would
return an integer value, we now tend to use shouldSpeculateInteger,
which checks if the value is either already an integer or should be
speculated to be an integer).

This is an 0.8% win on SunSpider, almost entirely thanks to a 25%
win on controlflow-recursive. It's also a 4.8% win on v8-crypto.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::predictArray):
(JSC::DFG::ByteCodeParser::predictInt32):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::predictGlobalVar):
(JSC::DFG::Graph::predict):
(JSC::DFG::Graph::getGlobalVarPrediction):
(JSC::DFG::Graph::getPrediction):

  • dfg/DFGSpeculativeJIT.cpp:

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

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::shouldSpeculateInteger):
(JSC::DFG::SpeculativeJIT::shouldSpeculateDouble):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r92148 r92593  
    156156            || (info.spillFormat() | DataFormatJS) == DataFormatJSInteger;
    157157    }
    158 
    159     bool isRegisterDataFormatDouble(NodeIndex nodeIndex)
     158   
     159    bool shouldSpeculateInteger(NodeIndex nodeIndex)
     160    {
     161        if (isInteger(nodeIndex))
     162            return true;
     163       
     164        if (isInt32Prediction(m_jit.graph().getPrediction(m_jit.graph()[nodeIndex])))
     165            return true;
     166       
     167        return false;
     168    }
     169
     170    bool shouldSpeculateDouble(NodeIndex nodeIndex)
    160171    {
    161172        Node& node = m_jit.graph()[nodeIndex];
     
    167178            return true;
    168179       
    169         if (node.op == GetLocal && isDoublePrediction(m_jit.graph().getPrediction(node.local())))
     180        if (isDoublePrediction(m_jit.graph().getPrediction(node)))
    170181            return true;
    171182       
     
    175186    bool shouldSpeculateInteger(NodeIndex op1, NodeIndex op2)
    176187    {
    177         return !(isRegisterDataFormatDouble(op1) || isRegisterDataFormatDouble(op2)) && (isInteger(op1) || isInteger(op2));
     188        return !(shouldSpeculateDouble(op1) || shouldSpeculateDouble(op2)) && (shouldSpeculateInteger(op1) || shouldSpeculateInteger(op2));
    178189    }
    179190
Note: See TracChangeset for help on using the changeset viewer.