Implement Error.stack
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2012 21:17:59 +0000 (21:17 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2012 21:17:59 +0000 (21:17 +0000)
commit868847eff22da89f3b5e5ed14c9bba1a84d545f6
treed8c547471111e2f307efd216491f40940c504c41
parent997816f741e6e4b8dac66a62afe0b85cf810b4f1
Implement Error.stack
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: https://svn.webkit.org/repository/webkit/trunk@108112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/js/exception-properties-expected.txt
LayoutTests/fast/js/script-tests/exception-properties.js
LayoutTests/fast/js/script-tests/stack-trace.js [new file with mode: 0644]
LayoutTests/fast/js/stack-trace-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/stack-trace.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/interpreter/Interpreter.cpp
Source/JavaScriptCore/interpreter/Interpreter.h
Source/JavaScriptCore/jit/JITOpcodes.cpp
Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/parser/Nodes.h
Source/JavaScriptCore/parser/Parser.h
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/JavaScriptCore/runtime/Error.cpp
Source/JavaScriptCore/runtime/Error.h