aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9.1' into 5.9Liang Qi2017-06-303-9/+11
|\ | | | | | | Change-Id: I3fc699beeb45e01abc644018db53f3c75d396f7c
| * Merge 5.9 into 5.9.1Oswald Buddenhagen2017-06-191-1/+1
| |\ | | | | | | | | | Change-Id: I4154bf5f6f0b74176e333541372511d47d408546
| * | Fix QML compiler crashes on big endian systemsDmitry Shachnev2017-06-183-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit be491913c036b148 changed QV4::CompiledData::Unit to use LEUInt32 structures internally, rather than native uints, however the generators were not updated at that time and still wrote native uints. Also initialize constants field of CompilationUnit to prevent crashes in unlink() where operator delete[] is called. Change-Id: Id6c6e6ad519c9927ba6027479689ecfde9ea86de Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix alignment issue on ARMv7Simon Hausmann2017-06-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As analyzed in the bug report, it appears that we may get QV4::CompiledData::Function pointers for writing that are not aligned for the 64-bit fields at the beginning. [ChangeLog][QtQml] Fix crash due to misaligned data structures on ARMv7 Task-number: QTBUG-61552 Change-Id: I6b2c166b725496150c8850475577628ccd811d65 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Silence -Wuninitialized warningAllan Sandfeld Jensen2017-06-201-0/+3
| |/ |/| | | | | | | | | | | | | Task-number: QTBUG-61089 Change-Id: I8b1fb03d040b04b3b14f371bf1a5ba8c2318054f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 784ea8c09d448a418b3128be8bee14d9535e36c9)
* | Prospective build fix for qml compiler on WindowsSimon Hausmann2017-06-141-1/+1
|/ | | | | | | | | Do not try to decorate the internal MoveMapping class with an export macro that becomes an import macro on usage, when using it in the context of QtQmlDevTools. Change-Id: Id5349763572a144ac7d51d0af1f07d6cc19d683d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use pre-generated QML caches even if they are not writableAlexander Volkov2017-06-091-1/+1
| | | | | | | For example, if they are installed into system paths. Change-Id: Id14ccfbe57c5bcf273c79510034dc20400073451 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Change temp allocation when generating IRLars Knoll2017-06-095-56/+155
| | | | | | | | | For functions that won't get optimized, it's useful to limit the number of temporaries as much as possible. Change-Id: I6e9be3129c064fdc4c01e1ec6f1617e901c05935 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix gcc5 miscompile of qle_bitfieldVille Voutilainen2017-06-081-0/+4
| | | | | | | Task-number: QTBUG-61123 Change-Id: I124d925846a2f485f7b69870c5eebc7f7f6b50f7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move Q_REQUIRED_RESULT to the beginning of the declarationThiago Macieira2017-06-031-2/+2
| | | | | | | That's the correct place and works with C++11 attributes. Change-Id: I7814054a102a407d876ffffd14b6a2f74423c222 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
* Merge remote-tracking branch 'origin/5.9.0' into 5.9Liang Qi2017-05-311-2/+3
|\ | | | | | | Change-Id: I3f77593ca944114534fff5df26bbb09150ee4400
| * QQmlIRBuilder: Only query type name cache for type namesRobin Burchell2017-05-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The behavior here was always incorrect: type names must start with an uppercase letter, so querying the type name cache with a lowercase string is wrong. However, this was turned into a larger problem by making more extensive use of QQmlTypeNameCache in e74a1d0b342f2c95dc3a543c8c9ec07fd52d8fe0, as it contained a lot of new types (including composite types, which previously were only in the cache if they were singletons). Task-number: QTBUG-60547 Change-Id: I40be2d535e99d3e1af250d995d7149ecbe2965d7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Move the list of default internal classes into EngineBaseLars Knoll2017-05-191-1/+1
| | | | | | | | | | | | | | | | And store them in an enumerated array. This will simplify upcoming changes. Change-Id: I82eac03b9f6264843ae625e36e150464fe08be9d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Optimizations to the generated byte codeLars Knoll2017-05-192-62/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cut the size of the generated byte code in half, by storing parameters in a more compact form and always storing the instruction type in the instruction. We can still used computed goto's for a fast interpreter, by looking up the jump point for the next instruction in the jump table. Another advantage is that the byte code is now platform independent (modulo endianness). The change comes with a 3% performance impact on x86_64, which is acceptable considering the size savings on the bytecode. Change-Id: I37de3e1f94611987a85e65ea86536583aa965d6d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Disable loop peelingLars Knoll2017-05-121-1/+5
| | | | | | | | | | | | | | | | | | | | Loop peeling does in our current JIT not give us any measurable performance benefits (no measurable diff in any of the v8 benchmarks), and significantly increases the size of the generated JIT code. Change-Id: Icab7887300f9c1cd5891983cbfe5885fc2b4db91 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Optimize Runtime::method_get/setElementLars Knoll2017-05-101-2/+2
|/ | | | | | | | | | | | | This is now actually just as fast as the lookup code, so disable the generation of lookups for indexed accesses for now. This saves some runtime memory, as we don't need the data structures for the lookup. We can reintroduce lookups, once they offer a real performance benefit. Change-Id: Idc3fa7b248e2e25b4b2cd60d5053e2815634c8b7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add qtConfig(dlopen) check before adding libdlKimmo Ollila2017-05-042-2/+2
| | | | | Change-Id: Iad67b9719fe6336b8dfc28de2e88463c588a0849 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Simon Hausmann2017-04-274-159/+185
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qtqmlglobal.h src/qtqmlglobal_p.h src/jsruntime/qv4global_p.h src/qml/compiler/compiler.pri src/qml/compiler/qv4ssa.cpp src/qmldevtools/qtqmldevtoolsglobal_p.h tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp Change-Id: I55c5d015b2cb1053b83b9c61caaf004fb49ee486
| * V4: Fix issues with very small loops5.8Erik Verbruggen2017-04-183-157/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Loops consisting of just a single basic block (e.g. a do-while loop with no nested loops or if statements) have a back-edge to themselves. There were 2 problems: - loop detection would create LoopInfo for any loop header referred to by blocks inside the loop (and a 1 block loop doesn't have body blocks), nor would it mark the loop header as such - when splitting critical edges, the newly inserted block would not be marked as part of the loop This is a problem specifically for 1 block loops: the block ends with a CJUMP, so the back-edge is a critical edge. So the new block inserted by edge splitting wouldn't be marked as belonging to the loop. The end result was that the life-time intervals for temporaries that are defined before the loop, but that are used inside the loop, and not after the loop, would have their life-time ended before the loop ends (instead of spanning the whole loop, *including* the back-edge). This in turns could lead to the stack/register allocator re-using the storage for that temporary, resulting in strange things happening. Task-number: QTBUG-59012 Change-Id: Ic946c73913711272efea2151cb85350412ca2fde Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * switch to new way to refer to libdlOswald Buddenhagen2017-04-111-1/+1
| | | | | | | | | | | | | | | | note that the condition is insufficient (it should include qtConfig(dlopen)), but this is just consistent with the c++ code. Change-Id: I4b447ff504539e4dc07ece3d696e5a85b2f4cc50 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Silence GCC 7 warnings about implicit fallthrough in Qt codeThiago Macieira2017-04-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This only deals with Qt code. MASM has a lot of those left. We should just update from upstream instead to get the fixes. qv4regalloc.cpp:660:52: warning: this statement may fall through [-Wimplicit-fallthrough=] if (leftSource->type == DoubleType || rightSource->type == DoubleType) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qv4regalloc.cpp:666:13: note: here case OpBitAnd: ^~~~ Change-Id: I7814054a102a407d876ffffd14b6b0e2d6b03689 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Speed up Qml library checksumming in developer buildsSimon Hausmann2017-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | The use of sha1 to determine if there were any changes in the Qml library in developer builds (for cache invalidation) works well, but it results in timeouts when running tests on ARM as type compilation takes too long. This is a developer feature and we might as well use a faster hash such as Md5 that is sufficiently reliable for our purposes. Change-Id: I917ae619c73a9cc821d888f16bfcccafeb8ebacc Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Fix support for jsTr() and QT_TR_NOOP in list elements when cachingSimon Hausmann2017-04-065-423/+544
| | | | | | | | | | | | | | | | | | Similar to the Qt Quick Compiler we need to do the expression simplification pass at cache generation time to extract translation calls in list elements. Change-Id: I267fc9647ab82bc83d6b087c06c0036df38238ff Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix loading of ahead-of-time generated cache files when cross-compilingSimon Hausmann2017-04-062-1/+2
| | | | | | | | | | | | | | | | | | The target ABI is something that we must include correctly at cache generation time. The corresponding qmake variable is available in qtbase now, so we can use that and embed it in the generated data. Change-Id: Icd6e44824f5151535ce9ddac27687b7877288725 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix warning for -no-feature-temporaryfileStephan Binner2017-04-041-0/+1
| | | | | | | | | | | | Change-Id: Iaa4138610834f87b2a9379e707025d2e8a0fd59c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
* | V4: Set correct source locations for jumps out of conditionalsv5.9.0-beta1Ulf Hermann2017-03-311-8/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We always want to place the jump on the last line of the conditionally executed statement, unless we might never execute the last line. In the latter case, that is if the inner statement is again a conditional, we use some token of the outer condition. This works fine with loops, as the loop condition is actually checked after each iteration, and it's plausible to the user that we jump there. With "if" statements, it's not so great. We cannot really explain why we jump back to the "if" token after executing the conditional statement. However, we have to add some source location to the jump instruction as otherwise it uses the source location of the last statement that had one, which is rather random. Task-number: QTBUG-59204 Task-number: QTBUG-59774 Change-Id: I48e331ce1c1830f236e16b75c9201a2f490d2092 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix encoding of primitive constants when cross-compilingSimon Hausmann2017-03-311-11/+65
| | | | | | | | | | | | | | | | | | | | QV4::Primitive is using host value encoding, which can differ from the target. The source of QV4::Primitive in the code generator is usually IR::Const, transformed via convertToValue(). That function becomes a template that converts to a simple target primitive type. Change-Id: If028aea9551d77d81eec306f60fd995c25b76710 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9Simon Hausmann2017-03-256-16/+18
|\ \
| * | Merge remote-tracking branch 'origin/5.8' into 5.9Simon Hausmann2017-03-156-16/+18
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qqmltypecompiler_p.h src/qml/qml/qqmltypeloader.cpp src/qml/qml/qqmltypeloader_p.h Change-Id: I4894555ab7a0879b56bbda7a46d16d1c40c19e7c
| | * Clean up type dependency hashing for QML cachingSimon Hausmann2017-03-136-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of passing the engine parameter all the way through the data structure generator, along with the dependent type data structure that is unused otherwise, let's simply provide a function object for the dependency hashing. This is also in preparation for adding singleton types to the dependency hash. Task-number: QTBUG-58486 Change-Id: I5bb5e5c06b7b5c77195cec3da13141333cfea7a8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Codegen: do not assume QStringRef(const QString *) is implicitMarc Mutz2017-03-221-2/+2
| | | | | | | | | | | | | | | | | | | | | It won't be for very much longer. Change-Id: I90fae21b621f104053b776296fc9f6525e8baf52 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Avoid an extra stat() on the source .qml file when loading cacheSimon Hausmann2017-03-228-18/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | For timestamp comparison it is not necessary to create another QFileInfo() object and call exists() and lastModified(), when we can pass that information through from the type loader. Change-Id: I225cd36e672f1f390bddb4e6ebfafa3fc1269795 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Clean up qOffsetOf usageSimon Hausmann2017-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | For offsets from CompiledData::Unit we can use C++11's offsetof macro as the class has standard layout. Change-Id: I7377294679a9cd79c35486fa34355933271f9251 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Protect CompilationUnit member usage against word size differencesSimon Hausmann2017-03-172-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we only use the runtimeStrings offset in JIT generated code, so move that into a standard layout base class and use that instead. Task-number: QTBUG-58666 Change-Id: Id933ba5df3a6990e89886c2b328e9e814ec5e413 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Protect CallData usage against cross-compilation word size differencesSimon Hausmann2017-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure via static asserts that the members always have the same offsets. Since the class has standard layout, we can also use the C++11 offsetof macro instead of qOffsetOf. Task-number: QTBUG-58666 Change-Id: I7dcecf517c771c7081334cd9d0b7ae133b23b23a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Prepare run-time method calling mechanism for cross-compilationSimon Hausmann2017-03-173-39/+40
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current way of encoding the offsetof() of the method_ members in QV4::Runtime is not portable when cross-compiling from a 64-bit host (where the offsetof would be calculated on) to a 32-bit target (where the offset would be different), or vice versa. In preparation for making this work, this patch first replaces the direct use of the run-time members with use through a void * and an enum for indexing. This gives us some type-safety in some places and will also allow for a translation of the pointer offset from host pointer indexing to target pointer indexes. As a bonus we can avoid going through the engine->runtime indirection in the interpreter altogether and call the static methods right away. Task-number: QTBUG-58666 Change-Id: I3cd6459523923a9719408317fa729bca19c2bf3c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix relocation related errors when loading AOT cachesSimon Hausmann2017-03-092-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original directory of the source file the cache was created from - when generating ahead of time - is unlikely going to be identical to the final location for example on a deployed device. Therefore when generating caches ahead of time, don't store the source path, don't attempt to verify it when loading and don't try to save the cache file at run-time again. We still need set the sourceFileIndex at load-time though, in order to make relative path url resolution work (for example source: "my.png" in an Image element). Change-Id: I3d6952f5d0a165cfa2cb400191a9f6ffe6be69f4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix time stamp related errors when loading AOT cachesSimon Hausmann2017-03-092-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Cache files created ahead of time do not require a timestamp match towards the source file. This is because we cannot guarantee that all transport mechanism from source to deployment preserve the timestamp at the required resolution (if at all) and the source may also not be present at all (obfuscated deployment chosen). For cache files created at run-time however we'll continue to require time stamp verification. Change-Id: Ia7cdf3d063edd5bb1e6985089f1a666c970a0bd0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix crash when loading cache files generated ahead of timeSimon Hausmann2017-03-072-5/+3
| | | | | | | | | | | | | | | | | | | | The offset of the runtimeStrings array differed between a V4_BOOTSTRAP build and the regular library build. This is an intermediate fix until QTBUG-58666 is fixed properly. Change-Id: Id1310ffa82f1079c1acef7730db41186fa62610f Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Set source location for all loop body-to-front jumpsUlf Hermann2017-03-071-5/+5
| | | | | | | | | | | | | | Task-number: QTBUG-59204 Change-Id: Id1a73b228cd3386c7fcc7712c2485f387238b65e Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Fix qmlcachegen command line parametersSimon Hausmann2017-03-072-10/+5
| | | | | | | | | | | | | | Add support for specifying the output file name Change-Id: I3ec3cecae2334a7640baa928c0739c5521496d2d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix restoring IR from cache filesSimon Hausmann2017-03-061-1/+16
| | | | | | | | | | | | | | | | | | | | | | Commit eeb08d9537d0b4e77b91848169e0bb79ec3d912c was missing the code to restore the aliases, the AST function formals as well as the object flags/id. This also fixes crashes with the QML compiler. Change-Id: I1c50816dc77ae66edbc3ddc7146da4edfd4170f4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add a source location to the final Jump in a for loopUlf Hermann2017-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | Otherwise it will assume the last statement as the location of the jump, and that might be a statement that is never hit. Task-number: QTBUG-59204 Change-Id: I66019a284b061358939b23e649ca0832b5442388 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix old QML compiler buildsSimon Hausmann2017-02-271-1/+1
| | | | | | | | | | | | | | Do a private export of the IR loader as the code is in QtQml now. Change-Id: If98c38b84d60b2904752c2adb2f9beb5e5e6d774 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-245-79/+147
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/quick/accessible/qaccessiblequickview_p.h src/quick/items/qquickmousearea.cpp src/quick/util/qquickanimatorjob.cpp tools/qmlplugindump/main.cpp Change-Id: I84474cf39895b9b757403971d2e9196e8c9d1809
| * Fix move ordering while resolving edges in register allocationErik Verbruggen2017-02-043-67/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When register allocation on an IR in SSA form is done, the last step is to turn the Phi nodes into moves and swaps and put those instructions in the predecessors. As the Phi nodes are conceptually "executed in parallel", this can result in cycles: r1 <- r0 r0 <- r1 These have to be turned into a swap instruction. Also, the moves have to be ordered in order to make sure that no values are overwritten: r1 <- r0 r2 <- r1 Here the two moves need to be switched. The comments in the code document the algorithm. Change-Id: I4151988681f7554b00a3eb70d224e6e2f29ebf04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Prevent propagating results of a phi node into another phi nodeErik Verbruggen2017-02-011-8/+37
| | | | | | | | | | | | | | | | | | .. of the same basic block. Phi nodes are "executed in parallel", so such a situation will lead to interesting results. Task-number: QTBUG-58553 Change-Id: Ibed439df91d46ea416dcb0a20457310e91dce8b4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Fix libs build with msvc on Chinese locale on WindowsLiang Qi2017-02-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chinese locale means Code Page 936 here. It's also related with removing C4819 warnings. And it's also following Conventions in Qt source code: All code is ascii only (7-bit characters only, run man ascii if unsure) See also http://wiki.qt.io/Coding_Conventions Task-number: QTBUG-56155 Task-number: QTBUG-58161 Change-Id: I1c38a6ce74670716f730663edbcdec3919b438c2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * QQmlTypeCompiler: Fix read after free in tst_qqmllanguageRobin Burchell2017-01-281-2/+1
| | | | | | | | | | | | | | | | | | | | invalidAlias.11 revealed a problem with the loop here, in that the vector was modified while it was being iterated. There isn't any need to modify the vector being iterated, as it'll be put into pendingObjects for the next loop. Change-Id: If9b537c4ac00697237d12e4b0be67ef39cc8b3c4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Fix build without features.temporaryfileTasuku Suzuki2017-01-271-0/+5
| | | | | | | | | | Change-Id: I31bcf56ee0c4ec9285dccb356b03b89e8ce8356a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>