X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/4e4e5a6f2694187498445a6ac6f1634ce8141119..6fe7ccc865dc7d7541b93c5bcaf6368d2c98a174:/debugger/DebuggerCallFrame.cpp?ds=inline diff --git a/debugger/DebuggerCallFrame.cpp b/debugger/DebuggerCallFrame.cpp index a734b1d..a48e7d1 100644 --- a/debugger/DebuggerCallFrame.cpp +++ b/debugger/DebuggerCallFrame.cpp @@ -44,10 +44,10 @@ const UString* DebuggerCallFrame::functionName() const if (!m_callFrame->callee()) return 0; - JSFunction* function = asFunction(m_callFrame->callee()); - if (!function) + JSObject* function = m_callFrame->callee(); + if (!function || !function->inherits(&JSFunction::s_info)) return 0; - return &function->name(m_callFrame); + return &jsCast(function)->name(m_callFrame); } UString DebuggerCallFrame::calculatedFunctionName() const @@ -55,13 +55,12 @@ UString DebuggerCallFrame::calculatedFunctionName() const if (!m_callFrame->codeBlock()) return UString(); - if (!m_callFrame->callee()) - return UString(); + JSObject* function = m_callFrame->callee(); - JSFunction* function = asFunction(m_callFrame->callee()); if (!function) return UString(); - return function->calculatedDisplayName(m_callFrame); + + return getCalculatedDisplayName(m_callFrame, function); } DebuggerCallFrame::Type DebuggerCallFrame::type() const @@ -74,23 +73,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 { if (!m_callFrame->codeBlock()) return JSValue(); - - RefPtr eval = EvalExecutable::create(m_callFrame, makeSource(script)); - JSObject* error = eval->compile(m_callFrame, m_callFrame->scopeChain()); - if (error) - return error; - - return m_callFrame->scopeChain()->globalData->interpreter->execute(eval.get(), m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception); + + JSGlobalData& globalData = m_callFrame->globalData(); + EvalExecutable* eval = EvalExecutable::create(m_callFrame, makeSource(script), m_callFrame->codeBlock()->isStrictMode()); + if (globalData.exception) { + exception = globalData.exception; + globalData.exception = JSValue(); + } + + JSValue result = globalData.interpreter->execute(eval, m_callFrame, thisObject(), m_callFrame->scopeChain()); + if (globalData.exception) { + exception = globalData.exception; + globalData.exception = JSValue(); + } + ASSERT(result); + return result; } } // namespace JSC