aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4lookup_p.h
Commit message (Collapse)AuthorAgeFilesLines
* QV4::Lookup: update comment about gc assumptionFabian Kosmale2021-02-101-0/+1
| | | | | Change-Id: I13304631a9870874fb130cd9e6598065fc952a71 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove the property cache from QQmlValueTypeWrapperLars Knoll2020-12-021-3/+5
| | | | | | | | | | | Instead operate directly on the meta object. We could maybe have an optimization, where we have a global map from id to QQmlPropertyData for each value type. Task-number: QTBUG-88765 Change-Id: I259a06ba116a536b56380c2636737c6c016665d9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Implement lookups for enumsSimon Hausmann2019-09-061-0/+9
| | | | | | | Task-number: QTBUG-77237 Change-Id: Ibe8fe8044b96d9d4b7a1a31b432daa886edbd799 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement lookups for qml type wrappersSimon Hausmann2019-09-051-0/+4
| | | | | | | Task-number: QTBUG-77237 Change-Id: I661dc7a23946520c8ad298c39796cb8d0561d80c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-111-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4value_p.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmltypewrapper.cpp src/quick/items/qquicktableview.cpp Change-Id: I684f8e01a711580512848bf1253f39b39fcbf4c7
| * Fix lookups of properties in QML singletonsSimon Hausmann2019-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | An unqualified name that points to a QML singleton will evaluate to a QQmlTypeWrapper JS object. A member lookup in such an object is not guaranteed to always produce the same property. The property cache check may protect us from that, but we must still retrieve the QObject singleton for every lookup. Task-number: QTBUG-75896 Change-Id: Ibd9bac6e5c2047f838758811790b299ace636446 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Remove now dead V4_BOOTSTRAP #if-eryUlf Hermann2019-05-131-3/+0
| | | | | | | | | | | | | | Change-Id: I04f8f69ed8ee415ca330e2f7beeffc4ee4c38e65 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Move model types into their own libraryUlf Hermann2019-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | The model types are not part of the core QML runtime and should only be loaded if you explicitly import them. We cannot enforce that in Qt5 as some of them are available from the QtQml import, but we can change it in Qt6. Change-Id: I1e49e84d748e352537ec2d4af901c034c91d038f Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
* | Merge remote-tracking branch 'origin/5.13' into HEADUlf Hermann2019-03-221-0/+35
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compileddata_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4jithelpers.cpp src/qml/jsruntime/qv4lookup.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4runtimeapi_p.h src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/qqmltypemodule_p.h Change-Id: If28793e9e08418457a11fc2c5832f03cab2fcc76
| * Accelerate lookup of singleton propertiesMichael Brasser2019-03-201-1/+2
| | | | | | | | | | | | Task-number: QTBUG-69898 Change-Id: Id03ba543fa293da2690099c3e6f94b2725de562f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Fix lookup fallback into the global object in QML bindingsSimon Hausmann2019-03-201-0/+7
| | | | | | | | | | | | | | | | | | | | This change addresses in particular qmlbench's fib10.qml, where usage of properties of the global object needs to go be accelerated in order to avoid regressing in performance. Task-number: QTBUG-69898 Change-Id: Ic43c64f4dd5459c4e92f87f03235ea836f971515 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Accelerate access to id objects in lookupsSimon Hausmann2019-03-201-0/+5
| | | | | | | | | | | | Task-number: QTBUG-69898 Change-Id: Ifbd9b3bf8d4b0c82b4c3933912e61eea8e0bb987 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Accelerate access to singletons and imported scriptsSimon Hausmann2019-03-201-0/+9
| | | | | | | | | | | | | | | | | | Use a dedicated lookup type to provide super fast access to engine wide singleton objects as well as scripts Task-number: QTBUG-69898 Change-Id: Ie430f48f6576a9171018ef18742dcf6b2adb4310 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Implement dummy QML lookups for "global" variablesSimon Hausmann2019-03-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When resolving names in the context of QML bindings, we now direct runtime access to QQmlContextWrapper::resolveQmlPropertyLookupGetter. At the moment this does basically the same as Runtime::method_loadName, which we called earlier. However this now provides the opportunity to optimize lookups in the QML context in a central place. When performing a call on a scope or context object property, we also did not use a CallName() instruction - which would have gotten the thisObject wrong - but instead we use a dedicated CallScopeObjectProperty and CallContextObjectProperty instruction. These rely on identifying these properties at compile time, which goes away with lookups (and also doesn't work when using ahead-of-time compilation). Therefore the qml context property lookup is using a getPropertyAndBase style signature and Runtime::method_callQmlContextPropertyLookup uses that. For the tests to pass, some error expectations need adjusting. In particular the compile-time detection of write attempts to id objects is now delayed to the run-time. The old code path is still there and will be removed separately in the next commit (as it is massive). Task-number: QTBUG-69898 Change-Id: Iad1ff93d3758c4db984a7c2d003beee21ed2275c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Enable lookups in QMLSimon Hausmann2019-03-191-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main feature that needs to be implemented in order to enable lookups in QML files is to respect that the QObject wrapper has its own storage layer (meta-object properties). Lookups need to be able to index those when the base is a QObject. This is done by caching the property data and guarding the validity by comparing property cache pointers. The same lookup logic is also implemented for value type wrappers. OVerall there's more that can be done with lookups in meta-objects, for constant properties for example. For "global" lookups we have a safeguard in place that generates a LoadName instruction for property access that should end up in the qml context wrapper. So no changes are needed here at first, but the lookup in the QML context can be optimized in the future. The way of storing the property cache in the lookup itself trades ugliness on destruction against the creation of less internal classes. Another option would be to store the property cache in the internal class and let QObjectWrapper always transition via the property cache. Task-number: QTBUG-69898 Change-Id: I9c378c071acc6d7d4a34a2a76616f9594119d515 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | V4: Change both setter0 lookup methods to reflect getter0Erik Verbruggen2019-03-011-6/+9
|/ | | | | | | | | | | | | | The setter0Inline would do the index to offset calculation each time it was called, while getter0Inline would do it once when creating the lookup. Same for setter0Memberdata. Both setters now mirror the behavior of their getter counterparts. However, getterTwoClasses is more sophisticated than setterTwoClasses, so there we still use the existing setter0setter0, but restore the uncorrected index back into the two-class-lookup. Change-Id: Ide29d0304e840b2e09d65bdfc216fa8da08d69dc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Never inline this lookupLars Knoll2018-09-141-1/+1
| | | | | | | | | It significantly decreases performance if this one gets inlined from some of the places we call it. Change-Id: I1e1102eaba45d15df25dafbed437ade1a4a511a9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Replace Identifier by PropertyKeyLars Knoll2018-07-021-1/+1
| | | | | | | | Change all uses of Identifier to use the new PropertyKey class and get rid of Identifier. Change-Id: Ib7e83b06a3c923235e145b6e083fe980dc240452 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix lookups of indexed propertiesLars Knoll2018-05-141-0/+6
| | | | | | | | These can now happen through destructuring expressions, so add proper support for those. Change-Id: I3fdd4e9903ab851a5c4f5c1b64ab4e991ba7d8c1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use Identifier by value and don't new them anymoreLars Knoll2018-05-021-1/+1
| | | | | Change-Id: Ib25c08027013217657beb2675dafa9a8c85cbaf9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Reorganize Lookup data structure to make marking fasterLars Knoll2018-04-121-9/+25
| | | | | | | | | | Do this by always using odd numbers for protoId's, and putting those into the same place as the InternalClass pointers. That makes it possible to quickly check whether the lookup contains a pointer to a valid heap object. Change-Id: I330017b26c090b4dcbbcce1a127dca7ba7e148d1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Rename InternalClass::id to protoIdLars Knoll2018-04-121-5/+5
| | | | | | | | It really identifies the 'revision' of the prototype chain that is being used with this internal class. Change-Id: Id5829c055cde2c1a2ca1032a7e831b3f0428774e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* garbage collect InternalClassLars Knoll2018-04-121-4/+6
| | | | | | | | | | | | | | | | Internal classes are now allocated and collected through the GC. As they are important to the deletion of other objects (because of the vtable pointer living inside the internal class), they need to get destroyed after regular objects have been sweeped. Achieve this by using a separate block allocator for internal class objects. Our lookups do often contain pointers to internal classes, so those need to be marked as well, so we don't accidentally collect them. Change-Id: I4762b054361c70c31f79f920f669ea0e8551601f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanup now unused code paths in qv4lookupLars Knoll2017-11-271-10/+0
| | | | | Change-Id: Ifd3fbc128f0ff30458912c65429bcf6f577204a0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Convert setters to use the id in InternalClassLars Knoll2017-11-271-3/+8
| | | | | Change-Id: I7f3acf96e998a41d60d33f98b243089b9ee40ff0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Convert global getters to use the id in internalclassLars Knoll2017-11-271-7/+3
| | | | | Change-Id: Id443245ee9f02af48abbf5ba4811ac69ad409059 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Convert primitive lookups to use the new ID in internal classLars Knoll2017-11-271-14/+11
| | | | | Change-Id: I1c2c3242f2a48e4e75b66b187127fcd362cd61c6 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Refactor getter lookupsLars Knoll2017-11-271-8/+28
| | | | | | | | | | Use the new id of InternalClass to simplify out lookup code for getters. Now all lookups in the prototype chain can be done at the same speed independent of the depth within the prototype chain with only two checks. Change-Id: I7d8451cc54c0ac50c1bcb4ae3bf386fd5f2a84aa Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Don't throw errors from the internal put methods anymoreLars Knoll2017-08-101-10/+10
| | | | | | | | Instead do it in the VME, where we can then easily separate into throwing and non throwing versions by bytecode. Change-Id: Ie63bd5b3610bb85f26fb8979179b2e239876cd97 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove unused lookup typesLars Knoll2017-08-101-11/+0
| | | | | | | | The indexed getters and setters haven't been used for a while and don't offer any performance benefits currently. Change-Id: Ifd5e1fab934e6e9940c4f1ad67f8850f04597504 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-061-7/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/jsruntime/qv4argumentsobject.cpp src/qml/jsruntime/qv4arraydata.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4errorobject.cpp src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4internalclass.cpp src/qml/jsruntime/qv4lookup.cpp src/qml/jsruntime/qv4managed.cpp src/qml/jsruntime/qv4managed_p.h src/qml/jsruntime/qv4object.cpp src/qml/jsruntime/qv4object_p.h src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4heap_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/memory/qv4mmdefs_p.h src/quick/scenegraph/util/qsgdistancefieldutil.cpp src/quick/scenegraph/util/qsgdistancefieldutil_p.h tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp Change-Id: I7ed925d4f5d308f872a58ddf51fdce0c8494ec9c
| * Optimize lookups based on IC changesLars Knoll2017-05-191-1/+2
| | | | | | | | | | Change-Id: I1f4f4aaad0c8194bce2ebde4503df38cab0990a2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Optimize other lookupsLars Knoll2017-05-081-2/+4
| | | | | | | | | | | | | | | | | | Add some more optimized lookups for accessing properties stored inline or in the memberData. Change-Id: Id74901d1dd91fd60933bf164c2bf90fed86232e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
| * Re-add some inline property storageLars Knoll2017-05-081-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that not using any inline property storage comes at a relatively high price in terms of memory consumption, as we always need to also create a memberData for any object. This avoids the memberData creation in quite a few cases, as we use the additional padding we have up to the 32 byte boundary given by the memory manager to store some property data. This complicates property access somewhat. To avoid performance regressions because of this, add specialized QV4::Lookup functions that optimize for properties that are inline or in the memberData struct. Change seems to be performance neutral on v8-bench on x86_64, but reduces peak memory usage when running the benchmark by around 20%. Change-Id: I0127d31a2d6038aaa540c4c4a1156f45ca3b7464 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | Merge remote-tracking branch 'origin/5.9' into HEADSimon Hausmann2017-03-231-0/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4mmdefs_p.h Change-Id: I9966750b7cd9106b78e4c4779f12b95a481cca40
| * Protect Lookup usage against cross-compilation word size differencesSimon Hausmann2017-03-171-0/+7
| | | | | | | | | | | | | | | | | | The offsets we're taking from Lookup in the code generator are always zero, but with static assertions we can ensure that they stay that way. Task-number: QTBUG-58666 Change-Id: I91e047d2101ba33e36aaada4a5adc75e20fea7d8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Always pass the ExecutionEngine into lookup callsLars Knoll2017-03-091-9/+8
|/ | | | | | | | | | | | This is required in preparation for proper write barriers, where we'll need to check the engine whether the barrier is enabled. It also makes the lookup calls more consistent, and doesn't affect performance in any measurable way. Change-Id: Ia838237a44ba809d4643e2626bc81560388276e2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Include the JIT assembler in qmldevtoolsSimon Hausmann2017-01-281-0/+3
| | | | | | Change-Id: I69b74e01dcffe82caafb7aa8495b3036afc2b933 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* 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>
* Add missing "We mean it" comments to private headers.Friedemann Kleint2015-10-061-0/+11
| | | | | | Task-number: QTBUG-48594 Change-Id: Ifc207938de7f0c8995fc712df92665f222612647 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* More cleanupsLars Knoll2015-04-211-1/+1
| | | | | | | | Get rid of Value::asObject(), and pass const Managed pointers into some more vtable methods. Change-Id: Ia4f427d5fd8868f77b4015d1ce5424d32bfc2115 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of asManaged()Lars Knoll2015-04-211-9/+9
| | | | | Change-Id: I853417fdf1cc339f7d43a006c20e1626b6bfb288 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Get rid of most uses of ValueRefLars Knoll2015-01-231-41/+41
| | | | | | | | | | | | Instead pass a const Value & into the functions With our new inheritance structure, we can get rid of ValueRef and instead simply pass a pointer to a Value again. Pointers to Values are safe to use again now, as they are now guaranteed to be in a place where the GC knows about them. Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix run-time string handling with regards to the new heapSimon Hausmann2014-11-211-31/+31
| | | | | | | | | | | | | | | | | Changed runtimeStrings to be an array of Heap::String pointers instead of indirect String pointers. Later that member along with other GC related members will go into a managed subclass. Meanwhile the generated code no more loads String pointers directly but just passes the index into the run-time strings to the run-time functions, which in turn will load the heap string into a scoped string. Also replaced the template<T> Value::operator=(T *m) with a non-template overload that takes a Managed *, in order to help the compiler choose the non-template operator=(Heap::Base *) overload. This allows removing a bunch of Value::fromHeapObject calls. Change-Id: I20415c0549d33cca6813441a2495976b66d4c00e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change signature or runtime methods to take an engine pointerLars Knoll2014-11-121-8/+8
| | | | | | | | | This makes a lot more sense in the long term and is the more maintainable solution, once the GC starts moving objects around in memory Change-Id: I8f327c0f5b5b0af38c5fe1a217852ee8c4a5c2fc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Add some specialized lookups for two internal classesLars Knoll2014-03-181-1/+13
| | | | | | | | | | | | Some methods are being called with two different types of objects, alternating between them. This adds a specialized lookup for that case. Speeds up the splay test by ~20%. Also create a clean path to a fallback lookup instead of going back to the generic lookup and then alternating. Change-Id: I3082d70d27155ef5f2cf2b680d227c6dd389956d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement Lookup::indexedSetterLars Knoll2014-01-311-0/+5
| | | | | | | | | use this instead of the generic runtime method. This gives around 10% speedup for array heavy Javascript such as crypto.js. Change-Id: Ic8f478c5b18893f2ef49e3f658b1ef24ae22e64f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use lookups for indexed accessesLars Knoll2014-01-201-0/+6
| | | | | | | This speeds up reading array data from objects significantly. Change-Id: I5d17a7b3e7583a16dc76d1ee6cbc1d7134e4c2fa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>