aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jit/qv4assembler_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Optimize JIT generated for for CreateCallContextLars Knoll2018-01-021-0/+1
| | | | | | | | | Added a storeHeapObject() call to the assembler, to ensure we store the pointer returned by newCallContext() correctly on 32 and 64 bit platforms. Change-Id: I2141d5dd3cdd39a9b8886236100e0437159c6fb9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* JIT: Inline load(Scoped)Local and store(Scoped)Local instructionsLars Knoll2017-11-301-0/+2
| | | | | | | | Generate inline code for loading and storing (scoped) locals in the JIT. Change-Id: I6eb72126a0a2c6012bf6e73df245c9301bd4c48d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* V4: Add a baseline JITErik Verbruggen2017-11-171-0/+188
| | | | | | | | This patch add a JIT back in for all platforms that supported JITting before, with the exception of MIPS. Change-Id: I51bc5ce3a2ac40e0510bd72a563af897c5b60343 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove now unused filesLars Knoll2017-06-301-1851/+0
| | | | | | | | | Remove all files from the old compiler pipeline that are now unused. This includes the whole IR, JIT code generation, and the old Moth Isel. Change-Id: I50d06abfbcf0e9755a54ed94638f8bb74f9512b1 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/devSimon Hausmann2017-04-081-39/+56
|\
| * Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-04-071-39/+56
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4vme_moth.cpp Change-Id: I865d794e550a263387a39ca8d051ebf48b70cbc0
| | * 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>
* | | Cleanups: Remove Steele barrier codeLars Knoll2017-04-071-24/+2
|/ / | | | | | | | | | | | | | | | | | | | | Remove the code related to the Steele write barrier and incremental garbage collection. This is in preparation for a fully concurrent GC, that will not have and incremental mode and will use a Yuasa write barrier. Change-Id: I155a85211c5be61e792e056321fbceaee47c0d87 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-301-8/+1
|\| | | | | | | | | | | | | | | Conflicts: src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h Change-Id: Ibfe69610ccd1f275f181b2bd87feece4ba221e50
| * 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>
* | Merge remote-tracking branch 'origin/5.9' into HEADSimon Hausmann2017-03-231-9/+16
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4mmdefs_p.h Change-Id: I9966750b7cd9106b78e4c4779f12b95a481cca40
| * 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>
* | Implement a real write barrierLars Knoll2017-03-091-16/+139
| | | | | | | | | | | | | | | | | | | | Implement a Steel write barrier for our objects. The barrier is interesting as it can also be used for incremental GC runs by simply turning the barrier on and leaving old objects marked as black. Change-Id: I0b273974d94a990dee3cd9298089b8b202c75bf2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Mark where we need a write barrier in the JITLars Knoll2017-03-091-100/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | Separate the loadAddress calls into loadAddressForReading and loadAddressForWriting. In the second case, add an out argument that specifies whether the write will need a barrier. Pass the write barrier type that is required for a store down into the actual store methods. Change-Id: I3f7634ab82d82f1b20dab331e083d1a662cd314e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add an actual write barrier and centralize it in one placeLars Knoll2017-03-091-1/+1
|/ | | | | | | | All stores into the Heap from C++ and Moth should now go through the write barrier. Change-Id: Iae9347754b90d68c10fade9f345842e86ec460cd Reviewed-by: Simon Hausmann <simon.hausmann@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>