From fb52dab6b41ddd6955cb14e1474f90ee5333dac9 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 24 Aug 2015 16:47:48 +0200 Subject: Further cleanups Reduce usage of ScopedContext. Change-Id: I84a6a7478065de3398fd0b21596ca1308e78ceb3 Reviewed-by: Simon Hausmann --- .../qmltooling/qmldbg_debugger/qv4datacollector.cpp | 18 ++++++++---------- .../qmltooling/qmldbg_debugger/qv4datacollector.h | 4 ++-- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'src/plugins/qmltooling/qmldbg_debugger') diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp index f788a0a217..db8c1feb92 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp @@ -43,14 +43,14 @@ QT_BEGIN_NAMESPACE -QV4::Heap::CallContext *QV4DataCollector::findContext(QV4::ExecutionEngine *engine, int frame) +QV4::CallContext *QV4DataCollector::findContext(QV4::ExecutionEngine *engine, int frame) { QV4::ExecutionContext *ctx = engine->currentContext; while (ctx) { QV4::CallContext *cCtxt = ctx->asCallContext(); if (cCtxt && cCtxt->d()->function) { if (frame < 1) - return cCtxt->d(); + return cCtxt; --frame; } ctx = engine->parentContext(ctx); @@ -59,12 +59,12 @@ QV4::Heap::CallContext *QV4DataCollector::findContext(QV4::ExecutionEngine *engi return 0; } -QV4::Heap::CallContext *QV4DataCollector::findScope(QV4::Heap::ExecutionContext *ctxt, int scope) +QV4::Heap::CallContext *QV4DataCollector::findScope(QV4::ExecutionContext *ctxt, int scope) { if (!ctxt) return 0; - QV4::Scope s(ctxt->engine); + QV4::Scope s(ctxt->d()->engine); QV4::ScopedContext ctx(s, ctxt); for (; scope > 0 && ctx; --scope) ctx = ctx->d()->outer; @@ -78,11 +78,11 @@ QVector QV4DataCollector::getScopeType QVector types; QV4::Scope scope(engine); - QV4::Scoped sctxt(scope, findContext(engine, frame)); + QV4::CallContext *sctxt = findContext(engine, frame); if (!sctxt || sctxt->d()->type < QV4::Heap::ExecutionContext::Type_QmlContext) return types; - QV4::ScopedContext it(scope, sctxt->d()); + QV4::ScopedContext it(scope, sctxt); for (; it; it = it->d()->outer) types.append(it->d()->type); @@ -379,8 +379,7 @@ void ArgumentCollectJob::run() QV4::Scope scope(engine); QV4::Scoped ctxt( - scope, QV4DataCollector::findScope( - QV4DataCollector::findContext(engine, frameNr), scopeNr)); + scope, QV4DataCollector::findScope(QV4DataCollector::findContext(engine, frameNr), scopeNr)); if (!ctxt) return; @@ -412,8 +411,7 @@ void LocalCollectJob::run() QV4::Scope scope(engine); QV4::Scoped ctxt( - scope, QV4DataCollector::findScope( - QV4DataCollector::findContext(engine, frameNr), scopeNr)); + scope, QV4DataCollector::findScope(QV4DataCollector::findContext(engine, frameNr), scopeNr)); if (!ctxt) return; diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h index f8cd0c1508..fb78c1614a 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h @@ -45,8 +45,8 @@ public: typedef uint Ref; typedef QVector Refs; - static QV4::Heap::CallContext *findContext(QV4::ExecutionEngine *engine, int frame); - static QV4::Heap::CallContext *findScope(QV4::Heap::ExecutionContext *ctxt, int scope); + static QV4::CallContext *findContext(QV4::ExecutionEngine *engine, int frame); + static QV4::Heap::CallContext *findScope(QV4::ExecutionContext *ctxt, int scope); static QVector getScopeTypes( QV4::ExecutionEngine *engine, int frame); -- cgit v1.2.3