aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Use the accumulator for the rhs of CmpJmp instructionsLars Knoll2017-08-081-7/+1
| | | | | | | | | | | | | | | Change-Id: Ib7923863a88aacab93b06fa3c75d788fcfc0bf4e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add instructions for <, <=, >, >=Lars Knoll2017-08-081-1/+36
| | | | | | | | | | | | | | | Change-Id: Ibdd784507083da4c2cdc49208e842cc2e9c40da5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Parse foo["bar"] as a member expressionLars Knoll2017-08-081-0/+11
| | | | | | | | | | | | | | | Change-Id: I9295ca7957783ed85c07e1522d05e300781361e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Move the function to call into the accumulatorLars Knoll2017-08-081-1/+3
| | | | | | | | | | | | | | | Change-Id: Ie84f3f029111b17d62912c653edc35b4cc2de026 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix bytecode dumping for argumentsErik Verbruggen2017-08-041-1/+1
| | | | | | | | | | | | | | | Change-Id: Ic29284da0ed555186db0e969b3c2c1ba8a1e5eba Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Store arguments in the stack frame before the locals/tempsErik Verbruggen2017-08-031-70/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All escaping arguments will still be loaded/stored from/to the CallData, but this is not the common case. In a subsequent patch we can make the caller prepare the stack frame, and for the common case we don't even need to copy arguments around. Change-Id: I3fbb6fe575a564d05a9fd5dcc0c8f4129eac3bc2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Where applicable, rename Temp* to Register*Erik Verbruggen2017-08-031-38/+38
| | | | | | | | | | | | | | | Change-Id: Ib7839ac09f520aaff3fadfdb37ea63d85a257bfd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Rename a number of types from Temp(orary) to StackSlotErik Verbruggen2017-08-031-103/+103
| | | | | | | | | | | | | | | | | | | | | | | | As a preparation to also store arguments on the stack, just like the temporaries. Change-Id: If3a6ed56930e29ad77c992811065bb32ee2d030c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Use lookup instructions when calling propertiesLars Knoll2017-08-021-5/+13
| | | | | | | | | | | | | | | | | | | | | Speeds up parts of v8-bench by 20%. Change-Id: Ic7e3d9103308b19bbe6bf1e40756b0f7f132d162 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Add commonly used JumpCompare instructionsErik Verbruggen2017-08-021-6/+64
| | | | | | | | | | | | | | | Change-Id: I00d4ed5d8b6ab30ee3459d1cc7a2737144474f8a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Allow for more values to be in the accumulatorErik Verbruggen2017-08-021-38/+148
| | | | | | | | | | | | | | | | | | | | | For subscript indices and the base of a property name lookup Change-Id: I20394aa5daf6e49137b66575e56d1f8937160a8d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Introduce an accumulator in the interpreter, and change instructionsErik Verbruggen2017-08-021-444/+375
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Fix various signed/unsigned warningsErik Verbruggen2017-08-021-1/+1
| | | | | | | | | | | | | | | Change-Id: I9f4a5a8470c1abc6b07a28c71fdad0d208e1fea1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Replace Q_ASSERT(!"unreachable") with Q_UNREACHABLE()Erik Verbruggen2017-08-021-35/+35
| | | | | | | | | | | | | | | Change-Id: I86cdc545e2186926d9a10bbd4102cb89c88a87c7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Remove Moth::Param from the interpreter instructionsErik Verbruggen2017-07-191-92/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | The Param struct is now internal to the interpreter loop. It can be removed in a second step so we can directly access constants/temporaries/locals/arguments. Change-Id: I47ecbfe7508f352a8f212af48461dc92b35f4695 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix assignments-to-self like x=xErik Verbruggen2017-07-071-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | For those expressions, the load and store of x do need to be generated: they are observable and might have side-effects. Change-Id: Ifbfdfa1cb40c58ca99468548b94a42de9b704ae0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix QML disk cachingErik Verbruggen2017-07-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add correct generator name (always moth for the interpreter). Also fix the test: where we generated a dummy function 0, we now don't do that anymore, so correct the function index, and the check for the code offset. Change-Id: I4c07b2b53483c513dfaf8993e1d0111bcc825179 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix bug when a ternary expression was used in a if conditionErik Verbruggen2017-07-041-74/+75
| | | | | | | | | | | | | | | | | | | | | | | | This also changes the Result, so its members cannot be overwritten by accident. Change-Id: Id3679cb668da74468cbe17853cb13340683f11c0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Bring back captureRequired on scope/contest property loadingErik Verbruggen2017-07-041-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Limit the amount of escaping variablesLars Knoll2017-07-041-21/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calculate more exactly which variables can be referenced from an inner context, and convert all the non escaping ones to temporaries on the stack. Change-Id: I0e33e85b0f6f426ef2812b8ecccee1870492b7b5 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Properly calculate escaping variablesLars Knoll2017-07-041-2/+2
| | | | | | | | | | | | | | | Change-Id: Ia9f0b6d3f31bd3a7bd4316ee3f3e9ff977f973b7 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Move the Runtime codegen into it's own fileLars Knoll2017-07-031-42/+1
| | | | | | | | | | | | | | | Change-Id: I3d09fc4b8aebe19acae0ba5a688491428a4af715 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Move Codegen::ScanFunctions into it's own fileLars Knoll2017-07-031-357/+1
| | | | | | | | | | | | | | | Change-Id: I2c6c2fa09bc58a26a350011f5d525ec9f4b89d7f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Split up qv4codegen into several filesLars Knoll2017-07-031-396/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And changed the namespace of those classes to QV4::Compiler. ScanFunctions should over time also move into its own file. Change-Id: If084acea4a9a20b9c79ad47dac19e02dc720e098 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Mark whether arguments or local variables can escapeLars Knoll2017-07-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This helps determine whether those variables can live on the JS stack or need to go into the ExecutionContext Change-Id: I791632b7fe9fd8788af7564844b5d368c3e0b91c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Smaller cleanupsLars Knoll2017-06-301-43/+43
| | | | | | | | | | | | | | | | | | | | | Remove an unused function, and rename some variables. Change-Id: I47491d40b0a3cee430e284bd4cc9df9b07d7d0b3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Get rid of IR::Module and IR::FunctionLars Knoll2017-06-301-87/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fold the stuff from IR::Function into QQmlJS::Context, and add a QQmlJS::Module class to replace the last pieces of the old IR. Change-Id: Ic02a6738a4f1db67a0ddf97b6c93ca32be81789d Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Remove interpreter instructions we can't generate anymoreErik Verbruggen2017-06-301-5/+1
| | | | | | | | | | | | | | | | | | | | | This includes the backing runtime methods. Change-Id: Ib8fb6091974794b11f732fadeb047a7347a50d66 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Re-add missing captureRequired flagErik Verbruggen2017-06-301-3/+5
| | | | | | | | | | | | | | | Change-Id: I79b49655a55f98906723351ef7dd79099697bea1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Don't use IR::Function for temp allocation anymoreLars Knoll2017-06-301-1/+1
| | | | | | | | | | | | | | | Change-Id: Id9ab6f3e9f5ae1c1bedb0b34bf1fac6abfe0bbfc Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Introduce a QQmlJS::ModuleLars Knoll2017-06-301-6/+11
| | | | | | | | | | | | | | | | | | | | | This is scheduled to replace IR::Module. Change-Id: I146362d07c46c4c1ad8ee46850ad38c18043ecc7 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Rename Codegen::Environment to Context and pull it out of CodegenLars Knoll2017-06-301-50/+50
| | | | | | | | | | | | | | | | | | | | | Part of refactoring and streamlining this code base. Change-Id: I324d35d1f0a74c5908b40243ffa2b247ce924304 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Remove some dead codeLars Knoll2017-06-291-11/+0
| | | | | | | | | | | | | | | Change-Id: I6a1475740999975bc88f511bc3a4c6b091f3f027 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Get rid of inheritedLocals in the codegenLars Knoll2017-06-291-17/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This was only causing us to create mutable bindings for variables that already existed, thus leading to an expensive noop. Change-Id: I6ed8ee891f8ec16c59e5fc43ed9eb155cb4b64ac Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Pass a correctly initialized calldata also when we have no argumentsLars Knoll2017-06-291-1/+3
| | | | | | | | | | | | | | | | | | | | | At least this and argc need to be present and have correct values. Change-Id: I35a841cf008947e62f9309c407b5cd47fdcf4b41 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Only register QML dependencies for reads from scope/context propsErik Verbruggen2017-06-291-6/+10
| | | | | | | | | | | | | | | Change-Id: I76ba10f16fc5b481cf1d149ebc45193fdab390fb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Mark QML id objects as read-onlyErik Verbruggen2017-06-291-3/+3
| | | | | | | | | | | | | | | Change-Id: I39510d59ee6f05a6e45718fd33a1815fb7c46d81 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Evaluate the argument to with() before setting up the exception handlerLars Knoll2017-06-291-0/+1
| | | | | | | | | | | | | | | | | | | | | Fixes a crash in the qjsengine autotest. Change-Id: I3cecd627a1322d486b654c819fb22c166a0ab2e4 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Switch over to new JS call setupLars Knoll2017-06-291-63/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Differences: - push parameters on the stack, including space for CallData members - call instructions calculate the argument start - use temp space above the calldata to evaluate arguments - fewer temporaries are needed when a call is done while generating the arguments of another call - when calling the function, the js stack space above the callData is not used, allowing for optimizations in the future - Array and ObjectLiteral use the same mechanism Change-Id: Id100fa06f12cc9d941b0f90b0b81b8270a8e4f5d Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Remove MoveConst and put constants in ParamErik Verbruggen2017-06-291-9/+7
| | | | | | | | | | | | | | | Change-Id: I7a289dff5cacc23c238e79e44eb96c690691da3b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix binops when rhs has an effect on the lhsErik Verbruggen2017-06-221-0/+2
| | | | | | | | | | | | | | | | | | | | | Like in "var x = 0; x * (x = 1)" Change-Id: I1e9087506f8b04ebbdbb7ad4fe7fbe935a949e42 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Encode numeric literals as int when possibleErik Verbruggen2017-06-221-1/+1
| | | | | | | | | | | | | | | Change-Id: I5ecc406f06a193b470eb9ac376da6b9f752d01cb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Remove the old compiler pipelineLars Knoll2017-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Don't compile the JIT and related code into libQtQml anymore. Change-Id: Ieb0ec33c964d09b121ede4097fe4218b147c673d Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Don't use the ISel's anymoreLars Knoll2017-06-221-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | Move the code that generates the CompilationUnit over to Codegen, and don't use the ISel's at all anymore when compiling JS/QML. Change-Id: Iba89082c386c3d3fd58ac25a4651c5d39178cc5c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Re-enable binops with a constant rhsLars Knoll2017-06-221-82/+86
| | | | | | | | | | | | | | | Change-Id: If2a2f6257905cf76b28feafe43e5f089ca8ade7f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Re-enable lookupsLars Knoll2017-06-221-49/+59
| | | | | | | | | | | | | | | Change-Id: I02d57d2cbb4ae56c0c4626d96cbdf9935b366579 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Do not unnecessary load constants into temporariesErik Verbruggen2017-06-221-1/+2
| | | | | | | | | | | | | | | | | | | | | Specifically when creating an object from an object literal. Change-Id: I2f29be5d977ac2e5a0a634229ae899356e568ebd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Initialize elided array elements with emptyErik Verbruggen2017-06-211-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | ... instead of undefined. Also massages the bytecode dumper a bit to make debugging easier. Change-Id: Ief1a9330196b20e97717174a945cd5a6432e05ce Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix invalid assertErik Verbruggen2017-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the "this" in store is a non-temp, we can't compare the base to the source value's Param. What needs to be checked is not the base, but the "b" value, which hold a (possibly loaded) value. Change-Id: I43ed77db70a3f075b40f01dd66f16a0046467ce1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Correctly trigger loads of arguments for calls and array/object literalsLars Knoll2017-06-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | These have to be loaded in the right order, as the load might trigger some side effects. Change-Id: I5a987bf90c7c9376de609ce24b00436cbf78168d Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>