aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-181-0/+7
|\ | | | | | | Change-Id: I20c622263f40c322954328e4d10a8071db3ca6d1
| * Fix throwing an exception inside a finally block with a return in catchSimon Hausmann2016-08-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When exiting a catch block with a return statement, we'll unwind the exception handling manually and emit finally statements right before jumping to the exit block. If we throw an exception in the final block, we'll end up using the exception handler of the catch block that contains the return statement, which means we'll end up popping the exception scope one too many times, once through ScopeAndFinally::CatchScope in unwindException() and then when executing the exception handler block. The latter we should not be executing, instead we should jump straight to the exit block. Therefore any statements emitted as part of the manual exception unwinding (finally block here) need to be part of a new basic block with no exception handler. This bug became visible in debug builds where the Scope destructor compares the scope mark against the engine stack top to ensure correct cleanup order (which was wrong). However that in turn was hidden in debug builds again due to an accidental = instead of == in a Q_ASSERT. With the Q_ASSERT fixed this use-case is covered by ch12/12.14/S12.14_A13_T3 Change-Id: Id74a1b2bb3e063871b89cc05353b601dd60df08e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-133-163/+165
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4ssa_p.h tests/benchmarks/qml/qqmlimage/qqmlimage.pro tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp Change-Id: Iad11ce7fdf0c6d200fdebc16a94081bd8069a87a
| * Move the moth stack slot allocator into qmldevtoolsSimon Hausmann2016-08-122-162/+164
| | | | | | | | | | | | | | This way it's accessible to the QML compiler. Change-Id: I3918a796c698fc75e134b29a61eed2ec028bc851 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Fix crash when cache property can not be foundFilipe Azevedo2016-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | For some reason if a cache property is not found this cause an application crash instead of just reporting an error. Now instead of a crash we get this kind of error visible: qrc:///the_file.qml line 64 column 30: Cannot assign object to property Change-Id: Ic420713df30603f1d164da439cba30a18af8f2bc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-012-21/+119
|\| | | | | | | | | | | | | | | Conflicts: tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp tests/auto/quick/qquickitem/tst_qquickitem.cpp Change-Id: If261f8eea84dfa5944bb55de999d1f70aba528fd
| * Fix string property assignments to 2d vectors and quaternionsSimon Hausmann2016-07-211-0/+24
| | | | | | | | | | | | | | | | | | Just like it's possible to assign "1,2,3" to a QVector3D, the same should be possible for a QVector2D and a QQuaternion. Task-number: QTBUG-54858 Change-Id: I8f394279dcdf5c057876efaa316b4bad51a4c126 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
| * JS: Check for errors before using sub-expression resultsErik Verbruggen2016-07-201-21/+95
| | | | | | | | | | | | | | | | Specifically: don't de-reference a result and assume that it's not-null. Task-number: QTBUG-54687 Change-Id: If07d3250a95a7815ab7a3262b88e0227965ef8e7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-101-2/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of 0e053528 was reverted in the merge, about lastTimestamp. It will be applied later in separate commit. qmltest::shadersource-dynamic-sourceobject::test_endresult() was blacklisted on linux. Conflicts: .qmake.conf tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp tests/auto/qmltest/BLACKLIST tests/auto/qmltest/qmltest.pro Task-number: QTBUG-53590 Task-number: QTBUG-53971 Change-Id: I48af90b49a3c7b29de16f4178a04807f8bc05130
| * Fix crash when using with statement with an expression that throwsSimon Hausmann2016-06-071-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to evaluate the expression for the "with" statement that is supposed to define the new scope _before_ opening up the scope, otherwise - when the evaluation of the expression throws an exception - we'll try to pop the "with" scope we couldn't open in the first place. [ChangeLog][QtQml] Fix crash when using the "with" statement with an expression that throws an exception. Task-number: QTBUG-53794 Change-Id: I7733f5a4c5d844916302b9a91c789a0f6b421e8a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Eradicate Q_FOREACH loops from headersMarc Mutz2016-05-111-1/+1
| | | | | | | | | | | | | | | | They may prevent use of QT_NO_FOREACH in other Qt modules. Change-Id: Iafc04a73579a90492f3ff303978b78b71eec4e55 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Use QStringRef to optimize memory allocationAnton Kudryavtsev2016-04-264-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace substring functions that return QString with corresponding functions that return QStringRef where it's possible. Create QString from QStringRef only where necessary. While touching the code, also port loops to C++11 style. Change-Id: I04c99b24ea6afd3715e3edf9ea00bfab838fd53c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | QML: Convert the PropertyDependencyMap to a QVarLengthArray.Erik Verbruggen2016-04-052-5/+28
| | | | | | | | | | | | | | This is much more efficient than a QHash. Change-Id: I84752eecb6a456402ae222c4d6543bbb67cbcf63 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Replace qQNaN() and friends with qt_qnan().Erik Verbruggen2016-04-052-2/+3
| | | | | | | | | | | | | | | | These constexpr functions can be inlined, and the compiler can be a bit smarter with code generation. Change-Id: I4ea87c794dd8e375749e18d273d01bb848231113 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QML: add type info for the built-in qml context.Erik Verbruggen2016-04-052-2/+16
| | | | | | | | | | | | | | | | | | | | Previously, the type for the target temp would be 'var', which would subsequently be corrected to qobject through a member access. That resulted in typing the defining move again, which is unnecessary. Change-Id: Ife993a667331e69aea64ac2af0f64096a142a583 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | QML: do not re-use the resolver data for members.Erik Verbruggen2016-04-043-47/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On successful lookup, the resolver data was cleared and re-used for the resolved member. The effect is that a second time the resolver is used, it will not be able to do the same lookup, resulting in it returning an unknown type. Because the same expression might need to be resolved multiple times (e.g. when a dependency changes type), this results in the wrong type (var), and then more iterations to propagate this wrong type to all usages. Instead, return a new resolver with its own data for the resolved member. This way, a member access on this result can be resolved correctly by this new resolver. Change-Id: Ia930c08a2e4a2182d800192547fc03cba209c78c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: prevent re-adding currentStmt to the worklist in type inference.Erik Verbruggen2016-03-301-2/+10
| | | | | | | | | | | | | | | | | | Adding the statement that is currently inferred to the worklist can happen when it's a member access where the base is discovered due to static QML lookup. Change-Id: I0e1b7011c4cfd691320d9b8dbcc660a65a558853 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: Fix debug output for the type inference pass.Erik Verbruggen2016-03-301-0/+11
| | | | | | | | | | Change-Id: Ia09b9ed4689b850a5575c72d63ca9677baf631e1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: Allow the compiler to inline more small methods.Erik Verbruggen2016-03-202-334/+323
| | | | | | | | | | Change-Id: Ib2dc03a2535fcbdb10be2dab39593e8dc224fd93 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: Move BitVector to the util header, so it can be re-used.v5.7.0-alpha1Erik Verbruggen2016-03-071-115/+0
| | | | | | | | | | Change-Id: I994ff9277fbbcebf2e45b3146859eb75264b83f4 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | V4: tweak Phi node data destruction.Erik Verbruggen2016-03-062-15/+22
| | | | | | | | | | | | | | | | | | | | | | | | 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-064-44/+36
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | V4: Replace foreach with range based for loops for statements.Erik Verbruggen2016-03-054-28/+29
| | | | | | | | | | | | | | | | Function::basicBlocks() returns a const reference to a QVector, so it can safely be iterated over without qAsConst. Change-Id: Ie9a17edfff7c1fbdc3601121935aef4b41338a35 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: Replace foreach with range based for loops for statements.Erik Verbruggen2016-03-054-20/+20
| | | | | | | | | | | | | | | | BasicBlock::statements() returns a const reference to a QVector, so it can safely be iterated over without qAsConst. Change-Id: If4e47e0e113adbc87253bb3478208a3a38fed9e2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: Replace foreach with range-based for loops on QVarLengthArrays.Erik Verbruggen2016-03-041-23/+23
| | | | | | | | | | | | | | | | QVarLengthArray is not shared, so it will not detach and make a copy of the data when begin() is called. Change-Id: I9114d99fc0cabb17d68993408bea01695754437a Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7J-P Nurmi2016-03-012-8/+17
|\| | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro Change-Id: I3ca8f0422828191b7e19539c25f31f2d048e9f18
| * Properly signal errors when accessing lowercase enum valuesThomas McGuire2016-02-242-8/+17
| | | | | | | | | | | | Task-number: QTBUG-46758 Change-Id: I14e394021c231bda5552c8d1c98f20c903a62f12 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Qml: replace QStringLiteral with QLatin1StringAnton Kudryavtsev2016-02-106-19/+19
| | | | | | | | | | | | | | ... in string comparisons. It's more efficient. Change-Id: I3be5a2be9ba5d55546472eac28f5f639a496bf3b Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Don't deep copy std::vector [-Wclazy-foreach]Sérgio Martins2016-02-081-5/+5
| | | | | | | | | | Change-Id: Ic326786a64c9b6dcd8cee1b45dec45de9cd90414 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-293-10/+16
|\| | | | | | | Change-Id: Iec1b2de53c275996364c4bab0123ccb3e6e9895e
| * Don't check for revisions when assigning to grouped propertiesLars Knoll2016-01-273-10/+16
| | | | | | | | | | | | | | | | | | | | This leads to wrong behavior in some cases, where we reject valid revisions, and there is probably no case, where this could lead to a conflict for the user of the API. Change-Id: I1614332cf4c07c6a227551612331dd69b2ae71f3 Task-number: QTBUG-40043 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-1921-294/+420
| | | | | | | | | | | | | | | | | | | | | | 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-103-15/+33
|\| | | | | | | | | | | | | | | | | | | 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: Replace QVector with (Q)VarLengthArray in BasicBlock.Erik Verbruggen2016-01-062-7/+25
| | | | | | | | | | | | | | | | | | This prevents extra mallocs in nearly all cases, because the number of incoming edges is not that big. The outgoing edge count has a maximum of two. Change-Id: I89195809952ce6087c5af51d717a4c2d8ac6b853 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| * V4: Shrink IR::Temp by removing unnecessary padding.Erik Verbruggen2015-12-231-5/+5
| | | | | | | | | | | | | | On 64bit systems, the size goes from 32 bytes to 24. Change-Id: Ic97f98b8f64fd5452f259e825a6bfd1656484fc5 Reviewed-by: Simon Hausmann <simon.hausmann@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>
* | Initialize all the pointer membersFrank Meerkoetter2015-12-151-0/+1
| | | | | | | | | | | | | | Fixes coverity CID10803. Change-Id: I2a9aa553bdd98c9d4662ccc3fc9d5f3d068de3ec Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Remove dead codeFrank Meerkoetter2015-12-081-1/+1
| | | | | | | | | | | | | | Fixes CID 154260. type is already checked above the return. Change-Id: I8a8702462d74a60163ae415553fe03fb7dc268f4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Replace all occurrences of qSNaN() with qQNaN()Ulf Hermann2015-12-072-2/+2
|/ | | | | | | | | | | 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>
* Don't try to resolve id values or singleton member as propertiesLars Knoll2015-11-271-1/+2
| | | | | | | | | | | | Change 1a1f10806c901bc10483370a932d41af0c9629cd started mapping id values to member expressions in the IR. But these should of course not get resolved against local properties of the object. Change-Id: I56bef738ec60b818d7af86bb1aa6d37b2c01d3fd Task-number: QTBUG-49484 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Volker Krause <volker.krause@kdab.com> Reviewed-by: Anton Kreuzkamp <anton.kreuzkamp@kdab.com>
* QML: Fix typeof context property.Erik Verbruggen2015-10-275-2/+48
| | | | | | | | This was missing from f21e8c641af6b2d10f0d7e7e0fc6a755dab3673c. Task-number: QTBUG-48524 Change-Id: I5cc6a979d965a1ef6b7fbc916a7ca9df868b459a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* V4: do not run optimizer for functions of >300 statements.Erik Verbruggen2015-10-231-2/+5
| | | | | | | | | | | | | | | | | | | The time it takes to run the optimizer depends on both the number of IR statements, and the number of basic-blocks. Many functions that have more than 300 statements are either the %entry point, or methods that set a large number of member variables. Both are not performance sensitive, so skipping them won't hurt execution speed. Actually, not optimizing them does improve startup speed. Basic blocks need to contain at least one statement (the terminator), so a large number basic blocks always results in at least an equal number of IR statements. Therefore they do not need to be taken into account. (An example of an excessive amount of basic blocks is a switch with 9000 cases: this will generate ~27000 basic blocks.) Change-Id: Iabf809d8ad293f4f27ece06d136aa281991a1b0f Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QML: Sanitize reading environment variables.Friedemann Kleint2015-10-222-5/+5
| | | | | | | | | | | Where possible, use qEnvironmentVariableIsSet()/ qEnvironmentVariableIsEmpty() instead of checking on the return value of qgetenv(). Where the value is required, add a check using one of qEnvironmentVariableIsSet()/Empty(). Change-Id: Ia8b7534e6f5165bd8a6b4e63ccc139c42dd03056 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Remove line numbers for statements without side-effects.Erik Verbruggen2015-10-151-46/+95
| | | | | | | | | | | | | When debug mode is not enabled, line numbers are only used in order to generate usable stack traces. Therefore statements that cannot fail/throw do not need line numbers associated with them. Of course, when debug mode is enabled, this is not applicable. The effect is that the generated code for such statements shrinks by 2 loads and 1 store. Change-Id: I4ec425dd20b56043e8ca0e4c68afc683eb9b50e7 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Initialize member variable.Erik Verbruggen2015-10-131-0/+1
| | | | | | | It's never used (because it's qSwap()ed), but still. Change-Id: I64cbb39dcd9f9368c73b5b9bf98dc1f3a52a13ef Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Make QML composite types inherit attached propertiesJ-P Nurmi2015-10-093-4/+40
| | | | | | | | Change-Id: Ic06af4805da987dd08e361f2668e7a1788d3eefe Task-number: QTBUG-43581 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add missing "We mean it" comments to private headers.Friedemann Kleint2015-10-0610-0/+110
| | | | | | Task-number: QTBUG-48594 Change-Id: Ifc207938de7f0c8995fc712df92665f222612647 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Minor cleanupLars Knoll2015-09-251-1/+1
| | | | | Change-Id: I478967dacc6f0e7b8a6df706bb878f46306871ce Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make QML composite types inherit enumsJ-P Nurmi2015-09-213-5/+8
| | | | | | | | | | | | | | | | | | | | | | | Problem: in Qt Quick Controls 2, enums declared in the abstract C++ base types were not accessible with the concrete QML type name, but had to be referenced using the base type name: Slider { snapMode: AbstractSlider.SnapOnRelease } Solution: this change resolves the C++ base type and creates the missing link between the composite type and its base type's meta- object. This allows referencing enums using the concrete/composite QML type name: Slider { snapMode: Slider.SnapOnRelease } Change-Id: Icefdec91b012b12728367fd54b4d16796233ee12 Task-number: QTBUG-43582 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>