aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-04-111-1/+3
|\ | | | | | | Change-Id: Ib3d81ad33a6ba28d891da91271a64d5fcc4874e6
| * Avoid access to declarativeData when isDeletingChildren is setBernhard Übelacker2017-04-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QObject's members declarativeData and currentChildBeingDeleted share the same memory because they are inside a union. This leads to a problem when destructing mixed Widgets and QML objects. Then in QObjectPrivate::deleteChildren the member currentChildBeingDeleted is set. But unfortunatley QObjectWrapper::destroyObject retrieves the same pointer via declarativeData. This patch should avoid this by disallowing retrieval of declarativeData when isDeletingChildren is set (or at least adds a Q_ASSERT). Task-number: QTBUG-57714 Change-Id: I9ee02f79be3e8226c30076c24859b49b8dcfaecf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | qml: Rename importCache vars to typeNameCacheRobin Burchell2017-01-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This better reflects what it is, and especially removes some confusion in QQmlTypeCompiler which has a m_importCache member (of type QQmlImports), which lead to some strange-to-read things like this: m_importCache.populateCache(*importCache); Which is now: m_importCache.populateCache(*typeNameCache); Change-Id: I7590dd1ba71ca77a8d964250a0d517156b723f8e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Allow canceling incubationJ-P Nurmi2017-01-241-0/+15
|/ | | | | | | | | | | | Qt Quick Controls must avoid destroying any object that belongs to a tree of objects being incubated. The problem is that QQC have no control over the incubation process. This patch adds private API that allows QQC to cancel incubation of a specific item that QQC would like to destroy. Change-Id: Id9f9004736e2b53fe46cdb6bb3055b7457def94d Task-number: QTBUG-50992 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML tooling: Make sure we signal object creation also from QQmlIncubatorUlf Hermann2017-01-111-0/+13
| | | | | | | | | | | | We have to call the QQmlEngineDebugService back from QQmlObjectCreator rather than QQmlComponent, as there are more ways to create an object. We also add the new instance to the global instance list if only the V4 debug service is active, as both QQmlEngineDebugService and QV4DebugService use it. Change-Id: I5dcc71b2e91049bc19ec70d7b87959a61c9b6b75 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Pass a QV4::Function to the QQmlBoundSignalExpression constructorLars Knoll2016-12-091-2/+1
| | | | | | | And avoid the creation of a temporary FunctionObject Change-Id: Idaacfd978ac4ee26960bdf185272cc44d6618a71 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Avoid the creation of a FunctionObject for most bindingsLars Knoll2016-12-091-3/+3
| | | | | Change-Id: Ia62d380945250015009d9c2b6ed65f6d830277ef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Minor cleanupLars Knoll2016-12-091-5/+6
| | | | | Change-Id: I091f2de77f84fb298404dc8784defcf3a812d56a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8.0' into 5.8Lars Knoll2016-12-071-1/+1
|\ | | | | | | Change-Id: I19804e880005c66880eeabfaebf0b1093de80e6b
| * Fix caching of the current qmlContext in QQmlObjectCreatorLars Knoll2016-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | A context is not a QV4::Object, just a QV4::Managed. Testing for Object here lead to us creating a new QV4::QmlContext every time this method got called instead of sharing it. Reduces memory consumption and improves the performance of some of the creation benchmarks in qmlbench by ~20%. Change-Id: I20c0ad52133aa0cb40c9d2551fd635bef8b7d90a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Start cleaning up the QmlContextWrapperLars Knoll2016-12-041-2/+1
| | | | | | | | | | | | | | | | | | The class should get merged with the QV4::QmlContext class. Simplify the cleanup by moving both classes into a common file. Change-Id: I0074da79701d5f41eb51681b70fcde85bfd45fc1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Cleanup Value::isObject/objectValue usagesLars Knoll2016-11-291-1/+1
| | | | | | | | | | | | | | | | Try to avoid calling both as objectValue() already checks isObject(). Change-Id: I1d770d4d9dabed4ea4cc3e322b8fdc5a64f5bd2b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Get rid of most QT_NO_FOO usagesLars Knoll2016-11-291-2/+2
|/ | | | | | | | Instead use QT_CONFIG(foo). This change actually detected a few mis-spelled macros and invalid usages. Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Obliterate QQmlAccessorsErik Verbruggen2016-08-301-1/+0
| | | | | Change-Id: I70a080feb401cf23aef1bde44a19a11e27642f30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-171-5/+5
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4ssa_p.h src/qml/qml/qqmlobjectcreator.cpp Change-Id: I8bb7fe773d657f908f20ee5e72c2b9bd643f6260
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-5/+5
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * QQmlObjectCreator: prefer initializer syntax over assignmentEdward Welbourne2016-08-111-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | Greater uniformity; also opens the door to potential const-ing, should this ever be worht considering. Change-Id: I91b44472cb7d84f85b3033f14a763beeea837459 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | * QQmlObjectCreator: initialize _bindingTargetEdward Welbourne2016-08-111-0/+1
| | | | | | | | | | | | | | | | | | | | | Coverity (CID 163180) noticed _bindingTarget wasn't initialized. Change-Id: Ia727d00a161e514c437a72084b6ef01a7ebf4abc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Make all fields in QQmlPropertyRawData privateErik Verbruggen2016-08-101-44/+44
| | | | | | | | | | | | | | | | | | | | | | | | And add accessors. This makes it easier later on to change the storage of the fields. Change-Id: I21163668ac83a7d52f398981baf3c27ef161c177 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Split off value type information from property dataErik Verbruggen2016-08-091-20/+32
| | | | | | | | | | | | | | | Change-Id: I2ae2fb0f18af9b866cc9482fd4f42d9d4269f8cb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Introduce QQmlPropertyIndexErik Verbruggen2016-08-041-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | This helps in making it clear when an index is a plain old number and when it consists of an encoded value type index. Change-Id: Ic50d95caf244ed0ee2d62bdba53910a371cfee04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Reduce the amount of malloc calls when instantiating objectsSimon Hausmann2016-08-031-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For regular Qt types we currently perform three mallocs, one for the public class, one for the private and one for the declarative data. The latter we can fold quite easily into the malloc of the public class. The plan for the private is a bigger separate one ;-) Change-Id: I69973652ba70a4a238b491dff3d47a9db9a226f1 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-08-021-0/+24
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickshadereffect.cpp 5.7 had a bug-fix in code dev has replaced wholesale. src/quick/items/qquickwindow.cpp src/quick/items/qquickwindow_p.h One side changed a method's signature; the other side renamed a method declared adjacent to it and changed some code using it, moving some from the public class to its private partner. tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp One side added a blank line before a comment the other re-wrote. Kept the re-write, killed the stray blank. .qmake.conf Ignore 5.7's change to MODULE_VERSION. src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qqmlpropertyvalidator.cpp 5.7 changed code in the former that dev moved to the latter. Reflect 5.7's changes there, adapted to dev's form. src/qml/qml/qqmlobjectcreator.cpp One side added new QVariant types; the other changed how it handled each type of QVariant (without git seeing any conflict); adapted the new stanzas to work the same as the transformed ones. tests/manual/v4/test262 dev had a broken sha1 for it; so used 5.7's 9741ac4655808ac46c127e3d1d8ba3d27ada618e Change-Id: I1fbe2255b97d6ef405cdd1d0cea7fab8dc351d6f
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-011-0/+26
| |\| | | | | | | | | | | | | | | | | | | | | | 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/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Cleanup: Move ResolvedTypeReference(Map) one scope upSimon Hausmann2016-08-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The class is a candidate for further functionality, it doesn't have to be nested in CompilationUnit. Change-Id: I100553160f5ae34f66b9f8ff5df9f636da2ffb67 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Remove some unused members on -no-qml-debugUlf Hermann2016-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | It's debatable if the uglification is worth the overhead of a few pointers. Change-Id: I63b55b2043b8752a94d4b862c3892915135a72b7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Replace debugger and profiler with stubs on -no-qml-debugUlf Hermann2016-07-281-3/+6
| | | | | | | | | | | | | | | Change-Id: I0f029d92366b3b508bf024c67b877a14bae27cd6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Unify property reads/writes and use accessorsErik Verbruggen2016-07-251-96/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | Pass property reads/writes through utility functions in QQmlProperty, which in turn will try to use accessors when available (and no interceptors have to be called). Change-Id: I60ecfc202b6024bfe4a33206a46299787b152546 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | 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>