summaryrefslogtreecommitdiff
path: root/src/qml/jsruntime/qv4debugging.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2014-11-07 05:46:20 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-11-12 12:13:03 +0100
commit19ae8cdffeaeb3fc6716b6f0a7ee8756ec9700c7 (patch)
tree91083b44b1f3db49c246ce74b20af83310d530f5 /src/qml/jsruntime/qv4debugging.cpp
parent7e61b8c09c647229e78bdedec9421f90063466af (diff)
downloadqtdeclarative-19ae8cdffeaeb3fc6716b6f0a7ee8756ec9700c7.tar.gz
Convert ExecutionContext::parent/outer to use a heap object
Change-Id: I1b8ee831cfcdd5b1904ce24a341f5a796dce41cf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4debugging.cpp')
-rw-r--r--src/qml/jsruntime/qv4debugging.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp
index fdba6e3626..7ef32a1c92 100644
--- a/src/qml/jsruntime/qv4debugging.cpp
+++ b/src/qml/jsruntime/qv4debugging.cpp
@@ -261,14 +261,19 @@ QVector<StackFrame> Debugger::stackTrace(int frameLimit) const
static inline CallContext *findContext(ExecutionContext *ctxt, int frame)
{
- while (ctxt) {
- CallContext *cCtxt = ctxt->asCallContext();
+ if (!ctxt)
+ return 0;
+
+ Scope scope(ctxt);
+ Scoped<ExecutionContext> ctx(scope, ctxt);
+ while (ctx) {
+ CallContext *cCtxt = ctx->asCallContext();
if (cCtxt && cCtxt->d()->function) {
if (frame < 1)
return cCtxt;
--frame;
}
- ctxt = ctxt->d()->parent;
+ ctx = ctx->d()->parent;
}
return 0;
@@ -276,10 +281,15 @@ static inline CallContext *findContext(ExecutionContext *ctxt, int frame)
static inline CallContext *findScope(ExecutionContext *ctxt, int scope)
{
- for (; scope > 0 && ctxt; --scope)
- ctxt = ctxt->d()->outer;
+ if (!ctxt)
+ return 0;
+
+ Scope s(ctxt);
+ Scoped<ExecutionContext> ctx(s, ctxt);
+ for (; scope > 0 && ctx; --scope)
+ ctx = ctx->d()->outer;
- return ctxt ? ctxt->asCallContext() : 0;
+ return ctx ? ctx->asCallContext() : 0;
}
void Debugger::collectArgumentsInContext(Collector *collector, int frameNr, int scopeNr)
@@ -403,7 +413,8 @@ bool Debugger::collectThisInContext(Debugger::Collector *collector, int frame)
bool myRun()
{
- ExecutionContext *ctxt = findContext(engine->currentContext(), frameNr);
+ Scope scope(engine);
+ Scoped<ExecutionContext> ctxt(scope, findContext(engine->currentContext(), frameNr));
while (ctxt) {
if (CallContext *cCtxt = ctxt->asCallContext())
if (cCtxt->d()->activation)
@@ -414,7 +425,6 @@ bool Debugger::collectThisInContext(Debugger::Collector *collector, int frame)
if (!ctxt)
return false;
- Scope scope(engine);
ScopedObject o(scope, ctxt->asCallContext()->d()->activation);
collector->collect(o);
return true;
@@ -477,7 +487,9 @@ QVector<Heap::ExecutionContext::ContextType> Debugger::getScopeTypes(int frame)
return types;
CallContext *ctxt = static_cast<CallContext *>(sctxt);
- for (ExecutionContext *it = ctxt; it; it = it->d()->outer)
+ Scope scope(m_engine);
+ Scoped<ExecutionContext> it(scope, ctxt);
+ for (; it; it = it->d()->outer)
types.append(it->d()->type);
return types;
@@ -550,8 +562,9 @@ void Debugger::leavingFunction(const ReturnedValue &retVal)
QMutexLocker locker(&m_lock);
+ Scope scope(m_engine);
if (m_stepping != NotStepping && m_currentContext == m_engine->currentContext()) {
- m_currentContext = m_engine->currentContext()->d()->parent;
+ m_currentContext = Scoped<ExecutionContext>(scope, m_engine->currentContext()->d()->parent).getPointer();
m_stepping = StepOver;
m_returnedValue = retVal;
}