summaryrefslogtreecommitdiff
path: root/src/qml/jsruntime/qv4executablecompilationunit.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Runtime codegen: Avoid memset for zeroingFabian Kosmale2023-05-041-12/+8
| | | | | | | | | We can just use calloc and zero-initialization. Change-Id: I88dc79d5b880253655159ae3b4385b9792a18ec6 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Refactor the usage of icutils::NodeAmir Masoud Abdol2023-04-241-1/+1
| | | | | | | | | | | In Unity Build, on OpenSUSE, for some reason compiler confuses the Node with an `int`. This refactoring resolves the issue by moving the type into the `icutils` namespace. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: Id379b9aff21b29115d4503791debd658f034a0cd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Improve handling of CU's sourceFileIndexUlf Hermann2023-03-281-4/+9
| | | | | | | | | | | | | | In the unlikely case that we get a corrupted CU from a cache file and it still passes the header verification we don't want it to access invalid memory when checking the file name. We also generally want to use uint as index into the string table. A signed integer makes no sense here. Pick-to: 6.5 Coverity-Id: 310389 Change-Id: I12e9b8f39e1d3c68fd701c1ef4f54845ab8c3c12 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Invalidate any existing cache files when saving a CU to diskUlf Hermann2023-02-101-2/+8
| | | | | | | | | | Otherwise we just re-load the old cache file next time. That's clearly not intended. Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-111078 Change-Id: Ia65b46880eca2b6e8c4792a09f20716125beada3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Allow more fine grained control of the disk cacheUlf Hermann2023-01-021-2/+5
| | | | | | | | | You can now enable and disable the AOT-compiled code and the loading and saving of .qmlc files separately. Fixes: QTBUG-101358 Change-Id: I1305c4f2f75d8cff544a127e956589d1ed1aeb52 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Qml: Analyze qsTranslate at compile timeUlf Hermann2022-10-131-9/+14
| | | | | | | | | | We generate translation bindings for all the other translation functions already. We can just as well generate a translation binding for this one, too. Fixes: QTBUG-107536 Change-Id: I851f03c26510b6d450aa78f5d7a1f0142d3a81aa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that on() was replaced with a matcher that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Change-Id: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-4/+4
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I601bf70f020f511019ed28731ba53b14b765dbf0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Use an enum to categorize functions and rename aotFunctionUlf Hermann2022-09-291-2/+2
| | | | | | | | We want to use the aotFunction member also for typed JavaScript functions. Change-Id: Iad6d12ebed3ad3069832484137ed8e4d9e7a7cf4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Optimize QObject method callsUlf Hermann2022-09-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | So far, for each method call we had to allocate a new QObjectMethod as we didn't have any lookup to cache the methods. Introduce a new lookup for that and use it for all QObject methods. Since QObjectMethod contains a pointer to the concrete QObject the method was retrieved from, some more care has to be taken: If we are going to call the method right away, we don't need the object since we always have a thisObject and any further retrieval of the same method will result in a call again. This enables us to cache the method for any instance of the same class. When storing the method elsewhere, though, we need to hold on to the object since you can defer the call or connect a handler to a signal or similar. For such operations we do need the object. We can still optimize a bit by re-using the method cache we build the first time around. Fixes: QTBUG-95628 Change-Id: I5991180c5e0234cdc179c2b78a43dafc9083e525 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Remove unused includes in qml, first partSemih Yavuz2022-09-141-1/+0
| | | | | | | | | | | | | | | Drop unnecessary includes detected by clangd-iwyu. Add new includes due to the transitive includes. Also, some of the includes were detected as unused even if they were actually in use. In those cases, use angular brackets instead of "" which deceives the tool not to complain. Affected subfolders: Debugger, Compiler, JsApi, JsRuntime, Memory, Parser Task-number: QTBUG-106473 Change-Id: I01d996a2a2ba31cbbc5f60f5454c8f850298f528 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Make modules imported with registerModule() available in QMLUlf Hermann2022-09-021-57/+110
| | | | | | | | | So far, you could only use them from pure JavaScript programs. Also, fix re-exporting parts of native modules. Fixes: QTBUG-105901 Change-Id: I170017083284e6457b1aa0c6e606fd26227edae3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Create Translation Bindings without CompiledData::BindingSami Shalayel2022-08-151-19/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To add translation bindings to qmltc, the methods used to create translation bindings need to be adapted to work without QV4::CompiledData::Binding as it is not available from qmltc. Instead, information already available from the QQmlJSScope should be used, along with a newly introduced helper class QQmlTranslation. Details: Add a QQmlTranslation class that represents a call to qsTr, qsTrId etc that knows how to translate itself (without needing any ExecutableCompilationUnit or Binding). It encapsulates the information needed to create a translation binding. ExecutableCompilationUnit::bindingValueAsString refactored so its functionality can be used without Binding. Instead, it uses only the translationId, see ExecutableCompilationUnit::translateFromId and ExecutableCompilationUnit::translateFrom. Refactored QQmlTranslationBinding to work with QQmlTranslation instead of CompiledData::Binding. Same for QQmlCppBinding::createTranslationBindingForBindable, QQmlTranslationPropertyBinding::create and QQmlCppBinding::createTranslationBindingForNonBindable. Changed TranslationBindingInformation to work without CompiledData::Binding, and also removed static unused QString ProxyTranslator::originStringFromInformation( const TranslationBindingInformation &translationBindingInformation) as I could not find out what this origin string is. Same for the translation debugging in qmldb_preview. Added QmltcCodeGenerator::generate_createTranslationBindingOnProperty. Added #if to avoid compilation error for standalone DOM compilation due to the new QQmlTranslation class. Task-number: QTBUG-105345 Change-Id: Iccd94d5cba4eaf63901233451fec48051c855c2a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QML: Port QV4::CompiledData::Binding to new special integer bitfieldUlf Hermann2022-05-111-1/+1
| | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: I9f8bc5fa45c61f77ee95b055a3d8de001da8f8c5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Port QV4::CompiledData::Location to new special integer bitfieldUlf Hermann2022-05-111-3/+9
| | | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: If0d6f893f2351a4146ddf125be4079b5e312f308 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Port QV4::CompiledData::Lookup to new special integer bitfieldUlf Hermann2022-05-111-2/+2
| | | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: I8cc6db56642f1cd2d16e80ba5c49ffd7c6fdcd8c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Port icutils::Node to new special integer bitfieldUlf Hermann2022-05-111-1/+1
| | | | | | | Change-Id: I46f4f21bda1360d09e2c49a1f04dbe411fb46f7d Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Port QV4::CompiledData::RegExp to new special integer bitfieldUlf Hermann2022-05-111-2/+2
| | | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: I37be080387bf086d84761b056140cc5a99d161ed Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Port QV4::CompiledData::Object to new special integer bitfieldUlf Hermann2022-05-111-6/+7
| | | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: Ia57a16313e883a8d4dab15c971181440ed1d2214 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Port QV4::CompiledData::JSClassMember to new special integer bitfieldUlf Hermann2022-05-111-2/+2
| | | | | | | | Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-99545 Change-Id: I0a7d86450011f1664d61db4d78317dafbcfbb8cf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Fix typo and apply some cosmeticsUlf Hermann2022-04-111-2/+2
| | | | | | Change-Id: If51b86e1741b7e9f0e7e4d5f593496bd28cec081 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* DelegateModel: Use actual bindings for required propertiesUlf Hermann2022-04-111-1/+1
| | | | | | | | | | | | | Tracking the change signals is brittle and error prone. We have bindings for this case. Let's use them. We can construct a synthetic QV4::Function that contains its own QQmlJSAotFunction. In order to pass the property index to the function we generalize the "index" property of QQmlJSAotFunction to contain any extra data the function may want to use. If there is no compilation unit, we pass that instead. Fixes: QTBUG-91649 Change-Id: I0758bcc4964a48c6818d18bfb0972e67dbc16a1f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix deprecated uses of QScopedPointerMårten Nordheim2022-03-101-2/+2
| | | | | | | | Which is uses of take() and swap(). And replace it with std::unique_ptr. Change-Id: I2580383c1d2af0ba6103a66f034235905e0988ac Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QQmlPropertyCache: Store checksums in type loaderUlf Hermann2022-03-091-2/+3
| | | | | | | | | | | | | The type loader is specific to the engine. This way we can calculate/retrieve the checksum without modifying the property cache, which makes checksum() threadsafe. The checksums are only needed for loading and storing compilation units from/to disk. Therefore, there is no point in keeping them inside the property caches anyway. Pick-to: 6.3 Task-number: QTBUG-73271 Change-Id: I7bea65e73769f76352bb5947d7229e256e7f2f25 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid spurious dependency on qml_compile_hash_p.hFabian Kosmale2022-02-131-0/+2
| | | | | | | | | | | | The compile hash changes on every commit, so including it in a central header like qv4compileddata_p.h would cause many spurious rebuilds. As we only needed it there for a static assert, we can simply move that check into a source file. Pick-to: 6.2 6.3 Change-Id: I9f24cb3faf5172023b0ece9e6aa07db02638c8be Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Avoid ping-pong between plain pointers and QQmlRefPointerUlf Hermann2022-01-251-1/+1
| | | | | | | | | | | | | | | We want to deal in QQmlRefPointer as much as possible. In particular, assigning nullptr to a QQmlRefPointer triggers the creation of an empty QQmlRefPointer and the assignment of that one. Provide a reset() method to do this in a cleaner way. In turn, make QQmlGuardedContextData::reset() private. It's really dangerous and should not be called from outside. setContextData() is safer but may do additional work. The only place from where reset() was previously called in its public capacity is probably dead code, though. Change-Id: Idb72e255dbfad6e5dd963dc76d719bb9edc10471 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Further tighten checks around QML_COMPILE_HASHUlf Hermann2022-01-201-4/+10
| | | | | | | | | Log the differing hashes in case of a mismatch. Pick-to: 6.2 6.3 Task-number: QTBUG-99608 Change-Id: Id85306d3cfdb08d235c8717b441105c5d0b68cf3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlEngine: Remove methods that merely forward to QQmlMetaTypeUlf Hermann2022-01-181-2/+2
| | | | | | | There is no reason to drag an engine around for those. Change-Id: I02100b207f197e75dfd458ff1cce5c4920dd94bd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Move composite types into QQmlMetaTypeUlf Hermann2022-01-151-5/+3
| | | | | | | | | | | | | | | | | This way we can retrieve them without an engine. Since we construct a new QMetaTypeInterface for each composite type we load, those QMetaTypeInterfaces will still be unique even if the same type is used in different engines. Therefore, we can store them all in the same container. This exposes the fact that we don't actually register composite types as "custom" QMetaTypes in registerInternalCompositeType(), but we expect them to be registered later on, in particular in unregisterInternalCompositeType(). Retrieve the IDs once, in order to have the types registered right away. Change-Id: Ib8e875a5c950f105996877ea597a6de2b01aa1f5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix handling of QML_COMPILE_HASHUlf Hermann2022-01-071-2/+2
| | | | | | | | | | | We need to check for the contents of the tag file, not its name. We need to strip the contents before checking. We need to run git in the right directory. We need to fail if we cannot find any QML_COMPILE_HASH. Pick-to: 6.3 6.2 Task-number: QTBUG-99608 Change-Id: Ic42a073b196143f8576a84e7a4531b5f2927fb68 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Do not copy lookupsUlf Hermann2021-12-161-14/+2
| | | | | | | | | | | | | It leads to data corruption. Also, be more careful about releasing the property cache. We can only do that if the qobjectlookup member of the union is active. Unfortunately we have to do a number of checks now, to make sure it is. In order to still keep the checks inline, we move some functions around. Pick-to: 6.2 6.3 Fixes: QTBUG-99211 Change-Id: If6dd879e67b172e1a9035e83fbfacbe73c6c7476 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use QHash instead of QMap for resolved typesFabian Kosmale2021-05-201-1/+13
| | | | | | | | | | | | | | | | This vastly speeds up resolved type reference lookups in QQmlObjectCreator::createInstance, which translates to significant improvements in qmlbench: perf record -b ./src/qmlbench --shell frame-count delegates_qobject.qml went from roughly 730 frames to > 800 locally. To have a stable order in the hash, we simply sort a tempory vector of keys. As this happens only once, the overhead is negligible and partially offset by the better memory locality of the QHash anyway. Task-number: QTBUG-88672 Change-Id: Ib547a87fd0d2d81f366ea927ade232f33b3d3788 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add QJSEngine::registerModuleAlex Shaw2021-05-011-10/+62
| | | | | | | | | | | | | | | | | | | | | | | | Some applications that use JavaScript as a scripting language may want to extend JS through C++ code. The current way to do that is with global objects. ES6 provides a better way of encapsulating code: modules. registerModule() allows an application to provide a QJSValue as a named module. Developers familiar with Node.js will find this very easy to use. Example: ```c++ QJSValue num(666); myEngine.registerModule("themarkofthebeast", num); ``` ```js import badnews from "themarkofthebeast"; ``` [ChangeLog][QtQml][QJSEngine] Adds the ability to register QJSValues in C++ as modules for importing in MJS files. Change-Id: I0c98dcb746aa2aa15aa2ab3082129d106413a23b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Redesign the AOT lookupsUlf Hermann2021-04-301-0/+1
| | | | | | | | | | | | | | | Each kind of lookup should come with a function that tries to execute the lookup, taking a minimal number of parameters, and another one that initializes the lookup, taking whatever is needed for that. No initialization should be done in the execution step and vice versa. Rather, the execution step should be repeated if an initialization had to be done first. This way, the happy path can be very fast if the lookups have been initialized before. Change-Id: Ic435b3dd4906d00144138cb05161a99a0a9c64ed Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Streamline retrieval of context property names and IDsUlf Hermann2021-04-151-0/+1
| | | | | | | | Most of this can be inline, and we never need to copy the actual identifier hash. Change-Id: I6468b6b1a571e4854c00c865a2aa57c3b2f0ca8c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Cache static compilation unitsUlf Hermann2021-01-121-1/+1
| | | | | | | | | | | | If we load the same file multiple times, we can re-use the old mapping. In fact we may leak memory if we don't. The fact that we have to use a mutex here is somewhat regrettable, but I haven't found a better way of serializing access. Task-number: QTBUG-89659 Pick-to: 5.15 Change-Id: Iaa44ac80faa5e95f30c05e950ab35083a8b0416b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove the property cache from QQmlValueTypeWrapperLars Knoll2020-12-021-5/+0
| | | | | | | | | | | Instead operate directly on the meta object. We could maybe have an optimization, where we have a global map from id to QQmlPropertyData for each value type. Task-number: QTBUG-88765 Change-Id: I259a06ba116a536b56380c2636737c6c016665d9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Respect QV4_FORCE_INTERPRETER when AOT compiled functions are availableUlf Hermann2020-11-261-1/+3
| | | | | | | | Those should not be executed then. Change-Id: I80bc4b2da0bc0e5813ba4eef4b756065d48ac586 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix logic to select AOT compiled functionUlf Hermann2020-10-231-4/+10
| | | | | | | | | We only want the function if it's not a nullptr and if it matches the required index. Change-Id: I5695bfb950f66e5a7589b042c3313297c51533d2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* Do proper memory management on the metatype interfaces we createLars Knoll2020-08-281-2/+1
| | | | | | | | | | Those interfaces are always registered in pairs. Add an external refcount to CompositeMetaTypeIds, and do registration and de-registration through this class. Change-Id: I4f3a53ad935a43a734d6506ffc768f507b48ee1f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Always group the metaType and listType togetherLars Knoll2020-08-281-11/+8
| | | | | | | | They are always created and destroyed together, so grouping them makes the required memory management of them easier. Change-Id: Ia1980f31f9bdff6a1accd229bc8380ae153edf67 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-161-2/+2
| | | | | | | | Task-number: QTBUG-84319 Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add support for binding ahead-of-time compiled bindings to QPropertiesSimon Hausmann2020-04-221-4/+4
| | | | | | | | | | When the ahead-of-time built binding returns the same type as the QProperty, then we can connect them directly with a small shim and pass through the context and scope objects. Change-Id: I9cb49d1fa35490a4ccb06965397674d5534c067d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add a hook that allows for ahead-of-time compiled functionsSimon Hausmann2020-04-221-0/+12
| | | | | | | | | | | | | Use the unused field in the CachedUnit structure provided by qmlcachegen to allow for providing function pointers for functions and bindings that are compiled ahead of time. Provided is the pointer into an array that is terminated with a {index: 0, functionPtr: nullptr} entry. The array index field in each array entry allows for gaps. Change-Id: I7457f5eea5f14e5f94431b9cc6da042cb03517a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Move constant evaluation of doubles and strings into base CUUlf Hermann2020-04-031-27/+3
| | | | | | | | | We don't need to execute anything for that. The translation evaluation is kept in the executable CU because we might not have a QCoreApplication. Change-Id: I2ee39b220305e74b8c8f5540b8e59a91e2ed2b4c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Encapsulate QV4::ResolvedTypeReferenceUlf Hermann2020-03-251-88/+27
| | | | | | | It's used all over the place. We need a proper interface. Change-Id: Iebe254ef3bf35503bf3fdd3639979a5db2b3449e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix typo: inlineComponendId -> inlineComponentIdUlf Hermann2020-03-241-2/+2
| | | | | | Change-Id: Ic0c768fc2402d8674e06e84dfe4dc90d05407167 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-1/+1
| | | | | | | | | | | | | | In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>