X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/f9bf01c6616d5ddcf65b13b33cedf9e387ff7a63..6fe7ccc865dc7d7541b93c5bcaf6368d2c98a174:/debugger/DebuggerCallFrame.cpp diff --git a/debugger/DebuggerCallFrame.cpp b/debugger/DebuggerCallFrame.cpp index a3299d4..a48e7d1 100644 --- a/debugger/DebuggerCallFrame.cpp +++ b/debugger/DebuggerCallFrame.cpp @@ -44,24 +44,23 @@ 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 { if (!m_callFrame->codeBlock()) - return 0; - - if (!m_callFrame->callee()) return UString(); - JSFunction* function = asFunction(m_callFrame->callee()); + JSObject* function = m_callFrame->callee(); + if (!function) - return 0; - return function->calculatedDisplayName(m_callFrame); + return UString(); + + 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; + + JSValue thisValue = m_callFrame->uncheckedR(codeBlock->thisRegister()).jsValue(); + if (!thisValue.isObject()) return 0; - return asObject(m_callFrame->thisValue()); + 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