Changeset 188649 in webkit


Ignore:
Timestamp:
Aug 19, 2015, 2:18:15 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

Add support for CheckWatchdogTimer as slow path in DFG and FTL.
https://bugs.webkit.org/show_bug.cgi?id=147968

Reviewed by Michael Saboff.

Re-implement the DFG's CheckWatchdogTimer as a slow path instead of a speculation
check. Since the watchdog timer can fire spuriously, this allows the code to
stay optimized if all we have are spurious fires.

Implement the equivalent slow path for CheckWatchdogTimer in the FTL.

The watchdog tests in ExecutionTimeLimitTest.cpp has already been updated in
https://bugs.webkit.org/show_bug.cgi?id=148125 to test for the FTL's watchdog
implementation.

  • dfg/DFGSpeculativeJIT32_64.cpp:

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

  • dfg/DFGSpeculativeJIT64.cpp:

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

  • ftl/FTLCapabilities.cpp:

(JSC::FTL::canCompile):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::DFG::LowerDFGToLLVM::compileNode):
(JSC::FTL::DFG::LowerDFGToLLVM::compileMaterializeCreateActivation):
(JSC::FTL::DFG::LowerDFGToLLVM::compileCheckWatchdogTimer):
(JSC::FTL::DFG::LowerDFGToLLVM::isInlinableSize):

  • jit/JIT.h:
  • jit/JITInlines.h:

(JSC::JIT::callOperation):

  • jit/JITOperations.cpp:
  • jit/JITOperations.h:
  • Changed operationHandleWatchdogTimer() to return an unused nullptr. This allows me to reuse the existing DFG slow path generator mechanism. I didn't think that operationHandleWatchdogTimer() was worth introducing a whole new set of machinery just so we can have a slow path that returns void.
