aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtimeapi_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove tracing JIT infrastructureUlf Hermann2019-04-291-8/+0
| | | | | | | | The tracing JIT won't be finished. Therefore, remove the parts that have already been integrated. Change-Id: If72036be904bd7fc17ba9bcba0a317f8ed6cb30d Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
* Merge remote-tracking branch 'origin/5.13' into HEADUlf Hermann2019-03-221-40/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compileddata_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4jithelpers.cpp src/qml/jsruntime/qv4lookup.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4runtimeapi_p.h src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/qqmltypemodule_p.h Change-Id: If28793e9e08418457a11fc2c5832f03cab2fcc76
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-211-13/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4bytecodehandler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4instr_moth.cpp src/qml/compiler/qv4instr_moth_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4baselinejit_p.h src/qml/jsruntime/qv4function.cpp src/qml/jsruntime/qv4vme_moth.cpp Change-Id: I8fb4d6f19677bcec0a4593b250f2eda5ae85e3d2
| | * Remove dead compile time QML context/scope property and id object codeSimon Hausmann2019-03-201-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After enabling lookups in QML files, we can remove all the code that tries to deal with (type) compile time detection of access to id objects and properties of the scope/context object. This also allows removing quite a bit of run-time code paths and even byte code instructions. Task-number: QTBUG-69898 Change-Id: I7b26d7983393594a3ef56466d3e633f1822b76f4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * Implement dummy QML lookups for "global" variablesSimon Hausmann2019-03-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When resolving names in the context of QML bindings, we now direct runtime access to QQmlContextWrapper::resolveQmlPropertyLookupGetter. At the moment this does basically the same as Runtime::method_loadName, which we called earlier. However this now provides the opportunity to optimize lookups in the QML context in a central place. When performing a call on a scope or context object property, we also did not use a CallName() instruction - which would have gotten the thisObject wrong - but instead we use a dedicated CallScopeObjectProperty and CallContextObjectProperty instruction. These rely on identifying these properties at compile time, which goes away with lookups (and also doesn't work when using ahead-of-time compilation). Therefore the qml context property lookup is using a getPropertyAndBase style signature and Runtime::method_callQmlContextPropertyLookup uses that. For the tests to pass, some error expectations need adjusting. In particular the compile-time detection of write attempts to id objects is now delayed to the run-time. The old code path is still there and will be removed separately in the next commit (as it is massive). Task-number: QTBUG-69898 Change-Id: Iad1ff93d3758c4db984a7c2d003beee21ed2275c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | V4: Add IR that can use traced information to JITErik Verbruggen2019-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the in a series of patches for a JIT that can use traced information to generate better code. In this patch, traced information is not used/stored yet. It allows testing the basic infrastructure without trying to do any optimizations, therefore making it easier to debug, test, and review. Change-Id: I589bdadf731c36542331abe64e1b39e305b6723e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | V4: Add more flags to runtime methodsErik Verbruggen2019-02-051-19/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark method that: - change the context (e.g. PushCallContext) - are pure (don't throw, have no visible side-effects, e.g. ToBoolean) - use the last argument as an output parameter (e.g. IteratorNext) These are used in subsequent patches to give the JIT more information about the call. For example, a pure function can be placed anywhere before its first use, as long as its parameter values are known. Change-Id: I31355d2016b6676f339a9838c25b941d0e7860f0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | V4: Clean up the runtime functions declarationsErik Verbruggen2019-02-051-170/+456
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The declarations and usage of runtime functions have seen a number of changes: - we don't use the array of method pointers anymore because we don't use cross-platform AOT JITting - the check if a method can throw a JS exception was invalid, and was not used anymore - value-pointer vs. const-value-ref was inconsistent This patch cleans that up. By fixing the exception checking, we can now use it in the baseline JIT to automatically insert those checks. To make that work correctly, all runtime methods are in a struct, which gets annotated to indicate if that method throws. (The old way of checking which type of engine was used is fragile: some non-throwing methods do not take an engine parameter at all, and those got flagged as throwing). By using a struct, we can also get rid of a bunch of interesting macros. The flags in the struct (as mentioned above) can later be extended to capture more information, e.g. if a method will change the context. Change-Id: I1e0b9ba62a0bf538eb728b4378e2678136e29a64 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* / V4: Collect trace information in the interpreterErik Verbruggen2019-01-251-0/+2
|/ | | | | | | | | | | | | | | Collect type information about values used in a function. These include all parameters, and the results of many bytecode instructions. For array loads/stores, it also tracks if the access is in-bounds of a SimpleArrayData. Collection is only enabled when the qml-tracing feature is turned on while configuring. In subsequent patches this is used to generated optimized JITted code. Change-Id: I63985c334c3fdc55fca7fb4addfe3e535989aac5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* V4: Conform method_objectLiteral arguments to equal other methodsErik Verbruggen2018-10-121-1/+1
| | | | | | | This runtime function was the only one taking argc before arguments. Change-Id: If0b049697f7fcc2746e8d287193a5b1230a6ea56 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* ES7: Implement Tail Position Calls in the runtimeErik Verbruggen2018-10-051-1/+7
| | | | | Change-Id: If1629109722496b3fd10b36b2376548440f2fee9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* ES7: Detect Tail Position Calls and pass that to the runtimeErik Verbruggen2018-10-041-0/+1
| | | | | | | Doing the tail call in the runtime will come in a follow-up patch Change-Id: I8224aac0edbdc765ee9b97703948edd52fd33f3e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for yield*Lars Knoll2018-09-071-0/+1
| | | | | Change-Id: I5b054b59519ed825459a5b0b0a7cd2c6fc8a3797 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix thisObject when calling super propertiesLars Knoll2018-08-311-0/+1
| | | | | Change-Id: Ia520d43ea2c29c16cfc8ffc86a32187a78848502 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Initialize this to empty for derived constructorsLars Knoll2018-08-291-0/+1
| | | | | | | | | As per spec, this should be uninitialized in derived constructors, and the base constructor needs to get called exactly once. Change-Id: If31804e58d7ba62efde8fbf6cd852674f8da4495 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement the dead temporal zoneSimon Hausmann2018-08-281-0/+1
| | | | | | | | | | | | | | With const and let it is possible to access the declared member before initialization. This is expected to throw a type reference error at run-time. We initialize such variables with the empty value when entering their scope and check upon access for that. For locals we place the lexically scoped variables at the end. For register allocated lexical variables we group them into one batch and remember the index/size. Change-Id: Icb493ee0de0525bb682e1bc58981a4dfd33f750e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add support for super propertiesLars Knoll2018-07-031-0/+2
| | | | | | | | Those are mostly working now, but when calling super properties the this object is not setup correctly. Change-Id: Ib42129ae6e729eeca00275f707f480371b7e42a5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add a newTarget parameter to the Construct runtime methodsLars Knoll2018-07-031-2/+2
| | | | | | | This is required to be able to support the super() call. Change-Id: I9998680341d701727ac1697187ad33481bdde422 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify storeProperty runtime APISimon Hausmann2018-06-271-1/+1
| | | | | | | | We can do the isStrict() check and throwTypeError() call in the runtime function instead of doing it twice on the two call sites. Change-Id: I5689babe4873c0bc3e7c85ca2d15a33f8ccb8794 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Simplify storeElement runtime APISimon Hausmann2018-06-271-1/+1
| | | | | | | | We can do the isStrict() check and throwTypeError() call in the runtime function instead of doing it twice on the two call sites. Change-Id: I70df3d7fe4333921a85c11b1573e234f7da2f47d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add basic support for EcmaScript classesYulong Bai2018-06-261-0/+1
| | | | | | | | | | | | | | | | Most of the class creation is done inside the runtime in the CreateClass method. Added a corresponding instruction to the interpreter and jit. The compiled data now contains an array of classes containing the compile time generated layout of the class. Currently, classes without an explicit constructor and classes with inheritance are not supported. Done-with: Yulong Bai <yulong.bai@qt.io> Change-Id: I0185dcc1e3b0b8f44deff74e44a8262fc646aa9e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for function calls with spreadLars Knoll2018-06-211-0/+2
| | | | | | | | | | | Function calls with thread are modelled by pushing an empty value in front of every argument that requires spreading. The runtime methods callWithSpread and constructWithSpread then take care of spreading out the arguments. Change-Id: Ie877c59d3d9d08fc5f20d7befb7153c7b716bf30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify DeleteMember and DeleteSubscript instructionsLars Knoll2018-06-211-3/+1
| | | | | | | | The delete operator is rarely used, so it's simpler to unify these into one DeleteProperty instruction. Change-Id: I8c0d4455b35efb03db2ab0010df70030d774a6ae Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix creation of object literalsLars Knoll2018-06-041-1/+1
| | | | | | | | | | | | | | | | Our method to create object literals wasn't compliant with the ES7 spec, as we would in some cases re-order the properties. This violated the spec which required properties to be created in order, so that for-of would also iterate over them in creation order. As a nice side effect, this simplifies the code and gets a couple of test cases using computed property names to pass. Task-number: QTBUG-62512 Change-Id: I6dfe004357c5d46a0890027f4fd9e2d1e1a2a17a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify with context runtime handlingSimon Hausmann2018-05-291-1/+1
| | | | | | | | Instead of duplicating the accumulator-to-object conversion in moth as well as the JIT, let's do that in one place in the runtime. Change-Id: I6870567d3c4fe663e54fece024f1e5e9bde97c35 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Call iterator.return when required in destructuring assignmentsLars Knoll2018-05-141-0/+1
| | | | | | | | Array destructuring assignments require a call to iterator.return if the iterator hasn't been exhausted during destructuring. Change-Id: I39fe4bc01bef6fb2ad3bda92caf6779fbbddc8e2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Refactor InteratorNext instructionLars Knoll2018-05-141-1/+1
| | | | | | | | | | The instruction now writes the value into a stack slot, and returns the done state in the accumulator. This should make it easier to implement the IteratorClose functionality required by the spec. Change-Id: I8cc497c54b0d044bd3c68a5a1b774eea8b2740ef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for destructuring of rest elementsLars Knoll2018-05-141-0/+1
| | | | | | | "var [x, ...y] = array" now works as intended. Change-Id: I45238f27f468d0b0e14dc0e931c55c4f40043690 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix array destructuringLars Knoll2018-05-131-1/+1
| | | | | | | | Array destructuring should use iterator objects, not integer indexes. Change-Id: I769bb1d63246da6bc45233f7a6e9a8e5ddc53a4d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add instructions to simplify for-of loopsLars Knoll2018-05-131-1/+2
| | | | | | | | | | | Added an IteratorNext instruction to fetch the next iteration value (empty if the iterator is done). This will also help to implement array destructuring without requiring huge amounts of byte code. Change-Id: If96c1e81471e5e2b0b7b2af122238d87741aa371 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Give for loops a per-iteration context as wellLars Knoll2018-05-111-0/+1
| | | | | | | | Regular for loops also have a per iteration context for lexically declared variables as well. Change-Id: I35cb58bfb198c7dc32d70f41ea0ced7ddefcc37e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Ensure we have a lexical scope for global codeLars Knoll2018-05-111-0/+2
| | | | | | | | | | | | | | | This requires a bit more work than simply pushing a new BlockContext for the lexically declared variables, as eval() and the Function constructor operate on the global scope (including the lexically declared names). To fix this introduce Push/PopScriptContext instructions, that create a BlockContext for the lexically declared vars and pushes that one as a global script context that eval and friends use. Change-Id: I0fd0b0f682f82e250545e874fe93978449fe5e46 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add some basic support for for-of loopsLars Knoll2018-05-091-3/+2
| | | | | | | | | | | | | The support is basically at the same level as for for-in at the moment. Currently unimplemented: * Destructuring * Proper lexical scoping * calling iterator.throw()/return() when required Change-Id: If193ce0b054c4315fc16b7e174334a31b2730dcf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add SymbolObject, well known symbols and fix most remaining issuesLars Knoll2018-05-021-1/+1
| | | | | | | | | Added SymbolObject, the equivalent to StringObject which was still missing so far. Added the predefined standard symbols, and fixed most test failures related to symbols. Change-Id: I1e28b439e7c4f5141b4a09bd8fb666c60691f192 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Rework catch context handlingLars Knoll2018-05-021-1/+1
| | | | | | | | | | | | Remove the need for a specialized catch context, instead use a regular block context, that also captures the catched variable. This also removes the need to do lookups by name inside a catch expression. Change-Id: I8b037add7f423922e2a76b4c0da646ca7e25813a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for proper lexical scopingLars Knoll2018-05-021-0/+1
| | | | | | | | | | | | | This is still to some extend work in progress as lexically scoped for loops won't yet do the right thing. let and const variables are still accessible before they are declared, and the global scope doesn't yet have a proper context for lexically declared variables. Change-Id: Ie39f74a8fccdaead437fbf07f9fc228a444c26ed Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for ES6 rest parametersLars Knoll2018-04-251-0/+1
| | | | | | | function foo(a, b, ...c) {...} now works correctly. Change-Id: Ie442a0e7cc5e9dc4156e56b348bba305cced8531 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* 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>