Ignore:
Timestamp:
Feb 1, 2012, 3:08:54 PM (14 years ago)
Author:
[email protected]
Message:

DFG should fold double-to-int conversions
https://bugs.webkit.org/show_bug.cgi?id=77532

Reviewed by Oliver Hunt.

Performance neutral on major benchmarks. But it makes calling V8's
Math.random() 4x faster.

  • bytecode/CodeBlock.cpp:

(JSC):
(JSC::CodeBlock::addOrFindConstant):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::addConstant):
(CodeBlock):

  • dfg/DFGAbstractState.cpp:

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

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::toInt32):
(ByteCodeParser):
(JSC::DFG::ByteCodeParser::getJSConstantForValue):
(JSC::DFG::ByteCodeParser::isInt32Constant):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::addShouldSpeculateInteger):
(Graph):
(JSC::DFG::Graph::addImmediateShouldSpeculateInteger):

  • dfg/DFGPropagator.cpp:

(JSC::DFG::Propagator::propagateNodePredictions):
(JSC::DFG::Propagator::doRoundOfDoubleVoting):
(JSC::DFG::Propagator::fixupNode):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileAdd):
(DFG):
(JSC::DFG::SpeculativeJIT::compileArithSub):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::valueOfNumberConstantAsInt32):
(SpeculativeJIT):

  • dfg/DFGSpeculativeJIT32_64.cpp:

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

  • dfg/DFGSpeculativeJIT64.cpp:

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

  • runtime/JSValueInlineMethods.h:

(JSC::JSValue::asDouble):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r106314 r106502  
    20632063    callFrame->setScopeChain(callFrame->scopeChain()->push(activation));
    20642064}
     2065
     2066unsigned CodeBlock::addOrFindConstant(JSValue v)
     2067{
     2068    unsigned numberOfConstants = numberOfConstantRegisters();
     2069    for (unsigned i = 0; i < numberOfConstants; ++i) {
     2070        if (getConstant(FirstConstantRegisterIndex + i) == v)
     2071            return i;
     2072    }
     2073    return addConstant(v);
     2074}
    20652075   
    20662076#if ENABLE(JIT)
Note: See TracChangeset for help on using the changeset viewer.