Ignore:
Timestamp:
Jan 28, 2014, 9:43:07 AM (12 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/DFGClobberize.h

    r162718 r162940  
    8989    case Identity:
    9090    case Phantom:
     91    case Breakpoint:
     92    case ProfileWillCall:
     93    case ProfileDidCall:
    9194    case BitAnd:
    9295    case BitOr:
     
    619622        return;
    620623       
    621     case Breakpoint:
    622     case ProfileWillCall:
    623     case ProfileDidCall:
    624624    case CountExecution:
    625625    case CheckWatchdogTimer:
Note: See TracChangeset for help on using the changeset viewer.