Changeset 148893 in webkit for trunk/Source/JavaScriptCore/jit


Ignore:
Timestamp:
Apr 22, 2013, 10:37:29 AM (12 years ago)
Author:
[email protected]
Message:

Change baseline JIT watchdog timer check to use the proper fast slow path
infrastructure.
https://bugs.webkit.org/show_bug.cgi?id=114963.

Reviewed by Oliver Hunt.

SH4 parts contributed by Julien Brianceau.

  • assembler/ARMAssembler.h:
  • assembler/MacroAssemblerARM.h:
  • assembler/MacroAssemblerARMv7.h:
  • assembler/MacroAssemblerMIPS.h:

(JSC::MacroAssemblerMIPS::branchAdd32):

  • assembler/MacroAssemblerSH4.h:

(JSC::MacroAssemblerSH4::branchAdd32):

  • assembler/MacroAssemblerX86Common.h:
  • assembler/SH4Assembler.h:
  • jit/JIT.cpp:

(JSC::JIT::emitEnterOptimizationCheck):
(JSC::JIT::privateCompileSlowCases):

  • jit/JIT.h:

(JSC::JIT::emitEnterOptimizationCheck):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_loop_hint):
(JSC::JIT::emitSlow_op_loop_hint):
(JSC::JIT::emit_op_enter):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_enter):

Location:
trunk/Source/JavaScriptCore/jit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r148696 r148893  
    104104
    105105#if ENABLE(DFG_JIT)
    106 void JIT::emitOptimizationCheck(OptimizationCheckKind kind)
     106void JIT::emitEnterOptimizationCheck()
    107107{
    108108    if (!canBeOptimized())
    109109        return;
    110    
    111     Jump skipOptimize = branchAdd32(Signed, TrustedImm32(kind == LoopOptimizationCheck ? Options::executionCounterIncrementForLoop() : Options::executionCounterIncrementForReturn()), AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter()));
     110
     111    Jump skipOptimize = branchAdd32(Signed, TrustedImm32(Options::executionCounterIncrementForReturn()), AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter()));
    112112    JITStubCall stubCall(this, cti_optimize);
    113113    stubCall.addArgument(TrustedImm32(m_bytecodeOffset));
    114     if (kind == EnterOptimizationCheck)
    115         ASSERT(!m_bytecodeOffset);
     114    ASSERT(!m_bytecodeOffset);
    116115    stubCall.call();
    117116    skipOptimize.link(this);
    118117}
    119118#endif
    120 
    121 void JIT::emitWatchdogTimerCheck()
    122 {
    123     if (!m_vm->watchdog.isEnabled())
    124         return;
    125 
    126     Jump skipCheck = branchTest8(Zero, AbsoluteAddress(m_vm->watchdog.timerDidFireAddress()));
    127     JITStubCall stubCall(this, cti_handle_watchdog_timer);
    128     stubCall.call();
    129     skipCheck.link(this);
    130 }
    131119
    132120#define NEXT_OPCODE(name) \
     
    474462        DEFINE_SLOWCASE_OP(op_jngreatereq)
    475463        DEFINE_SLOWCASE_OP(op_jtrue)
     464        DEFINE_SLOWCASE_OP(op_loop_hint)
    476465        DEFINE_SLOWCASE_OP(op_lshift)
    477466        DEFINE_SLOWCASE_OP(op_mod)
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r148696 r148893  
    781781        void emitSlow_op_jngreatereq(Instruction*, Vector<SlowCaseEntry>::iterator&);
    782782        void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&);
     783        void emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator&);
    783784        void emitSlow_op_lshift(Instruction*, Vector<SlowCaseEntry>::iterator&);
    784785        void emitSlow_op_mod(Instruction*, Vector<SlowCaseEntry>::iterator&);
     
    853854        void emitLoadCharacterString(RegisterID src, RegisterID dst, JumpList& failures);
    854855       
    855         enum OptimizationCheckKind { LoopOptimizationCheck, EnterOptimizationCheck };
    856856#if ENABLE(DFG_JIT)
    857         void emitOptimizationCheck(OptimizationCheckKind);
    858 #else
    859         void emitOptimizationCheck(OptimizationCheckKind) { }
    860 #endif
    861         void emitWatchdogTimerCheck();
     857        void emitEnterOptimizationCheck();
     858#else
     859        void emitEnterOptimizationCheck() { }
     860#endif
    862861
    863862#ifndef NDEBUG
     
    945944    } JIT_CLASS_ALIGNMENT;
    946945
    947     inline void JIT::emit_op_loop_hint(Instruction*)
    948     {
    949         emitWatchdogTimerCheck();
    950         emitOptimizationCheck(LoopOptimizationCheck);
    951     }
    952 
    953946} // namespace JSC
    954947
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r148711 r148893  
    482482}
    483483
     484void JIT::emit_op_loop_hint(Instruction*)
     485{
     486    // Emit the watchdog timer check:
     487    if (m_vm->watchdog.isEnabled())
     488        addSlowCase(branchTest8(NonZero, AbsoluteAddress(m_vm->watchdog.timerDidFireAddress())));
     489
     490    // Emit the JIT optimization check:
     491    if (canBeOptimized())
     492        addSlowCase(branchAdd32(PositiveOrZero, TrustedImm32(Options::executionCounterIncrementForLoop()),
     493            AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter())));
     494}
     495
     496void JIT::emitSlow_op_loop_hint(Instruction*, Vector<SlowCaseEntry>::iterator& iter)
     497{
     498    // Emit the slow path of the watchdog timer check:
     499    if (m_vm->watchdog.isEnabled()) {
     500        linkSlowCase(iter);
     501
     502        JITStubCall stubCall(this, cti_handle_watchdog_timer);
     503        stubCall.call();
     504
     505#if ENABLE(DFG_JIT)
     506        if (canBeOptimized()) {
     507            Jump doOptimize = branchAdd32(PositiveOrZero, TrustedImm32(Options::executionCounterIncrementForLoop()),
     508                AbsoluteAddress(m_codeBlock->addressOfJITExecuteCounter()));
     509            emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint));
     510            doOptimize.link(this);
     511        } else
     512#endif
     513            emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint));
     514    }
     515
     516#if ENABLE(DFG_JIT)
     517    // Emit the slow path for the JIT optimization check:
     518    if (canBeOptimized()) {
     519        linkSlowCase(iter);
     520
     521        JITStubCall stubCall(this, cti_optimize);
     522        stubCall.addArgument(TrustedImm32(m_bytecodeOffset));
     523        stubCall.call();
     524
     525        emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_loop_hint));
     526    }
     527#endif
     528}
     529
    484530void JIT::emit_op_neq(Instruction* currentInstruction)
    485531{
     
    864910void JIT::emit_op_enter(Instruction*)
    865911{
    866     emitOptimizationCheck(EnterOptimizationCheck);
     912    emitEnterOptimizationCheck();
    867913   
    868914    // Even though CTI doesn't use them, we initialize our constant
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r148696 r148893  
    11141114void JIT::emit_op_enter(Instruction*)
    11151115{
    1116     emitOptimizationCheck(EnterOptimizationCheck);
     1116    emitEnterOptimizationCheck();
    11171117   
    11181118    // Even though JIT code doesn't use them, we initialize our constant
Note: See TracChangeset for help on using the changeset viewer.