Changeset 202717 in webkit for trunk/Source/JavaScriptCore/debugger/DebuggerLocation.h
- Timestamp:
- Jun 30, 2016, 4:24:58 PM (9 years ago)
- Author:
- [email protected]
- Message:
-
Web Inspector: Wrong function name next to scope
https://bugs.webkit.org/show_bug.cgi?id=158210
<rdar://problem/26543093>
Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-06-30
Reviewed by Timothy Hatcher.
Source/JavaScriptCore:
- CMakeLists.txt:
- JavaScriptCore.xcodeproj/project.pbxproj:
Add DebuggerLocation. A helper for describing a unique location.
- bytecode/CodeBlock.cpp:
(JSC::CodeBlock::setConstantRegisters):
When compiled with debug info, add a SymbolTable rare data pointer
back to the CodeBlock. This will be used later to get JSScope debug
info if Web Inspector pauses.
- runtime/SymbolTable.h:
- runtime/SymbolTable.cpp:
(JSC::SymbolTable::cloneScopePart):
(JSC::SymbolTable::prepareForTypeProfiling):
(JSC::SymbolTable::uniqueIDForVariable):
(JSC::SymbolTable::uniqueIDForOffset):
(JSC::SymbolTable::globalTypeSetForOffset):
(JSC::SymbolTable::globalTypeSetForVariable):
Rename rareData and include a CodeBlock pointer.
(JSC::SymbolTable::rareDataCodeBlock):
(JSC::SymbolTable::setRareDataCodeBlock):
Setter and getter for the rare data. It should only be set once.
(JSC::SymbolTable::visitChildren):
Visit the rare data code block if we have one.
- runtime/JSSymbolTableObject.h:
- runtime/JSSymbolTableObject.cpp:
(JSC::JSSymbolTableObject::deleteProperty):
(JSC::JSSymbolTableObject::getOwnNonIndexPropertyNames):
Give JSSymbolTable its own class info. JSWithScope was unexpectedly
inheriting from JSSymbolTable since it did not have its own and
was using JSScope's class info. Also do a bit of cleanup.
- debugger/DebuggerLocation.cpp: Added.
(JSC::DebuggerLocation::DebuggerLocation):
- debugger/DebuggerLocation.h: Added.
(JSC::DebuggerLocation::DebuggerLocation):
Construction from a ScriptExecutable.
- runtime/JSScope.cpp:
(JSC::JSScope::symbolTable):
- runtime/JSScope.h:
- debugger/DebuggerScope.h:
- debugger/DebuggerScope.cpp:
(JSC::DebuggerScope::name):
(JSC::DebuggerScope::location):
Name and location for a scope. This uses:
JSScope -> SymbolTable -> CodeBlock -> Executable
- inspector/protocol/Debugger.json:
- inspector/InjectedScriptSource.js:
(InjectedScript.CallFrameProxy.prototype._wrapScopeChain):
(InjectedScript.CallFrameProxy._createScopeJson):
- inspector/JSJavaScriptCallFrame.cpp:
(Inspector::valueForScopeType):
(Inspector::valueForScopeLocation):
(Inspector::JSJavaScriptCallFrame::scopeDescriptions):
(Inspector::JSJavaScriptCallFrame::scopeType): Deleted.
- inspector/JSJavaScriptCallFrame.h:
- inspector/JSJavaScriptCallFramePrototype.cpp:
(Inspector::JSJavaScriptCallFramePrototype::finishCreation):
(Inspector::jsJavaScriptCallFramePrototypeFunctionScopeDescriptions):
(Inspector::jsJavaScriptCallFramePrototypeFunctionScopeType): Deleted.
Simplify this code to build the objects we will send across the protocol
to descript a Scope.
Source/WebInspectorUI:
- UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype._scopeChainNodeFromPayload):
Include new payload data in the construction call.
All the new data is optional, so we gracefully handle
legacy backends.
- UserInterface/Models/ScopeChainNode.js:
(WebInspector.ScopeChainNode):
(WebInspector.ScopeChainNode.prototype.get type):
(WebInspector.ScopeChainNode.prototype.get objects):
(WebInspector.ScopeChainNode.prototype.get name):
(WebInspector.ScopeChainNode.prototype.get location):
(WebInspector.ScopeChainNode.prototype.get hash):
Hash is a rough (name:sourceId:line:column) string for quick comparisons.
(WebInspector.ScopeChainNode.prototype.makeLocalScope):
Make this an action you take on a scope, to avoid having to
do it at construction time, or making it a generic setting.
- UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
(WebInspector.ScopeChainDetailsSidebarPanel.prototype._generateCallFramesSection):
This was wrong before. Move the work to CallFrame
and change it to be correct.
- UserInterface/CallFrame.js:
(WebInspector.CallFrame.prototype.mergedScopeChain):
This transforms the scope chain for a call frame from:
scope1 scope2 scope3 scope4 scope5 scope6 scope7
foo foo foo bar bar - -
Block Closure Closure Closure Closure GLE GBL
To:
scope1 scope2&3 scope4&5 scope6 scope7
foo foo* bar* - -
Block Local Closure GLE GBL
Doing a few things:
- Merge the first two Closure scopes sharing a location. These are the "var" and "let" Closure scopes in a function, and it is better to present these together in the UI.
- Mark the first Closure scope within a function (*). When this is displayed in the UI, we can provide the name of the function: "Closure Scope (name)", and we even have location information that we can use to display a goto arrow if needed.
- Make the first Closure scope the Local scope if it matches the Call Frame's function name. This lets us display the section as "Local Variables".
LayoutTests:
- inspector/debugger/paused-scopes-expected.txt: Added.
- inspector/debugger/paused-scopes.html: Added.
- inspector/debugger/resources/paused-scopes.js: Added.
Test dumps the call frames and scope chains for each call frame
when pausing at different locations in a program. Outputting
the hashes we can see even identically named functions have
different hashes because their location is different.
- inspector/model/scope-chain-node.html:
Make the test more stable on debug builds which run slower.
- File:
-
- 1 added