diff options
author | Ulf Hermann <[email protected]> | 2022-01-10 16:53:05 +0100 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2022-01-15 14:22:42 +0100 |
commit | f73e294472906077556e13ca10df185300c2450f (patch) | |
tree | fece290b38c3d3d4b047b90692a296eabc345905 | |
parent | 2715d67f53efc916f212022572fa639d7704b43c (diff) |
Remove the qml_sequence_object feature flag
QML sequences are required for named lists of value types. The original
reason for the introduction of this feature was the template code
explosion caused by the way the sequence types were registered in Qt5.
As we register them differently now, the code size overhead should be
smaller. It makes very little sense to switch sequence types off these
days.
[ChangeLog][QtQml][Important Behavior Changes] The qml_sequence_object
feature flag has been removed. Omitting sequences from the QML language
does not make much sense now that we use them for lists of value types.
The original reason to allow it was that the sequence support took up a
lot of space in the binary. This is not the case anymore since 6.0.
Change-Id: I2f1d43cdd29ba63853316b06113cb49ed30aa410
Reviewed-by: Joerg Bornemann <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
-rw-r--r-- | conanfile.py | 1 | ||||
-rw-r--r-- | src/qml/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/qml/configure.cmake | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 18 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 16 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4sequenceobject_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 3 | ||||
-rw-r--r-- | src/qmlworkerscript/qv4serialize.cpp | 8 |
9 files changed, 2 insertions, 62 deletions
diff --git a/conanfile.py b/conanfile.py index 139f2e1cbc..1fe8debe40 100644 --- a/conanfile.py +++ b/conanfile.py @@ -44,7 +44,6 @@ _qtdeclarative_features = [ "qml-object-model", "qml-preview", "qml-profiler", - "qml-sequence-object", "qml-table-model", "qml-worker-script", "qml-xml-http-request", diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt index 1266b6ac1d..2fbf187978 100644 --- a/src/qml/CMakeLists.txt +++ b/src/qml/CMakeLists.txt @@ -223,6 +223,7 @@ qt_internal_add_qml_module(Qml jsruntime/qv4value.cpp jsruntime/qv4value_p.h jsruntime/qv4variantobject.cpp jsruntime/qv4variantobject_p.h jsruntime/qv4vme_moth.cpp jsruntime/qv4vme_moth_p.h + jsruntime/qv4sequenceobject.cpp jsruntime/qv4sequenceobject_p.h jsruntime/qv4vtable_p.h memory/qv4heap_p.h memory/qv4mm.cpp memory/qv4mm_p.h @@ -537,11 +538,6 @@ qt_internal_extend_target(Qml CONDITION QT_FEATURE_qml_debug AND QT_FEATURE_tran debugger/qqmldebugtranslationprotocol_p.h ) -qt_internal_extend_target(Qml CONDITION QT_FEATURE_qml_sequence_object - SOURCES - jsruntime/qv4sequenceobject.cpp jsruntime/qv4sequenceobject_p.h -) - qt_internal_extend_target(Qml CONDITION UNIX SOURCES jsruntime/qv4compilationunitmapper_unix.cpp diff --git a/src/qml/configure.cmake b/src/qml/configure.cmake index 11c29620d6..989c2e3edc 100644 --- a/src/qml/configure.cmake +++ b/src/qml/configure.cmake @@ -159,11 +159,6 @@ qt_feature("qml-devtools" PRIVATE LABEL "QML Development Tools" PURPOSE "Provides the QmlDevtools library and various utilities." ) -qt_feature("qml-sequence-object" PRIVATE - SECTION "QML" - LABEL "QML sequence object" - PURPOSE "Supports mapping sequence types into QML." -) qt_feature("qml-xml-http-request" PRIVATE SECTION "QML" LABEL "QML XML http request" @@ -212,7 +207,6 @@ qt_configure_add_summary_section(NAME "Qt QML") qt_configure_add_summary_entry(ARGS "qml-network") qt_configure_add_summary_entry(ARGS "qml-debug") qt_configure_add_summary_entry(ARGS "qml-jit") -qt_configure_add_summary_entry(ARGS "qml-sequence-object") qt_configure_add_summary_entry(ARGS "qml-xml-http-request") qt_configure_add_summary_entry(ARGS "qml-locale") qt_configure_end_summary_section() # end of "Qt QML" section diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index a5f3336584..89471797d7 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -95,11 +95,7 @@ #include "qv4urlobject_p.h" #include "qv4jscall_p.h" #include "qv4variantobject_p.h" - -#if QT_CONFIG(qml_sequence_object) #include "qv4sequenceobject_p.h" -#endif - #include "qv4qobjectwrapper_p.h" #include "qv4memberdata_p.h" #include "qv4arraybuffer_p.h" @@ -636,10 +632,8 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) jsObjects[VariantProto] = memoryManager->allocate<VariantPrototype>(); Q_ASSERT(variantPrototype()->getPrototypeOf() == objectPrototype()->d()); -#if QT_CONFIG(qml_sequence_object) ic = newInternalClass(SequencePrototype::staticVTable(), SequencePrototype::defaultPrototype(this)); jsObjects[SequenceProto] = ScopedValue(scope, memoryManager->allocObject<SequencePrototype>(ic->d())); -#endif ExecutionContext *global = rootContext(); @@ -715,9 +709,7 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) static_cast<VariantPrototype *>(variantPrototype())->init(); -#if QT_CONFIG(qml_sequence_object) sequencePrototype()->cast<SequencePrototype>()->init(); -#endif jsObjects[WeakMap_Ctor] = memoryManager->allocate<WeakMapCtor>(global); jsObjects[WeakMapProto] = memoryManager->allocate<WeakMapPrototype>(); @@ -1541,10 +1533,8 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, QMet return v->toVariant(); } else if (QV4::QmlListWrapper *l = object->as<QV4::QmlListWrapper>()) { return l->toVariant(); -#if QT_CONFIG(qml_sequence_object) } else if (object->isListType()) { return QV4::SequencePrototype::toVariant(object); -#endif } } @@ -1569,12 +1559,11 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, QMet } QVariant retn; -#if QT_CONFIG(qml_sequence_object) bool succeeded = false; retn = QV4::SequencePrototype::toVariant(value, metaType, &succeeded); if (succeeded) return retn; -#endif + if (metaType.isValid()) { retn = QVariant(metaType, nullptr); auto retnAsIterable = retn.value<QSequentialIterable>(); @@ -1795,7 +1784,6 @@ QV4::ReturnedValue ExecutionEngine::fromData( #endif case QMetaType::QObjectStar: return QV4::QObjectWrapper::wrap(this, *reinterpret_cast<QObject* const *>(ptr)); -#if QT_CONFIG(qml_sequence_object) case QMetaType::QStringList: { bool succeeded = false; @@ -1806,7 +1794,6 @@ QV4::ReturnedValue ExecutionEngine::fromData( return retn->asReturnedValue(); return QV4::Encode(newArrayObject(*reinterpret_cast<const QStringList *>(ptr))); } -#endif case QMetaType::QVariantList: return variantListToJS(this, *reinterpret_cast<const QVariantList *>(ptr)); case QMetaType::QVariantMap: @@ -1875,13 +1862,10 @@ QV4::ReturnedValue ExecutionEngine::fromData( } } -#if QT_CONFIG(qml_sequence_object) bool succeeded = false; QV4::ScopedValue retn(scope, QV4::SequencePrototype::fromData(this, metaType, ptr, &succeeded)); if (succeeded) return retn->asReturnedValue(); -#endif - if (QMetaType::canConvert(metaType, QMetaType::fromType<QSequentialIterable>())) { QSequentialIterable lst; diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index be115cb064..617c7361cf 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -221,9 +221,7 @@ public: URIErrorProto, PromiseProto, VariantProto, -#if QT_CONFIG(qml_sequence_object) SequenceProto, -#endif SharedArrayBufferProto, ArrayBufferProto, DataViewProto, @@ -344,9 +342,7 @@ public: Object *uRIErrorPrototype() const { return reinterpret_cast<Object *>(jsObjects + URIErrorProto); } Object *promisePrototype() const { return reinterpret_cast<Object *>(jsObjects + PromiseProto); } Object *variantPrototype() const { return reinterpret_cast<Object *>(jsObjects + VariantProto); } -#if QT_CONFIG(qml_sequence_object) Object *sequencePrototype() const { return reinterpret_cast<Object *>(jsObjects + SequenceProto); } -#endif Object *sharedArrayBufferPrototype() const { return reinterpret_cast<Object *>(jsObjects + SharedArrayBufferProto); } Object *arrayBufferPrototype() const { return reinterpret_cast<Object *>(jsObjects + ArrayBufferProto); } diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 34994bd0e6..07f6b15f5c 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -58,11 +58,7 @@ #include <private/qv4identifiertable_p.h> #include <private/qv4lookup_p.h> #include <private/qv4qmlcontext_p.h> - -#if QT_CONFIG(qml_sequence_object) #include <private/qv4sequenceobject_p.h> -#endif - #include <private/qv4objectproto_p.h> #include <private/qv4jsonobject_p.h> #include <private/qv4regexpobject_p.h> @@ -210,7 +206,6 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object if (const QMetaObject *valueTypeMetaObject = QQmlMetaType::metaObjectForValueType(propMetaType)) return QV4::QQmlValueTypeWrapper::create(v4, object, property.coreIndex(), valueTypeMetaObject, propMetaType); } else { -#if QT_CONFIG(qml_sequence_object) // see if it's a sequence type bool succeeded = false; QV4::ScopedValue retn(scope, QV4::SequencePrototype::newSequence( @@ -218,7 +213,6 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object !property.isWritable(), &succeeded)); if (succeeded) return retn->asReturnedValue(); -#endif } if (!propMetaType.isValid()) { @@ -1330,7 +1324,6 @@ private: quint32 intValue; bool boolValue; QObject *qobjectPtr; -#if QT_CONFIG(qml_sequence_object) std::vector<int> *stdVectorIntPtr; std::vector<qreal> *stdVectorRealPtr; std::vector<bool> *stdVectorBoolPtr; @@ -1339,7 +1332,6 @@ private: #if QT_CONFIG(qml_itemmodel) std::vector<QModelIndex> *stdVectorQModelIndexPtr; #endif -#endif char allocData[MaxSizeOf7<QVariant, QString, @@ -1556,14 +1548,12 @@ static int MatchScore(const QV4::Value &actual, QMetaType conversionMetaType) } } -#if QT_CONFIG(qml_sequence_object) if (auto sequenceMetaType = SequencePrototype::metaTypeForSequence(obj); sequenceMetaType != -1) { if (sequenceMetaType == conversionType) return 1; else return 10; } -#endif if (obj->as<QV4::QQmlValueTypeWrapper>()) { const QVariant v = obj->engine()->toVariant(actual, QMetaType {}); @@ -1827,7 +1817,6 @@ void *CallArgument::dataPtr() case QVariantWrappedType: return qvariantPtr->data(); default: -#if QT_CONFIG(qml_sequence_object) if (type == qMetaTypeId<std::vector<int>>()) return stdVectorIntPtr; if (type == qMetaTypeId<std::vector<qreal>>()) @@ -1842,7 +1831,6 @@ void *CallArgument::dataPtr() if (type == qMetaTypeId<std::vector<QModelIndex>>()) return stdVectorQModelIndexPtr; #endif -#endif break; } @@ -1902,7 +1890,6 @@ void CallArgument::initAsType(QMetaType metaType) } } -#if QT_CONFIG(qml_sequence_object) template <class T, class M> bool CallArgument::fromContainerValue(const QV4::Value &value, M CallArgument::*member) { @@ -1916,7 +1903,6 @@ bool CallArgument::fromContainerValue(const QV4::Value &value, M CallArgument::* (this->*member) = nullptr; return false; } -#endif bool CallArgument::fromValue( QMetaType metaType, QV4::ExecutionEngine *engine, const QV4::Value &value) @@ -2037,7 +2023,6 @@ bool CallArgument::fromValue( break; } -#if QT_CONFIG(qml_sequence_object) if (type == qMetaTypeId<std::vector<int>>()) { if (fromContainerValue<std::vector<int>>(value, &CallArgument::stdVectorIntPtr)) return true; @@ -2061,7 +2046,6 @@ bool CallArgument::fromValue( } #endif } -#endif break; } diff --git a/src/qml/jsruntime/qv4sequenceobject_p.h b/src/qml/jsruntime/qv4sequenceobject_p.h index d7bc7327c5..db489d039d 100644 --- a/src/qml/jsruntime/qv4sequenceobject_p.h +++ b/src/qml/jsruntime/qv4sequenceobject_p.h @@ -65,8 +65,6 @@ #include <QtCore/qabstractitemmodel.h> #endif -QT_REQUIRE_CONFIG(qml_sequence_object); - QT_BEGIN_NAMESPACE namespace QV4 { diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 814e7ef789..119eb50421 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -91,10 +91,7 @@ #endif #include <private/qqmlplatform_p.h> #include <private/qqmlloggingcategory_p.h> - -#if QT_CONFIG(qml_sequence_object) #include <private/qv4sequenceobject_p.h> -#endif #ifdef Q_OS_WIN // for %APPDATA% # include <qt_windows.h> diff --git a/src/qmlworkerscript/qv4serialize.cpp b/src/qmlworkerscript/qv4serialize.cpp index 39adaa715b..126ebe5e41 100644 --- a/src/qmlworkerscript/qv4serialize.cpp +++ b/src/qmlworkerscript/qv4serialize.cpp @@ -42,9 +42,7 @@ #include <private/qv4value_p.h> #include <private/qv4dateobject_p.h> #include <private/qv4regexpobject_p.h> -#if QT_CONFIG(qml_sequence_object) #include <private/qv4sequenceobject_p.h> -#endif #include <private/qv4objectproto_p.h> #include <private/qv4qobjectwrapper_p.h> @@ -82,9 +80,7 @@ enum Type { WorkerRegexp, WorkerListModel, WorkerUrl, -#if QT_CONFIG(qml_sequence_object) WorkerSequence -#endif }; static inline quint32 valueheader(Type type, quint32 size = 0) @@ -245,7 +241,6 @@ void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine // No other QObject's are allowed to be sent push(data, valueheader(WorkerUndefined)); } else if (const Object *o = v.as<Object>()) { -#if QT_CONFIG(qml_sequence_object) if (o->isListType()) { // valid sequence. we generate a length (sequence length + 1 for the sequence type) uint seqLength = ScopedValue(scope, o->get(engine->id_length()))->toUInt32(); @@ -263,7 +258,6 @@ void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine return; } -#endif const QVariant variant = engine->toVariant(v, QMetaType::fromType<QUrl>(), false); if (variant.userType() == QMetaType::QUrl) { serializeString(data, variant.value<QUrl>().toString(), WorkerUrl); @@ -419,7 +413,6 @@ ReturnedValue Serialize::deserialize(const char *&data, ExecutionEngine *engine) agent->setProperty("engine", QVariant::fromValue(engine)); return rv->asReturnedValue(); } -#if QT_CONFIG(qml_sequence_object) case WorkerSequence: { ScopedValue value(scope); @@ -438,7 +431,6 @@ ReturnedValue Serialize::deserialize(const char *&data, ExecutionEngine *engine) QVariant seqVariant = QV4::SequencePrototype::toVariant(array, QMetaType(sequenceType), &succeeded); return QV4::SequencePrototype::fromVariant(engine, seqVariant, &succeeded); } -#endif } Q_ASSERT(!"Unreachable"); return QV4::Encode::undefined(); |