aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
Commit message (Collapse)AuthorAgeFilesLines
* [new compiler] Correct the use of default propertySimon Hausmann2014-01-202-8/+3
| | | | | | | | When a type declares a new default property, then the old default property continues to apply to its own bindings. Change-Id: Iafeec772baa4e1a430b09eed0b348b83984246cd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix implicit component determination for composite typesSimon Hausmann2014-01-201-3/+1
| | | | | | | | | | | | We want to search every object for properties that implicitly define components, unless the object itself is a Component. That means if there's a QQmlType and that meta-object is QQmlComponent's or there's no QQmlType because it's a composite type. Fixes QtQuickControls parsing. Change-Id: I3fc7c2aff0c83ceada0c6772a02eff40a22777c9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix duplicate property/signal name detection for group objectsSimon Hausmann2014-01-202-11/+9
| | | | | | | | | | | | | | | For a rectangle like this: color: "blue" border.color: "red" we must not issue a duplicate property error for "color" because they are in different objects. This patch fixes that by moving the sets for checking the presence of these into the object itself, so that the qSwap on _object also transitions to the correct property/signal name set. Change-Id: I9ac0e5877eb9f60b618b031f99290707de28112d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Add support for QML list modelsSimon Hausmann2014-01-204-15/+66
| | | | | | | | | | | | | List model definitions make heavy use of custom parsers, which requires AST access as well as a general port to the new QQmlCustomParser API. Additional fixes in the custom parser support were needed to pass all tests: * Fix support for AcceptsSignalHandlers and AcceptsAttachedProperties * Don't call setCustomData unless the compiler generated data earlier Change-Id: Ic42f8a890391267c94f63d35f055b60fdbf3c83d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix type versioningSimon Hausmann2014-01-201-0/+14
| | | | | | | | | | Imported types with a meta object that contains revisioned attributes, need their property cache created for exactly the imported version. So this is done ahead of type and populated in the resolved types, similar to the old code path in qqmlcompiler.cpp. Change-Id: I65a5d140d8f49cceeeee1162ab2d6376ad9c2e42 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix refcounting leaks with property cachesSimon Hausmann2014-01-203-44/+54
| | | | | | | | | | | The TypeReference is not copy-safe, as it holds refcounted property cache pointers. For the new compiler code path, don't copy them but keep pointers to TypeReference objects around. Also make sure to ref the root property cache correctly and avoid the unnecessary addref for the property cache when creating new vme meta objects (initial refcount is 1). Change-Id: I0c4b952c8300c2167d926d9c35b8579fd505d596 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix customer parser use with nested objectsSimon Hausmann2014-01-202-17/+18
| | | | | | | | Types with a custom parser attached don't need to continue with validation of properties in sub-objects. Change-Id: Ib25f8e037cf651dfb30dd4016f89980612dff4f4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix id mapping in implicitly defined componentsSimon Hausmann2014-01-201-1/+2
| | | | | | | | When scanning for component roots of explicitly defined components, make sure to skip synthetized ones. Now samegame runs :) Change-Id: If64171aefc1105a130a1a50e855af87977d2f3af Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-174-12/+59
|\ | | | | | | Change-Id: Id265682aa7db9be1c0b305ab3207b2c932a25a9f
| * V4: fix range splitting when split is between intervals.Erik Verbruggen2014-01-174-12/+59
| | | | | | | | | | | | | | | | | | | | | | Also added some "white-box" unit tests and sprinkled in a bit of documentation. The case that went wrong is covered by the test rangeSplitting_1: before the fix, the new interval would have two ranges: [66-64],[70-71]. The first range is invalid and should not be there at all. Change-Id: If0742f4e6a96d98ea5d696f95126886ba66f92bb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | [new compiler] Add support for type and enum resolution for custom parsersSimon Hausmann2014-01-172-1/+12
| | | | | | | | | | | | | | | | | | This is in preparation for listmodel support, share the code for resolving types and enums between the old and the new compiler, as all it needs is the imports. Change-Id: I4908d71eee50c769108e0e2b68b03496722fa49d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Fix error reporting location for custom parsersSimon Hausmann2014-01-172-16/+6
| | | | | | | | | | | | | | | | | | | | After the binding of QQmlCompilePass to QQmlTypeCompiler, I forgot to change the customer parser handling to also report the errors correctly back to the QQmlTypeCompiler. Instead they were collected locally with an empty url. Change-Id: I5ee527a77e27c0339c507f326a3b0f0837353db3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Fix implicit component definition for default propertiesSimon Hausmann2014-01-171-2/+14
| | | | | | | | | | | | | | | | | | When trying to determine if an object binding should be a component or not and we don't have a property name for the binding, then we must check if the default property happens to be a QQmlComponent. Change-Id: Ie21fc438b8b2d86caa3991794e6eac688c074440 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Add support for value interceptors / on-assignmentsSimon Hausmann2014-01-175-32/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Behavior on x { NumberAnimation { ... } } is implemented by assigning a value interceptor (Behavior is a sub-class of that) to the x property in a special way. That requires various things: * A VME meta-object must be created and installed on the surrounding object, in order for the interceptors to work * On assignments need to be excluded from duplicate property assignment checks * Behaviours require also finalization callbacks on component creation Change-Id: I40250b71081a2e315cda3bdb6677fa4b227fa443 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Clean up property cache / meta object builderSimon Hausmann2014-01-172-50/+82
| | | | | | | | | | | | | | | | Move the outter loop into the builder class itself, use a vector instead of a list (we know that it's a fixed size and we only do indexed access) Change-Id: I933f0496ea47b3bc7c2bebde7f1a14b4f603b4c3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Initial support for QQuick state changesSimon Hausmann2014-01-171-1/+1
| | | | | | | | | | | | | | This requires the use of the customer parser together with lazy binding compilation Change-Id: I45d8a206267d3e0c807771a79645168254be9c95 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Preliminary support for script string propertiesSimon Hausmann2014-01-172-0/+52
| | | | | | | | | | | | | | These should later get resolved at compile time, like enum assignments. Change-Id: I2f40c8d13330d2a101f79af12fe708f466eef225 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Fix group property initializersSimon Hausmann2014-01-171-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bindings with an object initializer without a type name must be group properties, instead of regular object bindings. Fixes font { pixelSize: 24 } versus font.pixelSize: 24 Change-Id: I468caa48be13f91f88545ef001ac9aaa46ba5d14 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-173-116/+200
|\| | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/imports/dialogs/DefaultFileDialog.qml src/imports/widgets/qquickqfiledialog.cpp Change-Id: I00de6dd05cb773f01254061d585a82c90b229acd
| * V4: relieve more memory allocator pressure.Erik Verbruggen2014-01-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | For _ZN13BenchmarkDemo11initPhysicsEv from the Octane testsuite, the total allocated memory drops from 1.5GB to 51MB. Peak memory usage stays at 29MB. Again, slow implementations of malloc()/free() will see a performance improvement. Change-Id: I21bc2f0d3735de0980fc9b3745906016e2e48a61 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * V4 IR: do edge splitting after SSA transformationErik Verbruggen2014-01-161-8/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reduces the work for the dominator tree/frontier calculations, because there are less blocks to consider. All blocks inserted by splitting the critical edges, have (by definition) no effect on the dominator calculations. However, the immediate dominators for all new blocks needs to be added, because this information is used by the block scheduling. This change reduces memory/time usage during optimization passes, especially when processing excessively big switch statements. Change-Id: Ia69882e9dabdddffa1c98b1079012d8d988e1e8f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * V4: lower memory allocator pressure.Erik Verbruggen2014-01-163-77/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | Changes to datastructures and more re-using of locally used temporary vectors. For the test regress-74474-002.js this lowers the total allocated memory from 1.98GB to 158MB. Thse peak memory usage stays at 75MB. There is no functional change. This should give a modest performance improvement which mainly depends on the speed of malloc()/free(). Change-Id: I1877c1903e59a33ee79ff2b801ef6f2c1cee30a6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * V4 IR: update immediate dominators when purging unreachable basic-blocksErik Verbruggen2014-01-161-13/+19
| | | | | | | | | | | | | | | | | | The basic block scheduling uses this information to place loops. When the immediate dominator information is invalid, the scheduling can be sub-optimal, or will sometimes forget to schedule some blocks. Change-Id: Iaeb45f2b757b676310be25a658ceadc07d5722ec Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * V4: remove unnecessary spills and order them correctly.Erik Verbruggen2014-01-163-21/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When doing edge resolving, too many spills were generated, and the dependency tracking of moves was not complete. Now we only insert spills that are caused by phi-nodes (because any other spill would be generated at the point a variable was defined). However, there can still be multiple dependencies between the moves generated by the edge resolving. Instead of only checking the first dependency, all of them are tracked. The bug report was a case where an unneccesary spill was generated, that got tracked, but "suppressed" the other (valid!) dependent move. The randomness was caused by the hash seeding of QHash. Task-number: QTBUG-35840 Change-Id: Ifbc3c8fc13de53c46a8b5859721b2497189921a3 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | [new compiler] Fix error handling for property names that look like signalsSimon Hausmann2014-01-141-4/+4
| | | | | | | | | | | | | | | | | | The check for the right hand side of a potential signal handler declaration needs be placed after we determined that we are really assigning to a signal. Change-Id: I7f5417dc30ba7365327560e1b16ee9ceaa9bed76 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] CleanupsSimon Hausmann2014-01-102-0/+900
| | | | | | | | | | | | | | | | Move all compilation phase related sub-classes (property cache generator, component and alias resolver, etc.) together into qqmltypecompiler.cpp Change-Id: I598c801d9434623fc8e6338dec11e4d4ee6d7232 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Add support for implicitly defined componentsSimon Hausmann2014-01-104-12/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use-cases like itemDelegate: Item { ... } implicitly define a component without the item-surrounding Component {}, base on the fact that the property itself is of type QQmlComponent (or derived). This means we have to synthesize a Component {} object and insert it into the data structure. Change-Id: I8992451a5a6732c7fd898eaf83c276dc6a8b7d19 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] CleanupsSimon Hausmann2014-01-102-9/+106
| | | | | | | | | | | | | | | | Tie QQmlCompilePass and QQmlTypeCompiler together, so that we can eliminate the battery of parameters to the individual compiler phases. Change-Id: If2b6cf8416e6c2253c8f054048d1fd5ae12282b6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Move component determination and alias resolvingSimon Hausmann2014-01-091-12/+12
| | | | | | | | | | | | | | | | | | Move the code before the JS code generation, as we are going to need the component boundaries for the correct scoping. This requires the component and alias resolver to operate on the pre-compiled-data data structures. Change-Id: I8d2e697d8a05e5a4914db93e785704f6b2434a2e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Classify as Q_PRIMITIVE_TYPE a few private types.Sérgio Martins2014-01-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found by clang plugin matching the criteria: - is pod / movable - sizeof(T) <= sizeof(void*) - used by QList The only case that can't be fixed is: QList<TypeCache::Iterator> in qqmltypeloader.cpp:1924 because Iterator is declared in qhash.h:349 Maybe use a QVector ... Change-Id: I9007cf43b0cf29ff39f3d2c95fb60d766c976ce7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Classify struct Use with Q_MOVABLE_TYPE.Sérgio Martins2014-01-091-0/+3
| | | | | | | | | | | | | | It's movable, private, !isLarge and used by QLists in this code. Change-Id: I08c6e7e65625aba1bc798a3911a20d6d2ddc73fb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Rework array handling for JS objectsLars Knoll2014-01-091-5/+6
| | | | | | | | | | | | | | | | | | Split up ArrayData into two classes, one for regular arrays, one for sparse arrays and cleanly separate the two cases. Only create array data on demand. Change-Id: I9ca8d0b53592174f213ba0f20caf93e77dba690a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-081-7/+164
|\| | | | | | | Change-Id: Ied8d65aaf57e897a3dbc4df100744a594e8ee2cf
| * V4: optimize dominator frontier storage.Erik Verbruggen2014-01-081-7/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes the dominator frontier storage from a set of basic-blocks for every basic-block to a BasicBlockSet for every basic-block. This new class stores a maximum of 8 nodes in a vector, and switches to a bit vector when going beyond 8 nodes. This is important in two cases: most basic-blocks have 2-3 nodes in the frontier, and an array is faster than a set in these cases. The few cases where the frontier goes beyond 8 nodes, is when a switch statement is used with lots of cases that all fall-through. On regress-74474-003.js this reduces peak memory usage from 1.68G to 60M. The switch statement in this test results in 27000 basic-blocks. Change-Id: I42646522ba9f8642d42a5d70fc6b760bb47ae69f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | [new compiler] CleanupsSimon Hausmann2014-01-083-2/+299
| | | | | | | | | | | | | | | | Move the code that calls the main compilation passes into a separate QQmlTypeCompiler class, away from the QQmlTypeLoader. Change-Id: Ia2f33a074d7fe7d9a092ff94d1e6cfc961ad5bdb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Fix signal handlers for properties declared in the same objectSimon Hausmann2014-01-082-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | We need to generate the property caches before we can try converting the signal handler expressions in the AST to function declarations, as that conversion requires looking up the signal signature / meta-data from the property cache. This in turn requires rewriting the property cache generator code to operate on the data structure we have before creating the QV4::CompiledData. Change-Id: I0d1c59d947f36171b4eb89f47a2e1ff1bc493c6f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [new compiler] Initial support for custom parsersSimon Hausmann2014-01-081-1/+4
| | | | | | | | | | | | | | | | Enough to support the Connections {} element. What's missing are pre-compiled bindings signal handlers. Change-Id: I3ad1413fa636434d899ae8fb380249aaf40363dc Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Clean up handling of illegal names and enable in new compilerSimon Hausmann2014-01-062-23/+16
| | | | | | | | | | | | | | | | | | | | Access to the identifier hash may not be thread-safe from the loader thread, so use a QSet copy instead (which is cheap because we don't detach). This also enables the checking for illegal types again. Change-Id: I8c3ec1fd0fc01cce3269e206f479a90bdbbc89dd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-062-157/+210
|\| | | | | | | Change-Id: If9a205bea219b9aca95d78b1e556ca9bbff58dd0
| * Fix property access to QQmlPropertyMap objects when addressed via idSimon Hausmann2014-01-021-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Property access to id objects is optimized at compile time, but we cannot do that for QQmlPropertyMap instances (or generally fully dynamic types). This issue was a regression against Qt 5.1 Task-number: QTBUG-35906 Change-Id: I759a1a899f6a3a1f6466282f455b289ad7451086 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix lookups of enums in singletonsSimon Hausmann2014-01-021-35/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a regression against 5.2.0 (which didn't have this bug), due to optimizations introduced in the stable branch after the release. The code path for optimizing access to the members of C++ based singletons through the regular meta-object properties would end up excluding access to enums when the lookup happens at run-time. The run-time getter for the singleton itself would return a wrapped QObject instead of a QQmlTypeWrapper, and only the latter includes enums. As QML based singletons (composite singletons) cannot declare enums, we can continue to do fast lookups on these, but otherwise have to fall back to the slower code path. Task-number: QTBUG-35721 Change-Id: Icc66bdaf3572622cdb718f82b706e3204afa0167 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * V4: remove class field in DominatorTree that was used only once.Erik Verbruggen2014-01-021-21/+18
| | | | | | | | | | | | | | | | | | Calculation of all the children of nodes in the dominator tree is now calculated as a local variable right before computing the dominator frontier. The effect is that they are not retained after their only use. Change-Id: I83c962c691b78cb767708eb04cf30d3b7a760deb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * V4 IR: do not add unconditional jumps to work listsErik Verbruggen2014-01-021-1/+4
| | | | | | | | | | | | | | | | | | | | Both type inference and the optimization pass do not do anything with unconditional jumps. So, instead of adding them to the worklist and later on removing them again, it’s faster to never add them in the first place. Change-Id: Ib81d43e9ea6df2b1a70e9dd1e9b9c29cb6d345d2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * V4 IR: change datastructures for dominator calculations.Erik Verbruggen2014-01-021-112/+172
| | | | | | | | | | | | | | | | Replace hashes from basic-block to basic-block with vectors that associate basic-block index to basic-block index. Change-Id: I834ea3d825e4d2b02c075b1b0f080f5a65f41317 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* | Move array data into it's own structLars Knoll2014-01-031-3/+3
|/ | | | | | | First step of separating the array data from Object. Change-Id: I5c857397f0ef53cff0807debdb1e405424e1046a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 SSA: add some more literature references.Erik Verbruggen2013-12-191-5/+13
| | | | | | | Also fixed some comments. Change-Id: I4aedff84bdbf8de248025bc48805a859704bdd8a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 IR: change block scheduling algorithm from recursive to iterative.Erik Verbruggen2013-12-121-102/+189
| | | | | | | | This makes time- and memory-complexity a lot better when compiling big JavaScript functions. Change-Id: I2a7cb9b5979844254747fa5cf7355cca0b113904 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* Fix broken Maroon game / regression in PropertyChanges {} elementSimon Hausmann2013-12-102-13/+36
| | | | | | | | | | | | | | | | | | | | | | Commit 0aadcf8077840068eb182269e9ed9c31ad12f45e that pre-compiles the expressions in PropertyChanges {} introduced a regression in where the evaluation context was incorrect and thus bindings would not be able to access the correct properties. For example PropertyChanges { target: someObject y: height / 2 } Here height should be looked up in the context of "someObject", not of the PropertyChanges element. This patch introduces an auto-test that verifies that the lookup context is correct and fixes the bug by disabling accelerated compile time property lookups for binding expressions that are requested from a custom parser. Change-Id: I5cb607d07211b453ddfc9928ccbf5f9ecec85575 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: change variable renumbering algorithm from recursive to iterative.Erik Verbruggen2013-12-101-89/+237
| | | | | | | | | Replace the recursive calls and subsequent clean-ups by pushing actions on a to-do stack, and processing that stack in a loop. Change-Id: I83536e88d400592b6e9f5fda3d795e41711a131a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* Clean up property dependency data structuresSimon Hausmann2013-12-057-141/+87
| | | | | | | | | | | | | | | | As a follow-up to the previous commit, this patch cleans up the data structures used to track dependencies of QML binding expressions and functions to context and scope properties, determined at compile time. Instead of "collecting" these depending properties upfront (codegen time), we propagate the information that a property is a context or scope property into the IR at codegen time and later in the isel collect these properties and their notify signal index in a hash in the IR functions. The CompileData structure generator then can read these hashes directly when writing out the dependency information. Change-Id: I32134706e2d24bf63d1b1abad0259ab072460173 Reviewed-by: Lars Knoll <lars.knoll@digia.com>