Ignore:
Timestamp:
Sep 29, 2011, 4:17:19 PM (14 years ago)
Author:
[email protected]
Message:

DFG JIT should infer which uses of a variable are not aliased
https://bugs.webkit.org/show_bug.cgi?id=68593

Reviewed by Oliver Hunt.

This separates how a variable is stored (i.e. its virtual register)
from how it's predicted. Each variable now takes a
VariableAccessData as its operand, instead of the virtual register.
The VariableAccessData stores the operand and the prediction. If
multiple uses of a variable are aliased, their VariableAccessDatas
are unified.

This also adds tracking of which argument values are used. It
correctly observes that an argument value is not used, if the
argument is assigned to inside the function before being used.

This also adds tracking of which variables are live at the head of
a basic block, and separates that from a variable being live at the
tail.

Finally, this communicates to both OSR entry and OSR exit code how
a variable is predicted at a particular point in the code, rather
than just communicating how it was predicted in the entire code
block (since with this patch there is no longer the notion of a
variable having just one prediction for a code block).

(JSC::actionablePredictionFromPredictedType):
(JSC::valueObeysPrediction):
(JSC::actionablePredictionToString):
(JSC::ActionablePredictions::ActionablePredictions):
(JSC::ActionablePredictions::setArgument):
(JSC::ActionablePredictions::argument):
(JSC::ActionablePredictions::setVariable):
(JSC::ActionablePredictions::variable):
(JSC::ActionablePredictions::argumentUpperBound):
(JSC::ActionablePredictions::variableUpperBound):
(JSC::ActionablePredictions::pack):
(JSC::ActionablePredictions::packVector):

  • bytecode/CodeBlock.h:
  • bytecode/PredictionTracker.h:
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::newVariableAccessData):
(JSC::DFG::ByteCodeParser::getLocal):
(JSC::DFG::ByteCodeParser::setLocal):
(JSC::DFG::ByteCodeParser::getArgument):
(JSC::DFG::ByteCodeParser::setArgument):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::processPhiStack):
(JSC::DFG::ByteCodeParser::parse):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::nameOfVariableAccessData):
(JSC::DFG::Graph::dump):
(JSC::DFG::Graph::predictArgumentTypes):

  • dfg/DFGGraph.h:

(JSC::DFG::operandIsArgument):
(JSC::DFG::VariableRecord::setFirstTime):
(JSC::DFG::BasicBlock::BasicBlock):
(JSC::DFG::Graph::predict):
(JSC::DFG::Graph::getPrediction):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::noticeOSREntry):

  • dfg/DFGNode.h:

(JSC::DFG::Node::hasVariableAccessData):
(JSC::DFG::Node::hasLocal):
(JSC::DFG::Node::variableAccessData):
(JSC::DFG::Node::local):

  • dfg/DFGOSREntry.cpp:

(JSC::DFG::prepareOSREntry):

  • dfg/DFGOSREntry.h:
  • dfg/DFGPropagator.cpp:

(JSC::DFG::Propagator::propagateNodePredictions):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::ValueSource::dump):
(JSC::DFG::OSRExit::OSRExit):
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::checkArgumentTypes):
(JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::ValueSource::ValueSource):
(JSC::DFG::ValueSource::forPrediction):
(JSC::DFG::ValueSource::isSet):
(JSC::DFG::ValueSource::kind):
(JSC::DFG::ValueSource::nodeIndex):
(JSC::DFG::ValueSource::nodeIndexFromKind):
(JSC::DFG::ValueSource::kindFromNodeIndex):
(JSC::DFG::SpeculativeJIT::isKnownArray):
(JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):
(JSC::DFG::SpeculativeJIT::SpeculativeJIT):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::OSRExit::OSRExit):
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::checkArgumentTypes):
(JSC::DFG::SpeculativeJIT::computeValueRecoveryFor):

  • wtf/PackedIntVector.h: Added.

(WTF::PackedIntVector::PackedIntVector):
(WTF::PackedIntVector::operator=):
(WTF::PackedIntVector::size):
(WTF::PackedIntVector::ensureSize):
(WTF::PackedIntVector::resize):
(WTF::PackedIntVector::clearAll):
(WTF::PackedIntVector::get):
(WTF::PackedIntVector::set):
(WTF::PackedIntVector::mask):

  • wtf/Platform.h:
  • wtf/UnionFind.h: Added.

(WTF::UnionFind::UnionFind):
(WTF::UnionFind::find):
(WTF::UnionFind::unify):

File:
1 edited

Legend:

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

    r95901 r96375  
    3939{
    4040    JSGlobalData* globalData = &exec->globalData();
    41     Graph dfg(codeBlock->m_numParameters, codeBlock->m_numVars);
     41    Graph dfg;
    4242    if (!parse(dfg, globalData, codeBlock))
    4343        return false;
     
    4747   
    4848    propagate(dfg, globalData, codeBlock);
    49    
    50     // Save the predictions we've made, so that OSR entry can verify them. Predictions
    51     // are saved in the CodeBlock from which we will be doing OSR entry, since the
    52     // CodeBlock to which we are OSRing may be replaced at any time.
    53     OwnPtr<PredictionTracker> predictions = adoptPtr(new PredictionTracker());
    54     *predictions = dfg.predictions();
    55     ASSERT(codeBlock->alternative());
    56     ASSERT(codeBlock->alternative()->getJITType() == JITCode::BaselineJIT);
    57     codeBlock->alternative()->setPredictions(predictions.release());
    5849   
    5950    JITCompiler dataFlowJIT(globalData, dfg, codeBlock);
Note: See TracChangeset for help on using the changeset viewer.