Ignore:
Timestamp:
Feb 1, 2012, 3:08:54 PM (13 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/dfg/DFGAbstractState.cpp

    r105217 r106502  
    281281    case ValueAdd:
    282282    case ArithAdd: {
    283         if (Node::shouldSpeculateInteger(m_graph[node.child1()], m_graph[node.child2()]) && node.canSpeculateInteger()) {
     283        if (m_graph.addShouldSpeculateInteger(node, m_codeBlock)) {
    284284            forNode(node.child1()).filter(PredictInt32);
    285285            forNode(node.child2()).filter(PredictInt32);
     
    299299    }
    300300           
    301     case ArithSub:
     301    case ArithSub: {
     302        if (m_graph.addShouldSpeculateInteger(node, m_codeBlock)) {
     303            forNode(node.child1()).filter(PredictInt32);
     304            forNode(node.child2()).filter(PredictInt32);
     305            forNode(nodeIndex).set(PredictInt32);
     306            break;
     307        }
     308        forNode(node.child1()).filter(PredictNumber);
     309        forNode(node.child2()).filter(PredictNumber);
     310        forNode(nodeIndex).set(PredictDouble);
     311        break;
     312    }
     313       
    302314    case ArithMul:
    303315    case ArithDiv:
Note: See TracChangeset for help on using the changeset viewer.