Ignore:
Timestamp:
Feb 27, 2012, 4:31:28 PM (13 years ago)
Author:
[email protected]
Message:

Implement support for op_negate and op_bitnot in the DFG JIT
https://bugs.webkit.org/show_bug.cgi?id=79617

Reviewed by Filip Pizlo.

Add an ArithNegate op to the DFG JIT, to implement op_negate.

This patch also adds support for op_negate to the JSVALUE64 baseline JIT
(JSVALUE32_64 already had this), so that we can profile the slowpath usage.

This is a 2.5%-3% Sunspider progression and a 1% win on Kraken.

  • assembler/ARMv7Assembler.h:

(JSC::ARMv7Assembler::sub_S):

  • Added sub_S from immediate.

(ARMv7Assembler):
(JSC::ARMv7Assembler::vneg):

  • Added double negate.
  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::negateDouble):

  • Added double negate.

(MacroAssemblerARMv7):
(JSC::MacroAssemblerARMv7::branchNeg32):

  • Added.
  • assembler/MacroAssemblerX86.h:

(MacroAssemblerX86):

  • moved loadDouble, absDouble to common.
  • assembler/MacroAssemblerX86Common.h:

(MacroAssemblerX86Common):
(JSC::MacroAssemblerX86Common::absDouble):

  • implementation can be shared.

(JSC::MacroAssemblerX86Common::negateDouble):

  • Added.

(JSC::MacroAssemblerX86Common::loadDouble):

  • allow absDouble to have a common implementation.
  • assembler/MacroAssemblerX86_64.h:

(MacroAssemblerX86_64):

  • moved loadDouble, absDouble to common.
  • dfg/DFGAbstractState.cpp:

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

  • support ArithNegate.
  • dfg/DFGArithNodeFlagsInferencePhase.cpp:

(JSC::DFG::ArithNodeFlagsInferencePhase::propagate):

  • support ArithNegate.
  • dfg/DFGByteCodeParser.cpp:

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

  • support ArithNegate.

(JSC::DFG::ByteCodeParser::parseBlock):

  • support op_negate.
  • dfg/DFGCSEPhase.cpp:

(JSC::DFG::CSEPhase::performNodeCSE):

  • support ArithNegate.
  • dfg/DFGCapabilities.h:

(JSC::DFG::canCompileOpcode):

  • support op_negate.
  • dfg/DFGGraph.h:

(JSC::DFG::Graph::negateShouldSpeculateInteger):

  • support ArithNegate.
  • dfg/DFGNode.h:

(JSC::DFG::Node::hasArithNodeFlags):

  • support ArithNegate.
  • dfg/DFGPredictionPropagationPhase.cpp:

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

  • support ArithNegate.
  • dfg/DFGSpeculativeJIT.cpp:

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

  • support ArithNegate.
  • dfg/DFGSpeculativeJIT.h:

(SpeculativeJIT):

  • support ArithNegate.
  • dfg/DFGSpeculativeJIT32_64.cpp:

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

  • support ArithNegate.
  • dfg/DFGSpeculativeJIT64.cpp:

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

  • support ArithNegate.
  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):

  • Add support for op_negate in JSVALUE64.
  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_negate):
(JSC::JIT::emitSlow_op_negate):

  • Add support for op_negate in JSVALUE64.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/ARMv7Assembler.h

    r106590 r109038  
    585585        OP_VMOV_IMM_T2  = 0xEEB0,
    586586        OP_VMRS         = 0xEEB0,
     587        OP_VNEG_T2      = 0xEEB0,
    587588        OP_VSQRT_T1     = 0xEEB0,
    588589        OP_B_T3a        = 0xF000,
     
    602603        OP_CMP_imm_T2   = 0xF1B0,
    603604        OP_RSB_imm_T2   = 0xF1C0,
     605        OP_RSB_S_imm_T2 = 0xF1D0,
    604606        OP_ADD_imm_T4   = 0xF200,
    605607        OP_MOV_imm_T3   = 0xF240,
     
    650652        OP_VCMPb        = 0x0A40,
    651653        OP_VCVT_FPIVFPb = 0x0A40,
     654        OP_VNEG_T2b     = 0x0A40,
    652655        OP_VSUB_T2b     = 0x0A40,
    653656        OP_VSQRT_T1b    = 0x0A40,
     
    15851588    }
    15861589
     1590    ALWAYS_INLINE void sub_S(RegisterID rd, ARMThumbImmediate imm, RegisterID rn)
     1591    {
     1592        ASSERT(rd != ARMRegisters::pc);
     1593        ASSERT(rn != ARMRegisters::pc);
     1594        ASSERT(imm.isValid());
     1595        ASSERT(imm.isUInt12());
     1596
     1597        m_formatter.twoWordOp5i6Imm4Reg4EncodedImm(OP_RSB_S_imm_T2, rn, rd, imm);
     1598    }
     1599
    15871600    // Not allowed in an IT (if then) block?
    15881601    ALWAYS_INLINE void sub_S(RegisterID rd, RegisterID rn, RegisterID rm, ShiftTypeAndAmount shift)
     
    17331746    {
    17341747        m_formatter.vfpOp(OP_VABS_T2, OP_VABS_T2b, true, VFPOperand(16), rd, rm);
     1748    }
     1749
     1750    void vneg(FPDoubleRegisterID rd, FPDoubleRegisterID rm)
     1751    {
     1752        m_formatter.vfpOp(OP_VNEG_T2, OP_VNEG_T2b, true, VFPOperand(1), rd, rm);
    17351753    }
    17361754
Note: See TracChangeset for help on using the changeset viewer.