Skip to content
  • oliver@apple.com's avatar
    Implement Error.stack · 49d0475c
    oliver@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=66994
    
    Reviewed by Gavin Barraclough.
    
    Source/JavaScriptCore:
    
    Implement support for stack traces on exception objects.  This is a rewrite
    of the core portion of the last stack walking logic, but the mechanical work
    of adding the information to an exception comes from the original work by
    Juan Carlos Montemayor Elosua.
    
    * interpreter/Interpreter.cpp:
    (JSC::getCallerInfo):
    (JSC):
    (JSC::getSourceURLFromCallFrame):
    (JSC::getStackFrameCodeType):
    (JSC::Interpreter::getStackTrace):
    (JSC::Interpreter::throwException):
    (JSC::Interpreter::privateExecute):
    * interpreter/Interpreter.h:
    (JSC):
    (StackFrame):
    (JSC::StackFrame::toString):
    (Interpreter):
    * jsc.cpp:
    (GlobalObject::finishCreation):
    (functionJSCStack):
    * parser/Nodes.h:
    (JSC::FunctionBodyNode::setInferredName):
    * parser/Parser.h:
    (JSC::::parse):
    * runtime/CommonIdentifiers.h:
    * runtime/Error.cpp:
    (JSC::addErrorInfo):
    * runtime/Error.h:
    (JSC):
    
    LayoutTests:
    
    Add testcases for producing a stack trace on exception objects.
    
    * fast/js/exception-properties-expected.txt:
    * fast/js/script-tests/exception-properties.js:
    * fast/js/script-tests/stack-trace.js: Added.
    (printStack):
    (hostThrower):
    (callbacker):
    (outer):
    (inner):
    (evaler):
    (normalOuter):
    (normalInner):
    (scripterInner):
    (scripterOuter):
    (selfRecursive1):
    (selfRecursive2):
    (selfRecursive3):
    (throwError):
    (object.get getter1.o.valueOf):
    (object.get getter1):
    (object.get getter2):
    (object.get getter3.o2.valueOf):
    (object.get getter3):
    (object.nonInlineable.callCount):
    (object.nonInlineable):
    (object.inlineable):
    (yetAnotherInlinedCall):
    (makeInlinableCall):
    (.try.g):
    (h):
    (mapTest):
    (mapTestDriver):
    (dfgFunction):
    (try.f):
    * fast/js/stack-trace-expected.txt: Added.
    * fast/js/stack-trace.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    49d0475c