summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/debugger/DebuggerCallFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/debugger/DebuggerCallFrame.cpp')
-rw-r--r--JavaScriptCore/debugger/DebuggerCallFrame.cpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/JavaScriptCore/debugger/DebuggerCallFrame.cpp
index 05a385d..ed673cb 100644
--- a/JavaScriptCore/debugger/DebuggerCallFrame.cpp
+++ b/JavaScriptCore/debugger/DebuggerCallFrame.cpp
@@ -41,21 +41,25 @@ const UString* DebuggerCallFrame::functionName() const
if (!m_callFrame->codeBlock())
return 0;
- JSFunction* function = asFunction(m_callFrame->callee());
- if (!function)
+ if (!m_callFrame->callee())
return 0;
- return &function->name(m_callFrame);
+
+ JSObject* function = m_callFrame->callee();
+ if (!function || !function->inherits(&JSFunction::info))
+ return 0;
+ return &asFunction(function)->name(m_callFrame);
}
UString DebuggerCallFrame::calculatedFunctionName() const
{
if (!m_callFrame->codeBlock())
return UString();
-
- JSFunction* function = asFunction(m_callFrame->callee());
- if (!function)
+
+ JSObject* function = m_callFrame->callee();
+ if (!function || !function->inherits(&JSFunction::info))
return UString();
- return function->calculatedDisplayName(m_callFrame);
+
+ return asFunction(function)->calculatedDisplayName(m_callFrame);
}
DebuggerCallFrame::Type DebuggerCallFrame::type() const
@@ -68,10 +72,15 @@ 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
@@ -79,12 +88,19 @@ JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) c
if (!m_callFrame->codeBlock())
return JSValue();
- RefPtr<EvalExecutable> eval = EvalExecutable::create(m_callFrame, makeSource(script));
+ RefPtr<EvalExecutable> eval = EvalExecutable::create(m_callFrame, makeSource(script), m_callFrame->codeBlock()->isStrictMode());
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();
+ JSValue result = globalData.interpreter->execute(eval.get(), m_callFrame, thisObject(), m_callFrame->scopeChain());
+ if (globalData.exception) {
+ exception = globalData.exception;
+ globalData.exception = JSValue();
+ }
+ ASSERT(result);
+ return result;
}
} // namespace JSC