Ignore:
Timestamp:
Dec 2, 2015, 9:42:56 PM (10 years ago)
Author:
[email protected]
Message:

Polymorphic operand types for DFG and FTL mul.
https://bugs.webkit.org/show_bug.cgi?id=151746

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

Perf on benchmarks is neutral except for the newly added JSRegress ftl-object-mul
test which shows a 2.16x speed up on x86_64 FTL, 1.27x speed up on x86_64 DFG,
and 1.56x on x86 DFG.

The speed up comes not from the mul operator itself, but from the fact that the
polymorphic operand types support now allow the test function to run without OSR
exiting, thereby realizing the DFG and FTL's speed up on other work that the test
function does.

This patch has passed the layout tests on x86_64 with a debug build.
It passed the JSC tests with x86 and x86_64 debug builds.

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::fixupNode):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGPredictionPropagationPhase.cpp:

(JSC::DFG::PredictionPropagationPhase::propagate):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileArithMul):

  • ftl/FTLCompile.cpp:
  • Changed to call generateBinaryOpFastPath() instead now, and let it dispatch to the appropriate snippet generator.
  • ftl/FTLCompileBinaryOp.cpp:

(JSC::FTL::generateBinaryArithOpFastPath):
(JSC::FTL::generateBinaryOpFastPath):
(JSC::FTL::generateArithSubFastPath): Deleted.
(JSC::FTL::generateValueAddFastPath): Deleted.

  • Refactored these functions to eliminate the need for copy-pasting every time we add support for another binary arithmetic snippet.
  • ftl/FTLCompileBinaryOp.h:
  • ftl/FTLInlineCacheDescriptor.h:
  • ftl/FTLInlineCacheDescriptorInlines.h:

(JSC::FTL::ArithMulDescriptor::ArithMulDescriptor):
(JSC::FTL::ArithMulDescriptor::icSize):

  • ftl/FTLInlineCacheSize.cpp:

(JSC::FTL::sizeOfArithMul):

  • ftl/FTLInlineCacheSize.h:
  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::DFG::LowerDFGToLLVM::lower):
(JSC::FTL::DFG::LowerDFGToLLVM::compileArithMul):

  • jit/JITMulGenerator.h:

(JSC::JITMulGenerator::JITMulGenerator):

  • tests/stress/op_mul.js:
  • Updated a test value: the interesting value for imminent overflow from an int32 is 0x7fffffff, not 0x7ffffff.

LayoutTests:

  • js/regress/ftl-object-mul-expected.txt: Added.
  • js/regress/ftl-object-mul.html: Added.
  • js/regress/script-tests/ftl-object-mul.js: Added.

(o1.valueOf):
(foo):

File:
1 edited

Legend:

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

    r192882 r192993  
    228228           
    229229        case ArithMul: {
     230            Edge& leftChild = node->child1();
     231            Edge& rightChild = node->child2();
     232            if (Node::shouldSpeculateUntypedForArithmetic(leftChild.node(), rightChild.node())
     233                || m_graph.hasExitSite(node->origin.semantic, BadType)) {
     234                fixEdge<UntypedUse>(leftChild);
     235                fixEdge<UntypedUse>(rightChild);
     236                node->setResult(NodeResultJS);
     237                break;
     238            }
    230239            if (m_graph.mulShouldSpeculateInt32(node, FixupPass)) {
    231                 fixIntOrBooleanEdge(node->child1());
    232                 fixIntOrBooleanEdge(node->child2());
     240                fixIntOrBooleanEdge(leftChild);
     241                fixIntOrBooleanEdge(rightChild);
    233242                if (bytecodeCanTruncateInteger(node->arithNodeFlags()))
    234243                    node->setArithMode(Arith::Unchecked);
     
    240249            }
    241250            if (m_graph.mulShouldSpeculateMachineInt(node, FixupPass)) {
    242                 fixEdge<Int52RepUse>(node->child1());
    243                 fixEdge<Int52RepUse>(node->child2());
     251                fixEdge<Int52RepUse>(leftChild);
     252                fixEdge<Int52RepUse>(rightChild);
    244253                if (bytecodeCanIgnoreNegativeZero(node->arithNodeFlags()))
    245254                    node->setArithMode(Arith::CheckOverflow);
     
    249258                break;
    250259            }
    251             fixDoubleOrBooleanEdge(node->child1());
    252             fixDoubleOrBooleanEdge(node->child2());
     260            fixDoubleOrBooleanEdge(leftChild);
     261            fixDoubleOrBooleanEdge(rightChild);
    253262            node->setResult(NodeResultDouble);
    254263            break;
Note: See TracChangeset for help on using the changeset viewer.