Location:
trunk/Source/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Source/JavaScriptCore/ChangeLog

    r188648 r188649  
     12015-08-19  Mark Lam  <mark.lam@apple.com>
     2
     3        Add support for CheckWatchdogTimer as slow path in DFG and FTL.
     4        https://bugs.webkit.org/show_bug.cgi?id=147968
     5
     6        Reviewed by Michael Saboff.
     7
     8        Re-implement the DFG's CheckWatchdogTimer as a slow path instead of a speculation
     9        check.  Since the watchdog timer can fire spuriously, this allows the code to
     10        stay optimized if all we have are spurious fires.
     11
     12        Implement the equivalent slow path for CheckWatchdogTimer in the FTL.
     13
     14        The watchdog tests in ExecutionTimeLimitTest.cpp has already been updated in
     15        https://bugs.webkit.org/show_bug.cgi?id=148125 to test for the FTL's watchdog
     16        implementation.
     17
     18        * dfg/DFGSpeculativeJIT32_64.cpp:
     19        (JSC::DFG::SpeculativeJIT::compile):
     20        * dfg/DFGSpeculativeJIT64.cpp:
     21        (JSC::DFG::SpeculativeJIT::compile):
     22        * ftl/FTLCapabilities.cpp:
     23        (JSC::FTL::canCompile):
     24        * ftl/FTLLowerDFGToLLVM.cpp:
     25        (JSC::FTL::DFG::LowerDFGToLLVM::compileNode):
     26        (JSC::FTL::DFG::LowerDFGToLLVM::compileMaterializeCreateActivation):
     27        (JSC::FTL::DFG::LowerDFGToLLVM::compileCheckWatchdogTimer):
     28        (JSC::FTL::DFG::LowerDFGToLLVM::isInlinableSize):
     29
     30        * jit/JIT.h:
     31        * jit/JITInlines.h:
     32        (JSC::JIT::callOperation):
     33        * jit/JITOperations.cpp:
     34        * jit/JITOperations.h:
     35        - Changed operationHandleWatchdogTimer() to return an unused nullptr.  This
     36          allows me to reuse the existing DFG slow path generator mechanism.  I didn't
     37          think that operationHandleWatchdogTimer() was worth introducing a whole new set
     38          of machinery just so we can have a slow path that returns void.
     39
    1402015-08-19  Mark Lam  <mark.lam@apple.com>
    241
  • TabularUnified trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r188624 r188649  
    46414641        break;
    46424642
    4643     case CheckWatchdogTimer:
     4643    case CheckWatchdogTimer: {
    46444644        ASSERT(m_jit.vm()->watchdog);
    4645         speculationCheck(
    4646             WatchdogTimerFired, JSValueRegs(), 0,
    4647             m_jit.branchTest8(
    4648                 JITCompiler::NonZero,
    4649                 JITCompiler::AbsoluteAddress(m_jit.vm()->watchdog->timerDidFireAddress())));
    4650         break;
     4645        GPRTemporary unused(this);
     4646        GPRReg unusedGPR = unused.gpr();
     4647       
     4648        JITCompiler::Jump timerDidFire = m_jit.branchTest8(JITCompiler::NonZero,
     4649            JITCompiler::AbsoluteAddress(m_jit.vm()->watchdog->timerDidFireAddress()));
     4650       
     4651        addSlowPathGenerator(slowPathCall(timerDidFire, this, operationHandleWatchdogTimer, unusedGPR));
     4652        break;
     4653    }
    46514654
    46524655    case CountExecution:
  • TabularUnified trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r188624 r188649  
    43304330        break;
    43314331
    4332     case CheckWatchdogTimer:
     4332    case CheckWatchdogTimer: {
    43334333        ASSERT(m_jit.vm()->watchdog);
    4334         speculationCheck(
    4335             WatchdogTimerFired, JSValueRegs(), 0,
    4336             m_jit.branchTest8(
    4337                 JITCompiler::NonZero,
    4338                 JITCompiler::AbsoluteAddress(m_jit.vm()->watchdog->timerDidFireAddress())));
    4339         break;
     4334        GPRTemporary unused(this);
     4335        GPRReg unusedGPR = unused.gpr();
     4336
     4337        JITCompiler::Jump timerDidFire = m_jit.branchTest8(JITCompiler::NonZero,
     4338            JITCompiler::AbsoluteAddress(m_jit.vm()->watchdog->timerDidFireAddress()));
     4339
     4340        addSlowPathGenerator(slowPathCall(timerDidFire, this, operationHandleWatchdogTimer, unusedGPR));
     4341        break;
     4342    }
    43404343
    43414344    case Phantom:
  • TabularUnified trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp

    r188624 r188649  
    120120    case CheckNotEmpty:
    121121    case CheckIdent:
     122    case CheckWatchdogTimer:
    122123    case StringCharCodeAt:
    123124    case AllocatePropertyStorage:
  • TabularUnified trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp

    r188624 r188649  
    5252#include "ScopedArgumentsTable.h"
    5353#include "VirtualRegister.h"
     54#include "Watchdog.h"
    5455#include <atomic>
    5556#include <dlfcn.h>
     
    829830        case MaterializeCreateActivation:
    830831            compileMaterializeCreateActivation();
     832            break;
     833        case CheckWatchdogTimer:
     834            compileCheckWatchdogTimer();
    831835            break;
    832836
     
    54295433    }
    54305434
     5435    void compileCheckWatchdogTimer()
     5436    {
     5437        LBasicBlock timerDidFire = FTL_NEW_BLOCK(m_out, ("CheckWatchdogTimer timer did fire"));
     5438        LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("CheckWatchdogTimer continuation"));
     5439       
     5440        LValue state = m_out.load8(m_out.absolute(vm().watchdog->timerDidFireAddress()));
     5441        m_out.branch(m_out.equal(state, m_out.constInt8(0)),
     5442            usually(continuation), rarely(timerDidFire));
     5443
     5444        LBasicBlock lastNext = m_out.appendTo(timerDidFire, continuation);
     5445
     5446        vmCall(m_out.operation(operationHandleWatchdogTimer), m_callFrame);
     5447        m_out.jump(continuation);
     5448       
     5449        m_out.appendTo(continuation, lastNext);
     5450    }
     5451
    54315452    bool isInlinableSize(LValue function)
    54325453    {
  • TabularUnified trunk/Source/JavaScriptCore/jit/JIT.h

    r188545 r188649  
    740740        MacroAssembler::Call callOperation(J_JITOperation_EZ, int, int32_t);
    741741        MacroAssembler::Call callOperation(J_JITOperation_EZZ, int, int32_t, int32_t);
     742        MacroAssembler::Call callOperation(P_JITOperation_E);
    742743        MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, size_t);
    743744        MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID);
  • TabularUnified trunk/Source/JavaScriptCore/jit/JITInlines.h

    r188545 r188649  
    188188}
    189189
     190ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(P_JITOperation_E operation)
     191{
     192    setupArgumentsExecState();
     193    return appendCallWithExceptionCheck(operation);
     194}
     195
    190196ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_E operation)
    191197{
  • TabularUnified trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r188545 r188649  
    989989}
    990990
    991 void JIT_OPERATION operationHandleWatchdogTimer(ExecState* exec)
     991// The only reason for returning an UnusedPtr (instead of void) is so that we can reuse the
     992// existing DFG slow path generator machinery when creating the slow path for CheckWatchdogTimer
     993// in the DFG. If a DFG slow path generator that supports a void return type is added in the
     994// future, we can switch to using that then.
     995UnusedPtr JIT_OPERATION operationHandleWatchdogTimer(ExecState* exec)
    992996{
    993997    VM& vm = exec->vm();
     
    9961000    if (UNLIKELY(vm.watchdog && vm.watchdog->didFire(exec)))
    9971001        vm.throwException(exec, createTerminatedExecutionException(&vm));
     1002
     1003    return nullptr;
    9981004}
    9991005
  • TabularUnified trunk/Source/JavaScriptCore/jit/JITOperations.h

    r188545 r188649  
    5151
    5252extern "C" {
     53
     54typedef char* UnusedPtr;
    5355
    5456// These typedefs provide typechecking when generating calls out to helper routines;
     
    294296JSCell* JIT_OPERATION operationNewObject(ExecState*, Structure*) WTF_INTERNAL;
    295297EncodedJSValue JIT_OPERATION operationNewRegexp(ExecState*, void*) WTF_INTERNAL;
    296 void JIT_OPERATION operationHandleWatchdogTimer(ExecState*) WTF_INTERNAL;
     298UnusedPtr JIT_OPERATION operationHandleWatchdogTimer(ExecState*) WTF_INTERNAL;
    297299void JIT_OPERATION operationThrowStaticError(ExecState*, EncodedJSValue, int32_t) WTF_INTERNAL;
    298300void JIT_OPERATION operationThrow(ExecState*, EncodedJSValue) WTF_INTERNAL;
Note: See TracChangeset for help on using the changeset viewer.