diff options
author | Simon Hausmann <[email protected]> | 2014-12-09 15:09:20 +0100 |
---|---|---|
committer | Simon Hausmann <[email protected]> | 2014-12-09 15:09:26 +0100 |
commit | ff466a1881435f927f5df9ce1e5eac07d5591904 (patch) | |
tree | 760e068743e6a8e1cc4ec63bb2f8e7dcef88b3e2 /src/qml/jsruntime/qv4debugging.cpp | |
parent | e04822f3c2a6b69b7d75e2039256aa2433c59dd2 (diff) | |
parent | 4a3f6e58b591f2fe2204f7cbc1efc8abb0aade74 (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
src/qml/jsruntime/qv4arraydata.cpp
src/qml/jsruntime/qv4context_p.h
src/qml/jsruntime/qv4globalobject.cpp
src/qml/jsruntime/qv4internalclass.cpp
src/quick/items/qquicktext_p.h
src/quick/items/qquicktextedit_p.h
src/quick/items/qquicktextinput_p.h
Change-Id: If07e483e03197cb997ef47a9c647a479cdb09f4c
Diffstat (limited to 'src/qml/jsruntime/qv4debugging.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4debugging.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp index 8211aa584e..4299af7112 100644 --- a/src/qml/jsruntime/qv4debugging.cpp +++ b/src/qml/jsruntime/qv4debugging.cpp @@ -51,25 +51,36 @@ namespace { class JavaScriptJob: public Debugger::Job { QV4::ExecutionEngine *engine; + int frameNr; const QString &script; public: - JavaScriptJob(QV4::ExecutionEngine *engine, const QString &script) + JavaScriptJob(QV4::ExecutionEngine *engine, int frameNr, const QString &script) : engine(engine) + , frameNr(frameNr) , script(script) {} void run() { - QV4::Scope scope(engine); - QV4::ExecutionContext *ctx = engine->currentContext(); - ContextStateSaver ctxSaver(ctx); - QV4::ScopedValue result(scope); + Scope scope(engine); + + ExecutionContextSaver saver(engine->currentContext()); + + Value *savedContexts = scope.alloc(frameNr); + for (int i = 0; i < frameNr; ++i) { + savedContexts[i] = engine->currentContext(); + engine->popContext(); + } + ExecutionContext *ctx = engine->currentContext(); QV4::Script script(ctx, this->script); script.strictMode = ctx->d()->strictMode; - script.inheritContext = false; + // In order for property lookups in QML to work, we need to disable fast v4 lookups. That + // is a side-effect of inheritContext. + script.inheritContext = true; script.parse(); + QV4::ScopedValue result(scope); if (!scope.engine->hasException) result = script.run(); if (scope.engine->hasException) @@ -87,7 +98,7 @@ class EvalJob: public JavaScriptJob public: EvalJob(QV4::ExecutionEngine *engine, const QString &script) - : JavaScriptJob(engine, script) + : JavaScriptJob(engine, /*frameNr*/-1, script) , result(false) {} @@ -107,8 +118,8 @@ class ExpressionEvalJob: public JavaScriptJob Debugger::Collector *collector; public: - ExpressionEvalJob(ExecutionEngine *engine, const QString &expression, Debugger::Collector *collector) - : JavaScriptJob(engine, expression) + ExpressionEvalJob(ExecutionEngine *engine, int frameNr, const QString &expression, Debugger::Collector *collector) + : JavaScriptJob(engine, frameNr, expression) , collector(collector) { } @@ -499,13 +510,10 @@ QVector<Heap::ExecutionContext::ContextType> Debugger::getScopeTypes(int frame) void Debugger::evaluateExpression(int frameNr, const QString &expression, Debugger::Collector *resultsCollector) { Q_ASSERT(state() == Paused); - Q_UNUSED(frameNr); Q_ASSERT(m_runningJob == 0); - ExpressionEvalJob job(m_engine, expression, resultsCollector); - m_runningJob = &job; - m_runningJob->run(); - m_runningJob = 0; + ExpressionEvalJob job(m_engine, frameNr, expression, resultsCollector); + runInEngine(&job); } void Debugger::maybeBreakAtInstruction() |