aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4jsir.cpp
Commit message (Collapse)AuthorAgeFilesLines
* V4: tweak Phi node data destruction.Erik Verbruggen2016-03-061-15/+18
| | | | | | | | | | | | Phi nodes can only occur at the start of a basic block. If there are any, they need to be subsequent to eachother, and the first phi node should be the first statement in the basic-block. A number of loops rely on this behavior, so they don't need to walk through the whole list of instructions in a basic-block (e.g. the calls to destroyData in BasicBlock::~BasicBlock). Change-Id: I57763bc6abae271337b0b169cccd26e10ecd9b2d Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* V4 IR: Store the phi-node parameters directly in the class.Erik Verbruggen2016-03-061-3/+3
| | | | | | | | | | | | Every time one of the paramets was accessed, the chain of loads was: phi->d->incoming->heapdata[i] Now it is: phi[i + offsetof(incoming)] This also removes at least one malloc (for the Data), and usually two (when the number of parameters is <= 4, which is most of the cases). Change-Id: I953e784647148266ae5a49a93a203d0d22cdcb63 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Qml: replace QStringLiteral with QLatin1StringAnton Kudryavtsev2016-02-101-1/+1
| | | | | | | ... in string comparisons. It's more efficient. Change-Id: I3be5a2be9ba5d55546472eac28f5f639a496bf3b 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>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-101-3/+3
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h tests/auto/quick/qquicklistview/tst_qquicklistview.cpp tests/auto/quick/qquicktextedit/qquicktextedit.pro tests/auto/quick/qquicktextinput/qquicktextinput.pro Change-Id: I95d2c20a8619e5b8fa361c941a16dd8dce3e04e7
| * Remove prohibited uses of underscore + capital letterThiago Macieira2016-01-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | All identifiers starting with an underscore and a capital letter are reserved to the compiler and must never be used by the user code. Try to find a better name or, in the worst case, move the underscore to the last position in these identifiers. See commit cf63c63d558227fdbef09699c261560e7474f5ea in qtbase for a case of such an identifier causing a build breakage when the compiler began treating it specially (it was _Nullable). Change-Id: I1d0f78915b5942aab07cffff140f9f39c29f0fdf Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* | V4: use range-based for-loops in the IR.Erik Verbruggen2016-01-051-9/+9
| | | | | | | | | | Change-Id: I488a8700c1fc070c1cbdfd8b6d1b1e5614be8702 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Replace all occurrences of qSNaN() with qQNaN()Ulf Hermann2015-12-071-1/+1
|/ | | | | | | | | | | We generally don't want to produce signalling NaNs as those cannot be used in any further arithmetic operations. In particular -(qSNaN()) claims it's not a double. Task-number: QTBUG-49753 Change-Id: I23cec4fec2ddf08c02a7d53db7f3b9ba46b6c288 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Access the id objects through a specialized runtime methodLars Knoll2015-08-121-6/+6
| | | | | | | | This brings us one step closer to getting rid of the QQmlContextWrapper. Change-Id: Ied57f4c174c2ebd95096310a4ad4c0c28787e7a4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Access context properties through the qml contextLars Knoll2015-08-101-2/+0
| | | | | | | And get rid of another temp in the IR. Change-Id: I039393e020e5141f1986aee276246c30fd8057f3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Use the QmlContext to access properties of the scope objectLars Knoll2015-08-101-2/+0
| | | | | | | | | Add some runtime methods to access properties of the scope object directly (using the QmlContext), and generate proper code to call those. Change-Id: I0b29357c9a3b9ad53ba568ec6cb763e8ecb10f21 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Add ability to retrieve and use the QmlContext from our generated codeLars Knoll2015-08-101-0/+2
| | | | | | | | | | | | | | Our generated code (JIT and interpreter) should operate on the QML context to retrieve QML related things. That's better than operating on 4 different temps. So this commit introduces the QML context as a temp in the code we generate for QML. The next commits will move things over to use that context with specialized runtime methods instead of using generic subscript/get calls on the different subobjects. Change-Id: Ia05cf339de9cdd23003f35cf78ede17d2590f8de Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Move Stmt::d to Phi::dRobin Burchell2015-01-231-7/+20
| | | | | | | Phi is the only thing using it. Change-Id: I2b6706884d9e41cc26632a6ad72281b391960f4f Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* V4 IR: Change data type used in RemoveSharedExpressions pass.Robin Burchell2015-01-071-11/+14
| | | | | | | | | | | | | | | | | | | | | | Profiling the loading of a pretty morbidly large QML file consistently showed that this was quite slow, around 1300ms in removeSharedExpressions, of which a good >600-700ms (I didn't count exactly, but it was a very large amount) was down to allocating and freeing QHash nodes. As we don't require removals, leaving insertion and lookup as the only two remaining options, a sorted vector becomes a viable alternative (credit to João Abecasis for the idea). An additional benefit of this change is that the two hash lookups are now compressed into a single 'hash' lookup (via the lower_bound call) instead of separately using contains() / insert(). Measuring the exact saving is difficult, but it looks like this saves between 700-1000ms off the runtime RemoveSharedExpressions. After this patch, malloc and free are dominating the optimizer run, instead of any particular method. Change-Id: I6c0bb8495eac4dd3613ba0274e8802d7bd609460 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4: disable type inference and loop peeling for the interpreter.Erik Verbruggen2014-08-261-0/+3
| | | | | | | | | | Loop peeling is always disabled. Type inference is still enabled for QML code, because of the static-type nature of the properties. This speeds up crypto.js by 20%. Change-Id: Ibf51cb36f8904d64df0793980d463451dfd361e2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* V4 IR: Add loop peeling.Erik Verbruggen2014-08-181-1/+1
| | | | | | | | | | | | By peeling the first iteration off of a loop and putting it in front of the loop, type inference can deduce more type information for esp. loop induction variables. To prevent increasing the code size too much, only the inner-most loops are peeled. This gives a 10% speed-up on crypto.js. Change-Id: I57f9611695bc8defc0bff84e440b8a20b2c8a34e Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* V4 IR: add immediate dominator re-calculation.Erik Verbruggen2014-08-181-1/+1
| | | | | | | | | When removing edges, the control-flow graph changes, so some immediate dominators might need to be updated. This change collects all candidates and processes them in a single batch. Change-Id: I928f42232427a84bcb9658e314dadd0bd021b12f Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* V4 IR: change IR printing to be more readable.Erik Verbruggen2014-08-131-117/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New structure: - "comments" now start with a semi-colon, and have a list of key: values. ; predecessors: L17 L26 L36, loop_header: yes ; line: 30, column: 3 - when a temporary has a known type, it is written in front of the teporary when it is being assigned, and not repeated. var %109 = this double %42 = 42 - an expression starts with the operation, followed by the operands that are separated by commas. The type of the operands is the type mentioned when they are assigned. int32 %115 = sub %184, %185 if gt %27, 0 goto L40 else goto L41 - conversions do mention the operand type in order to make them easier to read. double %178 = convert var to double %60 - phi node operands are prefixed by the from-label to make it easy to match those operands with the from-block. double %62 = phi L35: %58, L34: %61 - all names except for "this" and built-ins are prefixed by a dot in order to make it clear that a lookup will occur, just like member accesses. $6 = call .int2char($0) %7 = this %8 = %7.toString() Change-Id: I9f626a91f97ca7c3f27e01a5539f3c4fc10a46b4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 IR: copy arguments to temps at function start.Erik Verbruggen2014-07-231-0/+8
| | | | | | | | | | | | | When arguments cannot "escape" from the current context, and when the arguments array is not used, actual arguments can be treated the same as temporaries instead of memory locations. This has the benefits that they are subject to the same optimizations, and type deduction can assume that the value/type didn't change since its assignment. Another effect is that the values can be kept in registers, and loads from the stack take only 1 indirect load instead of 2 (from the formals array). Change-Id: I209da7991ec5d903b3c5acdbcaf6b1cc67502520 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 IR: (natural) loop detection.Erik Verbruggen2014-07-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | We perform loop detection to be able to assign to each block its loop, an chain them up from inner loop to outer loop. The new algorithm works on each basic block just once, and looks at a basic block just the number of connections it has. As it relies on the dominator tree it is more robust on actually finding al looping constructs and only those rather than relying on the statements used. It assumes that a basic block is analyzed before the one that dominate it (to guarantee finding outer loop headers before inner loop headers), so blocks are ordered to work on them in a way that guarantees that, using dominator tree depth, that is trivially available. Loop detection allows us to then schedule the loop body before the part after the loop (the header dominates both so just domination cannot choose between both), and can be used to optimize loops (either unrolling the first iteration or hoisting constant parts out of it). It also helps with generated JavaScript code: in order to simulate gotos or other unconditional branches, nested labeled do-while(false) loops are often used in combination with break/continue to "jump" between "loops". Change-Id: Idfcc74589e057b191f74880ffd309d0a9c301811 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-021-0/+8
|\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/quick/scenegraph/openglunderqml/squircle.h src/quick/doc/src/qmltypereference.qdoc src/quick/scenegraph/qsgthreadedrenderloop.cpp Change-Id: Ife4f4b897044a7ffcd0710493c6aed1d87cf1ef9
| * Fix Stmt:Data object leakLiang Jian2014-06-131-0/+8
| | | | | | | | | | | | | | | | | | call Stmt::destroyData() whenever a Stmt object is to be removed in BasicBlock to delete the Stmt::Data object hold in the Stmt object. Change-Id: I59c939d79b935153e6f8613e54f149120f5198f5 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | V4 RegAlloc: change life-time intervals from closed to half-open.Erik Verbruggen2014-06-131-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two changes in this patch, that go hand-in-hand. First, when re-numbering the statements in order of occurrence in the scheduled basic-blocks, the (new) position is not stored in the statement itself, but in the LifeTimeIntervals class. This makes it possible to re-use information gathered during SSA formation or optimization. The re-numbering itself has also changed, resulting in some minor changes to the life-time interval calculation. The new numbering is described in LifeTimeIntervals::renumber(). The reason is to make it easy for the register allocator and stack-slot allocator to distinguish between definition of a temporary and its uses. Example: 20: %3 = %2 + %1 22: print(%3) If the life-time of %2 or %1 ends at 20, then at the point that %3 gets assigned, it can re-use the storage occupied by %1 or %2. Also, when both %1 and %2 need to get a register assigned (because they were spilled to the stack, for example), %3 should be allocated "after" both %1 and %2. So, instead of having a closed interval of [20-22] for %3, we want to use an open interval of (20-22]. To simulate the "open" part, the life-time of %3 is set to [21-22]. So, all statements live on even positions, and temporaries defined by a statement start at statmentPosition + 1. Change-Id: I0eda2c653b0edf1a529bd0762d338b0ea9a66aa0 Sanity-Review: Qt Sanity Bot <qt_sanitybot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | V4 IR: Store positions for life-time intervals outside the statement.Erik Verbruggen2014-06-061-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | The statement ids are now stable, so the life-time interval calculation can re-use information calculated by the optimizer. This re-use will be done in a separate patch. It also allows for changes to the numbering in a non-intrusive way. This will also come in a later patch. Change-Id: Ie3a2e1d9e3537cc8070ff3e3007f3a5e8ca0579a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | V4 IR: make statement numbering fixed and clean up statement worklists.Erik Verbruggen2014-05-281-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Every statement in the IR now gets a fixed unique number. This number can be used to store statements or information for a statement into an array where the number is used as an index. This removes the need for many hashes. In the process of changing the code the two statement worklists in the optimizer are merged into one. A single instance can be (and is) re-used by the various algorithms. Change-Id: I8f49ec7b1df79cf6914c5747f5d2c994dad110b2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | V4: Split arguments/locals from temps.Erik Verbruggen2014-05-231-16/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a couple of reasons to split the temporaries off from the arguments and locals: Temporaries are invisible, and changes to them cannot be observed. On the other hand, arguments and locals are visible, and writes to them can be seen from other places (nested functions), or by using the arguments array. So, in practice these correspond to memory locations. (One could argue that if neither nested functions, nor eval(), nor arguments[] is used, the loads/stores are invisible too. But that's an optimization, and changing locals/arguments to temporaries can be done in a separate pass.) Because of the "volatile" nature of arguments and locals, their usage cannot be optimized. All optimizations (SSA construction, register allocation, copy elimination, etc.) work on temporaries. Being able to easily ignore all non-temporaries has the benefit that optimizations can be faster. Previously, Temps were not uniquely numbered: argument 1, local 1, and temporary 1 all had the same number and were distinguishable by their type. So, for any mapping from Temp to something else, a QHash was used. Now that Temps only hold proper temporaries, the indexes do uniquely identify them. Add to that the fact that after transforming to SSA form all temporaries are renumbered starting from 0 and without any holes in the numbering, many of those datastructures can be changed to simple vectors. That change gives a noticeable performance improvement. One implication of this change is that a number of functions that took a Temp as their argument, now need to take Temp-or-ArgLocal, so Expr. However, it turns out that there are very few places where that applies, as many of those places also need to take constants or names. However, explicitly separating memory loads/stores for arguments/locals from temporaries adds the benefit that it's now easier to do a peep-hole optimizer for those load/store operations in the future: when a load is directly preceded by a store, it can be eliminated if the value is still available in a temporary. Change-Id: I4114006b076795d9ea9fe3649cdb3b9d7b7508f0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | V4: replace debug macro by compile time constant.Erik Verbruggen2014-05-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | By having all code "enabled" all the time, it will be checked by the compiler and visible for refactoring. The compiler will optimize it away when debugging is turned off. Also fixes the code where previous refactoring changes were not applied. Change-Id: I634ac85570125b533adce93ca347c4be3d60aa83 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | V4 IR: change IR printing to use a visitor.Erik Verbruggen2014-05-211-303/+379
|/ | | | | | | | This allows for overriding methods to customize the printing of nodes. It also removes some duplicate code. Change-Id: Ieb9eec2fa7d4e211932d7772586a1d62b119a90a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2014-05-011-0/+6
|\ | | | | | | Change-Id: I996a85744753598bb48c7e0d7954049202f4f037
| * Extend the QML bootstrap library by the IR buildersSimon Hausmann2014-04-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | This is among other things needed to fix the qml import scanner to detect dependencies from .js files correctly. The patch also fixes the use of Q_QML_EXPORT towards Q_QML_PRIVATE_EXPORT where appropriate and corrects the wrong include path for the double conversion code to actually be relative to the file it is included from. This worked by accident because of other include paths present in the build. Change-Id: I338583dad2f76300819af8ab0dae8e5724c84430 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | V4 IR: replace QSets with QBitArray and QVector.Erik Verbruggen2014-04-291-0/+7
| | | | | | | | | | Change-Id: I565e0a22d4e94495eb427b85a59a62733a815527 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | V4 IR: reduce runtime cost.Erik Verbruggen2014-04-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | - Replace 2 QHash<BasicBlock *, ...> with QVector<...>, where the basic-block index is the index of the vector. - Nearly all QHashes and QSets will have a minimal fill rate. So, initialize/reserve all of them with a reasonable minimal size to prevent re-allocations and re-hashing. Change-Id: Iade857991d73fddd0b92cecb8d458064b253a08d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | V4 IR: clean up basic-block management and statement access.Erik Verbruggen2014-04-151-17/+152
|/ | | | | | | | | | | | | | | | BasicBlocks have an index property which points to the index of that basic block in the container array in Function. This property can be used to store calculated information about basic blocks in a vector, where the vector index corresponds to the basic block index. This is a lot cheaper than storing any information in a QHash<BasicBlock *, ....>. However, this numbering requires that no re-ordering or deletion of blocks happens. This change cleans up all that handling which was scattered over a number of places. Change-Id: I337abd39c030b9d30c82b7bbcf2ba89e50a08e63 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use Q_ASSERT instead of assertLars Knoll2014-03-191-8/+7
| | | | | Change-Id: I6185b59a7dfd6977ce82581ab4385e07d78f13f6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Enable constant propagation for all typesLars Knoll2014-03-191-0/+5
| | | | | | | | | So far constant propagation was only enabled for numbers and booleans. Enable it for all types now and make sure the propagation does the right thing. Change-Id: I202b0073f463d8a42e34931a736544207284b6dc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Clean up object literal handling with integral indicesSimon Hausmann2014-02-241-4/+0
| | | | | | | | | | | | | | | | | | | | | * Object literals with array indices are now created with one run-time call, instead of an initial one for non-integral keys followed by sub-sequent define_builtin_property calls. * Cleaned up propert name retrieval. Instead of using a visitor, it's easier to define a virtual method on the PropertyName type. The visitor doesn't buy us much as it's not possible to recurse within property names, and this way we can use it also from the function scanner to correctly determine the number of arguments needed for object literal initalizations. * Similarly the duplicated/common name member for all property assignments has been moved into PropertyName, for convenient access without AST casts. * Removed now unused builtin_define_property/settergetter functions from IR, run-time and moth. Change-Id: I90d54c81ea5f3f500f4f4a9c14f7caf5135e7f9f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up our internal namespacesLars Knoll2014-02-231-31/+31
| | | | | | | | QQmlJS::MASM -> QV4::JIT QQmlJS::V4IR -> QV4::IR Change-Id: I707e8990459114a699c200fe3c22cec3c8df1afc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-8/+8
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Clean up property dependency data structuresSimon Hausmann2013-12-051-15/+5
| | | | | | | | | | | | | | | | 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>
* Add support for accelerated property access to QML types and namespace supportSimon Hausmann2013-11-281-5/+19
| | | | | | | | | | | * Resolve lookups in namespaces at compile time and instruct the SSA optimizer to eliminate reads from the namespace (QQmlTypeWrapper) if possible. For example access to attached properties of types (i.e. MyNameSpace.ListView.isCurrentItem) requires neither reading the namespace nor the type. * Add support for accelerated lookup of attached properties Change-Id: Ib0b66404ed7e70e1d4a46a1ac8218743a4cc8608 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial support for accelerated property access to QML singletons and enumsSimon Hausmann2013-11-251-0/+6
| | | | | | | | | With this patch we determine the meta-object of singletons, propagate it into the IR and load them separately using a dedicated run-time function. In addition enums in singletons and QML types are resolved at compile time. Change-Id: I01ce1288391b476d1c9af669cb2987a44c885703 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* IR Cleanup, resolve ID objects through array subscriptsSimon Hausmann2013-11-251-15/+3
| | | | | | | | | | | | ...instead of a special MEMBER type. This allows removing the type member from V4IR::Member altogether (and thus unshadow from V4IR::Expr::type). By not requiring the base of a id lookup member expression to be a NAME, we can also speed up repeated id lookups by fetching the id object array wrapper only once per function. Change-Id: I3e9b8f498d32ace4a0cc2254f49e02ecc124f79c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup, get rid of MemberOfQObject V4IR::Member specializationSimon Hausmann2013-11-251-13/+4
| | | | | | | It is technically redundant to the Member::property field. Change-Id: If0ee35b2c94a2c9373784d36a1f8dfe8ad7dcfb3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Improve type interference for QObject propertiesSimon Hausmann2013-11-251-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | Propagate QObject properties in member expressions across temporaries as part of the type interference SSA pass. This replaces the earlier attempt to resolving QObject properties in fieldMemberExpression() in the codegen, but it was incomplete and now things like the following are fully resolved: var tmp = blah.somePropertyThatReturnsAQQuickItem; <-- QQuickItem property return type propagated into tmp var width = tmp.width; <-- and picked up here again to resolve the index of width instead of by name With this patch Temp gets a helper structure with a function pointer, initialized to aid the resolution of properties in Qt meta objects. This structure is propagated into the temps until it reaches the next member expression that uses the temp. Similarly QObjectType is added as IR type, next to VarType. The resolution inside the SSA type interference pass also requires passing through the QQmlEngine from the upper caller levels, in order to resolve the property type to a potential QMetaObject property. Change-Id: I14c98fa455db57603da46613ce49c174d0944291 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix property dependency generation for accelerated QML QObject propertiesSimon Hausmann2013-11-121-25/+0
| | | | | | | | | | | | | | The previous approach of collecting the dependencies through an IR visitor doesn't work, because it relies on a fixed structure - for example MEMBER(NAME, prop) - which we can't guarantee (it's usually MEMBER(TEMP, prop)). But it turns out that we can only pre-calculate dependencies for context, scope or id properties, so we can do that right away in the QML specific JS codegen, store that information in the IR function and use it from there in the data structure generator as well as in the isel as a parameter to getQObjectProperty to tell the run-time whether capture is required or not. Change-Id: I33711c3420d6534c653c2a6a4284f0fc12e941cf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move conversion of this object into generated codeLars Knoll2013-11-051-0/+2
| | | | | | | | | | | | When a non strict mode function uses the this object, we need to make sure it's being correctly converted into a object before being accessed. So far this was being done by ScriptFunction::call. Move this into the generated code to avoid overhead for methods not using 'this', and simplify our ScriptFunction::call() implementation. Change-Id: I739f4a89d29ed8082ce59e48d1523776224fc29d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-1/+3
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Speed up lookups of imported scriptsSimon Hausmann2013-10-311-2/+2
| | | | | | | | | | The QQmlContextData stores the JS objects of imported scripts in a QList<PersistentValue>. Instead of indexing into that list, this patch changes ctxt->importedScripts to be a JavaScript array, that in the IR we can index via subscript. Change-Id: Ie2c35fb5294a20a0b7084bb51d19671a27195fec Reviewed-by: Lars Knoll <lars.knoll@digia.com>