#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();
if (!m_callFrame->callee())
- return 0;
+ return String();
- JSFunction* function = asFunction(m_callFrame->callee());
- if (!function)
- return 0;
- return &function->name(m_callFrame);
+ JSObject* function = m_callFrame->callee();
+ if (!function || !function->inherits(&JSFunction::s_info))
+ return String();
+ return jsCast<JSFunction*>(function)->name(m_callFrame);
}
-UString DebuggerCallFrame::calculatedFunctionName() const
+String DebuggerCallFrame::calculatedFunctionName() const
{
if (!m_callFrame->codeBlock())
- return 0;
+ return String();
- if (!m_callFrame->callee())
- return UString();
+ JSObject* function = m_callFrame->callee();
- JSFunction* function = asFunction(m_callFrame->callee());
if (!function)
- return 0;
- return function->calculatedDisplayName(m_callFrame);
+ return String();
+
+ return getCalculatedDisplayName(m_callFrame, function);
}
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
+JSValue DebuggerCallFrame::evaluate(const String& script, JSValue& exception) const
{
if (!m_callFrame->codeBlock())
return JSValue();
-
- RefPtr<EvalExecutable> 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);
+
+ 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();
+ }
+
+ 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