Ignore:
Timestamp:
Oct 14, 2016, 7:19:16 PM (9 years ago)
Author:
[email protected]
Message:

[JSC] op_negate should with any type
https://bugs.webkit.org/show_bug.cgi?id=162587

Patch by Benjamin Poulain <[email protected]> on 2016-10-14
Reviewed by Saam Barati.

JSTests:

  • stress/arith-abs-to-arith-negate-range-optimizaton.js: Added.

Cover OSR Exits when converting Math.abs() into ArithNegate.

  • stress/arith-negate-on-various-types.js: Added.

Cover ArithNegate with all types.

Source/JavaScriptCore:

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
ArithNegate is quite simple. If the input is double, the output
is double. The other cases are set from the LLInt slow case.

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::makeSafe):

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGFixupPhase.cpp:

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

  • dfg/DFGIntegerRangeOptimizationPhase.cpp:

Tweak a bit the IntegerRangeOptimizationPhase when simplifying
ArithAbs to ArithNegate.
We should not do the conversion if the target nodes OSR Exits
on different input than the source node.

In particular, Checked ArithNegate exits on zero while
ArithAbs has not problem with it.
Unchecked ArithAbs() do not OSR Exit on INT_MIN, ArithNeg
should not either.

  • dfg/DFGPredictionPropagationPhase.cpp:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileArithNegate):
(JSC::DFG::SpeculativeJIT::compileMathIC):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::callOperation):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileMathIC):
(JSC::FTL::DFG::LowerDFGToB3::compileArithNegate):

  • jit/JITNegGenerator.cpp:

(JSC::JITNegGenerator::generateFastPath):

  • jit/JITOperations.cpp:

Add result profiling in baseline to have types we can use
in DFG and FTL.

File:
1 edited

Legend:

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

    r198621 r207369  
    12531253                        break;
    12541254                    }
    1255                     if (maxValue <= 0) {
     1255                    bool absIsUnchecked = !shouldCheckOverflow(node->arithMode());
     1256                    if (maxValue < 0 || (absIsUnchecked && maxValue <= 0)) {
    12561257                        node->convertToArithNegate();
    1257                         if (minValue > std::numeric_limits<int>::min())
     1258                        if (absIsUnchecked || minValue > std::numeric_limits<int>::min())
    12581259                            node->setArithMode(Arith::Unchecked);
    12591260                        changed = true;
Note: See TracChangeset for help on using the changeset viewer.