diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-05-20 09:56:07 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-05-20 09:56:07 +0000 |
commit | 41386e9cb918eed93b3f13648cbef387e371e451 (patch) | |
tree | a97f9d7bd1d9d091833286085f72da9d83fd0606 /Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp | |
parent | e15dd966d523731101f70ccf768bba12435a0208 (diff) | |
download | WebKitGtk-tarball-41386e9cb918eed93b3f13648cbef387e371e451.tar.gz |
webkitgtk-2.4.9webkitgtk-2.4.9
Diffstat (limited to 'Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp')
-rw-r--r-- | Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp index cb1f9d1c1..08fd618a8 100644 --- a/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp +++ b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp @@ -26,7 +26,8 @@ #include "config.h" #include "JSJavaScriptCallFrame.h" -#include "DebuggerScope.h" +#if ENABLE(INSPECTOR) + #include "Error.h" #include "JSCJSValue.h" #include "JSCellInlines.h" @@ -37,7 +38,7 @@ using namespace JSC; namespace Inspector { -const ClassInfo JSJavaScriptCallFrame::s_info = { "JavaScriptCallFrame", &Base::s_info, 0, CREATE_METHOD_TABLE(JSJavaScriptCallFrame) }; +const ClassInfo JSJavaScriptCallFrame::s_info = { "JavaScriptCallFrame", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSJavaScriptCallFrame) }; JSJavaScriptCallFrame::JSJavaScriptCallFrame(VM& vm, Structure* structure, PassRefPtr<JavaScriptCallFrame> impl) : JSDestructibleObject(vm, structure) @@ -64,8 +65,10 @@ void JSJavaScriptCallFrame::destroy(JSC::JSCell* cell) void JSJavaScriptCallFrame::releaseImpl() { - if (auto impl = std::exchange(m_impl, nullptr)) - impl->deref(); + if (m_impl) { + m_impl->deref(); + m_impl = nullptr; + } } JSJavaScriptCallFrame::~JSJavaScriptCallFrame() @@ -75,7 +78,7 @@ JSJavaScriptCallFrame::~JSJavaScriptCallFrame() JSValue JSJavaScriptCallFrame::evaluate(ExecState* exec) { - NakedPtr<Exception> exception; + JSValue exception; JSValue result = impl().evaluate(exec->argument(0).toString(exec)->value(exec), exception); if (exception) exec->vm().throwException(exec, exception); @@ -92,33 +95,29 @@ JSValue JSJavaScriptCallFrame::scopeType(ExecState* exec) return jsUndefined(); int index = exec->argument(0).asInt32(); - DebuggerScope* scopeChain = impl().scopeChain(); - DebuggerScope::iterator end = scopeChain->end(); + JSScope* scopeChain = impl().scopeChain(); + ScopeChainIterator end = scopeChain->end(); + + // FIXME: We should be identifying and returning CATCH_SCOPE appropriately. bool foundLocalScope = false; - for (DebuggerScope::iterator iter = scopeChain->begin(); iter != end; ++iter) { - DebuggerScope* scope = iter.get(); - - if (!foundLocalScope && scope->isFunctionOrEvalScope()) { - // First function scope is the local scope, each successive one is a closure. - if (!index) - return jsNumber(JSJavaScriptCallFrame::LOCAL_SCOPE); - foundLocalScope = true; + for (ScopeChainIterator iter = scopeChain->begin(); iter != end; ++iter) { + JSObject* scope = iter.get(); + if (scope->isActivationObject()) { + if (!foundLocalScope) { + // First activation object is local scope, each successive activation object is closure. + if (!index) + return jsNumber(JSJavaScriptCallFrame::LOCAL_SCOPE); + foundLocalScope = true; + } else if (!index) + return jsNumber(JSJavaScriptCallFrame::CLOSURE_SCOPE); } if (!index) { - if (scope->isCatchScope()) - return jsNumber(JSJavaScriptCallFrame::CATCH_SCOPE); - if (scope->isFunctionNameScope()) - return jsNumber(JSJavaScriptCallFrame::FUNCTION_NAME_SCOPE); - if (scope->isWithScope()) - return jsNumber(JSJavaScriptCallFrame::WITH_SCOPE); - if (scope->isGlobalScope()) { - ASSERT(++iter == end); + // Last in the chain is global scope. + if (++iter == end) return jsNumber(JSJavaScriptCallFrame::GLOBAL_SCOPE); - } - ASSERT(scope->isFunctionOrEvalScope()); - return jsNumber(JSJavaScriptCallFrame::CLOSURE_SCOPE); + return jsNumber(JSJavaScriptCallFrame::WITH_SCOPE); } --index; @@ -158,9 +157,9 @@ JSValue JSJavaScriptCallFrame::scopeChain(ExecState* exec) const if (!impl().scopeChain()) return jsNull(); - DebuggerScope* scopeChain = impl().scopeChain(); - DebuggerScope::iterator iter = scopeChain->begin(); - DebuggerScope::iterator end = scopeChain->end(); + JSScope* scopeChain = impl().scopeChain(); + ScopeChainIterator iter = scopeChain->begin(); + ScopeChainIterator end = scopeChain->end(); // We must always have something in the scope chain. ASSERT(iter != end); @@ -211,3 +210,4 @@ JSJavaScriptCallFrame* toJSJavaScriptCallFrame(JSValue value) } // namespace Inspector +#endif // ENABLE(INSPECTOR) |