aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljscompiler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-6.2.7' into ↵Tarja Sundqvist2023-10-031-9/+11
|\ | | | | | | | | | | tqtc/lts-6.2-opensource Change-Id: Ib72ded968b7ac6b75b499392162e3cf3b761ec48
| * qqmltypecompiler: align runtime function table order to qmlcachegenAndrei Golubev2022-10-121-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we write runtime functions to compilation unit at run time, the order of the functions in the unit (often) differs from the order of functions in the unit produced ahead of time by qmlcachegen and friends. Additionally, the order also differs from what qmltc expects (and qmlcompiler library in general) Fix the order by simplifying the procedure of JS code generation when we create the compilation unit at run time: new logic just goes over the objects in the document linearly, instead of relying on bindings (which are known to be out of order w.r.t. AST) Fixes: QTBUG-106800 Change-Id: I4070b9d061f03c4c76d03120654ad3f30725493a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 8d0adee3b3317f1fab03742bdf0f7cdbe57df914) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Revert "Update commercial license headers"Tarja Sundqvist2022-11-241-11/+11
|/ | | | | | | | | | | This reverts commit 74089697cf2a4961fb697100555b17ae2342d734. Revert of commercial license headers is required for the Qt 6.2.x opensource releases, Qt 6.2.5 onwards. Task-number: QTBUG-107760 Change-Id: Id49069cb5e5f261da185fd082dfb71deb259d387 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QML: Port QV4::CompiledData::Binding to new special integer bitfieldUlf Hermann2022-06-131-3/+3
| | | | | | | Task-number: QTBUG-99545 Change-Id: I9f8bc5fa45c61f77ee95b055a3d8de001da8f8c5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 36ebee4e69182f0e44d87691d4740b271e1dcf38)
* Update commercial license headersTarja Sundqvist2022-06-041-11/+11
| | | | | | | | | | | | | | | Updated header.COMM to the files in tqtc-qtdeclarative. Examples, tests, or documentation files are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the line count causes failures in tests. Task-number: QTQAINFRA-4941 Change-Id: I32f554b0a8cb527f74d46f3c02b0e745d9fc5ddf Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix warnings when which are treated as errors with -developer-buildAssam Boudjelthia2021-10-051-2/+2
| | | | | | | | | Task-number: QTBUG-91163 Change-Id: I7fdac1ff11b4e1c5a6b0caa6cbeae67ddc3effc4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 7185a63b3c0bcc797d683c5070a799b69ade019b) Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Rename the AOT context to aotContextUlf Hermann2021-04-141-7/+7
| | | | | | | We want the "context" name for other things. Change-Id: I9dcc88a9a7c7f5e8c495ee29f57e2c9d15c4990f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Filter out translation bindings before calling AOT compilerUlf Hermann2021-03-241-0/+2
| | | | | | | We don't have functions for those. Change-Id: I22acf7d8400eae2ea0ab872810d05a5aadc23c32 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Optimize stack frame setup for AOT compiled functionsUlf Hermann2021-03-231-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When called via the metaobject system, parameters and return values are passed as void*, with accompanying type information in the form of QMetaType. The same format is expected when calling an AOT compiled function. Previously, we would first convert all the parameters to QV4::Value, just to convert them back the moment we notice that there is an AOT compiled function. This is wasteful. This change provides a second call infrastructure that accepts void* and QMetaType as parameter and return value format, and passes them as-is all the way to any AOT compiled functions. If there is no AOT compiled function, the conversion is done when detecting this, rather than when initiating the call. This also passes the information "ignore return value" all the way down to the actual function call. If the caller is not interested in the return value, we don't have to marshal it back at all. For now, we only add the extra "callWithMetaTypes" vtable entry to ArrowFunction. However, other callables could also receive variants optimized for calling with void*/int rather than V4 values. This required changing the way how function arguments are stored in the property cache. We squeeze the return type into QQmlPropertyCacheMethodArguments now, and we use QMetaType instead of integers. In turn, we remove some unused bits. Change-Id: I946e603e623d9d985c54d3a15f6f4b7c7b7d8c60 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Pass further information about the IR to AOT compilersUlf Hermann2021-03-191-3/+19
| | | | | | | | | | | | | Without access to the JSCodeGen and the contexts for functions and bindings, the AOT compiler is forced to re-generate the byte code for each function. Also filter out object bindings. The AOT compiler cannot generate anything sensible for those. Change-Id: I415ed23791dc220918cdf6d49e9ef5d005796239 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add qCompileQmlFile overload with QmlIR::Document as in/out parameterAndrei Golubev2021-02-231-0/+6
| | | | | | | | | | | | | | | | QML compiler doesn't quite follow QQmlJSAotCompiler interface conventions and it's unclear if it can/should. However, it works with a populated QmlIR::Document and must really share the setup logic with some existing code. Thus, a new version of qCompileQmlFile is introduced that accepts QmlIR::Document as parameter to allow to use the set document afterwards. This way we can share the same code paths between qmlcachegen and qmlcompiler POC (and maybe even qmlcachegenplus could benefit) Task-number: QTBUG-84368 Change-Id: I4b662644a54e494a80224fe8512e3055952692c0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QmlCompiler: Generate AOT functions in same order as interpreted onesUlf Hermann2021-01-291-34/+71
| | | | | | | | Otherwise various internal indices may be off, in particular the internal classes. Change-Id: I3c2a6b8150590fc41ec55bf2dfbc989078ddce42 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Pass a more comprehensive context to AOT-compiled functionsUlf Hermann2021-01-111-17/+24
| | | | | | | | | | We need the compilation unit, and a way to retrieve JavaScript metatypes from it. Also, prepare for cases where we only have a QJSEngine, not a QQmlEngine, and pass the scope object as part of the AOT context. Change-Id: Ica81e92c99f3c9b6baffd04db1e0e91603fd2ac7 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Let AOT-compiled functions modify their argumentsUlf Hermann2020-12-021-4/+4
| | | | | | | | It allows for more natural looking generated code and there is no downside. The arguments are specially prepared for the call anyway. Change-Id: I8437e93adb1c67db1b53fbdb29cbea10f6ef278f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQmlCompiler: Notify any AOT compiler about binding scope and objectUlf Hermann2020-11-241-3/+13
| | | | | | | | | The scope can be different from the object a binding is attached to. In particular, a group property or an attached property are executed in the scope of the surrounding object but are attached to the inner object. Change-Id: I3671c0ba425b791960f3205baaff91471d2e7205 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Allow passing arguments to AOT-compiled functionsUlf Hermann2020-11-201-13/+22
| | | | | Change-Id: I2340f4413ae9a44c71000e840a79e904b6a0fec9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Mark dataPtr as unused for void AOT functionsUlf Hermann2020-11-131-0/+1
| | | | | | | Otherwise we get lots of "unused" warnings from the compiler. Change-Id: I7744715c476350dd3bba34500589cb1c62672c9f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Correctly store AOT functionsUlf Hermann2020-11-121-2/+5
| | | | | | | | There always has to be an empty last function. Otherwise we might access invalid memory when loading them. Change-Id: I5e7a784c14ac8a12450926b895664a98c03f85f1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Allow AOT compilation of JS functionsUlf Hermann2020-11-111-0/+15
| | | | | | | Previously, only bindings were compiled. Change-Id: I6e76c3f5e628e60538a0ed754fdd915978b88c1d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Allow the specification of file scope codeUlf Hermann2020-11-031-4/+9
| | | | | | | | This can contain extra includes and code that should be added before any functions. Change-Id: Ida13d38ab7198c3986e134fe6f3786acd821927f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Log the name of the binding being compiledUlf Hermann2020-10-271-2/+4
| | | | | | | The binding code alone is not very helpful. Change-Id: I74e8884b2345c8b60447375e38a18db65ac22cb4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Don't AOT-compile boring bindingsUlf Hermann2020-10-271-0/+11
| | | | | | | Plain literals don't benefit from AOT compilation. Change-Id: I8f20991b3e330f688f977d57acbffef36818a76c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Allow AOT compiled function to specify includesUlf Hermann2020-10-261-2/+14
| | | | | | | | This is necessary for include directives specific to the types being used. Change-Id: I34e0e5907d795714797fbb99a75b863cc41e9ad3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlcachegen: Move functions to compile QML/JS files to QmlCompilerUlf Hermann2020-10-231-0/+459
We need to re-use them. Also, provide a way to insert AOT compiled functions into the C++ code. Change-Id: I7b0d13cb307e8f979745f096a9614f087d135f68 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>