aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Cleanups in the runtime APILars Knoll2017-08-281-6/+5
| | | | | Change-Id: I0a669d3b643f1120c00767a104622453decd212b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix trace macros for runtime countersErik Verbruggen2017-08-021-2/+2
| | | | | Change-Id: I44e55350c20cb10cfb2fd58a46c5c620b71a7017 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up some duplicated methodsLars Knoll2016-11-291-3/+0
| | | | | Change-Id: Iad64dd2c330ca85a28f8f5c776b0ede623203558 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Obliterate QQmlAccessorsErik Verbruggen2016-08-301-2/+0
| | | | | Change-Id: I70a080feb401cf23aef1bde44a19a11e27642f30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Revert "QML: When available, use QQmlAccessors to read properties."Simon Hausmann2016-07-141-5/+0
| | | | | | | | | | | This reverts commit f6fee09942de7901a708c4e16db0c7c82550e8c5. The accessor pointers were embedded in the generated machine/byte code, which makes it non-relocatable. As discussed, for the moment the ability to have relocatable code is prioritized. But the goal is to re-enable accessor accelerated property access through lookups. Change-Id: I18ec9ce31901c1fae3e58ac0c41bc87791e8c380 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-241-1/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine_p.h src/qml/jsruntime/qv4runtime_p.h src/qml/qml/qqmldelayedcallqueue.cpp src/qml/qml/qqmlvaluetypewrapper.cpp src/qml/qml/qqmlvmemetaobject.cpp src/qml/qml/v8/qv8engine_p.h tests/auto/quick/qquicktext/tst_qquicktext.cpp Change-Id: I3f0608c7beb88088cbbef4d0db59920f56deaea9
| * V4: allow inlining of ExecutionEngine::{qml,js}Engine()Erik Verbruggen2016-05-201-0/+7
| | | | | | | | | | | | | | | | 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>
* | De-inline static methods of struct Runtime.Friedemann Kleint2016-05-091-343/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They are accessed via function pointer, so, inlining them does not have any effect. Move the implementation into qv4runtime.cpp, fixing MinGW-errors: qtdeclarative/src/qml/jsruntime/qv4runtime_p.h:144:22: error: 'static QV4::ReturnedValue QV4::Runtime::method_uPlus(const QV4::Value&)' redeclared without dllimport attribute after being referenced with dll linkage [-Werror] inline ReturnedValue Runtime::method_uPlus(const Value &value) ^ qtdeclarative/src/qml/jsruntime/qv4runtime_p.h:157:22: error: 'static QV4::ReturnedValue QV4::Runtime::method_uMinus(const QV4::Value&)' redeclared without dllimport attribute after being referenced with dll linkage [-Werror] inline ReturnedValue Runtime::method_uMinus(const Value &value) ^ qtdeclarative/src/qml/jsruntime/qv4runtime_p.h:170:22: error: 'static QV4::ReturnedValue QV4::Runtime::method_complement(const QV4::Value&)' redeclared without dllimport attribute after being referenced with dll linkage [-Werror] inline ReturnedValue Runtime::method_complement(const Value &value) Task-number: QTBUG-53222 Change-Id: I5a9bd162e0b1f52c66cd6a8efbf407fcd46d7fc7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | QML: When available, use QQmlAccessors to read properties.Erik Verbruggen2016-04-121-1/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a property is read from a QObject or the QML scope object, and we can statically resolve the type to qreal/QObject/int/bool/QString, and the property has an accessor declared for it, then use that accessor to do the read. This collapses the path of e.g.: Runtime::getQmlScopeObjectProperty -> QObjectWrapper::getProperty -> QObjectWrapper::getProperty -> LoadProperty -> QQmlAccessor::read (all of which do various checks for all the stuff mentioned above) to: Runtime::accessQmlScopeObjectQRealProperty -> QQmlAccessor::read which is a simple 4-line function, and doesn't need to do any check. According to valgrind, this saves 170 instructions on x86 for the simple binding: Item { width: height } Change-Id: I0761d01e8f1a3c13ecbffe2d8e0317ce9c0a4db0 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Convert the remaining runtime methods to new calling conventionLars Knoll2016-04-111-19/+19
| | | | | | | | | | Change-Id: I88ad3ca430508617d527715aa85ae8474ab7c621 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Convert comparison methods to the new runtime syntaxLars Knoll2016-04-111-11/+11
| | | | | | | | | | Change-Id: Iad4dadddefca2d6322d4f778272b75d64e1a746f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Convert unary operations to new calling conventionLars Knoll2016-04-111-4/+4
| | | | | | | | | | Change-Id: I629e336ec41f46390b7ed9f9365a832e1722b61a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Convert 3rd batch of runtime methodsLars Knoll2016-04-111-1/+1
| | | | | | | | | | Change-Id: Idc277fd95d2b397a573631026549da44801109f4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move the Runtime API into it's own fileLars Knoll2016-04-111-145/+1
|/ | | | | | | | We will need to access the runtime API in the engine, so let's separate the API from the implementation details. Change-Id: Iaa638fa19cc3859fcd210963396a248e64fb6955 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>
* QML: Fix typeof context property.Erik Verbruggen2015-10-271-0/+2
| | | | | | | | This was missing from f21e8c641af6b2d10f0d7e7e0fc6a755dab3673c. Task-number: QTBUG-48524 Change-Id: I5cc6a979d965a1ef6b7fbc916a7ca9df868b459a Reviewed-by: Simon Hausmann <simon.hausmann@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>
* Access the id objects through a specialized runtime methodLars Knoll2015-08-121-1/+2
| | | | | | | | This brings us one step closer to getting rid of the QQmlContextWrapper. Change-Id: Ied57f4c174c2ebd95096310a4ad4c0c28787e7a4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Access context properties through the qml contextLars Knoll2015-08-101-1/+3
| | | | | | | And get rid of another temp in the IR. Change-Id: I039393e020e5141f1986aee276246c30fd8057f3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Use the QmlContext to access properties of the scope objectLars Knoll2015-08-101-1/+3
| | | | | | | | | Add some runtime methods to access properties of the scope object directly (using the QmlContext), and generate proper code to call those. Change-Id: I0b29357c9a3b9ad53ba568ec6cb763e8ecb10f21 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Add ability to retrieve and use the QmlContext from our generated codeLars Knoll2015-08-101-5/+6
| | | | | | | | | | | | | | Our generated code (JIT and interpreter) should operate on the QML context to retrieve QML related things. That's better than operating on 4 different temps. So this commit introduces the QML context as a temp in the code we generate for QML. The next commits will move things over to use that context with specialized runtime methods instead of using generic subscript/get calls on the different subobjects. Change-Id: Ia05cf339de9cdd23003f35cf78ede17d2590f8de Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* V4: add int32 codepath to Runtime::div.Erik Verbruggen2015-08-061-0/+9
| | | | | | | Mirrors Runtime::mod, and prevents unnecessary conversion to double. Change-Id: Ib550ed3bc31aaf5bc5fd53524b396cce154d20a9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Remove type punning from QV4::Value.Erik Verbruggen2015-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Get rid of qv4value_inl_p.h and replace it by qv4typedvalue_p.hLars Knoll2015-04-241-1/+1
| | | | | | | | This is a cleaner separation and further reduces include dependencies in the definitions of our basic data structured. Change-Id: I18aa86cdea0c0dfbc16075d4d617af97e638811e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* More cleanups in qv4value_p.hLars Knoll2015-04-241-0/+1
| | | | | Change-Id: Ie48dc8f95daa4738e690902b5d33010afa7b974f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* 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 <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-155/+155
| | | | | | | | | | | | 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>
* Return a Heap::Object in Object::prototype()Lars Knoll2014-12-171-1/+1
| | | | | Change-Id: Ice0265ae558ba14497421a5bbf25ee9db76adab5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix run-time string handling with regards to the new heapSimon Hausmann2014-11-211-15/+16
| | | | | | | | | | | | | | | | | 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>
* Ported ExecutionEngine::newString and newIdentifier to Heap::StringSimon Hausmann2014-11-121-2/+2
| | | | | | | | | | Avoid the use of Returned<String> for newString and changed the identifier table to use Heap::String. This required moving some code back into Heap::String, but that's code that doesn't call back into the GC, so allocations and therefore future object moves aren't possible. Change-Id: I1dca3e9c12a9c56f09419af8cc8cba39fe04f720 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Ported most ExecutionEnginew::new* factory methods away from Returned<T>Simon Hausmann2014-11-121-1/+1
| | | | | | | | We don't need Returned<T> anymore with the QV4:: vs. Heap:: separation. Eliminating Returned<T> simplifies also some code. Change-Id: Ic2a9cd3c1a94f2ea37b539d3984d63997121c2b9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change signature or runtime methods to take an engine pointerLars Knoll2014-11-121-57/+57
| | | | | | | | | 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>
* Convert methods in RuntimeHelpers to take an engine pointerLars Knoll2014-11-121-7/+7
| | | | | | | This is safer and cleaner than to use a context pointer. Change-Id: Id5ef4e6667571897cd029125a0bdc18ce299da6d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup header file dependenciesLars Knoll2014-11-041-31/+1
| | | | | Change-Id: Ibb4658576a98b53de2eac2474ce4d5b9eb83b6ae Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove most calls to Value::managed()Lars Knoll2014-11-041-1/+1
| | | | | Change-Id: Id5b1cca542421d749711eff68520a4138ec95531 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 runtime: tune Runtime::add/sub/mul a bit.Erik Verbruggen2014-09-101-6/+6
| | | | | | | | | | Tell the compiler to schedule the int32 case first, tune the double conversion a bit (int64->double is quite expensive), and write the function in such a way that it matches typical overflow idiom which compilers recognize. Change-Id: Ieae9a60275716002fbdbc54e1d7291c8aad8c927 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-18/+10
| | | | | | | | | - 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>
* Accelerate property lookups for C++-based QObject singletons.Michael Brasser2014-08-071-0/+1
| | | | | Change-Id: Icbdf06a077014db5dd57cba42f84591433ec4196 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of CallDataRefLars Knoll2014-07-221-11/+11
| | | | | | | The class didn't really add any value. Change-Id: Ibd63c9b9b1fa3be6bfe8a70ca7fd4d6bf0c0019c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of StringRefLars Knoll2014-07-221-15/+15
| | | | | | | | 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>
* Extend the QML bootstrap library by the IR buildersSimon Hausmann2014-04-231-2/+14
| | | | | | | | | | | | | This is among other things needed to fix the qml import scanner to detect dependencies from .js files correctly. The patch also fixes the use of Q_QML_EXPORT towards Q_QML_PRIVATE_EXPORT where appropriate and corrects the wrong include path for the double conversion code to actually be relative to the file it is included from. This worked by accident because of other include paths present in the build. Change-Id: I338583dad2f76300819af8ab0dae8e5724c84430 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move inline function Bool Runtime::compareEqual() above usage.Friedemann Kleint2014-04-011-19/+19
| | | | | | | | | | Fix MinGW-warnings: src/qml/jsruntime/qv4runtime_p.h:496:13: warning: 'static QV4::Bool QV4::Runtime::compareEqual(QV4::ValueRef, QV4::ValueRef)' redeclared without dllimport attribute after being referenced with dll linkage Change-Id: Ieb212ed6aba2a0deeeddd033126ae7e9737bb38e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup our runtime methodsLars Knoll2014-03-111-211/+205
| | | | | | | | | Move all our runtime methods into the QV4::Runtime struct and give them nicer names without underscores. Sort them logically and remove a few unused methods. Change-Id: Ib69b71764ff194d0ba211aac581f9a99734d8180 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Determine whether or not an object literal requires a sparse array at ↵Simon Hausmann2014-02-241-1/+1
| | | | | | | compile time Change-Id: Ieb7f6ee97a4f251f1e2369850ebb9e2931f84ac1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up object literal handling with integral indicesSimon Hausmann2014-02-241-3/+1
| | | | | | | | | | | | | | | | | | | | | * Object literals with array indices are now created with one run-time call, instead of an initial one for non-integral keys followed by sub-sequent define_builtin_property calls. * Cleaned up propert name retrieval. Instead of using a visitor, it's easier to define a virtual method on the PropertyName type. The visitor doesn't buy us much as it's not possible to recurse within property names, and this way we can use it also from the function scanner to correctly determine the number of arguments needed for object literal initalizations. * Similarly the duplicated/common name member for all property assignments has been moved into PropertyName, for convenient access without AST casts. * Removed now unused builtin_define_property/settergetter functions from IR, run-time and moth. Change-Id: I90d54c81ea5f3f500f4f4a9c14f7caf5135e7f9f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Simplify some runtime codeLars Knoll2014-02-221-27/+17
| | | | | | | Simpler code and delivers the same performance. Change-Id: Ifd0398f0c123f4c21998f518574cf74cd7cf7e09 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Simplify some runtime methodsLars Knoll2014-02-071-15/+1
| | | | | | | | This gives as performant but simpler code, as the first line in toInt() checks if the value is integercompatible. Change-Id: I15d0ade231719116ca1c6c03a86106b7f5aaa9aa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Disentangle some includesLars Knoll2014-01-311-0/+1
| | | | | | | | | ScopedValue should require less dependencies. Hopefully we can then move it together with the main class definition at some point (ie. move ScopedValue int qv4value_p.h; similar for the other types). Change-Id: Ie7b31715cb718a90dba40845c7ae785a29855062 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>