Change ScriptDebugServer to use DebuggerCallFrame instead of JavaScriptCallFrame.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Oct 2013 00:51:31 +0000 (00:51 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Oct 2013 00:51:31 +0000 (00:51 +0000)
commit206d17dc75ca1fdb40203cf09fff607a5c55f52e
tree7a640abcd6c482967cf3b625a4301061ccb41178
parente27a122a7179b1e1757014e5001b2bac1f550e0a
Change ScriptDebugServer to use DebuggerCallFrame instead of JavaScriptCallFrame.
https://bugs.webkit.org/show_bug.cgi?id=121969.

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

1. Make JavaScriptCallFrame a thin shell around the DebuggerCallFrame.
   DebuggerCallFrame now tracks whether it is valid instead of needing
   JavaScriptCallFrame do it.
2. ScriptDebugServer now only instantiates an DebuggerCallFrame when needed
   just before it pauses and calls back to its client, and then invalidates
   it immediately when the callback returns. Every subsequent callback to
   the client will use a new instance of the DebuggerCallFrame.
3. Similarly, ScriptDebugServer now only creates a JavaScriptCallFrame when
   it "pauses".
4. DebuggerCallFrame only creates its caller DebuggerCallFrame when
   it is needed i.e. when the client calls callerFrame(). Similarly,
   JavaScriptCallFrame only creates its caller when it's requested.
5. DebuggerCallFrame's line() and column() now returns a base-zero int.
6. WebScriptDebugDelegate now only caches the functionName of the frame
   instead of the entire DebuggerCallFrame because that is all that is
   needed.
7. Also removed evaluateInGlobalCallFrame() which is not used anywhere.

* debugger/Debugger.cpp:
* debugger/Debugger.h:
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::DebuggerCallFrame):
(JSC::DebuggerCallFrame::callerFrame):
(JSC::DebuggerCallFrame::dynamicGlobalObject):
(JSC::DebuggerCallFrame::sourceId):
(JSC::DebuggerCallFrame::functionName):
(JSC::DebuggerCallFrame::scope):
(JSC::DebuggerCallFrame::type):
(JSC::DebuggerCallFrame::thisValue):
(JSC::DebuggerCallFrame::evaluate):
(JSC::DebuggerCallFrame::evaluateWithCallFrame):
(JSC::DebuggerCallFrame::invalidate):
(JSC::DebuggerCallFrame::positionForCallFrame):
(JSC::DebuggerCallFrame::sourceIdForCallFrame):
(JSC::DebuggerCallFrame::thisValueForCallFrame):
* debugger/DebuggerCallFrame.h:
(JSC::DebuggerCallFrame::create):
(JSC::DebuggerCallFrame::exec):
(JSC::DebuggerCallFrame::line):
(JSC::DebuggerCallFrame::column):
(JSC::DebuggerCallFrame::position):
(JSC::DebuggerCallFrame::isValid):
* interpreter/StackVisitor.cpp:

Source/WebCore:

Tests: inspector-protocol/debugger/call-frame-function-name.html
       inspector-protocol/debugger/call-frame-this-host.html
       inspector-protocol/debugger/call-frame-this-nonstrict.html
       inspector-protocol/debugger/call-frame-this-strict.html

1. Make JavaScriptCallFrame a thin shell around the DebuggerCallFrame.
   DebuggerCallFrame now tracks whether it is valid instead of needing
   JavaScriptCallFrame do it.
2. ScriptDebugServer now only instantiates an DebuggerCallFrame when needed
   just before it pauses and calls back to its client, and then invalidates
   it immediately when the callback returns. Every subsequent callback to
   the client will use a new instance of the DebuggerCallFrame.
3. Similarly, ScriptDebugServer now only creates a JavaScriptCallFrame when
   it "pauses".
4. DebuggerCallFrame only creates its caller DebuggerCallFrame when
   it is needed i.e. when the client calls callerFrame(). Similarly,
   JavaScriptCallFrame only creates its caller when it's requested.
5. DebuggerCallFrame's line() and column() now returns a base-zero int.
6. WebScriptDebugDelegate now only caches the functionName of the frame
   instead of the entire DebuggerCallFrame because that is all that is
   needed.
7. Also removed evaluateInGlobalCallFrame() which is not used anywhere.

