aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix dependency calculation for context and scope propertiesSimon Hausmann2013-12-053-4/+17
| | | | | | | | | | | | | | | We were incorrectly calculating writing to a context or scope property as a dependency for an expression. We don't know whether a property is being written only or also being read from at lookup time, but we can make that decision in the isel then when generating the move instructions. So initially context and scope properties end up in a candidate set first and get promoted to real dependencies when they're being used in reading moves. Task-number: QTBUG-35210 Change-Id: Ia67057abafc2d611e1e6605327b4965ebe91cbed Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 IR: reverse propagate int32 truncation.Erik Verbruggen2013-12-044-139/+363
| | | | | Change-Id: I5cb0c7798d0e530f3137710bf0e723bd7b64dc89 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused memberLars Knoll2013-12-042-4/+2
| | | | | Change-Id: I9926f1ab10ea04387f17794944dcc11f4a2a9054 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a static toArrayIndex() method to QV4::StringLars Knoll2013-12-041-1/+1
| | | | | | | | This avoids a hack in QV4::Codegen where we created a V4::String on the stack to convert to an array index. Change-Id: I9a88d45817bbcde52a4037a52fbae299b8c9cb1a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused inline wrapperLars Knoll2013-12-041-2/+2
| | | | | | | | | The wrapper method for Function::code() was still there from the times we used C++ exceptions. It's not needed any more, so get rid of it. Change-Id: I2ec25fbca71eeef9d7a94a38b5adfa42e4de3a84 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix build in release mode with forced assertsKonstantin Ritt2013-12-031-1/+1
| | | | | Change-Id: I0e35533af7f65200a8bc3c4024c29344fa6f4b7a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 IR: remove common toInt32 casts.Erik Verbruggen2013-12-031-2/+29
| | | | | | | | | | | | | E.g.: a | 0 b & 0xffffffff These operations force the operands to be converted to int32 without changing their value. At this point we already added convert calls to the IR, so we can safely get rid of these operations. Change-Id: Ic4d3b989e13439eccd2c878fa7bf5030acae7630 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 IR: change the worklist to a QSet for block scheduling.Erik Verbruggen2013-12-031-4/+4
| | | | | | | Fixes a crash in octane. Change-Id: Ib72ac0b7a2941230a87543f30fcf7e55d7094886 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: remove invalid assert.Erik Verbruggen2013-12-031-3/+1
| | | | | | | | Both the base and the index of a subscript can (and are allowed to) be other things than temporaries. Change-Id: If073e262712bab488f18eac5ebe097be99c40359 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix accelerated property lookup on id addressed objectsSimon Hausmann2013-11-291-1/+2
| | | | | | | | | | | For properties on id referenced objects, we can ignore the lack of the FINAL keyword on properties, as we want the same "lexical" lookup rules like for properties on the scope or context objects. In addition we need to initialize the resolver on the returned temp, to ensure a successful type determination in the use of the id object afterwards. Change-Id: I496c942ade55aa331e6972f06b21c2c86d4b00a4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Slightly accelerate access to value type propertiesSimon Hausmann2013-11-283-9/+22
| | | | | | | | | | | We can't do a fast property index based access on them, due to the inability to read individual fields from the original object (i.e. the logic in QQmlValueTypeWrapper). However what we can determine and propagate is the type information of the individual properties, i.e. that the x and y properties of a QPointF are always doubles. Change-Id: Iee71ece2117294b7bc0b93deb0a77d7c51148b11 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add a QML debug config option QML_LOOKUP_HINTS to find non-final propertiesSimon Hausmann2013-11-281-0/+12
| | | | | | | This helps to optimize property access, especially for attached properties. Change-Id: Id47a9c5f184f84ce5ab813d3b01d1a6c6031233e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support for accelerated property access to QML types and namespace supportSimon Hausmann2013-11-2812-56/+200
| | | | | | | | | | | * 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>
* Merge branch 'release' of ssh://codereview.qt-project.org/qt/qtdeclarative ↵Simon Hausmann2013-11-263-3/+21
|\ | | | | | | | | | | into stable Change-Id: I0bf06be69927d5961f1bdb4948c3572ef6111923
| * Fix out of bounds array access when index is integer and negativev5.2.0-rc1Simon Hausmann2013-11-251-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | When the index is a double, the branchTruncateDoubleToUInt takes care of branching when the index is negative, but when it's an integer we need to perform that check ourselves. Without the patch it's rather easy to cause the application to crash. Change-Id: If908923ddc2077b3fb3dd42350f038ff0072e8e1 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix memory corruption in QML expression compilationSimon Hausmann2013-11-252-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We store QQmlPropertyData pointers in our IR for Qt meta-object property resolution at compile time. As it turns out however, it is possible that these pointers change after retrieval from the QQmlPropertyCache, as the cache may change later in the compilation process. Therefore we must do what also QQmlCompiler does by storing a copy of the QQmlPropertyData. For the JS IR we can do that conveniently through the IR memory pool. A side-effect of this bug was that QQmlPropertyData pointers were re-used and so the identity check in the isel later such as _function->contextObjectDependencies.contains(m->property) for dependency tracking failed. In the example given in the bug report it was determined that the window.contentWidth property wouldn't need a property capture, and therefore the binding was not re-evaluated as window.contentWidth later in the binding evaluation phase received its correct value. This patch also fixes the incorrect debug output names assigned to JS binding expressions, where the index used to look up the name is per compiled object, not per QML component. Task-number: QTBUG-35063 Change-Id: I3e5bbfaac11e5c122a2ed15a3e486a93988e1b6e Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Initial support for accelerated property access to QML singletons and enumsSimon Hausmann2013-11-2512-15/+138
| | | | | | | | | | | | | | | | | | 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-2512-65/+34
| | | | | | | | | | | | | | | | | | | | | | | | ...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-255-33/+14
| | | | | | | | | | | | | | It is technically redundant to the Member::property field. Change-Id: If0ee35b2c94a2c9373784d36a1f8dfe8ad7dcfb3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Speed up repeated context, scope and import script lookupsSimon Hausmann2013-11-254-9/+36
| | | | | | | | | | | | | | | | | | Instead of querying for the context, scope or imported scripts object on each access, do it once at the beginning of the expression in the IR and re-use the temp. The optimizer will optimize away unused temps. Change-Id: I703e737469030c4454d23c567873012a2b537d71 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Improve type interference for QObject propertiesSimon Hausmann2013-11-2513-106/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Saner and simpler way to handle line numbers for JITed codeLars Knoll2013-11-222-45/+2
| | | | | | | | | | | | | | | | | | | | | | | | Instead of storing the current instruction pointer in the ExecutionContext, we might as well directly store the current line number there. Leads to simpler code, works cross platform and should also be faster. Change-Id: Ifb7897cf8dbe8a962505fe876aa3ed43283ebb06 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Use lookups for create_property (ie. new foo.bar)Lars Knoll2013-11-223-2/+31
|/ | | | | | | | This is not used that often, but it removes one more place where we do lookups by name. Change-Id: I9f798b8b4a64be3fdf3e53090e4288724c9d2b22 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4: remove failing assert and fix code.Erik Verbruggen2013-11-191-3/+3
| | | | | | | | | | Assert failed for cases where the node’s ancestor with lowest semi-dominator number was not the same as the parent. The test case exemplifies this. Task-number: QTBUG-34792 Change-Id: Ie6847b22a27211801bff7479bfcbfaf329c6005a Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* Fix failing assertion when trying to assign to an id referenced QML objectSimon Hausmann2013-11-194-4/+7
| | | | | | | | | | References to id addressed QML objects are member expressions, which are unlike other member expressions by not being lvalues. Handle this correctly. Task-Number: QTBUG-34890 Change-Id: Ied6230edbc561128ad36bf0d1a1918185204deec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 SSA: speed up dominator calculations.Erik Verbruggen2013-11-181-63/+137
| | | | | | | | | | | Changed three recursive routines to worklist-based iterative ones. This not only speeds up the dominator frontier calculation, but also prevents the algorithm to run out of stack space. This is a partial fix for QTBUG-34047. Change-Id: Ife8dc35724d50408ad356e1621884bdb82db9626 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix compiler warnings with mingw64.Erik Verbruggen2013-11-181-0/+1
| | | | | | | Task-number: QTBUG-34152 Change-Id: Ibb93d1cac8c343a7ca34ce7d010f24fc56ba89df Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix property dependency generation for accelerated QML QObject propertiesSimon Hausmann2013-11-1212-140/+48
| | | | | | | | | | | | | | 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>
* Fix out of bounds array index in the generated JIT codeLars Knoll2013-11-121-3/+5
| | | | | | | | | When converting a double to int, make sure we check for >= 0 before using it, otherwise we get out of bounds accesses. Task-number: QTBUG-34635 Change-Id: If72e116c08fe1dff03cd88ce510cf8b96d249b92 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* V4 IR: change basic-block cleanup to remove unreachable cycles too.Erik Verbruggen2013-11-121-22/+57
| | | | | | | | | | | | | | | | | | | | The previous version left unreachable cycles untouched. For example in: function f() { if (false) while (true) { doSomething(); } anotherThing(); } The edge to the then-part would be removed, but the loop itself would not be removed. This resulted in the basic-block scheduler choking when hitting the block with the anotherThing() call, because it wants to have all blocks from incoming edges resolved first. Task-number: QTBUG-34776 Change-Id: I5b3a79140e6058c4ade4ec7687c1a795f1a74f97 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* Remove unused _info on non-debug buildsShawn Rutledge2013-11-121-0/+7
| | | | | | | | | Otherwise clang generates a warning which is fatal because of treating warnings as errors. Change-Id: I47c280edf6b0f8efa5ce24f9e92551304aed15fb Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* V4 JIT: fix invalid sanity assert.Erik Verbruggen2013-11-121-2/+22
| | | | | | | | | | | | | If there are multiple incoming edges to a block, and there are one or more phi nodes at the start, then only check the temp uses for the edge we are resolving. Task-number: QTBUG-34770 Change-Id: Ibb5c7c323d6be8bc1ed492b08ed098de2f2726cc Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* V4 IR: scan arguments when entering function scope in QML.Erik Verbruggen2013-11-122-1/+8
| | | | | | | | | | | | | When doing IR generation for a function declaration in a QML object, call through the helper methods to check for forbidden names, and most importantly, also checks if the function has parameters. If the latter is the case, they need to be added as a member for the current scope in order to get IR generation correct. Task-number: QTBUG-34493 Change-Id: I0ade15ee19e1b1ac8ee2f2d3fa186d1551800199 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: fix loop block marking for initializer blocks.Erik Verbruggen2013-11-121-4/+4
| | | | | | | | | | | | | | Any new blocks generated as part of the initializer were incorrectly marked as belonging to a loop. For example, if a LocalForStatement would contain a ternary expression, the generated then and else blocks would be marked. This would confuse the block scheduling, because all blocks are postponed unil the condition block (“group start”) is scheduled. Task-number: QTBUG-33754 Change-Id: I45919ebeac356f015bb91fe0210472b3df0b56d8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 interpreter: remove stack-slot allocator.Erik Verbruggen2013-11-124-161/+70
| | | | | | | | | | The life-ranges are only valid when the IR is in SSA form. So the use of them in the interpreter after converting out of SSA form introduced bugs. Instead, allocate a stack-slot for each unique temporary, and re-use the code for this from the JIT. Change-Id: I294f1116064f0b85996cf96a0b408b41a3c785e2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Simplify & speed up function callingLars Knoll2013-11-094-4/+7
| | | | | | | | | Get rid of the SimpleCallContext, instead simply use the CallContext data structure, but don't initialize the unused variables. Change-Id: I11b311986da180c62c815b516a2c55844156d0ab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Generate inline code for "foo == null/undefined"Lars Knoll2013-11-052-12/+79
| | | | | Change-Id: I81f5708034ed50207afde697e377e8f265cbcd1c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move conversion of this object into generated codeLars Knoll2013-11-0512-1/+45
| | | | | | | | | | | | 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>
* Optimise string additionsLars Knoll2013-11-051-2/+9
| | | | | | | | Small optimisation for string additions, also add one more check for exceptions in the code where required. Change-Id: I6c14bc88ea5d03f7eeed0e0168c5195f9f823693 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix rounding behavior of Qml when assigning doubles to integer propertiesSimon Hausmann2013-11-051-8/+6
| | | | | | | | | | | | The engine used to round, but that is inconsistent with ECMAScript's way of converting doubles to integers by truncation. With this patch we can also enable the propagation of integer type information into the IR, but we have to be careful not to utilize it when writing properties. Change-Id: I04af4879ba5131349eca2eeff2b27f4598f5267b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Refactor marking GC'ed objectsLars Knoll2013-11-052-6/+6
| | | | | | | | | | | Don't use recursive function calls anymore. Instead, push marked objects onto the JS stack, and then pop them off when their children are being marked. Should reduce stack memory usage, and improves performance by ~5%. Change-Id: I2d37d97579144fcba87ec8e9fd545dd220c01fbb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix a bug in LifetimeInterval:covers()Lars Knoll2013-11-041-3/+1
| | | | | Change-Id: I7c3b0b2ac43462a9834e3f1891dae23fc9ed061d Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-0410-90/+94
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid exception checks after calls to some run-time functionsSimon Hausmann2013-11-011-0/+16
| | | | | | | | | | We know that some run-time functions won't thrown an exception, so this patch annotates them with a tricked NoThrowContext* instead of ExecutionContext*, which allows the masm isel to detect calls to them and avoid generating the exception handling checks after the call. Change-Id: Ida1c9497edda14f26e1d6389b0144f6abeeba654 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Avoid unnecessary saving of the instruction pointer in the JITSimon Hausmann2013-11-012-4/+7
| | | | | | | | We only need to save it when the line number changes, not for each and every call. Change-Id: I1a6fdf97abd3dd654bbd97d2a99cd09e9c20f64f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Improve debugging of QML expressionsSimon Hausmann2013-11-012-3/+3
| | | | | | | | Add the name of the property to the generated IR function ("expression for x") to make it easier to debug. Change-Id: If35f42764774e6d7f40d3bf080e1fbdb12321ed5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Don't assert on (++1), rather throw a ReferenceErrorLars Knoll2013-11-011-0/+10
| | | | | | | Also fix up the generated string for the reference error. Change-Id: I327a8eb682017297a799f8bae650267727039616 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix compile.BogDan Vatra2013-11-011-1/+1
| | | | | Change-Id: Iee1280462bec296de1ff2f7572cfc98035195235 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up lookups of imported scriptsSimon Hausmann2013-10-3111-21/+21
| | | | | | | | | | 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>
* Implement loading of resolved imported scriptsSimon Hausmann2013-10-3111-29/+77
| | | | | | | | We can resolve the use of names that refer to imported scripts at compile time and load them at run-time by index through context->importedScripts. Change-Id: I681b19e7d68dbf3b9a68af00b4cea2a9254c2d78 Reviewed-by: Lars Knoll <lars.knoll@digia.com>