aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmllistwrapper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-02-281-0/+25
|\ | | | | | | Change-Id: I92b13a9c1727644d63e125c1e6f1fdac72720ad7
| * Add a javascript push method binding to QQmlListPropertyIonut Alexandrescu2017-02-211-0/+25
| | | | | | | | | | | | | | | | | | | | Create a PropertyList prototype, and add the push method to QQmlListProperty that call the append function if it has been defined. Added a unit test and updated the documentation. Change-Id: I2647766e98b60bf0546f6d6ed1422a616e0d3a07 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Object: Allow put and putIndexed to return success or failureRobin Burchell2017-02-091-1/+2
|/ | | | | | | | | Some parts of the ES6 (and even ES5!) spec specifically require handling of a property write failure. This will be introduced in followup changes, as it's going to be rather more involved than this. Change-Id: Ie482493fcf4780df0e23619650a856421d20bd55 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Also check for correct destroy() chainingErik Verbruggen2016-10-061-0/+1
| | | | | | | | | Check that the destroy() method of Heap::Base was called when a Managed object needs destruction. This checks if a call to the parent's destroy() method was accidentally omitted. Change-Id: Id025ecd6d4744bf3eab23503fbe317ed2a461138 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Make Heap::Object and all subclasses trivialErik Verbruggen2016-10-061-10/+11
| | | | | | | | | | | | GCC6 might dead-store-eliminate out our secret write to Base::mmdata, because it expects all memory content to be "undefined" before constructor calls. Clang might take the same approach if the constructor of Heap::Object is removed. By making these structs trivial, it also makes them memcpy-able. Change-Id: I055b2ad28311b997fbe059849ebda4d5894eaa9b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Introduce destroy() on Base subclassesErik Verbruggen2016-10-051-1/+1
| | | | | | | | This removes the destructors of subclasses of Base, making them nearly trivial. Change-Id: Ia6f7d467e87899b5ad37b8709a8f633a51689d59 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Replace QPointer with a QQmlQPointer (which is trivial)Erik Verbruggen2016-09-271-0/+2
| | | | | | | One of the steps needed to make QV4::Heap::structs trivial. Change-Id: Ic4d73f15035af21c8a682aaad1ee68cdd91f8e7d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* 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>
* 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>
* Move remaining objects to new constructor syntaxLars Knoll2015-09-221-5/+4
| | | | | | | Also disable the old way of constructing objects. Change-Id: Ib4e69087cd563ae1481da116d6caf97876239798 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Remove type punning from QV4::Value.Erik Verbruggen2015-07-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The union in QV4::Value is used to do type punning. In C++, this is compiler-defined behavior. For example, Clang and GCC will try to detect it and try to do the proper thing. However, it can play havoc with Alias Analysis, and it is not guaranteed that some Undefined Behavior (or Compiler depenedent behavior) might occur. The really problematic part is the struct inside the union: depending on the calling convention and the register size, it results in some exciting code. For example, the AMD64 ABI specifies that a struct of two values of INTEGER class can be passed in separate registers when doing a function call. Now, if the AA in the compiler looses track of the fact that the tag overlaps with the double, you might get: ecx := someTag ... conditional jumps double_case: rdx := xorredDoubleValue callq someWhere If the someWhere function checks for the tag first, mayhem ensues: the double value in rdx does not overwrite the tag that is passed in ecx. Changing the code to do reinterpret_cast<>s might also give problems on 32bit architectures, because there is a double, whose size is not the same as the size of the tag, which could confuse AA. So, to fix this, the following is changed: - only have a quint64 field in the QV4::Value, which has the added benefit that it's very clear for the compiler that it's a POD - as memcpy is the only approved way to ensure bit-by-bit "conversion" between types (esp. FP<->non-FP types), change all conversions to use memcpy. Use bitops (shift/and/or) for anything else. - only use accessor functions for non-quint64 values As any modern compiler has memcpy as an intrinsic, the call will be replaced with one or a few move instructions. The accessor functions also get inlined, the bitops get optimized, so in all cases the compiler can generate the most compact code possible. This patch obsoletes f558bc48585c69de36151248c969a484a969ebb4 (which had the exact aliassing problem of the double and the tag as described above). Change-Id: I60a39d8564be5ce6106403a56a8de90943217006 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
* Move the StringValue members of ExecutionEngine onto the JS stackLars Knoll2015-06-101-1/+1
| | | | | Change-Id: Ib55c05f1730b7659e2f6fee7e1fa79c10c759167 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Further cleanupsLars Knoll2015-04-161-4/+4
| | | | | | | | | The get and getIndexed vtable methods should take a const Managed pointer. Start cleaning up the asFoo() methods in Value and Managed by removing asArrayObject() and asErrorObject(). Change-Id: Ibd49bf20773ef84c15785b7ac37a7bc9fd4745d5 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-1/+1
| | | | | | | | | | | | 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>
* Get rid of all uses of Managed::engine()Lars Knoll2015-01-211-2/+2
| | | | | Change-Id: I596f14554d81f5e9af9996294d96047f2e810bef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove all the setVTable() calls that aren't required anymoreLars Knoll2015-01-211-2/+0
| | | | | | | | The memory manager's allocation methods now set this up correctly for us :) Change-Id: I8492bf732df601f95a1a851fb3804127ffc83935 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove v8engine usage in the value type providerLars Knoll2015-01-081-1/+1
| | | | | Change-Id: I6b26a8249175a86c6e15d000b24ba3300e112715 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't store a v8engine pointer in qqmllistwrapperLars Knoll2015-01-011-13/+10
| | | | | Change-Id: I21b055deb74aafff8b2ee1cdce776e06f154dcaa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix the way we set the property name during iterationLars Knoll2014-12-201-2/+2
| | | | | | | This was broken due to the new inheritance scheme for Managed Change-Id: Ia9df50e7e655c3a812a01a2c78945e648aa444dc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup destruction of heap objectsLars Knoll2014-11-211-6/+0
| | | | | | | | Generate the code from a macro instead of duplicating boiler plate code. Operate on Heap::Base instead of Managed. Change-Id: I84c5a705980899be3e5b931a093645e50d3923bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move data of more Qml related objects into Heap namespace.Lars Knoll2014-11-101-3/+3
| | | | | Change-Id: Ifb3a7093351474d6feb2f64498b531c36fdf669b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Object::Data into the Heap namespaceLars Knoll2014-11-081-1/+1
| | | | | Change-Id: I9d30081f71b83bc86f5e5714e23396b18c4d54c5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Begin moving the data out of Managed objectsLars Knoll2014-11-081-1/+1
| | | | | | | | | | | We need to move the Data objects out of the Managed objects, to avoid lots of trouble because inner classes can't be forward declared in C++. Instead move them all into a Heap namespace. Change-Id: I736af60702b68a1759f4643aa16d64108693dea2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup header file dependenciesLars Knoll2014-11-041-0/+1
| | | | | Change-Id: Ibb4658576a98b53de2eac2474ce4d5b9eb83b6ae Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of !this and similar constructsLars Knoll2014-10-311-14/+10
| | | | | | | | | 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>
* 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>
* Change the object allocation schemeSimon Hausmann2014-07-221-2/+2
| | | | | | | | | Instead of allocating the data directly, centralize the object and its ::Data allocation in one place in the memory manager. This is in preparation for additional pointer indirection later. Change-Id: I7880e1e7354b3258b6a8965be378cd09c9467d25 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Convert context and list wrapperLars Knoll2014-07-221-10/+9
| | | | | Change-Id: Ida3ac10092e1fae53f57e2e664f58c6138a17a99 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of StringRefLars Knoll2014-07-221-3/+3
| | | | | | | | Remove the Ref classes, as they won't be required anymore once Managed and Managed::Data are separated. Change-Id: Ic6bec2d5b4ecf2595ce129dbb45bbf6a385138a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert list wrapper to new storage layoutLars Knoll2014-07-221-17/+18
| | | | | Change-Id: Id360880d26444d84462e16e7401945d1160b4281 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix unreliable behavior of array methods on qml list propertiesSimon Hausmann2014-04-091-2/+10
| | | | | | | | | | | Array methods such as forEach rely on the hasProperty boolean of getIndexed to be set appropriately. Some getIndexed implementation - such as the QQmlListProperty one - didn't initialize it correctly and therefore the behavior was undefined. Task-number: QTBUG-38088 Change-Id: I34bc3136d8cc2bc280397d0c4d5051e7d72269e8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix occasional crashes in canvas getImageData and other placesSimon Hausmann2014-02-041-0/+3
| | | | | | | | | | | In some places we allocate custom array objects and in the constructor we call setArrayType, which will allocate the array's data through the GC. In all of these cases we need to make sure that the array object itself is protected from garbage collection, because while in the constructor it may not be yet in the scope the callee has usually set up. Change-Id: I96b7af4ae00fd809067e12bacd6563984c5e9240 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Split ManagedVTable into two classesLars Knoll2014-01-211-2/+2
| | | | | | | | Keep the basic methods in ManagedVTable, but have the Object related stuff in an ObjectVTable class. Change-Id: I9b068acf3caef813686227b8d935e7df1a7d1a6e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't return a Property pointer in Object::advanceIteratorLars Knoll2014-01-201-6/+5
| | | | | Change-Id: Iac4cb2a2252b18e40455910e51e3e374df7c1e80 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework array handling for JS objectsLars Knoll2014-01-091-1/+1
| | | | | | | | | Split up ArrayData into two classes, one for regular arrays, one for sparse arrays and cleanly separate the two cases. Only create array data on demand. Change-Id: I9ca8d0b53592174f213ba0f20caf93e77dba690a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Encapsulate the current context and fix it's usageLars Knoll2013-12-041-2/+2
| | | | | | | | | | | Encapsulate accesses to the current context, and rework the way we push and pop this context from the context stack. Largely a cleanup, but simplifies the code in the long term Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the vtable pointer from the object to the internal classLars Knoll2013-12-041-1/+1
| | | | | | | | This saves one pointer per object, and willmake other optimizations easier in the future. Change-Id: I1324cad31998896b5dc76af3c8a7ee9d86283bfe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-0/+2
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid side effects when en exception has been thrown.Lars Knoll2013-10-291-2/+2
| | | | | | | | | | | | | | We don't want to check for exceptions after every single line on our runtime methods. A better way to handle this is to add the check in all methods that have direct side effects (as e.g. writing to a property of the JS stack). We also need to return whereever we throw an exception. To simplify the code, ExecutionContext::throwXxx methods now return a ReturnedValue (always undefined) for convenience. Change-Id: Ide6c804f819c731a3f14c6c43121d08029c9fb90 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* inline get_element callsLars Knoll2013-10-141-0/+1
| | | | | | | | | | | Inline calls to get_element if the base is an object with a simple array structure, and the index is an integer number. Implemented for 64bit only for now, saves ~25% on crypto.js Change-Id: I3e34a6409169d90d3937f62264707d52a6c2f9f7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup API of Safe<T>Lars Knoll2013-10-021-1/+1
| | | | | | | | Don't have an implicit cast operator to Returned<T> anymore, and return a T* from the operator->() Change-Id: If4165071b986bfc84a157560d94d39c2dcfbc9e1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix ObjectIterator API to be GC safeLars Knoll2013-10-021-2/+2
| | | | | Change-Id: I3a9c48d53d8dbadcb9b32c00fcef1f89447c4b8c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove most uses of Value from qml/qmlLars Knoll2013-09-301-1/+1
| | | | | Change-Id: I409a8505a9e01f86d777bc694d24516d1c8f0c4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more direct QV4::Value usageLars Knoll2013-09-281-4/+6
| | | | | | | | Remove Value::fromString(String *), and make Encode safe against encoding raw Managed * pointers. Change-Id: Ibca4668e1cbeaf85c78169d14386281659d33ef6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-2/+2
| | | | | | | | This will simplify finding the remaining direct usages of QV4::Value that need fixing. Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* convert Managed::put() API to be GC safeLars Knoll2013-09-221-1/+1
| | | | | Change-Id: I09198ce372fa545372db389fac26828d21ad5731 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a StringRef for Managed::get()Lars Knoll2013-09-221-2/+2
| | | | | | | | | also store "toString" and "valueOf" as identifiers in the engine and fix two places where we compared strings the wrong way. Change-Id: I70612221e72d43ed0e3c496e4209681bf254cded Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-7/+7
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue for Managed::getIndexed()Lars Knoll2013-09-181-4/+4
| | | | | Change-Id: I0371ed21c4ef99564d3ffa1082dd109e890a78bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>