Avoid JSC debugger overhead unless needed.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Oct 2013 22:00:40 +0000 (22:00 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Oct 2013 22:00:40 +0000 (22:00 +0000)
commit7af29cbfbdf05616e9d8ead41a3e16d6312192a8
treeef6951d7bf87f539a40599f813b2f1c05565e5b1
parent8c32c11ea1c7f047596a03874288c53d86344c56
Avoid JSC debugger overhead unless needed.
https://bugs.webkit.org/show_bug.cgi?id=123084.

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

- If no breakpoints are set, we now avoid calling the debug hook callbacks.
- If no break on exception is set, we also avoid exception event debug callbacks.
- When we return from the ScriptDebugServer to the JSC::Debugger, we may no
  longer call the debug hook callbacks if not needed. Hence, the m_currentCallFrame
  pointer in the ScriptDebugServer may become stale. To avoid this issue, before
  returning, the ScriptDebugServer will clear its m_currentCallFrame if
  needsOpDebugCallbacks() is false.

* debugger/Debugger.cpp:
(JSC::Debugger::Debugger):
(JSC::Debugger::setNeedsExceptionCallbacks):
(JSC::Debugger::setShouldPause):
(JSC::Debugger::updateNumberOfBreakpoints):
(JSC::Debugger::updateNeedForOpDebugCallbacks):
* debugger/Debugger.h:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::unwind):
(JSC::Interpreter::debug):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_debug):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_debug):
* llint/LLIntOffsetsExtractor.cpp:
* llint/LowLevelInterpreter.asm:

Source/WebCore:

No new tests.

- If no breakpoints are set, we now avoid calling the debug hook callbacks.
- If no break on exception is set, we also avoid exception event debug callbacks.
- When we return from the ScriptDebugServer to the JSC::Debugger, we may no
  longer call the debug hook callbacks if not needed. Hence, the m_currentCallFrame
  pointer in the ScriptDebugServer may become stale. To avoid this issue, before
  returning, the ScriptDebugServer will clear its m_currentCallFrame if
  needsOpDebugCallbacks() is false.

* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::setBreakpoint):
(WebCore::ScriptDebugServer::removeBreakpoint):
(WebCore::ScriptDebugServer::clearBreakpoints):
(WebCore::ScriptDebugServer::setPauseOnExceptionsState):
(WebCore::ScriptDebugServer::setPauseOnNextStatement):
(WebCore::ScriptDebugServer::breakProgram):
(WebCore::ScriptDebugServer::stepIntoStatement):
(WebCore::ScriptDebugServer::dispatchDidContinue):
(WebCore::ScriptDebugServer::exception):
(WebCore::ScriptDebugServer::didReachBreakpoint):
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::reset):

Source/WebKit/mac:

* WebView/WebScriptDebugger.mm:
(WebScriptDebugger::WebScriptDebugger):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/debugger/Debugger.cpp
Source/JavaScriptCore/debugger/Debugger.h
Source/JavaScriptCore/interpreter/Interpreter.cpp
Source/JavaScriptCore/jit/JITOpcodes.cpp
Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp
Source/JavaScriptCore/llint/LowLevelInterpreter.asm
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/ScriptDebugServer.cpp
Source/WebCore/inspector/InspectorDebuggerAgent.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebScriptDebugger.mm