aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compiler.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Move line number information into a side tableLars Knoll2017-08-251-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't emit any Line instructions anymore, and instead store the info in a side table in the compiled data, where it can be looked up on demand. Change-Id: Idcaf3bf4ee4129fd62f9e717bf1277dc6a34fe19 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into wip/new-backendLars Knoll2017-08-221-11/+13
|\| | | | | | | | | | | Change-Id: Iff06429f948ac6cdec77a9e5bb8c5375c56fe705
| * | Refactor le integer types from qjson_p.h to qendian_p.hAllan Sandfeld Jensen2017-07-061-11/+11
| | | | | | | | | | | | | | | Change-Id: Ibb24b0a55dd94e03fea3104e8af5ddb266004300 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-041-5/+7
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/quick/doc/src/qmltypereference.qdoc Change-Id: Ia58f1c5a98309c32ef8d8e5c893faf261215f19f
| | * Merge remote-tracking branch 'origin/5.9.1' into 5.9Liang Qi2017-06-301-5/+5
| | |\ | | | | | | | | | | | | Change-Id: I3fc699beeb45e01abc644018db53f3c75d396f7c
| | | * Fix QML compiler crashes on big endian systemsDmitry Shachnev2017-06-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Remove unused lookup typesLars Knoll2017-08-101-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | The indexed getters and setters haven't been used for a while and don't offer any performance benefits currently. Change-Id: Ifd5e1fab934e6e9940c4f1ad67f8850f04597504 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Store arguments in the stack frame before the locals/tempsErik Verbruggen2017-08-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All escaping arguments will still be loaded/stored from/to the CallData, but this is not the common case. In a subsequent patch we can make the caller prepare the stack frame, and for the common case we don't even need to copy arguments around. Change-Id: I3fbb6fe575a564d05a9fd5dcc0c8f4129eac3bc2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix various signed/unsigned warningsErik Verbruggen2017-08-021-9/+8
| | | | | | | | | | | | | | | Change-Id: I9f4a5a8470c1abc6b07a28c71fdad0d208e1fea1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Split up qv4codegen into several filesLars Knoll2017-07-031-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And changed the namespace of those classes to QV4::Compiler. ScanFunctions should over time also move into its own file. Change-Id: If084acea4a9a20b9c79ad47dac19e02dc720e098 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Remove now unused filesLars Knoll2017-06-301-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove all files from the old compiler pipeline that are now unused. This includes the whole IR, JIT code generation, and the old Moth Isel. Change-Id: I50d06abfbcf0e9755a54ed94638f8bb74f9512b1 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Get rid of IR::Module and IR::FunctionLars Knoll2017-06-301-28/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fold the stuff from IR::Function into QQmlJS::Context, and add a QQmlJS::Module class to replace the last pieces of the old IR. Change-Id: Ic02a6738a4f1db67a0ddf97b6c93ca32be81789d Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Don't use the ISel's anymoreLars Knoll2017-06-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Move the code that generates the CompilationUnit over to Codegen, and don't use the ISel's at all anymore when compiling JS/QML. Change-Id: Iba89082c386c3d3fd58ac25a4651c5d39178cc5c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Re-enable lookupsLars Knoll2017-06-221-3/+18
| | | | | | | | | | | | | | | Change-Id: I02d57d2cbb4ae56c0c4626d96cbdf9935b366579 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Support object literalsErik Verbruggen2017-06-201-16/+7
| | | | | | | | | | | | | | | Change-Id: I7fc4565044caf23bec239561be4fbc020ccc2468 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Support for some more binary and unary operationsErik Verbruggen2017-06-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | And some cleanups to the output of the bytecode dumper. Change-Id: I62fa5fbf87319118a4ba5f641652f8556cc16e07 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Pass the JSUnitGenerator into the codegenLars Knoll2017-06-191-0/+35
|/ / | | | | | | | | | | | | | | Allow registering all the required data to generate the proper compilationunit already in the codegenerator. Change-Id: I36345cc01927b3f8dc3ba6d91da175bd6abe124a Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-04-071-1/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4vme_moth.cpp Change-Id: I865d794e550a263387a39ca8d051ebf48b70cbc0
| * Fix loading of ahead-of-time generated cache files when cross-compilingSimon Hausmann2017-04-061-1/+1
| | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.9' into HEADSimon Hausmann2017-03-231-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4mmdefs_p.h Change-Id: I9966750b7cd9106b78e4c4779f12b95a481cca40
| * Avoid an extra stat() on the source .qml file when loading cacheSimon Hausmann2017-03-221-1/+1
| | | | | | | | | | | | | | | | | | 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>
* | Make the decision about whether to use a Simple callcontext earlierLars Knoll2017-03-091-0/+2
|/ | | | | | | | | All required information is already available when creating the CompiledData::Function, so determine at that point whether we use a Simple or full CallContext. Change-Id: Ife489ca2ca6eaf2ffc7843544a56e8bd86590e9d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add Q_ALLOCA_VAR, Q_ALLOCA_DECLARE and Q_ALLOCA_ASSIGN macrosKimmo Ollila2017-02-151-1/+1
| | | | | | | | | | | Define Q_ALLOCA_VAR macro to be used instead of #ifdeffing the occurrences of alloca() in case it's not supported. Q_ALLOCA_DECLARE and Q_ALLOCA_ASSIGN macros separate memory allocation from the declaration and RAII. Change-Id: Idc7551642c48a968a44bcade14d84800a3a1270e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-221-0/+6
|\ | | | | | | Change-Id: I171c7dbb6a74fe743c2eec63e86e9c0bef7c7dfd
| * Fix excessive invalidation of QML disk cachesSimon Hausmann2016-10-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We use an MD5 checksum over the meta-object data to verify that the types a QML file depends on haven't changed since the cache was generated. However when the dependent types are QML types, then the meta-object data contains dynamically generated type names such as QMLTYPE_1234, which is non-deterministic. To address this, we resort to the checksum over the meta-object data only for C++ types (if those change it's likely an incompatible change) and for QML types use the fact that all the information about the QML declared types comes from the QML file only, which means we can in that case simply use a checksum over the QV4::CompiledData memory chunk. In addition we need to ensure that the generated CompiledData memory chunk is deterministic by avoiding any uninitialized bytes (memset) and using a map instead of a hash for the mapping of object index to object id. Task-number: QTBUG-55926 Change-Id: I27c840b1960ad36b486198e504b70989c22a3972 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-09-211-0/+1
|\| | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4isel_moth_p.h Change-Id: I8e86a649d1ef8ad27dc66cc8c290093b2faabc69
| * QML: Make sure the integer data is aligned on 4-byte boundariesErik Verbruggen2016-08-301-0/+1
| | | | | | | | | | | | | | | | | | The packing for a the compiled data is 1 byte, but integers clearly need 4 byte alignment. This worked before by accident, but broke when a single quint8 was added to the Function. Change-Id: Ia7954423d5a7b4a0e6ef177fc3ee350889f43154 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Qml compiler: replace 'foreach' with 'range for'Anton Kudryavtsev2016-09-091-2/+2
|/ | | | | | | ... and with 'index-based for' in one place. Change-Id: I4df75bd5921f9ee8b5744067adbaafbc46452f87 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Make the unit mapping on Windows configurable with regards to executable mappingSimon Hausmann2016-08-171-0/+1
| | | | | | | | | | If we generate byte code, then we can mmap without the executable flags, otherwise we need them. This should make things work out of the box on platforms where special rights are needed before executable mappings are allowed. Change-Id: I24e663f85d661bc51cd3bf2463547b1d1590ea32 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Fix endianness in constant handlingSimon Hausmann2016-08-031-0/+6
| | | | | | | | When running on a big-endian system, we need to convert the constant values into big-endian once and then it's possible to access them directly. Change-Id: I655bad7b7734e3b95e79e5f688f0b4041d0c41c4 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Make generated code loading constants relocatableSimon Hausmann2016-08-021-0/+4
| | | | | | | | | | | | On 32-bit architectures we were encoding the absolute address of generated constants in memory into the load instruction. In order to make the code reloctable, this patch changes the JIT over to use the constant table in the compilation unit. This means two additional loads per constant. On architectures that support instruction pointer relative addressing, we can try to fix this in the future (arm32 for example). Change-Id: I8ed7aa7c67711696d6c46c72b3b642d610ff2cbc Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Add a checksum to the generated QML compilation unitsSimon Hausmann2016-08-021-0/+1
| | | | | Change-Id: Icd5b1d805059981cbbb4c0eb2a5c842d59223839 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Improve robustness of qml disk cachingSimon Hausmann2016-07-231-4/+6
| | | | | | | | Perform various basic checks before proceeding to load an existing cache file, including the qt version, architecture, data structure version and others. Change-Id: Ie822b056e944ac120643aad260e97f62616688bf Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Improve robustness of qml cache expiry checkingSimon Hausmann2016-07-191-0/+1
| | | | | | | | | | | Instead of relying on two time stamps in the file system (source file and cache file), make the determination on whether the source file is newer than the cache solely depend on the time stamp of only the source file. This means that when cache files are stored in archives for example their modification date does not need to be preserved upon extraction. Change-Id: I0b4362663868c6fb9bd7e106028161b2d67274d4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Simplify CompiledData::Unit serializationSimon Hausmann2016-07-151-59/+79
| | | | | | | | | | | | | | | There are currently two places where we calculate the total size of a CompiledData::Unit including all of its data, once in its calculateSize() function and then when constructing the Unit itself. This is error prone when trying to do changes to the layout, as two places need to be adjusted. Instead we can centralize the populating of the entire CompiledData::Unit header, the calculation of the various offsets as well as the entire size in one shot in a new generateHeader function. Afterwards we can allocate the final amount of memory and copy the remaining bytes across and assemble the final data structure. Change-Id: Ic26d7812e59d2bee2f45cd72742e3195a56950df Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up function offset table generationSimon Hausmann2016-07-151-7/+4
| | | | | | | | We can replace the intermediate hash with a vector of the final little-endian encoded function offsets. Change-Id: If3f970330ab232a672f7c75b4d32f8ef4d246714 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* More endianness fixesSimon Hausmann2016-07-151-6/+8
| | | | | | | | It's necessary to consistently use LEUInt32 when writing the offset tables, as that's also what we're using when reading from them. Change-Id: Idbef310bd6b28a0e6b6b0dff516e0ef178f04999 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up JS internal class serializationSimon Hausmann2016-07-151-31/+24
| | | | | | | | We can serialize the compiled JS class data right when we collect it from the IR. That makes the assembly of the compilation a little simpler later on. Change-Id: I36d7dd2cc74241338fb1c236ce7778405066c8b8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove unused fields in CompiledData::FunctionSimon Hausmann2016-07-141-8/+2
| | | | | | | | The table for referencing the inner functions is not needed. This also allows making the function offsets table a local variable. Change-Id: I3f1a1d6ab8c4f417edeafdc174e5b41d2d2b611b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix endian support in compiled data structuresSimon Hausmann2016-07-141-0/+6
| | | | | | | | | | | | The goal is to make the compiled data structures persistent on disk. In order to make it possible to create these data structures on a "host" system that may have a different endianness than the target system, we now make all the word sized fields little-endian. The template wrappers from QJson provide zero-overhead access for little-endian machines (the vast majority) while maintaining a large degree of source compatibility. Change-Id: I3d30da1fcf3bffb98dbe9337d3a35482fb7b57c8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QML: Store idObjectDependencies in a QVarLengthArray.Erik Verbruggen2016-06-241-2/+4
| | | | | | | | | The number of id objects referenced from a function or binding is often very small. So using a QSet that allocates hash nodes takes more memory, and is actually slower than using an array. Change-Id: Id9fa60a860314790284f66318593b3ef938e6eef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Added basic support for saving compilation units to diskSimon Hausmann2016-06-171-0/+3
| | | | | | | | | Hidden behind a QML_DISK_CACHE=1 environment variable we will now attempt to save a binary representation of the type compilation for Foo.qml next to it called Foo.qmlc. Change-Id: I27e800b50cdb186669256fd277578ea1f1e70513 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up CompiledData::FunctionSimon Hausmann2016-06-071-3/+2
| | | | | | | | | * We don't need 64 bits for the flags, for now 8 bits are sufficient. * Removed the unused index member. It's symmetric to the index of the function object in the function table anyway. Change-Id: I18248e8ed79b3c3af87e17689dadf7323d5d9bb3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Save some memoryLars Knoll2016-04-111-1/+0
| | | | | Change-Id: I866eeba45e30fd5e38541b2de4a2fda5549104a9 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QML: Convert the PropertyDependencyMap to a QVarLengthArray.Erik Verbruggen2016-04-051-4/+2
| | | | | | | This is much more efficient than a QHash. Change-Id: I84752eecb6a456402ae222c4d6543bbb67cbcf63 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add 28 QList::reserve() callsSérgio Martins2015-06-081-0/+1
| | | | | Change-Id: Id4820ac458f48b10f2bf457144767efdef9e2c07 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-06-041-1/+1
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine_p.h src/quick/items/qquickitemsmodule.cpp src/quick/items/qquicktext.cpp src/quick/util/qquickpixmapcache.cpp tests/auto/quick/qquickwindow/tst_qquickwindow.cpp Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
| * Fix uninitialized variables/dataSimon Hausmann2015-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | * Initialize the indexOfRootObject member * When creating the QV4::CompiledData::String objects, don't include the one ushort _beyond_ the QString, which is random data. Change-Id: I8fe8a465e2713a385504f217b367a62b70ee5fdf Reviewed-by: Lars Knoll <lars.knoll@digia.com>