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 | |
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')
-rw-r--r-- | src/qml/compiler/qqmltypecompiler.cpp | 2 | ||||
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 14 | ||||
-rw-r--r-- | src/qml/debugger/debugger.pri | 5 | ||||
-rw-r--r-- | src/qml/debugger/qqmldebugserver.cpp | 1 | ||||
-rw-r--r-- | src/qml/debugger/qqmlenginedebugservice.cpp | 12 | ||||
-rw-r--r-- | src/qml/debugger/qqmlinspectorservice.cpp | 1 | ||||
-rw-r--r-- | src/qml/jit/qv4isel_masm.cpp | 13 | ||||
-rw-r--r-- | src/qml/jsapi/qjsengine.cpp | 6 | ||||
-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 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 36 | ||||
-rw-r--r-- | src/qml/qml/qqmlprivate.h | 12 | ||||
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 4 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 4 | ||||
-rw-r--r-- | src/qml/types/qqmlobjectmodel.cpp | 2 |
19 files changed, 116 insertions, 88 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index 3a27a859fd..8edf4bbe7c 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -1389,7 +1389,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI if (!mo) continue; - static QQmlType *componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject); + QQmlType *componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject); Q_ASSERT(componentType); QmlIR::Object *syntheticComponent = pool->New<QmlIR::Object>(); diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 31e3ed867e..d2222a0458 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -2991,7 +2991,19 @@ void splitCriticalEdges(IR::Function *f, DominatorTree &df, StatementWorklist &w toBB->in[inIdx] = newBB; newBB->out.append(toBB); - newBB->setContainingGroup(toBB->containingGroup()); + // add newBB to the correct loop group + if (toBB->isGroupStart()) { + BasicBlock *container; + for (container = fromBB->containingGroup(); container; container = container->containingGroup()) + if (container == toBB) + break; + if (container == toBB) // if we were already inside the toBB loop + newBB->setContainingGroup(toBB); + else + newBB->setContainingGroup(toBB->containingGroup()); + } else { + newBB->setContainingGroup(toBB->containingGroup()); + } // patch the terminator Stmt *terminator = fromBB->terminator(); diff --git a/src/qml/debugger/debugger.pri b/src/qml/debugger/debugger.pri index 2545c7836d..77a3ba6490 100644 --- a/src/qml/debugger/debugger.pri +++ b/src/qml/debugger/debugger.pri @@ -34,8 +34,3 @@ HEADERS += \ $$PWD/qqmlprofiler_p.h INCLUDEPATH += $$PWD - -!contains(DEFINES, QT_QML_NO_DEBUGGER): static { - DEFINES += QML_DEBUGGER_EMBED - include(../../plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pri) -} diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp index 9715b5c8d4..b4f905eb7c 100644 --- a/src/qml/debugger/qqmldebugserver.cpp +++ b/src/qml/debugger/qqmldebugserver.cpp @@ -460,6 +460,7 @@ QQmlDebugServer::QQmlDebugServer() } } #else + Q_UNUSED(&cleanup) if (!appD->qmljsDebugArgumentsString().isEmpty()) { qWarning() << QString(QLatin1String( "QML Debugger: Ignoring \"-qmljsdebugger=%1\". " diff --git a/src/qml/debugger/qqmlenginedebugservice.cpp b/src/qml/debugger/qqmlenginedebugservice.cpp index cb533a0459..088f3203d6 100644 --- a/src/qml/debugger/qqmlenginedebugservice.cpp +++ b/src/qml/debugger/qqmlenginedebugservice.cpp @@ -96,8 +96,16 @@ QDataStream &operator>>(QDataStream &ds, QDataStream &operator<<(QDataStream &ds, const QQmlEngineDebugService::QQmlObjectProperty &data) { - ds << (int)data.type << data.name << data.value << data.valueTypeName - << data.binding << data.hasNotifySignal; + ds << (int)data.type << data.name; + // check first whether the data can be saved + // (otherwise we assert in QVariant::operator<<) + QByteArray buffer; + QDataStream fakeStream(&buffer, QIODevice::WriteOnly); + if (QMetaType::save(fakeStream, data.value.type(), data.value.constData())) + ds << data.value; + else + ds << QVariant(); + ds << data.valueTypeName << data.binding << data.hasNotifySignal; return ds; } diff --git a/src/qml/debugger/qqmlinspectorservice.cpp b/src/qml/debugger/qqmlinspectorservice.cpp index 31fa9bddef..89c2c17c45 100644 --- a/src/qml/debugger/qqmlinspectorservice.cpp +++ b/src/qml/debugger/qqmlinspectorservice.cpp @@ -106,6 +106,7 @@ void QQmlInspectorService::updateState() return; } + m_currentInspectorPlugin = 0; foreach (QQmlInspectorInterface *inspector, m_inspectorPlugins) { if (inspector->canHandleView(m_views.first())) { m_currentInspectorPlugin = inspector; diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp index ff35abda67..f905e9c978 100644 --- a/src/qml/jit/qv4isel_masm.cpp +++ b/src/qml/jit/qv4isel_masm.cpp @@ -1533,16 +1533,15 @@ void InstructionSelection::calculateRegistersToSave(const RegisterInformation &u fpRegistersToSave.clear(); foreach (const RegisterInfo &ri, Assembler::getRegisterInfo()) { +#if defined(RESTORE_EBX_ON_CALL) + if (ri.isRegularRegister() && ri.reg<JSC::X86Registers::RegisterID>() == JSC::X86Registers::ebx) { + regularRegistersToSave.append(ri); + continue; + } +#endif // RESTORE_EBX_ON_CALL if (ri.isCallerSaved()) continue; - if (ri.isRegularRegister()) { -#if defined(RESTORE_EBX_ON_CALL) - if (ri.isRegularRegister() && ri.reg<JSC::X86Registers::RegisterID>() == JSC::X86Registers::ebx) { - regularRegistersToSave.append(ri); - continue; - } -#endif // RESTORE_EBX_ON_CALL if (ri.isPredefined() || used.contains(ri)) regularRegistersToSave.append(ri); } else { diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index 427575b386..fba5d1a910 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -243,6 +243,8 @@ void QJSEngine::collectGarbage() \row \li QT_TRID_NOOP() \li QT_TRID_NOOP() \endtable + It also adds an arg() method to the string prototype. + \sa {Internationalization with Qt} */ void QJSEngine::installTranslatorFunctions(const QJSValue &object) @@ -260,6 +262,10 @@ void QJSEngine::installTranslatorFunctions(const QJSValue &object) obj->defineDefaultProperty(QStringLiteral("QT_TR_NOOP"), QV4::GlobalExtensions::method_qsTrNoOp); obj->defineDefaultProperty(QStringLiteral("qsTrId"), QV4::GlobalExtensions::method_qsTrId); obj->defineDefaultProperty(QStringLiteral("QT_TRID_NOOP"), QV4::GlobalExtensions::method_qsTrIdNoOp); + + // string prototype extension + v4->stringObjectClass->prototype->defineDefaultProperty(QStringLiteral("arg"), + QV4::GlobalExtensions::method_string_arg); #endif } 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 } diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index a92162aa74..debf740358 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -491,6 +491,12 @@ The following functions are also on the Qt object. \li \c application.domain \li This is the organization domain set on the QCoreApplication instance. This property can be written to in order to set the organization domain. + + \row + \li \c application.supportsMultipleWindows + \li This read-only property can be used to determine whether or not the + platform supports multiple windows. Some embedded platforms do not support + multiple windows, for example. \endtable The object also has one signal, aboutToQuit(), which is the same as \l QCoreApplication::aboutToQuit(). diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index df4006d3c2..807eb05362 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -63,7 +63,8 @@ static const QLatin1Char Backslash('\\'); static const QLatin1Char Colon(':'); static const QLatin1String Slash_qmldir("/qmldir"); static const QLatin1String String_qmldir("qmldir"); -static const QString dotqml_string(QLatin1String(".qml")); +static const QString dotqml_string(QStringLiteral(".qml")); +static const QString dotuidotqml_string(QStringLiteral(".ui.qml")); static bool designerSupportRequired = false; namespace { @@ -657,23 +658,28 @@ bool QQmlImportNamespace::Import::resolveType(QQmlTypeLoader *typeLoader, return (*type_return != 0); } } else if (!isLibrary) { - QString qmlUrl = url + QString::fromRawData(type.constData(), type.length()) + dotqml_string; - + QString qmlUrl; bool exists = false; - if (QQmlFile::isBundle(qmlUrl)) { - exists = QQmlFile::bundleFileExists(qmlUrl, typeLoader->engine()); - } else { - exists = !typeLoader->absoluteFilePath(QQmlFile::urlToLocalFileOrQrc(qmlUrl)).isEmpty(); - if (!exists) { - QString formUrl = url + QString::fromRawData(type.constData(), type.length()) + QStringLiteral(".ui.qml"); - if (!typeLoader->absoluteFilePath(QQmlFile::urlToLocalFileOrQrc(formUrl)).isEmpty()) { - exists = true; - qmlUrl = formUrl; - } + const QString urlsToTry[2] = { + url + QString::fromRawData(type.constData(), type.length()) + dotqml_string, // Type -> Type.qml + url + QString::fromRawData(type.constData(), type.length()) + dotuidotqml_string // Type -> Type.ui.qml + }; + for (uint i = 0; i < sizeof(urlsToTry) / sizeof(urlsToTry[0]); ++i) { + const QString url = urlsToTry[i]; + + if (QQmlFile::isBundle(url)) { + exists = QQmlFile::bundleFileExists(url, typeLoader->engine()); + } else { + exists = !typeLoader->absoluteFilePath(QQmlFile::urlToLocalFileOrQrc(url)).isEmpty(); + if (!exists) + exists = QQmlMetaType::findCachedCompilationUnit(QUrl(url)); + } + + if (exists) { + qmlUrl = url; + break; } - if (!exists) - exists = QQmlMetaType::findCachedCompilationUnit(QUrl(qmlUrl)); } if (exists) { diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h index 29d2bc6193..dfbf04a50f 100644 --- a/src/qml/qml/qqmlprivate.h +++ b/src/qml/qml/qqmlprivate.h @@ -122,12 +122,12 @@ namespace QQmlPrivate typedef int yes_type; typedef char no_type; - static yes_type check(To *); - static no_type check(...); + static yes_type checkType(To *); + static no_type checkType(...); static inline int cast() { - return StaticCastSelectorClass<From, To, sizeof(check(reinterpret_cast<From *>(0)))>::cast(); + return StaticCastSelectorClass<From, To, sizeof(checkType(reinterpret_cast<From *>(0)))>::cast(); } }; @@ -145,10 +145,10 @@ namespace QQmlPrivate typedef char no_type; template<typename ReturnType> - static yes_type check(ReturnType *(*)(QObject *)); - static no_type check(...); + static yes_type checkType(ReturnType *(*)(QObject *)); + static no_type checkType(...); - static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type); + static bool const value = sizeof(checkType(&T::qmlAttachedProperties)) == sizeof(yes_type); }; template <typename T> diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index fcbf474008..6e2e51b493 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -174,7 +174,7 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) /*! \qmltype DelegateModel \instantiates QQmlDelegateModel - \inqmlmodule QtQml.Models 2 + \inqmlmodule QtQml.Models \brief Encapsulates a model and delegate The DelegateModel type encapsulates a model and the delegate that will @@ -2307,7 +2307,7 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package) /*! \qmltype DelegateModelGroup \instantiates QQmlDelegateModelGroup - \inqmlmodule QtQml.Models 2 + \inqmlmodule QtQml.Models \ingroup qtquick-models \brief Encapsulates a filtered set of visual data items diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 142625d7ae..afd887ba53 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1436,7 +1436,7 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index) /*! \qmltype ListModel \instantiates QQmlListModel - \inqmlmodule QtQml.Models 2 + \inqmlmodule QtQml.Models \ingroup qtquick-models \brief Defines a free-form list data source @@ -2447,7 +2447,7 @@ bool QQmlListModelParser::definesEmptyList(const QString &s) /*! \qmltype ListElement \instantiates QQmlListElement - \inqmlmodule QtQml.Models 2 + \inqmlmodule QtQml.Models \brief Defines a data item in a ListModel \ingroup qtquick-models diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp index d2f47c41b2..7c1a951a2b 100644 --- a/src/qml/types/qqmlobjectmodel.cpp +++ b/src/qml/types/qqmlobjectmodel.cpp @@ -123,7 +123,7 @@ public: /*! \qmltype ObjectModel \instantiates QQmlObjectModel - \inqmlmodule QtQml.Models 2 + \inqmlmodule QtQml.Models \ingroup qtquick-models \brief Defines a set of items to be used as a model |