diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-12-09 15:09:20 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-12-09 15:09:26 +0100 |
commit | ff466a1881435f927f5df9ce1e5eac07d5591904 (patch) | |
tree | 760e068743e6a8e1cc4ec63bb2f8e7dcef88b3e2 /src/qml/jsruntime | |
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')
-rw-r--r-- | src/qml/jsruntime/qv4context_p.h | 8 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4debugging.cpp | 36 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4globalobject.cpp | 5 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4internalclass.cpp | 35 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4mm.cpp | 2 |
5 files changed, 40 insertions, 46 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index 7057e94457..bb45bf4b7d 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -62,11 +62,6 @@ struct ExecutionContext : Base { Type_CallContext = 0x5, Type_QmlContext = 0x6 }; - struct EvalCode - { - Function *function; - EvalCode *next; - }; inline ExecutionContext(ExecutionEngine *engine, ContextType t); @@ -80,7 +75,6 @@ struct ExecutionContext : Base { ExecutionContext *outer; Lookup *lookups; CompiledData::CompilationUnit *compilationUnit; - EvalCode *currentEvalCode; int lineNumber; @@ -158,7 +152,6 @@ Heap::ExecutionContext::ExecutionContext(ExecutionEngine *engine, ContextType t) , outer(0) , lookups(0) , compilationUnit(0) - , currentEvalCode(0) , lineNumber(-1) { // ### GC @@ -216,7 +209,6 @@ inline void ExecutionEngine::pushContext(CallContext *context) Q_ASSERT(current && current->d() && context && context->d()); context->d()->parent = current->d(); current = context; - current->d()->currentEvalCode = 0; } inline ExecutionContext *ExecutionEngine::popContext() 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() diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index f287fc7aec..776e20231e 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -395,11 +395,6 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) ContextStateSaver stateSaver(ctx); - Heap::ExecutionContext::EvalCode evalCode; - evalCode.function = function; - evalCode.next = ctx->d()->currentEvalCode; - ctx->d()->currentEvalCode = &evalCode; - // set the correct strict mode flag on the context ctx->d()->strictMode = strictMode(); ctx->d()->compilationUnit = function->compilationUnit; diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp index f24263a251..d3e6bdd57b 100644 --- a/src/qml/jsruntime/qv4internalclass.cpp +++ b/src/qml/jsruntime/qv4internalclass.cpp @@ -421,25 +421,24 @@ InternalClass *InternalClass::frozen() void InternalClass::destroy() { - if (!engine) - return; - engine = 0; - - propertyTable.~PropertyHash(); - nameMap.~SharedInternalClassData<Identifier *>(); - propertyData.~SharedInternalClassData<PropertyAttributes>(); + QList<InternalClass *> destroyStack; + destroyStack.append(this); - if (m_sealed) - m_sealed->destroy(); - - if (m_frozen) - m_frozen->destroy(); - - for (QHash<Transition, InternalClass *>::ConstIterator it = transitions.begin(), end = transitions.end(); - it != end; ++it) - it.value()->destroy(); - - transitions.clear(); + while (!destroyStack.isEmpty()) { + InternalClass *next = destroyStack.takeLast(); + if (!next->engine) + continue; + next->engine = 0; + next->propertyTable.~PropertyHash(); + next->nameMap.~SharedInternalClassData<Identifier *>(); + next->propertyData.~SharedInternalClassData<PropertyAttributes>(); + if (next->m_sealed) + destroyStack.append(next->m_sealed); + if (next->m_frozen) + destroyStack.append(next->m_frozen); + destroyStack.append(next->transitions.values()); + next->transitions.clear(); + } } struct InternalClassPoolVisitor diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp index f90db63924..1c46932383 100644 --- a/src/qml/jsruntime/qv4mm.cpp +++ b/src/qml/jsruntime/qv4mm.cpp @@ -245,7 +245,7 @@ Heap::Base *MemoryManager::allocData(std::size_t size) m_d->availableItems[pos] += uint(increase); m_d->totalItems += int(increase); #ifdef V4_USE_VALGRIND - VALGRIND_MAKE_MEM_NOACCESS(allocation.memory, allocation.chunkSize); + VALGRIND_MAKE_MEM_NOACCESS(allocation.memory.base(), allocSize); #endif } |