• oliver@apple.com's avatar
    Unify the many and varied stack trace mechanisms, and make the result sane. · 3980d396
    oliver@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=114072
    
    Reviewed by Filip Pizlo.
    
    Source/JavaScriptCore:
    
    Makes JSC::StackFrame record the bytecode offset and other necessary data
    rather than requiring us to perform eager evaluation of the line number, etc.
    Then remove most of the users of retrieveLastCaller, as most of them were
    using it to create a stack trace in a fairly incomplete and inefficient way.
    
    StackFrame now also has a couple of helpers to get the line and column info.
    
    * API/JSContextRef.cpp:
    (JSContextCreateBacktrace):
    * bytecompiler/BytecodeGenerator.cpp:
    (JSC::BytecodeGenerator::emitDebugHook):
    * interpreter/Interpreter.cpp:
    (JSC):
    (JSC::Interpreter::dumpRegisters):
    (JSC::Interpreter::unwindCallFrame):
    (JSC::getBytecodeOffsetForCallFrame):
    (JSC::getCallerInfo):
    (JSC::StackFrame::line):
    (JSC::StackFrame::column):
    (JSC::StackFrame::expressionInfo):
    (JSC::StackFrame::toString):
    (JSC::Interpreter::getStackTrace):
    (JSC::Interpreter::addStackTraceIfNecessary):
    (JSC::Interpreter::retrieveCallerFromVMCode):
    * interpreter/Interpreter.h:
    (StackFrame):
    (Interpreter):
    * runtime/Error.cpp:
    (JSC::throwError):
    * runtime/JSGlobalData.h:
    (JSC):
    (JSGlobalData):
    * runtime/JSGlobalObject.cpp:
    (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
    
    Source/WebCore:
    
    Now that we've fleshed out the StackFrames from Interpreter::getStackTrace
    WebCore can just ask us for a stack trace rather than implementing its own
    stack walking.
    
    * bindings/js/ScriptCallStackFactory.cpp:
    (WebCore::createScriptCallStack):
    * inspector/ScriptCallFrame.cpp:
    (WebCore::ScriptCallFrame::isEqual):
    * inspector/ScriptCallFrame.h:
    (ScriptCallFrame):
    (WebCore::ScriptCallFrame::columnNumber):
    
    Tools:
    
    The commandline jsc executable no longer requires arguments, so
    I've made run-jsc work without them.
    
    * Scripts/run-jsc:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147818 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    3980d396
JSGlobalObject.cpp 35.3 KB