aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Revert "QML: When available, use QQmlAccessors to read properties."Simon Hausmann2016-07-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f6fee09942de7901a708c4e16db0c7c82550e8c5. The accessor pointers were embedded in the generated machine/byte code, which makes it non-relocatable. As discussed, for the moment the ability to have relocatable code is prioritized. But the goal is to re-enable accessor accelerated property access through lookups. Change-Id: I18ec9ce31901c1fae3e58ac0c41bc87791e8c380 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix endian support in compiled data structuresSimon Hausmann2016-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to make the compiled data structures persistent on disk. In order to make it possible to create these data structures on a "host" system that may have a different endianness than the target system, we now make all the word sized fields little-endian. The template wrappers from QJson provide zero-overhead access for little-endian machines (the vast majority) while maintaining a large degree of source compatibility. Change-Id: I3d30da1fcf3bffb98dbe9337d3a35482fb7b57c8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QML: Use write accessors when setting constant binding values.Erik Verbruggen2016-07-111-10/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bindings with constant values like: Item { x: 10 } Setting these values is now also done through write accessors. On x86_64 QQmlObjectCreator::setPropertyBinding goes from ~7600 instructions to ~3600 (according to valgrind). Change-Id: I6a9ecfcd21c7b115828df3f235c292675ea9efc5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Specialize bindings based on target property type.Erik Verbruggen2016-06-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we can determine the type of a target property during type compilation, we can skip a whole bunch of code that deals with converting the result of a binding to the correct (target) type. This removes 65 instructions on x86 for such typed bindings. Change-Id: Id2c7c57b9ae6dfbeb921121beae9630604ca1d17 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Clean up property cache array handlingSimon Hausmann2016-06-161-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QQmlPropertyCacheVector in the CompilationUnit encapsulates the property caches for the objects declared in the QML tree as well as the bits indicating whether a VME meta-object is needed. The ref-counting for the caches in that vector was done "manually" and thus error prone. This patch replaces the vector with a wrapper container that has explicit move semantics and takes care of the addref() and release() calls upon insertion, replacement and destruction. Change-Id: If805fe016f1a1c70e56f8a90909ab87b653ea026 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Minor refcounting cleaningSimon Hausmann2016-06-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Replace manual reference counting with automated counting, which is less error prone. Change-Id: I6a133bf9610f0d789f745b3cc1f0016e670a9525 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Remove QQmlCompiledData in favor of QV4::CompiledData::CompilationUnitSimon Hausmann2016-06-011-45/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | QQmlCompiledData used to contain the binary data for instantiating QML types in the QML VME. Nowadays the QML type compiler as well as the JavaScript compiler create a QV4::CompiledData::CompilationUnit. Change-Id: I155f62a5ecfb55a3fe230520231b6d8fd5b28ac9 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | | Remove inheritance of QQmlCompiledData from QQmlCleanUpSimon Hausmann2016-06-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The clear() re-implementation from QQmlCleanUp was empty, so this added no functionality. Commit 19c6f620dd35916466c36234231d798f79732ab0 removed the last usage of it. Change-Id: I499a6daeb1f74cc8bad1cacc5c367fde1e6eee75 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Moved resolved type references over to QV4::CompiledData::CompilationUnitSimon Hausmann2016-05-311-4/+4
| | | | | | | | | | | | | | | Change-Id: I99bb37bf4d4aa4aedd8e02a0fb4afb4a908573a6 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Move dependent scripts to QV4::CompiledData::CompilationUnitSimon Hausmann2016-05-311-4/+4
| | | | | | | | | | | | | | | Change-Id: I85e8267ce4cd26ae83fe567357e1368658fdb43d Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Moved object/bindings/customparser counters to CompilationUnitSimon Hausmann2016-05-311-6/+6
| | | | | | | | | | | | | | | | | | | | | These allow pre-allocating some arrays when instantiating types. Change-Id: I2ca4ba4a69429918f03a5ba4c501c763e7ffa8dc Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Moved the import cache from QQmlCompiledData to CompilationUnitSimon Hausmann2016-05-311-2/+2
| | | | | | | | | | | | | | | Change-Id: I77892919678cb01ba1e697a44122760679a72045 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Move property caches from QQmlCompiledData to QV4::CompiledData::CompilationUnitSimon Hausmann2016-05-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This makes particularly sense as the binding property data per object that allows us to avoid a by-name property lookup when instantiating types is also stored there. Change-Id: I4d9275c1d8fde252df83eb11a9dfea71e5e9583a Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Removed the dependency to QQmlCompiledData from QQmlCustomParserSimon Hausmann2016-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | We only need fields from the compilation unit, so let's pass that instead. This is private, internal QQmlEngine API only used by QtQml and QtQuick. Change-Id: I1a659654d95585b736384b5b519d05a4df3f9ead Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Remove the custom parser binding bits hash table from QQmlCompiledDataSimon Hausmann2016-05-301-23/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | Similary to the other hash tables we can store the actual information about whether a binding is covered by a custom parser or not straight in the CompiledData::Binding. Change-Id: Iab9044af57338cec935d3ef38764d7dc1aa507e8 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Centralize deferred binding bit information in CompiledData::BindingSimon Hausmann2016-05-301-24/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ultimately the decision which bindings to initialize in a deferred way depends on the data in the meta-object (deferred property names entry). The hash in QQmlCompiledData is just caching this information. We are better off storing this single bit right in the binding itself instead of in a parallel data structure. Change-Id: Ib66d3550210af1f882b98b0ba9089391813d69ad Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | QmlProfiler: Send RangeData and RangeLocation only once per typeUlf Hermann2016-05-271-2/+3
| | | | | | | | | | | | | | | | | | | | | This saves time when serializing the data to be sent. Change-Id: Ic8c534d55445934a64dd253273099194b27d98af Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Optimize named object handlingSimon Hausmann2016-05-261-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By storing the object indices of named objects in the CompiledData::Object of a component, we can achieve two things: (1) We can eliminate the hash of vectors in QQmlCompiledData for the object-to-id mapping (2) We can store the mapping from object name to integer object id in the CompilationUnit and share it across different QQmlContextData instances (as long as it is not modified). Also added a new test that verifies the functionality of a .qml file starting with Component{} itself with object names, something that was previously only implicitly tested through some of the examples (corkboards.qml for example). Change-Id: I28c70217222dc0e5252bf5247b7e3fc4def47446 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Simplify object to id-in-context mappingSimon Hausmann2016-05-261-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | By storing the calculated integer id for an id-named object in CompiledData::Object we can simplify the code and replace a hash table with a plain vector. Change-Id: I4a84cdd00e98766d603d152e5a6574b232771a02 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Add a flag to CompiledData::Object record component boundariesSimon Hausmann2016-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This allows simplifying some code and reducing the usage of the objectIndexToId hash maps. Change-Id: I1f08d4b224c4f9fa498d90471fa545ae4e4f2af4 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Get rid of QQmlVMEMetaDataSimon Hausmann2016-05-241-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is unused now and we can remove it as well as its QByteArray based storage. The non-emptyness of the meta-data QByteArray was also used to indicate whether it is necessary to create a VME meta-object when instantiating an object. This bit is now folded into the flag of the QFlagPointer storing the property caches. Change-Id: I3c3604c61ff16a4e76912e68b1c19afdb0f2bd9d Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-241-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine_p.h src/qml/jsruntime/qv4runtime_p.h src/qml/qml/qqmldelayedcallqueue.cpp src/qml/qml/qqmlvaluetypewrapper.cpp src/qml/qml/qqmlvmemetaobject.cpp src/qml/qml/v8/qv8engine_p.h tests/auto/quick/qquicktext/tst_qquicktext.cpp Change-Id: I3f0608c7beb88088cbbef4d0db59920f56deaea9
| * | V4: allow inlining of ExecutionEngine::{qml,js}Engine()Erik Verbruggen2016-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | All other changes are just to be able to include qv8engine_p.h in qv4engine_p.h Change-Id: I71ba2ec42cdc20d5c7d97a74b99b4d1ada1a5ed8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Simplify VME meta object meta-dataSimon Hausmann2016-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For each type of VME meta object we store an array of integers holding the meta-type ids of the QML declared properties. We can replace that array with access to the QV4::CompiledData::Property entry for each property, where the type is also accessible. This is a fairly straight-forward change, except for the bit in QV4::CompilationUnit where we delay the release of the CompiledData::Unit and friends until the destructor instead of releasing it at unlink time. That should be a safe change and is necessary as there are a few tests around where the VME meta object still needs access to this meta-data at a very late stage in the life-cycle right before the deferred deletion is run. Change-Id: I431de15d12766df837c0e0251192df16a5a76868 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Optimize property/alias data structuresSimon Hausmann2016-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used to store property declarations and alias declarations in the same properties array in CompiledData::Object. However at run-time the QQmlVMEMetaObject implements them separately, using separate data structures (in the meta-data) and (most importantly) using separate property id segments: First the properties, then the aliases. By reflecting the same separation in CompiledData::Object with property arrays and alias arrays, we can pave the way for getting rid of the meta-data in QQmlVMEMetaObject. Change-Id: Ia84813fe3da6f3fdbd4d2b16136a8bf11fa175a6 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | CleanupSimon Hausmann2016-05-191-4/+4
|/ / | | | | | | | | | | | | Remove two dummy forwarding functions Change-Id: I053f9aecc761772c932550a0ddbea390621049c1 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QmlProfiler: Reduce memory usage for file names and URLsUlf Hermann2016-05-021-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the various file names are actually not kept as QStrings in the respective objects being profiled, our saving them as QStrings in each and every profiling event is not implicitly shared and causes a huge memory overhead. Avoid that by saving each location only once, indexed by a disguised pointer to the object it refers to. Normally, objects could disappear during the profiling session, and new objects could be allocated in their place, which would mess up our indexing system. We prevent that by referencing the objects when we index them, thus preventing them from getting auto-destructed. Mind that those are not JavaScript objects but rather functions, bindings, components and the like. So, this will only cause a memory leak if you're compiling and dropping QML components over and over. Task-number: QTBUG-52937 Change-Id: Ia4dfb09a71a5c9a2d6ce25c3811bbe2a1036c1c1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-071-0/+2
|\| | | | | | | Change-Id: Icfa1d61fcc286c3418d4a625de11d2191336fa60
| * Let QQmlObjectCreator::setPropertyBinding return false for invalid typesFrederik Gladhorn2016-03-041-0/+2
| | | | | | | | | | | | | | | | | | This in theory happen for attached property types. Fixes Coverity CID 154272. Change-Id: I113797dea8949877cbeac82bae57655170878d4c 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 Qi2015-12-071-2/+15
|\| | | | | | | Change-Id: Ica75a71062d0613e415f2433c5c22c2e251b37cd
| * Make property interceptors work on alias properties againLars Knoll2015-11-261-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a regression introduced by change 01c0c0963794f4dd8c3601e8340cc3dc4dec41bd, where interceptors wouldn't work correctly on alias properties. This required some refactoring and splitting out the interceptor handling from the VMEMO into it's own class, as we are now installing bindings directly on the target property of an alias and not on the alias anymore. We now resolve the target property inside the QML object creator and install a interceptor metaobject on the target if required where we can then register the interceptor. Change-Id: I3ebc8f492ce5dcab7acf901711b47336d5182ffa Task-number: QTBUG-49072 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-141-1/+6
|\| | | | | | | Change-Id: I11ea57222ba5aa683b7bfd7735fbc1d2cf86e875
| * Make QML composite types inherit attached propertiesJ-P Nurmi2015-10-091-1/+6
| | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-09-251-8/+7
|\| | | | | | | | | | | | | Conflicts: src/qml/debugger/qqmldebug.cpp Change-Id: I93de5a81b18cdece475870cf7cfba1b9baef2304
| * Fix function signatureLars Knoll2015-09-221-1/+2
| | | | | | | | | | | | | | Returning a PersistentValue doesn't make much sense. Change-Id: I6044a12e48aa835ef78008e070bacda5125a7ca7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Make QML composite types inherit enumsJ-P Nurmi2015-09-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Further cleanupsLars Knoll2015-09-151-5/+3
| | | | | | | | | | | | | | Reduce usage of ScopedContext. Change-Id: I84a6a7478065de3398fd0b21596ca1308e78ceb3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Don't push new QML contexts onto the context stackLars Knoll2015-09-081-1/+0
| | | | | | | | | | | | | | | | | | | | When creating new QML contexts, these are not used directly, but rather as scopes for other functions. Change the behavior, so that newQmlContext doesn't push the new context onto the context stack. Change-Id: I8254da3f660c4791941835c925b9892274ea51b0 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Refactor the way we declare signal parameter namesLars Knoll2015-09-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Qml Connection objects where using an awkward way to make the parameter names of signals available to the signal handler. This now uses an approach that is equivalent to what we do with other functions. The main difference is that we can't know the parameter names at type compile time, so we have to rewrite the internal class of the QV4::Function at connect time. Change-Id: I5e538ac840b5a46ccb14ff71684404d947948324 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Decode signal signatures as UTF-8 rather than Latin1Ulf Hermann2015-09-151-3/+4
|/ | | | | | | | QML source code is supposed to be in UTF-8, including signal specifications. Change-Id: Ic2d0aef579addabf39b3910393a77989130bc11a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Create less BindingWrappersLars Knoll2015-08-251-11/+12
| | | | | | | | Instead create QmlContext's directly as they are the only thing used from the binding wrapper. Change-Id: If3a987134dee9e85b6a76ed74aacd76b19279117 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Add some typesafetyLars Knoll2015-06-181-1/+1
| | | | | | | | Even though the goal is to get rid of the contextwrapper, this helps in the meantime. Change-Id: I234ef39f74fb0eee78710884de6a1c90763bce74 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Remove a global read-write QQmlBinding::Invalid variableLars Knoll2015-06-101-1/+1
| | | | | Change-Id: I3ca148ae021ffc349b943231cc749828b0b7816c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make bindings refcountedLars Knoll2015-06-101-13/+8
| | | | | | | | | | | Refcounting our bindings greatly simplifies our memory management of the objects and ensures we safely clean them all up. In addition, it allows us to remove the m_mePtr and weak reference handling from QQmlAbstractBinding as we can safely handle this through the same mechanism. Change-Id: If23ebc8be276096146952b0008b62018f5d57faf Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Replace bindingType() method by a virtual getterLars Knoll2015-06-051-1/+1
| | | | | | | | | This removes the need to save some bits in the abstract binding object, and should make it easier to move QQmlAbstractBinding over to be reference counted. Change-Id: Ib46cb3217f3dc462f1dcaa6153d90ea2f7401f48 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix build with QT_STRICT_ITERATORSSérgio Martins2015-05-151-2/+2
| | | | | Change-Id: I3df6ac107cb46b3a1b15b80f39d7c6015adcd9ac Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Smaller cleanupsLars Knoll2015-04-271-4/+2
| | | | | Change-Id: Ib8a222c26316ad31699d3becaa945ac4035e437b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Simplify binding setup code furtherLars Knoll2015-04-271-17/+3
| | | | | | | | Reduce the number of setBinding/removeBinding overloads and simplify their internal handling. Change-Id: I87174a3b2dc0ecb8380e8fc28f8969fbf475c728 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>