Ignore:
Timestamp:
Jan 28, 2014, 9:43:07 AM (11 years ago)
Author:
[email protected]
Message:

Jettison DFG code when neither breakpoints or the profiler are active.
<https://webkit.org/b/127766>

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

We need to jettison the DFG CodeBlocks under the following circumstances:

  1. When adding breakpoints to a CodeBlock, jettison it if it is a DFG CodeBlock.
  2. When enabling stepping mode in a CodeBlock, jettison it if it a DFG CodeBlock.
  3. When settign the enabled profiler in the VM, we need to jettison all DFG CodeBlocks.

Instead of emitting speculation checks, the DFG code will now treat Breakpoint,
ProfileWillCall, and ProfileDidCall as no-ops similar to a Phantom node. We
still need to track these nodes so that they match the corresponding opcodes
in the baseline JIT when we jettison and OSR exit. Without them, we would OSR
exit to the wrong location in the baseline JIT code.

In DFGDriver's compileImpl() and DFGPlan's finalizeWithoutNotifyingCallback()
we fail the compilation effort with a CompilationInvalidated result. This allows
the DFG compiler to re-attampt the compilation of the function after some time
if it is hot. The CompilationInvalidated result is supposed to cause the DFG
to exercise an exponential back off before re-attempting compilation again
(see runtime/CompilationResult.h).

This patch improves the Octane score from ~2950 to ~3067.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::addBreakpoint):
(JSC::CodeBlock::setSteppingMode):

  • bytecode/CodeBlock.h:
  • debugger/Debugger.h:
  • dfg/DFGAbstractInterpreterInlines.h:

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

  • dfg/DFGClobberize.h:

(JSC::DFG::clobberize):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compileImpl):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::finalizeWithoutNotifyingCallback):

  • dfg/DFGSpeculativeJIT32_64.cpp:

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

  • dfg/DFGSpeculativeJIT64.cpp:

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

  • profiler/LegacyProfiler.cpp:

(JSC::LegacyProfiler::startProfiling):
(JSC::LegacyProfiler::stopProfiling):

  • runtime/VM.cpp:

(JSC::VM::VM):
(JSC::SetEnabledProfilerFunctor::operator()):
(JSC::VM::setEnabledProfiler):

  • runtime/VM.h:

(JSC::VM::enabledProfiler):

LayoutTests:

Added a test to exercise setting a breakpoint in 2 DFG compiled functions:
1 not inlined, and 1 inlined.

  • inspector-protocol/debugger/resources/breakpoint.js:

(notInlineable):
(inlineable):
(notInliningFoo):
(inliningFoo):
(dfgWithoutInline):
(dfgWithInline):

  • inspector-protocol/debugger/setBreakpoint-dfg-expected.txt: Added.
  • inspector-protocol/debugger/setBreakpoint-dfg.html: Added.
File:
1 edited

Legend:

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

    r159276 r162940  
    3535#include "DFGThunks.h"
    3636#include "DFGWorklist.h"
     37#include "Debugger.h"
    3738#include "JITCode.h"
    3839#include "Operations.h"
     
    7475        return CompilationFailed;
    7576   
     77    if (vm.enabledProfiler())
     78        return CompilationInvalidated;
     79
     80    Debugger* debugger = codeBlock->globalObject()->debugger();
     81    if (debugger && (debugger->isStepping() || codeBlock->baselineAlternative()->hasDebuggerRequests()))
     82        return CompilationInvalidated;
     83
    7684    if (logCompilationChanges())
    7785        dataLog("DFG(Driver) compiling ", *codeBlock, " with ", mode, ", number of instructions = ", codeBlock->instructionCount(), "\n");
Note: See TracChangeset for help on using the changeset viewer.