* bindings/js/JSJavaScriptCallFrameCustom.cpp:
(WebCore::JSJavaScriptCallFrame::thisObject):
* bindings/js/JavaScriptCallFrame.cpp:
(WebCore::JavaScriptCallFrame::JavaScriptCallFrame):
(WebCore::JavaScriptCallFrame::caller):
* bindings/js/JavaScriptCallFrame.h:
(WebCore::JavaScriptCallFrame::create):
(WebCore::JavaScriptCallFrame::sourceID):
(WebCore::JavaScriptCallFrame::position):
(WebCore::JavaScriptCallFrame::line):
(WebCore::JavaScriptCallFrame::column):
(WebCore::JavaScriptCallFrame::functionName):
(WebCore::JavaScriptCallFrame::type):
(WebCore::JavaScriptCallFrame::scopeChain):
(WebCore::JavaScriptCallFrame::dynamicGlobalObject):
(WebCore::JavaScriptCallFrame::thisValue):
(WebCore::JavaScriptCallFrame::evaluate):
* bindings/js/ScriptDebugServer.cpp:
(WebCore::DebuggerCallFrameScope::DebuggerCallFrameScope):
(WebCore::DebuggerCallFrameScope::~DebuggerCallFrameScope):
(WebCore::ScriptDebugServer::ScriptDebugServer):
(WebCore::ScriptDebugServer::setBreakpoint):
(WebCore::ScriptDebugServer::removeBreakpoint):
(WebCore::ScriptDebugServer::hasBreakpoint):
(WebCore::ScriptDebugServer::evaluateBreakpointAction):
(WebCore::ScriptDebugServer::breakProgram):
(WebCore::ScriptDebugServer::stepOverStatement):
(WebCore::ScriptDebugServer::stepOutOfFunction):
(WebCore::ScriptDebugServer::currentDebuggerCallFrame):
(WebCore::ScriptDebugServer::dispatchDidPause):
(WebCore::ScriptDebugServer::updateCallFrame):
(WebCore::ScriptDebugServer::updateCallFrameAndPauseIfNeeded):
(WebCore::ScriptDebugServer::pauseIfNeeded):
(WebCore::ScriptDebugServer::callEvent):
(WebCore::ScriptDebugServer::returnEvent):
(WebCore::ScriptDebugServer::willExecuteProgram):
(WebCore::ScriptDebugServer::didExecuteProgram):
* bindings/js/ScriptDebugServer.h:
* bindings/js/WorkerScriptDebugServer.cpp:
(WebCore::WorkerScriptDebugServer::willExecuteProgram):

Source/WebKit/mac:

1. Make JavaScriptCallFrame a thin shell around the DebuggerCallFrame.
   DebuggerCallFrame now tracks whether it is valid instead of needing
   JavaScriptCallFrame do it.
2. ScriptDebugServer now only instantiates an DebuggerCallFrame when needed
   just before it pauses and calls back to its client, and then invalidates
   it immediately when the callback returns. Every subsequent callback to
   the client will use a new instance of the DebuggerCallFrame.
3. Similarly, ScriptDebugServer now only creates a JavaScriptCallFrame when
   it "pauses".
4. DebuggerCallFrame only creates its caller DebuggerCallFrame when
   it is needed i.e. when the client calls callerFrame(). Similarly,
   JavaScriptCallFrame only creates its caller when it's requested.
5. DebuggerCallFrame's line() and column() now returns a base-zero int.
6. WebScriptDebugDelegate now only caches the functionName of the frame
   instead of the entire DebuggerCallFrame because that is all that is
   needed.
7. Also removed evaluateInGlobalCallFrame() which is not used anywhere.

* WebView/WebScriptDebugDelegate.mm:
(-[WebScriptCallFramePrivate dealloc]):
(-[WebScriptCallFrame _initWithGlobalObject:functionName:exceptionValue:JSC::]):
(-[WebScriptCallFrame functionName]):
(-[WebScriptCallFrame exception]):
* WebView/WebScriptDebugger.mm:
(WebScriptDebugger::exception):

LayoutTests:

* http/tests/inspector/debugger-test.js:
(initialize_DebuggerTest):
* inspector-protocol/debugger/call-frame-function-name-expected.txt: Added.
* inspector-protocol/debugger/call-frame-function-name.html: Added.
* inspector-protocol/debugger/call-frame-this-host-expected.txt: Added.
* inspector-protocol/debugger/call-frame-this-host.html: Added.
* inspector-protocol/debugger/call-frame-this-nonstrict-expected.txt: Added.
* inspector-protocol/debugger/call-frame-this-nonstrict.html: Added.
* inspector-protocol/debugger/call-frame-this-strict-expected.txt: Added.
* inspector-protocol/debugger/call-frame-this-strict.html: Added.
* inspector/debugger/pause-in-internal-script-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156936 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/debugger-test.js
LayoutTests/inspector-protocol/debugger/call-frame-function-name-expected.txt [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/call-frame-function-name.html [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/call-frame-this-host-expected.txt [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/call-frame-this-host.html [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/call-frame-this-nonstrict-expected.txt [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/call-frame-this-nonstrict.html [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/call-frame-this-strict-expected.txt [new file with mode: 0644]
LayoutTests/inspector-protocol/debugger/call-frame-this-strict.html [new file with mode: 0644]
LayoutTests/inspector/debugger/pause-in-internal-script-expected.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/debugger/Debugger.cpp
Source/JavaScriptCore/debugger/Debugger.h
Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
Source/JavaScriptCore/debugger/DebuggerCallFrame.h
Source/JavaScriptCore/interpreter/StackVisitor.cpp
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
Source/WebCore/bindings/js/JavaScriptCallFrame.cpp
Source/WebCore/bindings/js/JavaScriptCallFrame.h
Source/WebCore/bindings/js/ScriptDebugServer.cpp
Source/WebCore/bindings/js/ScriptDebugServer.h
Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm
Source/WebKit/mac/WebView/WebScriptDebugger.mm