aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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>
* 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>
* 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>
* Remove some dead codeSimon Hausmann2015-09-212-17/+4
| | | | | | | Also get rid of the unnecessary QQmlCustomCompilerBackend interface. Change-Id: I6cfdd88ef49d3d314d07aa069da481d304e7a285 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix incorrect signal emission for QML declared propertiesSimon Hausmann2015-08-241-7/+4
| | | | | | | | | After commit 6cd0001054faa9c7c20dcd5e9c7512367b2c1f5f we also need to remove the special var handling for signal indicies assigned to QML declared properties, in order to emit the right signal when the property changes. Change-Id: Ibdaba0435d8878e1e16dabe20559c484b217d82a Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix use of function expressions with signal handlersSimon Hausmann2015-08-241-8/+21
| | | | | | | | | | | | | | | | | | | | Writing onClicked: function(mouseEvent) { ... } would get silently "accepted" by the engine, but it wouldn't do anything. We basically wrapped it in a new function, so that it became onClicked: function(mouse){ function(mouseEvent() {} } which is a noop. With older versions this used to produce a syntax error. However the better fix is to simply support this kind of assignment for more expressive signal handlers, because now the names of the signal parameters can be explicitly named (with names of your choice). Change-Id: I96369f8805fab97509784222f614ee17cf681aba Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Get rid of special handling of var propertiesLars Knoll2015-08-181-27/+6
| | | | | | | | | | | | These can be handled in a simple way now by using a special propertyType value indicating that we have a var property. Also remove the additional write calls in the different readProperty implementations. If the stored data doesn't match, we can simply return the default value directly. Change-Id: I3823a971df24bd78f0acdc4c0042776277b3c55f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-182-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/debugger/qv4debugservice.cpp src/qml/jsruntime/qv4value_inl_p.h src/qml/jsruntime/qv4value_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/qml/qqmlnotifier_p.h src/qml/qml/qqmlproperty.cpp src/quick/items/qquickflickable.cpp src/quick/items/qquicktextedit.cpp tests/auto/quick/qquickwindow/BLACKLIST The extra changes in qqmlbinding.cpp are ported from changes to qqmlproperty.cpp that occurred in parallel with writeBinding() being moved to qqmlbinding.cpp. Change-Id: I16d1920abf448c29a01822256f52153651a56356
| * Work around ICC 16 beta compiler bug in SFINAE expansionThiago Macieira2015-07-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling std::vector<int>'s constructor (or assign()) with two ints can select one of two different overloads: the (size_t, value_type) overload which fills with n copies of the value or (iterator, iterator) overload, which would copy a range. libstdc++ had some workarounds for this scenario, by using an indirect dispatch to determine whether it was a pair of integrals or not. But ever since the resolution of DR1234 (https://gcc.gnu.org/bugzilla/ show_bug.cgi?id=43813) with C++11's more expressive SFINAE, the dispatching is done actually by the outer template by adding an extra template parameter that requires std::iterator_traite<T> to expand. That's where ICC fails: it expands std::iterator_traits<int> and that fails. It should have ignored the expansion and discarded that overload. The workaround is simple: pass different types as the parameters, which means the compiler cannot select the overload containing a pair of iterators. /usr/include/c++/5/bits/stl_iterator_base_types.h(154): error: name followed by "::" must be a class or namespace name typedef typename _Iterator::iterator_category iterator_category; ^ detected during: instantiation of class "std::__iterator_traits<_Iterator, void> [with _Iterator=int]" at line 163 instantiation of class "std::iterator_traits<_Iterator> [with _Iterator=int]" at line 876 of "compiler/qv4ssa.cpp" Change-Id: I52dd43c12685407bb9a6ffff13f5f783820213a5 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
| * fix readonly metaproperties (revealed by compiler warning)Shawn Rutledge2015-07-211-2/+2
| | | | | | | | | | | | | | Found thanks to -Wparentheses + gcc 5.1 Change-Id: Iad784a26d268b85f7c67623fd63f0b097a9f29f9 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | qml: Avoid heap allocations due to QString::fromLatin1()Sérgio Martins2015-08-131-1/+1
| | | | | | | | | | | | | | By using QStringLiteral when the argument is a literal. Change-Id: Ib25042d10f3d9d0aca81af74cde0107aba4f9432 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Access the id objects through a specialized runtime methodLars Knoll2015-08-1211-42/+44
| | | | | | | | | | | | | | | | 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-1010-36/+53
| | | | | | | | | | | | | | 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-1010-32/+96
| | | | | | | | | | | | | | | | | | 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-1010-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Remove unused QQmlPoolFrank Meerkoetter2015-07-311-1/+0
| | | | | | | | | | | | | | This code is no longer in use. Change-Id: If0cb009ac6622ed36cba5886d6685d3f242c3c87 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Use by-ref in foreach when T is large or non-trivialSérgio Martins2015-07-181-1/+1
| | | | | | | | | | Change-Id: I79271fdc3fa064e362dfaa64ff11d8a4c6b7e8c3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-06-302-77/+169
|\| | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/qml/qqmlengine.cpp src/quick/items/qquickitemsmodule.cpp tools/qml/main.cpp Change-Id: Ida8daf6b4d7e675385f2f5514c446e52dedaf136
| * Merge remote-tracking branch 'origin/5.5.0' into 5.5Liang Qi2015-06-261-74/+166
| |\ | | | | | | | | | Change-Id: I4020a1b3c59dea18faf7cbcbb78b90fcfc3680f0
| | * Add a version of BitVector that uses QBitArray.Erik Verbruggen2015-06-081-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some C++ STL libraries are unable to ship a bug-free std::vector<bool>, and/or a bug-free specialization of std::find for std::vector<bool>. So, for those platforms there now is a slow version of BitVector, which relies on QBitArray, which we can fix if we find bugs. Change-Id: I5ddfb18cabe82049a7ede6083fe6ba142bca068b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| | * Wrap std::vector<bool> in our own class.Erik Verbruggen2015-06-081-74/+112
| | | | | | | | | | | | | | | | | | | | | | | | So we can replace the implementation when we encounter a broken version of std::vector<bool> or a broken specialization of std::find for it. Change-Id: I7d7c0af585388ddedf5167cd9863c52ab638442d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * | Improve qml error message "invalid alias location"Aleix Pol2015-06-101-3/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Specify we're talking about the target itself rather than talking location, which I always doubt about whether it's the location within the file. Also specify the offending property, so we get a clue about what to look into. [ChangeLog][QtQml] Improve "invalid alias location" error message by specifying what's the offending property and by calling it "invalid alias target location" Change-Id: I7a9390089ee8986872c119df44d8036bf267ab99 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Add 28 QList::reserve() callsSérgio Martins2015-06-082-0/+2
| | | | | | | | | | Change-Id: Id4820ac458f48b10f2bf457144767efdef9e2c07 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Remove more unused code from the QQmlEnginePrivateHolger Hans Peter Freyther2015-06-081-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | overloadError has always been false and the if (overloadError) was dead code. The code has been commented out for a long time and I started to extend the #ifdef. The QQmlError is only used inside the commented out code so I have removed the error param. This is fixing Coverity CID 10612. Change-Id: I48f36ede6ba615a34b15caefb0eea5d7e898f120 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Some cleanups to QQmlRefCountLars Knoll2015-06-051-1/+1
| | | | | | | | | | | | | | | | | | Rename QQmlRefPointer::take to adopt, as it's a better fit with the semantics. Get rid of the assignment operator from a raw pointer and add a Adopt argument to the constructor. Change-Id: Ia1ebe42b24570f32543e783f91eb3206602772a2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-06-044-3/+5
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine_p.h src/quick/items/qquickitemsmodule.cpp src/quick/items/qquicktext.cpp src/quick/util/qquickpixmapcache.cpp tests/auto/quick/qquickwindow/tst_qquickwindow.cpp Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
| * Avoid uninitialized bytes in QV4::CompiledDataSimon Hausmann2015-05-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | When populating the QV4::CompiledData for a JS unit, we memset the malloc'ed data to zero. We should do the same when creating a unit for QML files. We do write all the fields that we use, but due to padding we may end up with bytes that are neither used nor written but still uninitialized. Consequently they should be zero'ed, otherwise serialization will write garbage. Change-Id: I0b093e4dde6789d7236247507221f4f3476ba89d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Merge remote-tracking branch 'origin/5.4' into 5.5Simon Hausmann2015-05-041-1/+1
| |\ | | | | | | | | | Change-Id: Ie8ea118ed0a1a9a1c3d81e1e34d85c03c695c9a4
| | * Fix passing of locals as function arguments with side-effectsSimon Hausmann2015-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 75c22465cf8fe262edfe6178bb9ca19661fb710e regressed in allowing locals and arguments to be passed directly as further arguments to function calls, but that's incorrect when considering var i = 2; testFunction(i, i += 2) where it is instrumental to place the first argument into a temp (making a copy) instead of passing it directly. Change-Id: Iffcf6c6eda92a8fb665982cda1db0b96359cd092 Task-number: QTBUG-45879 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | Fix uninitialized variables/dataSimon Hausmann2015-04-293-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initialize the indexOfRootObject member * When creating the QV4::CompiledData::String objects, don't include the one ushort _beyond_ the QString, which is random data. Change-Id: I8fe8a465e2713a385504f217b367a62b70ee5fdf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | Fix build with QT_STRICT_ITERATORSSérgio Martins2015-05-153-5/+5
| | | | | | | | | | | | | | | Change-Id: I3df6ac107cb46b3a1b15b80f39d7c6015adcd9ac Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-04-281-1/+1
|\| | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktext/tst_qquicktext.cpp Change-Id: I075e742da8396a268d97d3ab34bcd9e0c0cf001f
| * | Fix regression with nested objects served by custom parsersSimon Hausmann2015-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following piece of code used to work and broke with Qt 5.3: ListModel { property var conn: Connection { ... } } When validating the properties of the ListModel we would not validate the Connection sub-object here, which meant the custom parser for the connection object was never called. We need to extend the logic for sub-object validation to recursive into sub-objects when this is either an attached property (Component.onComplete on a list model for example) or the object is assigned to an _existing_ property, i.e. a property not deal with by the custom parser. In this case that's a custom declared property. Change-Id: Ic99f746f08771460cc6424a9e8a839c78a7eafd9 Task-number: QTBUG-45735 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | Get rid of qv4value_inl_p.h and replace it by qv4typedvalue_p.hLars Knoll2015-04-245-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | This is a cleaner separation and further reduces include dependencies in the definitions of our basic data structured. Change-Id: I18aa86cdea0c0dfbc16075d4d617af97e638811e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | More cleanups in qv4value_p.hLars Knoll2015-04-241-0/+1
|/ / | | | | | | | | Change-Id: Ie48dc8f95daa4738e690902b5d33010afa7b974f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Eliminate remaining property cache string lookups upon object instantiationSimon Hausmann2015-04-211-0/+5
| | | | | | | | | | | | | | | | Even for the id property binding we can use the property data cache and therefore avoid string hashing. Change-Id: Id9a4ca3159cdfe5ba93060f1bc8626e70140daa1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Speed up property binding initialization on object creationSimon Hausmann2015-04-214-25/+55
| | | | | | | | | | | | | | | | | | | | Avoid repeated string hashing and lookups in the property cache in order to retrieve the property details when initializing literal and script bindings. Instead we now cache the property data at type validation time, similar to how the property data was encoded in the VME instructions in the old engine. Change-Id: I3957c7c4c3e26dfa97c4880b23940a3755ee90e4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Cleanup: Fix const'ness of the property binding validator codeSimon Hausmann2015-04-142-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | The property validator is supposed to validate the proposed property bindings and abort type compilation if necessary. As such it is a read-only pass through the data structures and therefore we make it const. However it does have a side-effect of collecting some state, which however is "write-only" and therefore marked as mutable. Those variables are written to, but not read during this pass. Change-Id: I6a3655fedbd6691b7498cf82ca1c8e21dd635bd3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>