aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit/qv4assembler_p.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Get rid of #ifdef for JIT::Assembler::generateCJumpOnCompareSimon Hausmann2017-01-311-20/+58
| | | | | | | ...by moving the body into the 8-byte register operations class. Change-Id: I386c1af711935f08f48cb65adb2f1f4fec64322d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Template-specialize the mangling/demangling Assembler::loadDouble/storeDoubleSimon Hausmann2017-01-301-14/+51
| | | | | Change-Id: If8e566f31cf036459eba935fadb31359f436454a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Include the JIT assembler in qmldevtoolsSimon Hausmann2017-01-281-2/+5
| | | | | | Change-Id: I69b74e01dcffe82caafb7aa8495b3036afc2b933 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make QV4::JIT::InstructionSelection a templateSimon Hausmann2017-01-281-2/+0
| | | | | | | | | | This completes the foundation of being able to include all assembler backends in one build. The next steps will be template specialization instead of #ifdefs for target architecture dependent instruction selection. Change-Id: I048a5e582d5993dc422577981e32e7cd93b9f0f8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make QV4::JIT::Assembler a templateSimon Hausmann2017-01-281-49/+118
| | | | | | | We are going to need multiple variants of it in the future. Change-Id: Ieeec833f911b4cdeb2de4e9afb982b90424cd157 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Changed JSC::MacroAssembler to be a templateSimon Hausmann2017-01-281-14/+14
| | | | | Change-Id: If6edb7ed0fac51e93b218eb45c01274a87b9e904 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make QV4::JIT::TargetPlatform a templateSimon Hausmann2017-01-281-2/+18
| | | | | | | | In the future we're going to need different specializations of that depending on the target platform chosen at run-time. Change-Id: I2ed6f41c3eb0487d83afee01f81b78361678dfd9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up JIT::TargetPlatform structSimon Hausmann2017-01-281-0/+4
| | | | | | | | | Similar to the previous change, minimize the dependency on the JSC::MacroAssembler interface, to allow changing it more easily in the future. Change-Id: I3ab5a4c96b4d3e0a341697401fafe994be0406d0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Minor cleanup: Move LookupCall and RuntimeCall into AssemblerSimon Hausmann2017-01-281-19/+19
| | | | | Change-Id: I31d440d6dc3f42ba33ae42af7ba42a6d045a02fb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Break circular assembler dependencySimon Hausmann2017-01-111-2/+2
| | | | | | | | | The QV4::Assembler does not need a reference to the ISel that uses the assembler, a reference to the JS unit generator for string registration is sufficient. Change-Id: I9e929e4d0aecbf0144296f85cb8d208296f28003 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-10-101-0/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/quick/quickwidgets/quickwidget/main.cpp src/qml/jsruntime/qv4jsonobject.cpp src/qml/jsruntime/qv4qobjectwrapper.cpp src/qml/jsruntime/qv4qobjectwrapper_p.h src/qml/qml/qqmlengine.cpp src/qml/qml/qqmlpropertycache.cpp src/qml/qml/qqmlpropertycache_p.h src/quick/items/qquickanimatedsprite.cpp src/quick/items/qquickitem.cpp src/quick/items/qquickitem.h src/quick/items/qquickitem_p.h src/quick/items/qquickview_p.h src/quick/scenegraph/qsgcontext.cpp src/quick/scenegraph/qsgdefaultrendercontext.cpp Change-Id: I172c6fbff97208f21ed4c8b6db3d1747a889f22b
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-301-0/+5
| |\ | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktext/tst_qquicktext.cpp Change-Id: I241cd418bb7e7b95e0a0a2ee4c465d48be2a5582
| | * V4: Free up 2 address bits in 64bit modeErik Verbruggen2016-09-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This allows for the OS to use 49 address bits. It also maps JS Undefined to the C++ nullptr on 64bit. Task-number: QTBUG-54822 Change-Id: I7cc90620f499be1506a61aac77d72d067308838c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | V4: Replace 3 QHashes with std::vectorsErik Verbruggen2016-08-241-6/+4
| | | | | | | | | | | | | | | | | | | | | All keyed on basic block index. Change-Id: I98d46a36896d4b1ab45882ea9f38d0539ffb319e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | V4: Fix JavaScript finally-block executionErik Verbruggen2016-08-101-42/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After moving all runtime functions into the Runtime class and doing indirect function calls, the code generation would always emit code to check for an exception after a call. This is problematic for methods that do not throw, but might be called when an exception is thrown. I.e. in a finally block. This is especially problematic for methods like popScope, the very first runtime method that is called in a finally block. The result was that after popScope, execution was passed over to the exception handler block for that finally block (meaning: the body of the finally block was never executed). The fix is to declare an enumerator in an anonymous enum for each runtime method that indicates if an exception check is needed. The existing ExceptionCheck templates are used to set the value. Change-Id: I5bd8bcf2a92acabf2a33b3764447de6cc364bba9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QML: fix inconsistent-missing-override warningErik Verbruggen2016-08-081-1/+1
| | | | | | | | | | | | | | | Change-Id: I3399f1ce4abb8cb4b78c5a7a218321f308e916fb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Make generated code loading constants relocatableSimon Hausmann2016-08-021-21/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On 32-bit architectures we were encoding the absolute address of generated constants in memory into the load instruction. In order to make the code reloctable, this patch changes the JIT over to use the constant table in the compilation unit. This means two additional loads per constant. On architectures that support instruction pointer relative addressing, we can try to fix this in the future (arm32 for example). Change-Id: I8ed7aa7c67711696d6c46c72b3b642d610ff2cbc Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Fix ICC change-of-sign warningThiago Macieira2016-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | INT_MIN is negative. qv4assembler_p.h(108): warning #68: integer conversion resulted in a change of sign Change-Id: I149e0540c00745fe8119fffd1463d31acd727690 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Added basic loading of compilation units from diskSimon Hausmann2016-07-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This remains hidden behind the QML_DISK_CACHE flag until all backends support it and the verification code is in place. Change-Id: Ic77c64e20a2dc4c43473c47640e09f8070237e85 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Remove another instance of TrustedImmPtr usage in the JITSimon Hausmann2016-07-141-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use of TrustedImmPtr means the code becomes unrelocatable. Replace the usage with constant table use. This does not eliminate the absolute addressing right now as the constant table still uses patches, but that needs to be ported separately anyway. Change-Id: I469520fba9c9068f041157e39bc57552558e3355 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Remove some dead code in the JITSimon Hausmann2016-07-141-55/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some internal API in the JIT that explicitly uses TrustedImmPtr is not used anymore. To prevent future accidental usage and thus introduce non-relocatable code, let's remove the convenience API. Change-Id: I7f1ed23808449991b5765467845c66fe116ca8a0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix a missing override declaration.Robin Burchell2016-06-221-1/+1
| | | | | | | | | | | | | | | Change-Id: Iea2fec595e588571ed3d9a5c843404d52cd24c92 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Added basic support for saving compilation units to diskSimon Hausmann2016-06-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Hidden behind a QML_DISK_CACHE=1 environment variable we will now attempt to save a binary representation of the type compilation for Foo.qml next to it called Foo.qmlc. Change-Id: I27e800b50cdb186669256fd277578ea1f1e70513 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | CleanupSimon Hausmann2016-05-061-2/+0
| | | | | | | | | | | | | | | | | | | | | Remove unused virtual function Change-Id: I728a0f982f2790921e3af5332fa1ee14391239c5 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | | CleanupLars Knoll2016-04-111-22/+14
| | | | | | | | | | | | | | | | | | | | | | | | Remove support for calls that would need to be relocated and force all calls to be either runtime or lookup calls. Change-Id: If434608a8247680c0a01216dc75b09f23e7f753e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Convert the remaining runtime methods to new calling conventionLars Knoll2016-04-111-5/+0
| | | | | | | | | | | | | | | Change-Id: I88ad3ca430508617d527715aa85ae8474ab7c621 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Convert comparison methods to the new runtime syntaxLars Knoll2016-04-111-1/+4
| | | | | | | | | | | | | | | Change-Id: Iad4dadddefca2d6322d4f778272b75d64e1a746f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Start converting Runtime calls to 'vtable' callsLars Knoll2016-04-111-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code was using absolute addressing for calls into methods of the Runtime. This produces non relocatable code, which is bad for caching. So instead, we'll have a table of function pointers for all runtime methods in the ExecutionEngine, and do the runtime calls through that table. Change-Id: I75c04f699ea11c38f742575f9ce264c0c5ad0c96 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Remove some unused codeLars Knoll2016-04-111-22/+1
|/ / | | | | | | | | Change-Id: Ic13248877e8f822cfcd9a371fc6504469b1156c8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove a case of type-punning.Erik Verbruggen2016-01-201-6/+4
| | | | | | | | | | | | | | | | This is officially undefined behavior. Change-Id: I74d7d7d6cf6a774bc6f90c5a0362ce5ba07768f8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | V4: Rename StackFrameRegister to FramePointerRegister.Erik Verbruggen2016-01-191-2/+2
| | | | | | | | | | | | | | Because that's what CPU documentation calls it. Change-Id: I36efd9f424f9b4f4a8b7cbc65a2e63c67be80b95 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>
* Remove prohibited uses of underscore + capital letterThiago Macieira2016-01-081-1/+1
| | | | | | | | | | | | | | All identifiers starting with an underscore and a capital letter are reserved to the compiler and must never be used by the user code. Try to find a better name or, in the worst case, move the underscore to the last position in these identifiers. See commit cf63c63d558227fdbef09699c261560e7474f5ea in qtbase for a case of such an identifier causing a build breakage when the compiler began treating it specially (it was _Nullable). Change-Id: I1d0f78915b5942aab07cffff140f9f39c29f0fdf Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Remove uses of QT_POINTER_SIZE, replacing with proper constructsThiago Macieira2015-10-291-1/+1
| | | | | | | | | | | Where the size of void* was really wanted, use sizeof(void*). There's only one use of QT_POINTER_SIZE in qtdeclarative now, in fdegen/ main.cpp selecting the ELF size constants. It's easier to keep it like that than to use C++ selecting constructs. The tool isn't built anyway. Change-Id: I1d0f78915b5942aab07cffff140fa0f99ce7d7d4 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Use the correct macro to detect 64-bit value encodingThiago Macieira2015-10-291-3/+3
| | | | | | | We have a macro for it, so let's use it. Change-Id: I1d0f78915b5942aab07cffff140fa0ac23392362 Reviewed-by: Erik Verbruggen <erik.verbruggen@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>
* Remove type punning from QV4::Value.Erik Verbruggen2015-07-241-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* V4: add JIT support for mips platforms (32-bit) and enable itJulien Brianceau2015-04-271-0/+12
| | | | | | | [ChangeLog][QtQml] Enabled Just-In-Time compilation for JavaScript on MIPS Change-Id: Idce070f29645760d6376767ef67e4592828c104d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* V4 JIT: cosmetic changeJulien Brianceau2015-04-141-4/+4
| | | | | | | | Since 4377d44fb7399751ed4f284bb4be7ece494aff6d, we can avoid one generateFunctionCallImp bounce. Change-Id: I2e92578dbc26a614f7626d2c28a2d9b28dd06b6b 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>
* Fix run-time string handling with regards to the new heapSimon Hausmann2014-11-211-4/+4
| | | | | | | | | | | | | | | | | 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>
* Change signature or runtime methods to take an engine pointerLars Knoll2014-11-121-10/+11
| | | | | | | | | 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>
* Refactor ExecutionContextsLars Knoll2014-11-081-3/+3
| | | | | | | Move the Data class out into the Heap namespace. Change-Id: I2b798deb53812a08155c92a0e6ef2dcd2ea137b8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 JIT: fix stack layout.Erik Verbruggen2014-08-261-13/+15
| | | | | | | | | | | | | | | | | Commit d9f33ccdef985badc56fd8940373748626beffc7 introduced an off-by-one in the calculation of the offset of a saved register (in StackLayout::savedRegPointer), resulting in overwriting a callee saved register with the tag of a QV4::Value. This method now calculates those pointers relative to the bottom of the stack frame. The off-by-one didn't happen before that patch, because there was a magical +1 used in the constructor for the number of callee saved registers, thereby prevented this from happening. However, that resulted in a frame size that was unnecessary big. Task-number: QTBUG-40927 Change-Id: If88fe9f3490a4d23a1e69c630c87219fcfef671f Reviewed-by: Simon Hausmann <simon.hausmann@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>
* V4 JIT: support saving used callee saved FP registers.Erik Verbruggen2014-08-141-6/+11
| | | | | | | | This is not used yet by any platform/abi we support, because we do not define any callee-saved FP registers. Yet. Change-Id: I5857a452456175398c5e9681ff33800b9431b9da Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 JIT: parameterize the prologue and epilogue generationErik Verbruggen2014-08-141-15/+17
| | | | | | | | | ... with the regular (non-FP) registers that need to be saved. This patch shouldn't change any of the JIT generated code, because all regular callee saved registers are passed in. Change-Id: Id11b8f37f06d80e8015ac6f0d0ccefdfa3342cbe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-08-141-3/+2
|\ | | | | | | Change-Id: I2e06c2fcd8aa9d5d090f0568be75272ec82f7b20
| * V4 JIT: fix JS stack frame size calculation.Erik Verbruggen2014-08-131-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | StackLayout::calculateJSStackFrameSize now returns the size in number of QV4::Value items, instead of bytes. The value is then multiplied in the assembler by sizeof(Value) to get the number of bytes. Previously, the return value was number of bytes, which also got multiplied. A direct effect is that the JS stack size will be ~87% smaller, with the nice effect that the GC will run faster (less roots on the stack). It also won't retain objects whose reference accidentally ended up on the stack below the used portion for the current function, so possibly freeing (more) objects (earlier) than before. Change-Id: Idd5a9c173e641c03e6b8a6fe743e403eda34dfe0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | V4 JIT: fix stack use below stack pointerErik Verbruggen2014-08-141-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | When storing a double value returned from a function call on platforms where the value wouldn't fit in a register, we used to store it on the stack and then load it into a FP register. This stack use was done without first lowering the stack pointer. For x86 and ARM, the value is loaded directly into the FP register, and for other non-64-bit platforms it correctly allocates the stack slot. Change-Id: Idbc260038958a036ac2a7383d845199626decc8e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>