aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtimeapi_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix lookup of enums declared in QML singletonsSimon Hausmann2018-03-161-1/+0
| | | | | | | | | | | | | | | | | | | | | Given the following expression var x = MySingleton.MyEnumValue where MySingleton is a QML (composite) singleton and MyEnumValue comes from a QML declared enum, we had code in place up to (and including) 5.10 to attempt to optimize that expression to a enum constant at compile time. In 5.10 that optimization does not exist anymore. In <= 5.10 we would also skip the optimization under certain circumstances (too many statementes, etc.). The fallback that is in place for handling this at run-time tried to be smart by avoiding the QQmlContextWrapper::get lookup and return straight a reference to the singleton as QObject. That works for regular property lookups, but it fails when trying to look up something like an enum, that isn't a meta-object property. Change-Id: I1819b9d8ae06a3f595e067bf5b018c4065be76bb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Correctly set this object when calling scope/context functionsErik Verbruggen2018-02-201-0/+2
| | | | | | | | | | | | | When a function is called that is in a QML scope or a QML context, set the 'this' object to the QML scope. This is done by introducing two new interpreter instructions, which get the context passed in. Note: this patch is 5.11 specific. 5.9 had a similair issue, but the implementation is quite different, so that was fixed separately. Task-number: QTBUG-66432 Change-Id: Ie43150cdd26360025895df28d31264985abf1c15 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move the construction of the JSCall frame into the runtimeLars Knoll2017-11-071-8/+8
| | | | | | | The VME shouldn't have to care about this part Change-Id: I9e49353dce29912f5a222b7ed1b42ace2aa8cebd Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Merge remote-tracking branch 'origin/dev' into HEADLars Knoll2017-10-221-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4isel_moth_p.h src/qml/compiler/qv4ssa.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm_p.h src/qml/jit/qv4regalloc.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4qmlcontext_p.h src/qml/jsruntime/qv4regexp.cpp src/qml/jsruntime/qv4regexp_p.h src/qml/jsruntime/qv4regexpobject.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/v8/qqmlbuiltinfunctions.cpp tests/auto/qml/qml.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp Change-Id: I1577e195c736f3414089036b957a01cb91a3ca23
* | Remove unused methodLars Knoll2017-09-151-1/+0
| | | | | | | | | | Change-Id: I87291d31c9e0d575211c1d7e364b46cd93b483ed Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove unused UnwindException instructionLars Knoll2017-08-281-1/+0
| | | | | | | | | | Change-Id: I8b93270b5aebd39df8f88166e183814f6391c0f5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Cleanup and inline context push/pop related codeLars Knoll2017-08-281-4/+2
| | | | | | | | | | Change-Id: I38ee6c3039663e10aee47b2005f8755fc9c50289 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Specialize possible direct calls to evalLars Knoll2017-08-251-0/+1
| | | | | | | | | | | | | | To avoid additional overhead on most function calls Change-Id: I2477b91fda6216b508c8331884a02b601f65590c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Cleanup object construction instructionsLars Knoll2017-08-251-5/+1
| | | | | | | | | | | | | | | | Remove the unused Create/Construct instructions, and rename the single remaining one to 'Construct'. Change-Id: I10163a15681156f37e34d21a05d195d3c22adcff Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Always retrieve the this object from the stackLars Knoll2017-08-101-1/+0
| | | | | | | | | | | | | | | | There is actually no point in even having it in the context, as it's immutable and can't become part of a closure. Change-Id: I375fd07b9c442d667488430ebd246e174fdb243f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | More consistent naming of instructions and runtime methodsLars Knoll2017-08-101-16/+16
| | | | | | | | | | Change-Id: Ib8af10a48749b16c48d75c91ad215396b201a9d5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Split StoreName into StoreNameStrict and StoreNameSloppyLars Knoll2017-08-101-1/+2
| | | | | | | | | | | | | | And adjust the name of the corresponding runtime functions. Change-Id: I4adf7b0e069d9b0dff9162cd1271dafc60be854b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove some unused runtime methodsLars Knoll2017-08-101-8/+0
| | | | | | | | | | Change-Id: Ief0ecf2783fa772a7738d0a6d001998c3967b727 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Refactor context handlingLars Knoll2017-08-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the push/pop context instructions to not modify the JS stack anymore, as that can cause conflicts with the VME (and was an ugly hack in any case). Instead, these instructions not return the old context, that is then stored in a temporary. Get rid of Engine::current and Engine::currentContext. The StackFrame structures do now contain the only and authoritive data. This finally gives us a nice setup where we create and destroy frames on the stack when entering/leaving functions. Change-Id: If161e3e941f59865c47ecfe1e094faf62b52bfa0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Don't throw exceptions in Object::delete(indexed) anymoreLars Knoll2017-08-101-5/+4
| | | | | | | | | | Change-Id: I8613ab21eb1435903e2a8514c21fe51f4a305a2f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Don't throw errors from the internal put methods anymoreLars Knoll2017-08-101-3/+3
| | | | | | | | | | | | | | | | Instead do it in the VME, where we can then easily separate into throwing and non throwing versions by bytecode. Change-Id: Ie63bd5b3610bb85f26fb8979179b2e239876cd97 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Create separate instructions to create both types of arguments objectsLars Knoll2017-08-101-1/+2
| | | | | | | | | | | | | | | | | | We know at compile time whether an arguments object should be strict or non strict (unmapped/mapped in ecmascript 6), use separate instructions for both cases. Change-Id: Ia23e68003beeda41a1f3597c0ba0980954c80ec7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Inline more of the runtime code into the interpreterLars Knoll2017-08-081-8/+0
| | | | | | | | | | Change-Id: I4744c9b39d4de599f02dd91622dd19713c8cc7eb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Introduce an accumulator in the interpreter, and change instructionsErik Verbruggen2017-08-021-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | This reduces the number of stores to the stack (for which we need a write-barrier in the future) by keeping the last calculated value in the accumulator register (which is a local variable). In the future we might want to collapse certain common instruction patterns into a super-sized instruction. Change-Id: I02ebed2db957765e994c8f939bf7585894881deb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Bring back captureRequired on scope/contest property loadingErik Verbruggen2017-07-041-8/+2
| | | | | | | | | | | | | | | | | | | | This is needed to properly register permanent/temporary dependencies This patch also removes related interpreter instructions that should have changed, but were not used. Change-Id: Ie53c4611766680734c02e328b7f2c752cae150e0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Remove interpreter instructions we can't generate anymoreErik Verbruggen2017-06-301-6/+2
| | | | | | | | | | | | | | This includes the backing runtime methods. Change-Id: Ib8fb6091974794b11f732fadeb047a7347a50d66 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add support for post increment/decrementErik Verbruggen2017-06-211-2/+4
|/ | | | | Change-Id: Ie3f03a548105fe49d29e3d60bf823435f21b0340 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Complete transition to standard layout classes for JIT accessSimon Hausmann2017-03-211-8/+2
| | | | | | | | | | | | 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>
* Prepare run-time method calling mechanism for cross-compilationSimon Hausmann2017-03-171-236/+156
| | | | | | | | | | | | | | | | | | | 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 build of QtQuick compiler generated code with popScope()Simon Hausmann2016-12-021-0/+5
| | | | | | | | | | | After commit 5e6bf607ee1e466eebabb7b8114c9f5e8fc40a9e we would not have an exception check template matching anymore that sets NeedsCheck to false, and consequently generated code that would try to call popScope() with an ExecutionEngine instead of a NoThrowEngine. Task-number: QTRD-2219 Change-Id: Iddf8218d1efb9af77c9a5f7ef84b9998fb167ef5 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* V4: check for exceptions after convertThisToObjectErik Verbruggen2016-11-241-7/+2
| | | | | | | | | The method_convertThisToObject method was invalidly tagged as not needing exception checks. As a side-effect method_pushCatchScope and method_popScope are now correctly tagged with a NoThrowEngine. Change-Id: I11d987e62136216a29eadcbd641546311030058f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix binding dependencies when used in together with functionsSimon Hausmann2016-08-301-2/+2
| | | | | | | | | | | | | When a function called from a binding would access a scope or context property, we would end up registering those dependencies as permanent dependencies in the expression and set m_permanentDependenciesRegistered to true. Then after the binding evaluation itself, we would not end up registering the real binding's permanent dependencies. Change-Id: I3b6c1c181aa064d535362c736b5b2bbc4f576ba9 Done-with: Erik Task-number: QTBUG-54394 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* V4: Fix JavaScript finally-block executionErik Verbruggen2016-08-101-0/+33
| | | | | | | | | | | | | | | | | | | 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>
* Revert "QML: When available, use QQmlAccessors to read properties."Simon Hausmann2016-07-141-21/+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>
* qv4runtimeapi_p.h: Add "We mean it" comment.Friedemann Kleint2016-05-041-0/+11
| | | | | Change-Id: Icd0060aef1ebc595a5988ef827096567c14cfc3c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QML: When available, use QQmlAccessors to read properties.Erik Verbruggen2016-04-121-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Removed unused typedefsLars Knoll2016-04-111-2/+0
| | | | | Change-Id: If0908854876bd242b510f5a536afb06511c0ba61 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Convert the remaining runtime methods to new calling conventionLars Knoll2016-04-111-22/+44
| | | | | Change-Id: I88ad3ca430508617d527715aa85ae8474ab7c621 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Convert comparison methods to the new runtime syntaxLars Knoll2016-04-111-10/+20
| | | | | Change-Id: Iad4dadddefca2d6322d4f778272b75d64e1a746f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Convert unary operations to new calling conventionLars Knoll2016-04-111-6/+12
| | | | | Change-Id: I629e336ec41f46390b7ed9f9365a832e1722b61a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Convert 3rd batch of runtime methodsLars Knoll2016-04-111-19/+37
| | | | | Change-Id: Idc277fd95d2b397a573631026549da44801109f4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Convert second batch of runtime methodsLars Knoll2016-04-111-14/+28
| | | | | Change-Id: I8b85b0398f758026cc8f8359f722c0d7f8544dbb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Convert the first batch of runtime functionsLars Knoll2016-04-111-28/+57
| | | | | | | | Convert them to the new calling convention through function pointers in the execution engine. Change-Id: Iecc54c9512f7231a04eb1659490a5d56118ff66a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Start converting Runtime calls to 'vtable' callsLars Knoll2016-04-111-1/+15
| | | | | | | | | | | | | 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>
* Move the Runtime API into it's own fileLars Knoll2016-04-111-0/+193
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>