aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4variantobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QML: Allow some more backing types for enumsFabian Kosmale2023-04-121-1/+2
| | | | | | | | | Task-number: QTBUG-112180 Done-with: Fabian Kosmale <fabian.kosmale@qt.io> Change-Id: I48a2a696d3424ab1d8b9e693a92361a978ad70e9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QML: Try QMetaType conversion in VariantObject's valueOf()Ulf Hermann2022-11-221-1/+11
| | | | | | | | | Since we're explicitly dealing with a QVariant here, the metatype conversion is adequate. We do the same already for toString(). Change-Id: I38c17b40da73ff0f0274e7d65b462eda1af2235a Reviewed-by: Semih Yavuz <semih.yavuz@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* V4: Drop extra QVariant parameter from fromData()Ulf Hermann2022-10-071-2/+2
| | | | | | | | The data needs to be copied anyway if we are going to store it in ScarceResourceObject. We can just as well copy it from the void pointer. Change-Id: Ic106221138b1236a6ddea20cfdb468c6fbe3e1c3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Remove unused includes in qml, final partSemih Yavuz2022-09-141-1/+0
| | | | | | | | | | | | | | Drop unnecessary includes detected by clangd-iwyu. Add new includes due to the transitive includes. Also, some of the includes were detected as unused even if they were actually in use. In those cases, use angular brackets instead of "" which deceives the tool not to complain. Affected subfolders: JsRuntime, Qml Fixes: QTBUG-106473 Change-Id: I483da15d42a8e3ce6cd3b654909665fff3075d6b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Avoid various warnings about deprected QMetaType methodsUlf Hermann2020-09-161-2/+2
| | | | | Change-Id: I8f4b2703fdd08ff341904219cec33c321e0511c7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace QVariant::type with QVariant::userTypeOlivier Goffart2020-01-171-10/+10
| | | | | | | | | | | as type is going to be deprecated. This change was done automatically with the help of clazy. In addition, ColumnRoleMetadata was changed to take an int instead of a QVariant::Type Change-Id: Ibc02d7b52e7d931a56c19fdebc4788b5e6df2a39 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove unused includes of qv8engine_p.hUlf Hermann2019-04-091-1/+0
| | | | | Change-Id: Ic135a863581d29a3afb9c6c7f070d2630b3913b4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use custom debug stream operator in console.logMårten Nordheim2018-11-081-5/+8
| | | | | | | | | | | Fallback for string-conversion was previously using hard-coded string template mimicing QVariant. Just use QVariant's debug stream operator which may include data from the contained type. Change-Id: I8243ba6b04d842a895ac3234bb54f6a4eed849f1 Fixes: QTBUG-60057 Done-With: Jędrzej Nowacki <jedrzej.nowacki@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Prefix vtable methods with virtualLars Knoll2018-07-031-1/+1
| | | | | | | | | Turns out that the overloading of vtable methods and regular ones is problematic in some cases. So let's rather make it explicit which methods are part of the vtable, and which aren't. Change-Id: Ifee32a26104d30f3c82bca8b5a9cdea2d4f4f526 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Convert more builtin functions to use the new calling conventionLars Knoll2018-01-121-9/+9
| | | | | | | | Convert most of the methods used QML objects to the new calling convention. Converted IndexedBuiltinFunction to do the same. Change-Id: I41b26042c2f56f24988485b06e8ccd214e2573c0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove Scope::result and convert calling convention for builtinsLars Knoll2017-08-081-20/+16
| | | | | | | | Allow for faster calling of builtins, and completely avoid scope creation in many cases. Change-Id: I0f1681e19e9908db10def85a74e134a87fc2e44c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Go through proper set() functions when writing to MemberDataLars Knoll2017-03-091-2/+2
| | | | | | | | This is required, so we only have to add the write barrier in one place. Change-Id: I4e8bde823b30ad18f043312ac3f1ed46597b91a7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Convert more builtin functions to the new calling conventionLars Knoll2017-01-251-23/+24
| | | | | Change-Id: I053215261e1186aff25f29e0967219ef667f7678 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-181-16/+19
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4variantobject.cpp src/qml/types/qquickworkerscript.cpp src/quick/scenegraph/util/qsgdefaultpainternode_p.h tools/qmljs/qmljs.cpp Change-Id: I876242714ec8c046238d8fd673a5ace2455b2b59
| * QML: Make Heap::Object and all subclasses trivialErik Verbruggen2016-10-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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: Move the ScarceResourceData from VariantObject onto the heapErik Verbruggen2016-10-051-14/+15
| | | | | | | | | | | | | | So now VariantObject is nearly a trivial struct. Change-Id: Ifc54c04d9686c03e12066c5287823dd3b1315d2a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | optimize string usage: use fromLatin1() lessAnton Kudryavtsev2016-09-081-2/+5
|/ | | | | | | | | | .. to reduce allocations. Replace fromLatin1 with QLatin1String or with QStringBuilder where it is possible. Change-Id: I09c7242fa7b118447b51239e2a6743a34fb3de14 Reviewed-by: Ulf Hermann <ulf.hermann@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>
* Convert variant object and ObjectProtoLars Knoll2015-09-221-3/+6
| | | | | Change-Id: I5ee3b453b74f5832997aca68d04979302f9afac5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* qml: Avoid heap allocations due to QString::fromLatin1()Sérgio Martins2015-08-131-1/+1
| | | | | | | By using QStringLiteral when the argument is a literal. Change-Id: Ib25042d10f3d9d0aca81af74cde0107aba4f9432 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Move the StringValue members of ExecutionEngine onto the JS stackLars Knoll2015-06-101-2/+2
| | | | | Change-Id: Ib55c05f1730b7659e2f6fee7e1fa79c10c759167 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move more objects from the v4 engine to the js stackLars Knoll2015-04-241-1/+1
| | | | | | | Convert most of the prototype objects in the v4 engine. Change-Id: I365f290493c20973bc991b6a383649836e42a16a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.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>
* 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>
* CleanupsLars Knoll2015-01-231-5/+5
| | | | | | | | Simplify some code in BooleanObject Simplify access to call arguments and thisObject Change-Id: I2f8e844019bc587385608beb02f05b15f827535c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove the remaining bit of code that use the vtable in the internalClassLars Knoll2015-01-211-1/+1
| | | | | Change-Id: Ia52f0e6db325aab37477d455f163487b319dce29 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* This method is only used one place, so inline it thereLars Knoll2015-01-091-22/+0
| | | | | Change-Id: Ia8b75965208c9687163ddaf982c4081c1ee504d4 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>
* Cleanup: Fix value type wrapper class nameSimon Hausmann2014-12-231-1/+1
| | | | | | | | It's supposed to be QQmlFoo instead of QmlFoo. While all this code is being touched, we might as well fix the name. Change-Id: Ia8be0c6ec46e114f7559c1e7a07a9d368932999e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix handling of enum values encapsulated in QVariantTobias Koenig2014-12-181-0/+2
| | | | | | | | | In case a QJSValue contains a QVariant which wrapps an enum value, the valueOf() method will convert the enum to an int32. Change-Id: I0b92207184f343d53f73884245b90552165c34fc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move prototype back from the vtable into ObjectLars Knoll2014-12-111-6/+1
| | | | | | | | This is the only way we can support a GC that moves objects around in memory. Change-Id: I1d168fae4aa9f575b730e469e762bc5b5549b886 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 Variant and ArgumentsObject into Heap namespaceLars Knoll2014-11-081-2/+2
| | | | | Change-Id: Id2092a15c9fb5341d9b5cf4a9ac7a978308e4174 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Object::Data into the Heap namespaceLars Knoll2014-11-081-2/+2
| | | | | Change-Id: I9d30081f71b83bc86f5e5714e23396b18c4d54c5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of !this and similar constructsLars Knoll2014-10-311-2/+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 mapping of JS objects/arrays to C++Simon Hausmann2014-09-171-1/+1
| | | | | | | | | | | | | | | [ChangeLog][QtQml][Important Behavior Changes] When a JavaScript object/array is passed to C++ through a QVariant, the engine no longer immediately converts the object recursively into a QVariantMap or QVariantList but instead stores a QJSValue in the QVariant. This prevents a loss of data when the JS object contains non-primitive types such as function objects for example. Code that expects the variant type to be exactly QVariant::Map or QVariant::List may need to be adapted. Registered conversion functions however ensure that code that merely calls toMap() or toList() continues to work. Task-number: QTBUG-40431 Change-Id: I1dbc1d5f8e78ad28bb62db3681b9a0b34557e7f5 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 more objects to the new constructor schemeLars Knoll2014-07-221-20/+13
| | | | | Change-Id: I31b2a1ba4a93f0d4bde68eeb94f13e7224c0cd7b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert ExecutionContext to new storage schemeLars Knoll2014-07-221-7/+7
| | | | | Change-Id: I9fcc13da5360f37cef3149b114ed9263b9b74281 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move VariantObject over to new storage layoutLars Knoll2014-07-221-20/+17
| | | | | Change-Id: I96a4ce5d3a3e4fdd29ba0aac1bd3361588457580 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Managed data into it's own subclassLars Knoll2014-07-221-9/+9
| | | | | | | | | 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>
* CleanupsLars Knoll2014-01-311-1/+1
| | | | | | | | | | Remove SafeValue, it was used to port over to an exact GC. Since we now have that, we can now safely merge it with QV4::Value again. Also rename SafeString to StringValue for better naming consistency. Change-Id: I8553d1bec5134c53996f6b0d758738a0ec8a2e4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Split ManagedVTable into two classesLars Knoll2014-01-211-1/+1
| | | | | | | | 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>
* Remove setVTable calls in performance critical areasLars Knoll2013-12-041-2/+0
| | | | | | | | | | Remove all the calls to setVTable that were in performance critical parts of the code. This now brings performance back to the level we had with the vtable inlined in the Managed objects. Change-Id: I76317cc5c53b5b700d1d3883b954407142a4c424 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the vtable pointer from the object to the internal classLars Knoll2013-12-041-2/+2
| | | | | | | | 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>
* Simplify & speed up function callingLars Knoll2013-11-091-4/+4
| | | | | | | | | Get rid of the SimpleCallContext, instead simply use the CallContext data structure, but don't initialize the unused variables. Change-Id: I11b311986da180c62c815b516a2c55844156d0ab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix the remaining objects against self destructionLars Knoll2013-10-111-1/+1
| | | | | | | | This makes pretty much all test cases pass with exact garbage collection. Change-Id: Ia874e3c17c3984afb7cfe370f9bd3ad8fe46699a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more direct QV4::Value usageLars Knoll2013-09-281-2/+2
| | | | | | | | Remove Value::fromString(String *), and make Encode safe against encoding raw Managed * pointers. Change-Id: Ibca4668e1cbeaf85c78169d14386281659d33ef6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>