X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/ba379fdc102753d6be2c4d937058fe40257329fe..217a6308cd6a1dc049a0bb69263bd4c91f91c4d0:/debugger/DebuggerCallFrame.cpp?ds=sidebyside diff --git a/debugger/DebuggerCallFrame.cpp b/debugger/DebuggerCallFrame.cpp index cd8702b..a5d045c 100644 --- a/debugger/DebuggerCallFrame.cpp +++ b/debugger/DebuggerCallFrame.cpp @@ -32,30 +32,36 @@ #include "JSFunction.h" #include "CodeBlock.h" #include "Interpreter.h" +#include "Operations.h" #include "Parser.h" namespace JSC { -const UString* DebuggerCallFrame::functionName() const +String DebuggerCallFrame::functionName() const { if (!m_callFrame->codeBlock()) - return 0; + return String(); - JSFunction* function = static_cast(m_callFrame->callee()); - if (!function) - return 0; - return &function->name(&m_callFrame->globalData()); + if (!m_callFrame->callee()) + return String(); + + JSObject* function = m_callFrame->callee(); + if (!function || !function->inherits(&JSFunction::s_info)) + return String(); + return jsCast(function)->name(m_callFrame); } -UString DebuggerCallFrame::calculatedFunctionName() const +String DebuggerCallFrame::calculatedFunctionName() const { if (!m_callFrame->codeBlock()) - return 0; - - JSFunction* function = static_cast(m_callFrame->callee()); + return String(); + + JSObject* function = m_callFrame->callee(); + if (!function) - return 0; - return function->calculatedDisplayName(&m_callFrame->globalData()); + return String(); + + return getCalculatedDisplayName(m_callFrame, function); } DebuggerCallFrame::Type DebuggerCallFrame::type() const @@ -68,25 +74,36 @@ DebuggerCallFrame::Type DebuggerCallFrame::type() const JSObject* DebuggerCallFrame::thisObject() const { - if (!m_callFrame->codeBlock()) + CodeBlock* codeBlock = m_callFrame->codeBlock(); + if (!codeBlock) return 0; - return asObject(m_callFrame->thisValue()); + JSValue thisValue = m_callFrame->uncheckedR(codeBlock->thisRegister()).jsValue(); + if (!thisValue.isObject()) + return 0; + + return asObject(thisValue); } -JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) const +JSValue DebuggerCallFrame::evaluate(const String& script, JSValue& exception) const { if (!m_callFrame->codeBlock()) return JSValue(); + + VM& vm = m_callFrame->vm(); + EvalExecutable* eval = EvalExecutable::create(m_callFrame, m_callFrame->codeBlock()->unlinkedCodeBlock()->codeCacheForEval(), makeSource(script), m_callFrame->codeBlock()->isStrictMode()); + if (vm.exception) { + exception = vm.exception; + vm.exception = JSValue(); + } - int errLine; - UString errMsg; - SourceCode source = makeSource(script); - RefPtr evalNode = m_callFrame->scopeChain()->globalData->parser->parse(m_callFrame, m_callFrame->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg); - if (!evalNode) - return Error::create(m_callFrame, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url()); - - return m_callFrame->scopeChain()->globalData->interpreter->execute(evalNode.get(), m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception); + JSValue result = vm.interpreter->execute(eval, m_callFrame, thisObject(), m_callFrame->scope()); + if (vm.exception) { + exception = vm.exception; + vm.exception = JSValue(); + } + ASSERT(result); + return result; } } // namespace JSC