diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-08-24 15:31:46 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-09-15 07:37:16 +0000 |
commit | 3a8d6123d1947d18db15bf8b30f59cdea7e31380 (patch) | |
tree | 7ad4ca820c395099e938fd9dacffbe27728d24d7 /src/plugins | |
parent | fb059f697a128f87ceecf5ddff1dd735ae78db20 (diff) |
Store the stack of executioncontext's on the JS stack
This saves one pointer per allocated execution context.
Now every execution context that is pushed, allocates two
Values on the js stack. One contains the context itself, the
other one the offset to the parent context.
Things are a bit tricky for with and catch scopes, as those
are called from the generated code, and can't open a Scope
anymore. In addition, all methods iterating over the js
stack frames need to work with ExecutionContext pointers,
not ScopedContext's.
Change-Id: I6f3013749d4e73d2fac37973b976ba6029686b82
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp | 19 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h | 2 |
2 files changed, 8 insertions, 13 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp index 2ef7713ac7..49dde9e8bf 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp @@ -43,13 +43,9 @@ QT_BEGIN_NAMESPACE -QV4::Heap::CallContext *QV4DataCollector::findContext(QV4::Heap::ExecutionContext *ctxt, int frame) +QV4::Heap::CallContext *QV4DataCollector::findContext(QV4::ExecutionEngine *engine, int frame) { - if (!ctxt) - return 0; - - QV4::Scope scope(ctxt->engine); - QV4::ScopedContext ctx(scope, ctxt); + QV4::ExecutionContext *ctx = engine->currentExecutionContext; while (ctx) { QV4::CallContext *cCtxt = ctx->asCallContext(); if (cCtxt && cCtxt->d()->function) { @@ -57,7 +53,7 @@ QV4::Heap::CallContext *QV4DataCollector::findContext(QV4::Heap::ExecutionContex return cCtxt->d(); --frame; } - ctx = ctx->d()->parent; + ctx = engine->parentContext(ctx); } return 0; @@ -82,7 +78,7 @@ QVector<QV4::Heap::ExecutionContext::ContextType> QV4DataCollector::getScopeType QVector<QV4::Heap::ExecutionContext::ContextType> types; QV4::Scope scope(engine); - QV4::Scoped<QV4::CallContext> sctxt(scope, findContext(engine->currentContext(), frame)); + QV4::Scoped<QV4::CallContext> sctxt(scope, findContext(engine, frame)); if (!sctxt || sctxt->d()->type < QV4::Heap::ExecutionContext::Type_QmlContext) return types; @@ -384,7 +380,7 @@ void ArgumentCollectJob::run() QV4::Scope scope(engine); QV4::Scoped<QV4::CallContext> ctxt( scope, QV4DataCollector::findScope( - QV4DataCollector::findContext(engine->currentContext(), frameNr), scopeNr)); + QV4DataCollector::findContext(engine, frameNr), scopeNr)); if (!ctxt) return; @@ -417,7 +413,7 @@ void LocalCollectJob::run() QV4::Scope scope(engine); QV4::Scoped<QV4::CallContext> ctxt( scope, QV4DataCollector::findScope( - QV4DataCollector::findContext(engine->currentContext(), frameNr), scopeNr)); + QV4DataCollector::findContext(engine, frameNr), scopeNr)); if (!ctxt) return; @@ -448,8 +444,7 @@ void ThisCollectJob::run() bool ThisCollectJob::myRun() { QV4::Scope scope(engine); - QV4::ScopedContext ctxt(scope, QV4DataCollector::findContext(engine->currentContext(), - frameNr)); + QV4::ScopedContext ctxt(scope, QV4DataCollector::findContext(engine, frameNr)); while (ctxt) { if (QV4::CallContext *cCtxt = ctxt->asCallContext()) if (cCtxt->d()->activation) diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h index 7d26d71bdf..f8cd0c1508 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h @@ -45,7 +45,7 @@ public: typedef uint Ref; typedef QVector<uint> Refs; - static QV4::Heap::CallContext *findContext(QV4::Heap::ExecutionContext *ctxt, int frame); + static QV4::Heap::CallContext *findContext(QV4::ExecutionEngine *engine, int frame); static QV4::Heap::CallContext *findScope(QV4::Heap::ExecutionContext *ctxt, int scope); static QVector<QV4::Heap::ExecutionContext::ContextType> getScopeTypes( QV4::ExecutionEngine *engine, int frame); |