X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/f9bf01c6616d5ddcf65b13b33cedf9e387ff7a63..14957cd040308e3eeec43d26bae5d76da13fcd85:/debugger/DebuggerCallFrame.cpp?ds=inline diff --git a/debugger/DebuggerCallFrame.cpp b/debugger/DebuggerCallFrame.cpp index a3299d4..08fba4a 100644 --- a/debugger/DebuggerCallFrame.cpp +++ b/debugger/DebuggerCallFrame.cpp @@ -44,24 +44,22 @@ 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 &asFunction(function)->name(m_callFrame); } UString DebuggerCallFrame::calculatedFunctionName() const { if (!m_callFrame->codeBlock()) - return 0; + return UString(); - if (!m_callFrame->callee()) + JSObject* function = m_callFrame->callee(); + if (!function || !function->inherits(&JSFunction::s_info)) return UString(); - JSFunction* function = asFunction(m_callFrame->callee()); - if (!function) - return 0; - return function->calculatedDisplayName(m_callFrame); + return asFunction(function)->calculatedDisplayName(m_callFrame); } DebuggerCallFrame::Type DebuggerCallFrame::type() const @@ -74,23 +72,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