aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit/qv4assembler_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix JITted code for jump strict-not-equal undefined on 32bitErik Verbruggen2018-03-151-10/+27
| | | | | | | | | | | | | | The generated code for jump-on-strict-not-equal-undefined used the same logic (but with inverted conditions) as the equal case. For equality, one can jump to else if the value parts are not the same. So, for not-equal, if the value parts are the same, it would jump to the else block if they are the same. Meaning, an encoded int value of 0 (which is strict-not-equal to undefined) would end up being evaluated as equal. Task-number: QTBUG-66832 Change-Id: I5c6b8e9b11be53ae21a7164e0a1e0cbfd204f401 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix double conversion code generation when cross-compilingSimon Hausmann2017-04-061-0/+14
| | | | | | | | | We can't use QV4_USE_64_BIT_VALUE_ENCODING for deciding how generate code for checking if the tag of a value contains the necessary mask to detect doubles. Change-Id: Id5a5c1b136313aa4dfd2c997898e97cd4ebaeb83 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix shadow stack space handling when cross-compilingSimon Hausmann2017-04-061-7/+1
| | | | | | | | | | | | | Both MIPS and X86-64 on Windows reserve space for four registers on the stack, that the called function may use to spill the parameters passed in registers. This needs to be handled without #ifdefs in order to support cross-compilation and from the looks of it it was also wrong on MIPS. Change-Id: If65a6a0f6f64b8536703d32e7678e30ad807f7c8 Reviewed-by: Julien Brianceau <jbriance@cisco.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix Clang warning about member in template class not definedThiago Macieira2017-04-031-0/+3
| | | | | | | | | | | | qv4isel_masm.cpp:285:44: warning: instantiation of variable 'QV4::JIT::Assembler<QV4::JIT::AssemblerTargetConfiguration<JSC::MacroAssemblerX86_64, QV4::JIT::TargetOperatingSystemSpecialization::NoOperatingSystemSpecialization>>::Void' required here, but no definition is available [-Wundefined-var-template] Depending on qv4assembler.cpp instantiating the same template that q4isel_masm.pp required is fragile. So move the definition to the header, next to the class. Change-Id: I27b55fdf514247549455fffd14b178ec9d4b508d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix encoding of primitive constants when cross-compilingSimon Hausmann2017-03-311-20/+23
| | | | | | | | | | QV4::Primitive is using host value encoding, which can differ from the target. The source of QV4::Primitive in the code generator is usually IR::Const, transformed via convertToValue(). That function becomes a template that converts to a simple target primitive type. Change-Id: If028aea9551d77d81eec306f60fd995c25b76710 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix value type encoding constant usage when cross-compilingSimon Hausmann2017-03-301-12/+17
| | | | | | | | | | | | | | | Our two value encodings use different masks for the upper 4 bytes. Depending on the target architecture we must use different values when generating code that uses these masks. This patch replaces the #ifdef'ed ValueTypeInternal_* enum values with two C++11 scoped enums that allows for the co-existence of both throughout the code base as well as selective use in the code generators. Change-Id: I380c8c28b84df2874cca521b78bfe7f9388ed228 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix stack pointer arithmetic when cross-compilingSimon Hausmann2017-03-291-1/+1
| | | | | | | | | | Replace the use of size(void*) with target assembler specific values for the pointer size, when calculating offsets into the stack for poke/peek/push/pop and placing arguments onto the stack before calling functions. Change-Id: I3aff540f0083967e75b61e0c29dbeb4d9ecfa433 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Minor cleanup: Remove unused functionSimon Hausmann2017-03-291-7/+0
| | | | | Change-Id: Ie8d0c7b360ff120f381e33439037cf7b01257456 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Complete transition to standard layout classes for JIT accessSimon Hausmann2017-03-211-1/+1
| | | | | | | | | | | | Move the Runtime function pointer array into EngineBase so that we can eliminate the last use of qOffsetOf. For improved cache locality the memory manager point is now also located in the EngineBase. Change-Id: I0b3cf44c726aa4fb8db1206cc414a56c2f522a84 Task-number: QTBUG-58666 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Protect ExecutionContext member usage against word size differencesSimon Hausmann2017-03-171-1/+1
| | | | | | | | | | | Ensure the offsets we're taking from ExecutionContext members in the JIT code generator can be translated from host architecture sizes to target architecture, using assertions and a memory layout that we already have in the dev branch with commit 4de7e48ab160dacc7a09360e80264eac4945a8f4. Task-number: QTBUG-58666 Change-Id: I26cdbd1ddb995b116624fab16f7caba5d21c13b5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Prepare run-time method calling mechanism for cross-compilationSimon Hausmann2017-03-171-4/+5
| | | | | | | | | | | | | | | | | | | The current way of encoding the offsetof() of the method_ members in QV4::Runtime is not portable when cross-compiling from a 64-bit host (where the offsetof would be calculated on) to a 32-bit target (where the offset would be different), or vice versa. In preparation for making this work, this patch first replaces the direct use of the run-time members with use through a void * and an enum for indexing. This gives us some type-safety in some places and will also allow for a translation of the pointer offset from host pointer indexing to target pointer indexes. As a bonus we can avoid going through the engine->runtime indirection in the interpreter altogether and call the static methods right away. Task-number: QTBUG-58666 Change-Id: I3cd6459523923a9719408317fa729bca19c2bf3c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix running of 32-bit JIT code generated on 64-bit hostsSimon Hausmann2017-03-171-4/+10
| | | | | | | | | | | | | | | The offsets of members encoded in JIT generated code differ between 32-bit and 64-bit architectures. This patch moves some of the ExecutionEngine members into a separate standard-layout EngineBase class (in line with the same class in commit 2a554434a571dcefd26cf10ef8c5ae8b3b7d66db and subject to merging). By ensuring that the members are stored at pointer intervals, we can translate from host pointer size to target when generating the code. Task-number: QTBUG-58666 Change-Id: I1c38a7da059826848b80fd9972ed073214501386 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* V4 JIT: Store the NaNEncodeMask in a register on 64bitErik Verbruggen2017-02-241-15/+8
| | | | | | | | | | When a callee saved register is available on 64bit platforms, put the Value::NaNEncodeMask in it. This saves one instruction for every load or store of doubles. Change-Id: I57262988610996e6a912e97d3026d4bb8ce26fe8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix assembler cross-compilation on 32-bit hostsSimon Hausmann2017-02-071-3/+2
| | | | | | | | | The GOT register restoring logic needs to be done via TargetPLatform members instead of plain #ifdefs. Task-number: QTBUG-58569 Change-Id: If00d3f92558361ad5dcb20c3ff7eff78d31d75d3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Eliminate VALUE_FITS_IN_REGISTER #ifdefSimon Hausmann2017-02-061-1/+44
| | | | | | | | | | These macros do not apply anymore when cross-compiling. This patch replaces the macro use for locals JS stack initialization with register size dependent operations as well as when loading the this object into a stack slot. Change-Id: Ia986f6dbfa37c6d6ce2f1de6253e7008e4aa87dd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove platform ifdefs for ISE::convertTypeToDoubleSimon Hausmann2017-01-311-0/+26
| | | | | Change-Id: I75db85fbd601d4790a3cb9af483474a976d00e86 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove platform ifdefs for generateCJumpStrictUndefinedSimon Hausmann2017-01-311-16/+37
| | | | | | | | Use templates to perform the platform encoding dependent way of comparing a given value against undefined. Change-Id: I7e7726455023200bd74e62d2dbc4e2c2908d9e64 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove platform ifdefs in JIT::ISel::visitRetSimon Hausmann2017-01-311-0/+99
| | | | | | | | Use templates to encode the various platform dependent ways of encoding the return values. Change-Id: Icb481a75924da7d78396ff1c95474dc9c29ca494 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Eliminate platform #ifdef for loading stringsSimon Hausmann2017-01-311-0/+12
| | | | | | | | Use templates to abstract the two different ways of making a QV4::Value hold the address of a managed, in this case to a runtime string. Change-Id: Ibe9ae10fdcef68dbfc7c61fbb3ec8b3a1d50f1a2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix intermixed 32-bit/64-bit buildSimon Hausmann2017-01-311-4/+23
| | | | | | | | | | | | | Replace the use of TrustedImmPtr(0) with target register size dependent template functions, as TrustedImmPtr is forbidden for non-zero values (non-relocatable code) and for zero still ends up using functions in the underlying assembler that are behind #ifdefs. Similarly the use of xorPtr does not compile with ARMv7, so use the zeroRegister abstraction instead. Change-Id: I84c1792847bd51d1cf5f305c3589517583b816f3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Correctly specialize TargetPlatform as templateSimon Hausmann2017-01-311-8/+21
| | | | | Change-Id: I37d2a2d74e150b92f5a338d799def337dcb8abd9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove 64-/32-bit platform ifdef in assembler instruction selectionSimon Hausmann2017-01-311-0/+80
| | | | | | | | We can replace that code with a compile-time if statement where the compiler will throw away the unused part. Change-Id: I827633a14b3025bb7acaef6f85a52682d6df3da1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move generateRuntimeCall macroSimon Hausmann2017-01-311-0/+7
| | | | | | | | Move it into JITAssembler for future use there. All it requires is making the assembler to use a macro parameter. Change-Id: I204e91d1b24eb02e476d8f4a43f3cd1665df0560 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move loading of register arguments into 8-byte register opsSimon Hausmann2017-01-311-46/+88
| | | | | Change-Id: I779fff3a925015c34162542648b8074692c0b974 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace ifdefs with templates when loading double constantsSimon Hausmann2017-01-311-10/+15
| | | | | Change-Id: I33155d8071d03250edefaf93f769c9629a5f827f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace platform ifdefs in copyValue with template specializationsSimon Hausmann2017-01-311-18/+18
| | | | | Change-Id: Iecc92f86a7314e4674f140251467c0654451abef Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove ifdefs in JIT::Assembler:storeValueSimon Hausmann2017-01-311-8/+14
| | | | | Change-Id: I4660bbf0dde4aef15be07ea61c1e0c181ec696be Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace more storeDouble 64/32-bit #ifdef variation with templatesSimon Hausmann2017-01-311-12/+16
| | | | | Change-Id: I56159645dd896eff0874129db6c0d53241ad901e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace platform #ifdefs in Assembler::storeReturnValueSimon Hausmann2017-01-311-48/+29
| | | | | | | | | | | Use RegisterSizeDependentAssembler for the 64- and 32-bit implementations of using the return value register(s). The fallback of returning the double via the stack is removed as it was not used in any of our JIT supported target architectures AFAIK. Change-Id: I27194edfe6676992d17bd09cc50ea7da4e339c22 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* 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>