aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlbinding.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Speed up object creationSimon Hausmann2015-04-161-2/+2
| | | | | | | | Avoid copying url and file name twice into the context every time we instantiate an object. Change-Id: I1c76b80b9c44f95512af5899d760151f6dcd7bb5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up binding evaluationSimon Hausmann2015-04-161-23/+2
| | | | | | | | | Don't spend any cycles of determining the location of the binding (file, line, column) unless we really need that information. That's the case when the profiler is active or an error happens. Change-Id: Iae97808d500b88fed6a813e8b224aa6ebe04d3b6 Reviewed-by: Lars Knoll <lars.knoll@digia.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-2/+2
| | | | | | | | | | | | 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>
* Make sure we always have an engine when assigning to a PersistentLars Knoll2015-01-131-6/+10
| | | | | | | This prepares things for a rewrite of the internals of Persistent. Change-Id: Ib93ec5911984d1bfce87ffdc3f86bc75f6ecafe9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of the bindingKeyFlagLars Knoll2015-01-121-1/+1
| | | | | | | | | Instead use the vtable to identify that we have a binding function. Change-Id: I794aebb6fb83f648ba36f2f15cad94d2af3cae91 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove QQmlTrace. We have a real profiler.Erik Verbruggen2015-01-091-8/+0
| | | | | Change-Id: I50d981b277187327c2c63f8372f64db1300ed9ef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup variant conversion codeLars Knoll2015-01-091-1/+1
| | | | | | | | Make public methods proper members of the ExecutionEngine, and move private methods into the .cpp file only. Change-Id: I3ca49e39bb1c4e559a2c63346e6ae6cfa446147d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the variant conversion methods from qv8engine to qv4::ExecutionEngineLars Knoll2015-01-091-1/+1
| | | | | Change-Id: Ibd529ae5cc3ba06f46152e9daa9119a4e7a2561c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove v8engine dependency in toVariant conversionsLars Knoll2015-01-021-1/+1
| | | | | Change-Id: I0f2f77c9cc268a0c5ca3ffe0cd66fc98bb1964b3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove most of the places where getPointer() is usedLars Knoll2014-12-201-1/+1
| | | | | | | This is no longer required, and simply uglifies the code Change-Id: Iba91a1d7735ebe23a43437f137a488423b6eb743 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of !this and similar constructsLars Knoll2014-10-311-1/+2
| | | | | | | | | The C++ standard doesn't allow calling member functions on a mull object. Fix all such places, by moving the checks to the caller where required. Change-Id: I10fb22acaf0324d8ffd3a6d8e19152e5d32f56bb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix QQmlExpression/QQmlScriptString/QQmlBinding crashesSimon Hausmann2014-10-091-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | In the QQmlScriptString we store the binding id and it is an index into the runtimeFunctions array of the compilation unit. However we don't store the compilation unit and instead in QQmlBinding and QQmlExpression try to retrieve it from the cache via the context url (we have the context after all). That turns out to be not a reliable way, as sometimes the URL might slightly differ from the originally compiled cache (qrc:/// turning to qrc:/ maybe). Consequently the type is (unnecessarily) compiled again and unfortunately not _linked_, therefore the runtime functions array is empty. Another option is that when the component was created from a QByteArray, then no entry exists in the cache in the first place. This patch addresses the problem by storing a reference to the compilation unit in the QQmlContextData. That we can safely retrieve and it'll make sure the compilation unit also stays alive. In the process of that the manual reference counting was switched over to QQmlRefCount and QQmlRefPointer for QV4::CompilationUnit. Task-number: QTBUG-41193 Change-Id: I9111f9a3b65618e453954abcd789c039e65a94f7 Reviewed-by: Lars Knoll <lars.knoll@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>
* Convert qqmlbuiltinfunctions to the new storage layoutLars Knoll2014-07-221-1/+1
| | | | | Change-Id: Idb075e97a5f62bbfe8086155d13a01d1dbc99c08 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move data of FunctionObject into an inner structLars Knoll2014-07-221-2/+2
| | | | | Change-Id: Ic00b1761565f9f8881b665a3fecca723239e2279 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Managed data into it's own subclassLars Knoll2014-07-221-1/+1
| | | | | | | | | This prepares for moving over to a d pointer scheme, where Managed subclasses don't hold any data directly. This is required to be able to move over to a modern GC. Change-Id: I3f59633ac07a7da461bd2d4f0f9f3a8e3b0baf02 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup: Get rid of the url and file name members in QQmlCompiledDataSimon Hausmann2014-06-051-1/+1
| | | | | | | | This is part of the effor of moving members from QQmlCompiledData into QV4::CompilationUnit in order to eliminate the former in the long run. Change-Id: Icce7fe0ee9a49cb3a7677fd7020008fc55ecdcf6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Rework custom parser integrationSimon Hausmann2014-06-041-28/+0
| | | | | | | | | | | | | | | | | | | | | | | The custom parser design used to be so that the custom parser operates on the "AST", creates its own binary representation of the data it needs, stores it in a QByteArray and gets that at object instantiation time. That meant serializing everything necessary. With the introduction of the "binary" QML data structure, that process of serialization becomes obsolete and would require extra work in the custom parsers for example for QQuickStates to store the translation parameters. The clean solution is to eliminate this unnecessary serialization process and instead let the custom parsers do a verification pass at type compile time and then simply operate directly on the QV4::CompiledData::Bindings at object instantiation time. That simplifies the code, and allows for support of translations throughout all list model properties. Additionally this speeds up the creation of state objects and reduces memory consumption. Previously a text: qsTr("foo") binding in states would result in an actual java script binding. After this patch it is merely stored as a string and translated at object instantiation time. Change-Id: I7550274513f54abb09a0ab4de51c4c0bcdb23cae Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Avoid recompiling of signal handlers defined in QtQuick state changes and ↵Simon Hausmann2014-04-021-2/+2
| | | | | | | | | | Connection objects We can re-use the expression we've compiled at QML type compilation time, as long as we "inject" the signal parameters in the dynamic qml lookup chain. Change-Id: Icc417531c41dea06ff5d033011179af49b03f542 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix performance regression for bindings from QtQuick state changesSimon Hausmann2014-04-021-1/+1
| | | | | | | | | | | | | | | | This is a regression from the compiler change. We can and should try to use the binding as it was compiled in the loader thread for things like PropertyChanges { target: foo width: someExpresion + to + calculate * width; } It is already ensured that these expressions are compiled without type optimizations. Change-Id: Ib855d8a848fcab2524df008727eab436ac98514e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix compilation of script stringsSimon Hausmann2014-04-021-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | The right hand side of script string properties can be evaluated in entirely dynamic scopes, due to QQmlExpressions' public API of allowing construction from a QQmlScriptString and a variable scope/context. Nevertheless we should compile these bindings at type compile time, as long as we make sure that the compiled code doesn't try to do any compile time determined property lookups and type resolution. This is implemented using a separate compilation pass that ensures the disableAcceleratedLookups flag is set. A few minor cleanups come with this patch: * Ensure that the property caches array is always symmetric to the list of compiled QML objects, as that allows the use of at() instead of value(). * The code for creating a QML callable function object for a given run-time function is now centralized in a static function QmlBindingWrapper, used for script strings and bindings from custom parsers. The provided unit test verifies the successful execution of the same script string with two different scope objects. Change-Id: Ica2cea46dd9e47263b4d494d922d3cc9664b08ae Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix typoSimon Hausmann2014-04-011-1/+1
| | | | | | | creatScriptFunction -> createScriptFunction Change-Id: Icdb9214b1ae067fa2b8693d50cdac0be9fe6d390 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Cleanupsv5.3.0-beta1Simon Hausmann2014-03-211-15/+11
| | | | | | | | | * Get rid of members in QQmlCompiledData that were used by the VME and are now unused * Get rid of QQmlVME friend declarations that are not needed anymore Change-Id: I11b4b6f0b4b0b60edf92a1256be3d0d44d76bbc9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Namespace cleanupSimon Hausmann2014-03-171-1/+1
| | | | | | | Move the QML IR types into the QmlIR namespace and clean them up. Change-Id: I2125449e5a519034e23670651efa620f405730b4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove redundant QQmlBinding members.Michael Brasser2014-03-111-35/+53
| | | | | | | | | This reduces the size of QQmlBinding by 12 bytes. Task-number: QTBUG-37134 Change-Id: Id55257edec8cee88d863374e8a96d7eebbeaf523 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Add dedicated QML profiler and adapterUlf Hermann2014-02-151-3/+3
| | | | | | | | The remaining "profiling" parts of the QML profiler service are engine specific and are best accessed through their own adapter. Change-Id: Idb763104bdd80e4dabdf132ec1a496b9bc9f6f46 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* [new compiler] Preliminary support for script string propertiesSimon Hausmann2014-01-171-1/+2
| | | | | | | These should later get resolved at compile time, like enum assignments. Change-Id: I2f40c8d13330d2a101f79af12fe708f466eef225 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support pre-compiled bindings for QML custom parsersSimon Hausmann2013-11-291-1/+9
| | | | | | | | | | | | | | | | | | | | | | For example the x property in PropertyChanges { target: foo x: someItem.x - other.width / 2 } was compiled at run-time dynamically, which produces slower code (no type information available) and slows down the type instantiation, because the compilation happens every time at instantiation time (or later). With this change, when the custom parser behind PropertyChanges requests a binding ID for "x", the right hand side will be added to the bindings to compile, then compiled and later at run-time the QQmlBinding constructor that takes a QQmlBinding::Identifier can retrieve the correct compiled function from the QV4::CompiledData::CompilationUnit. Change-Id: I857fb2d39e82714b225bc9394b9904b795c6662b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Ensure the this object is set correctly to the scope object in binding ↵Simon Hausmann2013-11-051-10/+0
| | | | | | | | | expressions This is a regression from 5.1 Change-Id: I61ad372a02d937c195dad74bd9fcb8fd4410d97a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix Persistent/WeakValue APILars Knoll2013-09-261-3/+5
| | | | | | | Don't use unprotected Values in the API anymore. Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-4/+5
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix qqmlecmascript::enums and nonNotifyableSimon Hausmann2013-06-081-1/+1
| | | | | | | | | | | | In the v8 bindings in expressionIdentifier we used to print the url with line number and only in the base class we printed the expression itself. With qv8bindings.cpp gone, we can do that now in the base class, as expected by the test. Adjusted the test also by columns. Change-Id: I8d532d21baf5bf2fbfcca56c2657a1d65025fe84 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Small cleanupLars Knoll2013-05-261-6/+1
| | | | | | | | | We don't do rewriting for bindings anymore. Remove a method overload that's not really needed anymore. Change-Id: I9d57d30dce4848cb06c88c3f042ccf30e6d41aab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of Get/SetHiddenValue in the v8 APILars Knoll2013-05-241-13/+5
| | | | | | | | | | It was only used to mark an object as something to be used as a binding. Simply use one of the free bits in QV4::Managed for that. Also changed a bit more code over from v8 to v4. Change-Id: I6e787e611041e058fe109df1d7a13598655f8eba Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove the remaining dependencies onto the binding rewriterLars Knoll2013-05-241-8/+4
| | | | | | | | Remove the remaining places that were rewriting bindings. Remove the binding rewriter class. Change-Id: Ib1e9121dc10f4526ddb7cf0ae32fecd8ce2d4993 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add support for direct binding evaluation in QV4ScriptLars Knoll2013-05-241-23/+10
| | | | | | | | | This way there is no need to rewrite the binding expressions anymore, instead we can directly compile them into a binding function. Change-Id: I91a0c540d066976e363590fe9ccde6a81ee92b1d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make the default constructor of PersistentValue not allocate a d pointerLars Knoll2013-05-071-2/+2
| | | | | | | | This is also required to change the v8::Persistent in QQmlData over to v4. Change-Id: Ib3164ded9c772e977f6b43ef6163a3aa74da3800 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change some v8::Persistent to QV4::PersistentValueLars Knoll2013-05-071-4/+4
| | | | | Change-Id: I2c4e98cf7e778de9aafabdbd68e6682106343d12 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of v8::LocalLars Knoll2013-05-061-2/+2
| | | | | | | | | The class was doing exactly the same thing as v8::Handle in our implementation. Removing it cleans up quite a bit of code. Change-Id: I37a3dcdef062fc388751e9ef0a158b5926ba2efb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert some v8::Persistent to v4Lars Knoll2013-05-061-8/+7
| | | | | Change-Id: Ic6613b020dbbb1ee75e2096707d8fb1aa228083d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove v8::HandleScopeLars Knoll2013-05-031-2/+0
| | | | | | | This class never made sense with v4... :) Change-Id: Id597d791d1adf52cc821d6d46f57cb24d1acd343 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup v8 Context handlingLars Knoll2013-05-031-2/+0
| | | | | | | | | We don't need or use v8 Context objects, so it's sufficient to have one global context for now. Remove all code related to entering or leaving Context's. Change-Id: I4f7ddaa4907e59de5713368fa13bbc40e5830542 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move QV8Engine::to/fromVariant over to a v4 based APILars Knoll2013-05-011-1/+1
| | | | | Change-Id: Ie44de10cbd970715345e2c428db666dc6233b39c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Trim trailing whitespace.Stephen Kelly2012-08-221-8/+8
| | | | | Change-Id: I3d268d3ce8d73c7287f51abe9a28c165cb75acb9 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Reduce memory consumption of source coordinatesMatthew Vogt2012-08-161-13/+13
| | | | | | | | | | Reduce memory consumption by storing source location coordinates as 16-bit variables (in run-time structures). Also modify qmlmin to restrict line lengths so that the column bound is not normally exceeded. Change-Id: I08605626ffbdf081b6da2aea1116bdfe24998572 Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
* Make QQmlScriptString opaque.Michael Brasser2012-08-031-0/+48
| | | | | | | | Allow for future optimization by encapsulating the raw script data. Change-Id: I1863103e8e6d74ede60593cabb240e16f2ae657e Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Delay conversion of v8 exceptions to QQmlErrors.Michael Brasser2012-06-051-10/+5
| | | | | | | | | This conversion in relatively expensive, and not required for transient exceptions that occur during startup due to the order of binding evaluation. Change-Id: I29a16c075890c8966c0bad0a77412ad232c791bb Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>