summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/debugger')
-rw-r--r--Source/JavaScriptCore/debugger/Debugger.cpp145
-rw-r--r--Source/JavaScriptCore/debugger/Debugger.h65
-rw-r--r--Source/JavaScriptCore/debugger/DebuggerActivation.cpp116
-rw-r--r--Source/JavaScriptCore/debugger/DebuggerActivation.h74
-rw-r--r--Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp107
-rw-r--r--Source/JavaScriptCore/debugger/DebuggerCallFrame.h67
6 files changed, 574 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/debugger/Debugger.cpp b/Source/JavaScriptCore/debugger/Debugger.cpp
new file mode 100644
index 000000000..13d6ad8f3
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/Debugger.cpp
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "config.h"
+#include "Debugger.h"
+
+#include "Error.h"
+#include "Interpreter.h"
+#include "JSFunction.h"
+#include "JSGlobalObject.h"
+#include "Parser.h"
+#include "Protect.h"
+
+namespace {
+
+using namespace JSC;
+
+class Recompiler : public MarkedBlock::VoidFunctor {
+public:
+ Recompiler(Debugger*);
+ ~Recompiler();
+ void operator()(JSCell*);
+
+private:
+ typedef HashSet<FunctionExecutable*> FunctionExecutableSet;
+ typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap;
+
+ Debugger* m_debugger;
+ FunctionExecutableSet m_functionExecutables;
+ SourceProviderMap m_sourceProviders;
+};
+
+inline Recompiler::Recompiler(Debugger* debugger)
+ : m_debugger(debugger)
+{
+}
+
+inline Recompiler::~Recompiler()
+{
+ // Call sourceParsed() after reparsing all functions because it will execute
+ // JavaScript in the inspector.
+ SourceProviderMap::const_iterator end = m_sourceProviders.end();
+ for (SourceProviderMap::const_iterator iter = m_sourceProviders.begin(); iter != end; ++iter)
+ m_debugger->sourceParsed(iter->second, iter->first, -1, UString());
+}
+
+inline void Recompiler::operator()(JSCell* cell)
+{
+ if (!cell->inherits(&JSFunction::s_info))
+ return;
+
+ JSFunction* function = asFunction(cell);
+ if (function->executable()->isHostFunction())
+ return;
+
+ FunctionExecutable* executable = function->jsExecutable();
+
+ // Check if the function is already in the set - if so,
+ // we've already retranslated it, nothing to do here.
+ if (!m_functionExecutables.add(executable).second)
+ return;
+
+ ExecState* exec = function->scope()->globalObject->JSGlobalObject::globalExec();
+ executable->discardCode();
+ if (m_debugger == function->scope()->globalObject->debugger())
+ m_sourceProviders.add(executable->source().provider(), exec);
+}
+
+} // namespace
+
+namespace JSC {
+
+Debugger::~Debugger()
+{
+ HashSet<JSGlobalObject*>::iterator end = m_globalObjects.end();
+ for (HashSet<JSGlobalObject*>::iterator it = m_globalObjects.begin(); it != end; ++it)
+ (*it)->setDebugger(0);
+}
+
+void Debugger::attach(JSGlobalObject* globalObject)
+{
+ ASSERT(!globalObject->debugger());
+ globalObject->setDebugger(this);
+ m_globalObjects.add(globalObject);
+}
+
+void Debugger::detach(JSGlobalObject* globalObject)
+{
+ ASSERT(m_globalObjects.contains(globalObject));
+ m_globalObjects.remove(globalObject);
+ globalObject->setDebugger(0);
+}
+
+void Debugger::recompileAllJSFunctions(JSGlobalData* globalData)
+{
+ // If JavaScript is running, it's not safe to recompile, since we'll end
+ // up throwing away code that is live on the stack.
+ ASSERT(!globalData->dynamicGlobalObject);
+ if (globalData->dynamicGlobalObject)
+ return;
+
+ Recompiler recompiler(this);
+ globalData->heap.objectSpace().forEachCell(recompiler);
+}
+
+JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject)
+{
+ CallFrame* globalCallFrame = globalObject->globalExec();
+ JSGlobalData& globalData = globalObject->globalData();
+
+ EvalExecutable* eval = EvalExecutable::create(globalCallFrame, makeSource(script), false);
+ if (!eval) {
+ exception = globalData.exception;
+ globalData.exception = JSValue();
+ return exception;
+ }
+
+ JSValue result = globalData.interpreter->execute(eval, globalCallFrame, globalObject, globalCallFrame->scopeChain());
+ if (globalData.exception) {
+ exception = globalData.exception;
+ globalData.exception = JSValue();
+ }
+ ASSERT(result);
+ return result;
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/debugger/Debugger.h b/Source/JavaScriptCore/debugger/Debugger.h
new file mode 100644
index 000000000..f48243c45
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/Debugger.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef Debugger_h
+#define Debugger_h
+
+#include <wtf/HashSet.h>
+
+namespace JSC {
+
+ class DebuggerCallFrame;
+ class ExecState;
+ class JSGlobalData;
+ class JSGlobalObject;
+ class JSValue;
+ class SourceProvider;
+ class UString;
+
+ class JS_EXPORT_PRIVATE Debugger {
+ public:
+ virtual ~Debugger();
+
+ void attach(JSGlobalObject*);
+ virtual void detach(JSGlobalObject*);
+
+ virtual void sourceParsed(ExecState*, SourceProvider*, int errorLineNumber, const UString& errorMessage) = 0;
+ virtual void exception(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber, bool hasHandler) = 0;
+ virtual void atStatement(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void callEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void returnEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+
+ virtual void willExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void didExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+ virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
+
+ void recompileAllJSFunctions(JSGlobalData*);
+
+ private:
+ HashSet<JSGlobalObject*> m_globalObjects;
+ };
+
+ // This function exists only for backwards compatibility with existing WebScriptDebugger clients.
+ JSValue evaluateInGlobalCallFrame(const UString&, JSValue& exception, JSGlobalObject*);
+
+} // namespace JSC
+
+#endif // Debugger_h
diff --git a/Source/JavaScriptCore/debugger/DebuggerActivation.cpp b/Source/JavaScriptCore/debugger/DebuggerActivation.cpp
new file mode 100644
index 000000000..80be310b5
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/DebuggerActivation.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DebuggerActivation.h"
+
+#include "JSActivation.h"
+
+namespace JSC {
+
+ASSERT_HAS_TRIVIAL_DESTRUCTOR(DebuggerActivation);
+
+const ClassInfo DebuggerActivation::s_info = { "DebuggerActivation", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(DebuggerActivation) };
+
+DebuggerActivation::DebuggerActivation(JSGlobalData& globalData)
+ : JSNonFinalObject(globalData, globalData.debuggerActivationStructure.get())
+{
+}
+
+void DebuggerActivation::finishCreation(JSGlobalData& globalData, JSObject* activation)
+{
+ Base::finishCreation(globalData);
+ ASSERT(activation);
+ ASSERT(activation->isActivationObject());
+ m_activation.set(globalData, this, static_cast<JSActivation*>(activation));
+}
+
+void DebuggerActivation::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+ DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
+ COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
+ ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
+ JSObject::visitChildren(thisObject, visitor);
+
+ if (thisObject->m_activation)
+ visitor.append(&thisObject->m_activation);
+}
+
+UString DebuggerActivation::className(const JSObject* object)
+{
+ const DebuggerActivation* thisObject = jsCast<const DebuggerActivation*>(object);
+ return thisObject->m_activation->methodTable()->className(thisObject->m_activation.get());
+}
+
+bool DebuggerActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
+{
+ DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell);
+ return thisObject->m_activation->methodTable()->getOwnPropertySlot(thisObject->m_activation.get(), exec, propertyName, slot);
+}
+
+void DebuggerActivation::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
+{
+ DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell);
+ thisObject->m_activation->methodTable()->put(thisObject->m_activation.get(), exec, propertyName, value, slot);
+}
+
+void DebuggerActivation::putWithAttributes(JSObject* object, ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes)
+{
+ DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
+ thisObject->m_activation->methodTable()->putWithAttributes(thisObject->m_activation.get(), exec, propertyName, value, attributes);
+}
+
+bool DebuggerActivation::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
+{
+ DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell);
+ return thisObject->m_activation->methodTable()->deleteProperty(thisObject->m_activation.get(), exec, propertyName);
+}
+
+void DebuggerActivation::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
+{
+ DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
+ thisObject->m_activation->methodTable()->getPropertyNames(thisObject->m_activation.get(), exec, propertyNames, mode);
+}
+
+bool DebuggerActivation::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+ DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
+ return thisObject->m_activation->methodTable()->getOwnPropertyDescriptor(thisObject->m_activation.get(), exec, propertyName, descriptor);
+}
+
+void DebuggerActivation::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes)
+{
+ DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
+ thisObject->m_activation->methodTable()->defineGetter(thisObject->m_activation.get(), exec, propertyName, getterFunction, attributes);
+}
+
+void DebuggerActivation::defineSetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
+{
+ DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
+ thisObject->m_activation->methodTable()->defineSetter(thisObject->m_activation.get(), exec, propertyName, setterFunction, attributes);
+}
+
+} // namespace JSC
diff --git a/Source/JavaScriptCore/debugger/DebuggerActivation.h b/Source/JavaScriptCore/debugger/DebuggerActivation.h
new file mode 100644
index 000000000..c28d0b3a2
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/DebuggerActivation.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DebuggerActivation_h
+#define DebuggerActivation_h
+
+#include "JSObject.h"
+
+namespace JSC {
+
+ class DebuggerActivation : public JSNonFinalObject {
+ public:
+ typedef JSNonFinalObject Base;
+
+ static DebuggerActivation* create(JSGlobalData& globalData, JSObject* object)
+ {
+ DebuggerActivation* activation = new (NotNull, allocateCell<DebuggerActivation>(globalData.heap)) DebuggerActivation(globalData);
+ activation->finishCreation(globalData, object);
+ return activation;
+ }
+
+ static void visitChildren(JSCell*, SlotVisitor&);
+ static UString className(const JSObject*);
+ static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&);
+ static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
+ static void putWithAttributes(JSObject*, ExecState*, const Identifier& propertyName, JSValue, unsigned attributes);
+ static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
+ static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+ static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&);
+ static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes);
+ static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes);
+
+ static const ClassInfo s_info;
+
+ static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
+ {
+ return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
+ }
+
+ protected:
+ static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | JSObject::StructureFlags;
+
+ void finishCreation(JSGlobalData&, JSObject* activation);
+
+ private:
+ DebuggerActivation(JSGlobalData&);
+ WriteBarrier<JSActivation> m_activation;
+ };
+
+} // namespace JSC
+
+#endif // DebuggerActivation_h
diff --git a/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
new file mode 100644
index 000000000..08fba4a6b
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DebuggerCallFrame.h"
+
+#include "JSFunction.h"
+#include "CodeBlock.h"
+#include "Interpreter.h"
+#include "Parser.h"
+
+namespace JSC {
+
+const UString* DebuggerCallFrame::functionName() const
+{
+ if (!m_callFrame->codeBlock())
+ return 0;
+
+ if (!m_callFrame->callee())
+ return 0;
+
+ JSObject* function = m_callFrame->callee();
+ if (!function || !function->inherits(&JSFunction::s_info))
+ return 0;
+ return &asFunction(function)->name(m_callFrame);
+}
+
+UString DebuggerCallFrame::calculatedFunctionName() const
+{
+ if (!m_callFrame->codeBlock())
+ return UString();
+
+ JSObject* function = m_callFrame->callee();
+ if (!function || !function->inherits(&JSFunction::s_info))
+ return UString();
+
+ return asFunction(function)->calculatedDisplayName(m_callFrame);
+}
+
+DebuggerCallFrame::Type DebuggerCallFrame::type() const
+{
+ if (m_callFrame->callee())
+ return FunctionType;
+
+ return ProgramType;
+}
+
+JSObject* DebuggerCallFrame::thisObject() const
+{
+ CodeBlock* codeBlock = m_callFrame->codeBlock();
+ if (!codeBlock)
+ return 0;
+
+ 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();
+
+ 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
diff --git a/Source/JavaScriptCore/debugger/DebuggerCallFrame.h b/Source/JavaScriptCore/debugger/DebuggerCallFrame.h
new file mode 100644
index 000000000..d8fb9dae5
--- /dev/null
+++ b/Source/JavaScriptCore/debugger/DebuggerCallFrame.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DebuggerCallFrame_h
+#define DebuggerCallFrame_h
+
+#include "CallFrame.h"
+
+namespace JSC {
+
+ class DebuggerCallFrame {
+ public:
+ enum Type { ProgramType, FunctionType };
+
+ DebuggerCallFrame(CallFrame* callFrame)
+ : m_callFrame(callFrame)
+ {
+ }
+
+ DebuggerCallFrame(CallFrame* callFrame, JSValue exception)
+ : m_callFrame(callFrame)
+ , m_exception(exception)
+ {
+ }
+
+ JSGlobalObject* dynamicGlobalObject() const { return m_callFrame->dynamicGlobalObject(); }
+ ScopeChainNode* scopeChain() const { return m_callFrame->scopeChain(); }
+ const UString* functionName() const;
+ JS_EXPORT_PRIVATE UString calculatedFunctionName() const;
+ JS_EXPORT_PRIVATE Type type() const;
+ JS_EXPORT_PRIVATE JSObject* thisObject() const;
+ JS_EXPORT_PRIVATE JSValue evaluate(const UString&, JSValue& exception) const;
+ JSValue exception() const { return m_exception; }
+
+ private:
+ CallFrame* m_callFrame;
+ JSValue m_exception;
+ };
+
+} // namespace JSC
+
+#endif // DebuggerCallFrame_h