aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4arraybuffer_p.h
Commit message (Collapse)AuthorAgeFilesLines
* V4: Slim down FunctionObjectUlf Hermann2024-05-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most FunctionObjects do not actually need their custom jsCall members. They will only call the functions from the vtable anyway. FunctionObject can therefore be split into a static and a dynamic variant. Only the dyanmic variant needs to carry (and invoke) the extra pointer. The jsCallWithMetaTypes pointer is completely pointless because none of the dynamic functions actually implement it. Furthermore, the QV4::Function and QV4::ExecutionContext pointers in FunctionObject are only needed by actual JavaScript functions. The builtins that like to be dynamic functions never need them. Therefore, split out another class for this. In the generic FunctionObject, we need the capability to decide at run time whether the function shall be a constructor or not. Add a flag to replace the check for jsCallAsConstructor. Also, where we can, avoid the pessimization of checking whether a function is a constructor before trying to call it as constructor. Rather have the default implementation throw the exception. As a side effect, for most functions we don't need an ExecutionContext anymore. The engine is enough. Task-number: QTBUG-124662 Change-Id: Iac657fa71288dd6ec230a33de2986ba3bcf4628c Reviewed-by: Fabian Kosmale <[email protected]>
* Remove the use of Q_QML_PRIVATE_EXPORTAlexey Edelev2024-01-111-4/+4
| | | | | | Task-number: QTBUG-117983 Change-Id: I5790f01d614cd70c7fcc9bd817ec6ace3f3e3730 Reviewed-by: Ulf Hermann <[email protected]>
* QV4::Heap::SharedArrayBuffer: avoid std::aligned_storage (deprecated in C++23)Marc Mutz2022-10-171-1/+4
| | | | | | | | | | | | | | | | ... by rolling our own. Qt 5.15 uses a pointer (additional indirection), not aligned_storage, so isn't affected. References: - https://github.com/cplusplus/papers/issues/197 - https://wg21.link/p1413 Pick-to: 6.4 6.2 Task-number: QTBUG-99122 Change-Id: Ia116dc11336901a19fc227fb68ac266c1bfbbcb1 Reviewed-by: Fabian Kosmale <[email protected]>
* 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 <[email protected]>
* V4: Fix naming of array data classesUlf Hermann2022-01-201-24/+39
| | | | | | | | | | | Provide convenience wrappers for access to const/mutable data, properly discern between the "buffer" object and the actual data, especially regarding shared/detached state. Change-Id: I48f1f1eb8c204c29277746e5dee63892cbf3ac89 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Andrei Golubev <[email protected]>
* Make QtQml work with the latest changes in qtbaseLars Knoll2020-01-141-13/+14
| | | | | | | | | | | | Adjust the code to work with the new QString and QVector data structures that have inlined size and data pointers. Fix a large bunch of compiler warnings from QFlags. Update dependencies for qtbase and qtsvg Change-Id: Iba237aed90c140b822e0cf501b9fb7156ec27c2d Reviewed-by: Fabian Kosmale <[email protected]>
* Implement support for SharedArrayBufferLars Knoll2018-08-251-12/+60
| | | | | | | | We'll still need to hook this up with Worker threads to become useful. Change-Id: Iedae7307edd76368aeba163731856ebe9b32c6b6 Reviewed-by: Simon Hausmann <[email protected]>
* Implement the $262.detachArrayBuffer() method for testingLars Knoll2018-08-201-2/+13
| | | | | Change-Id: I30ddca4402254e1cde17712d07ea0bff2ea5f595 Reviewed-by: Simon Hausmann <[email protected]>
* Implement support for new.targetLars Knoll2018-07-031-1/+1
| | | | | | | | | Support the new.target meta property in the codegen, and add support for passing the newtarget into the constructor vtable methods and the execution context. Change-Id: I62ea58e5e92d894035a76e35776203e9837c383b Reviewed-by: Simon Hausmann <[email protected]>
* Prefix vtable methods with virtualLars Knoll2018-07-031-2/+2
| | | | | | | | | 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 <[email protected]>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-2/+2
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <[email protected]>
* Convert TypedArray and friends to new calling conventionLars Knoll2017-11-131-4/+4
| | | | | Change-Id: Ia532b98738edb1bcc3fa5b81456763f2ec49952a Reviewed-by: Erik Verbruggen <[email protected]>
* Change signature for call/callAsConstructorLars Knoll2017-11-071-2/+2
| | | | | Change-Id: I159b57acc7a2133ef1ad545aa84e792c63449a57 Reviewed-by: Lars Knoll <[email protected]>
* Rename the construct 'virtual' method to callAsConstructorLars Knoll2017-11-071-1/+1
| | | | | | | To make it consistent with the rest of the engine. Change-Id: I57b98fa26134f9864c663f47371ef3e9ca16ac9c Reviewed-by: Erik Verbruggen <[email protected]>
* Remove Scope::result and convert calling convention for builtinsLars Knoll2017-08-081-4/+4
| | | | | | | | Allow for faster calling of builtins, and completely avoid scope creation in many cases. Change-Id: I0f1681e19e9908db10def85a74e134a87fc2e44c Reviewed-by: Simon Hausmann <[email protected]>
* Change function signatures for call/construct backLars Knoll2017-08-041-2/+2
| | | | | | | | Change those back again to return a value. This will be required to avoid creation of Scope objects between JS function calls. Change-Id: I05cb5cf8fd0c13dcefa60d213ccd5983fab57ea3 Reviewed-by: Erik Verbruggen <[email protected]>
* Convert builtins in TypedArray, ArrayBuffer and DataViewLars Knoll2017-01-251-4/+4
| | | | | Change-Id: I091020406f438f2dedf9ccae950fb328f2cf5522 Reviewed-by: Simon Hausmann <[email protected]>
* QML: Make Heap::Object and all subclasses trivialErik Verbruggen2016-10-061-3/+3
| | | | | | | | | | | | 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 <[email protected]>
* 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 <[email protected]>
* Fix conversion of QByteArray back to String in JavaScriptSimon Hausmann2016-08-301-0/+1
| | | | | | | | | | | | | | | Commit 3b7e2a69f7eb8597c807de39b4de39721e9e2bd2 changed behavior so that QByteArray is converted to the JS ArrayBuffer type, which is a better fit than QVariant. However ArrayBuffer does not have a toString method in the spec, and therefore any previous implicit toString conversion such as when passing to JSON.parse() would fail. To restore compatibility this patch adds a non-spec toString() that performs an UTF-8 conversion, as it was done previously through QVariant's toString. Task-number: QTBUG-55562 Change-Id: I096046954f7b29f7258deaa9ef5c8fa9292552ef Reviewed-by: Lars Knoll <[email protected]> Reviewed-by: J-P Nurmi <[email protected]>
* V4: Pass scope around as parameters inside the runtime.Erik Verbruggen2016-06-221-2/+2
| | | | | | | | | | | | | | | | The implementation of many (or all) runtime functions consist of first creating a QV4::Scope, which saves and restores the JS stack pointer. It also prevents tail-calls because of that restoring behavior. In many cases it suffices to do that at the entry-point of the runtime. The return value of a JS function call is now also stored in the scope. Previously, all return values were stored in a ScopedValue, got loaded on return, and immediately stored in another ScopedValue in the caller. This resulted in a lot of stores, where now there is only one store needed, and no extra ScopedValue for every function. Change-Id: I13d80fc0ce72c5702ef1536d41d12f710c5914fa Reviewed-by: Simon Hausmann <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* Simplify new construction schemeLars Knoll2015-09-221-0/+1
| | | | | | | | Declare the default prototype and internal class in the class itself. Change-Id: I08c2b42aa61a886580061336ae60cef8dedc0f03 Reviewed-by: Simon Hausmann <[email protected]>
* Move more objects over to the new allocation schemeLars Knoll2015-09-221-2/+2
| | | | | Change-Id: I0241efe10d115f8e4a646f840e47e220eb6cfc18 Reviewed-by: Simon Hausmann <[email protected]>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-04-221-8/+5
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlbinding.cpp src/qml/jsruntime/qv4arraybuffer.cpp src/qml/jsruntime/qv4functionobject.cpp Change-Id: Ic752e9dfd69b282093651c9234c110a49762f06d
| * QML Engine: Share data for ArrayBuffer created from QByteArray.Valery Kotov2015-04-151-8/+5
| | | | | | | | | | | | | | | | | | | | ExecutionEngine performs shallow copy of internal data for ArrayBuffer created from QByteArray. Change-Id: I514cd9708a7fbe9a989937fac62d00b464d7362d Reviewed-by: Simon Hausmann <[email protected]> Reviewed-by: Valery Kotov <[email protected]> Reviewed-by: Pasi Keränen <[email protected]>
* | More cleanupsLars Knoll2015-04-211-2/+2
|/ | | | | | | | Get rid of Value::asObject(), and pass const Managed pointers into some more vtable methods. Change-Id: Ia4f427d5fd8868f77b4015d1ce5424d32bfc2115 Reviewed-by: Simon Hausmann <[email protected]>
* 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 <[email protected]>
* Exposed TypedArray private APIs for Canvas3D use.Pasi Keranen2015-02-111-3/+3
| | | | | | | | | | Exported QV4::TypedArray, QV4::ArrayBuffer and QV4::Heap::ArrayBuffer in to the private API set. Changed ArrayBuffer length in the constructor to size_t instead of int. Added accessor methods to TypedArray array type and byte length. Change-Id: I3f89b8e263012bc90cc665aed5744cbc66379204 Reviewed-by: Simon Hausmann <[email protected]>
* Cleanup destruction of heap objectsLars Knoll2014-11-211-1/+2
| | | | | | | | 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 <[email protected]>
* Use Heap objects inside argumentsobject, arraybuffer and errorobjectLars Knoll2014-11-121-1/+3
| | | | | Change-Id: Iad76a1351dcca1fd46303a1072540c23a8ef6722 Reviewed-by: Simon Hausmann <[email protected]>
* Move Data for typedarrays into Heap namespaceLars Knoll2014-11-101-10/+15
| | | | | Change-Id: I1737423c22e0c68c9eaa14f6d4f5b1e48aea4a77 Reviewed-by: Simon Hausmann <[email protected]>
* Move Data of FunctionObject and related classes into HeapLars Knoll2014-11-081-1/+1
| | | | | Change-Id: Iadf74f953798c1884e0ec704ccb7c70d971e3273 Reviewed-by: Simon Hausmann <[email protected]>
* Move Object::Data into the Heap namespaceLars Knoll2014-11-081-1/+1
| | | | | Change-Id: I9d30081f71b83bc86f5e5714e23396b18c4d54c5 Reviewed-by: Simon Hausmann <[email protected]>
* Implement ArrayBufferLars Knoll2014-10-291-0/+93
This is the first class required to support typed arrays in our JS engine. Change-Id: I0fe1e1ca430769c171912dda207cfae772e9b9db Reviewed-by: Simon Hausmann <[email protected]>