summaryrefslogtreecommitdiff
path: root/src/qml/compiler/qv4codegen.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | | 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>
* | | Make sure we don't accept literals as lvaluesLars Knoll2017-06-211-0/+3
| | | | | | | | | | | | | | | Change-Id: I06f475337944554842b4c0a05f0c88617579e2cb Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Fix recursive array definitionsLars Knoll2017-06-211-2/+11
| | | | | | | | | | | | | | | | | | | | | Make sure '[[1, 2], 3]' produces the correct result. Change-Id: I95efcf4cab20badfffd31429a57fb73cdf241518 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Fix delete operatorLars Knoll2017-06-211-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | Use a switch statement so we cover all cases of Reference types. Fixes a crash for 'delete this'. Change-Id: Ib3575fb2176cd9493211a716132d2f768e0f0ac7 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Throw syntax error if arguments or eval are used as lvalues in strict modeLars Knoll2017-06-211-7/+15
| | | | | | | | | | | | | | | Change-Id: I4c46537e3a4f3c2c22efea323dc8a95c1078c75f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Add support for post increment/decrementErik Verbruggen2017-06-211-49/+28
| | | | | | | | | | | | | | | Change-Id: Ie3f03a548105fe49d29e3d60bf823435f21b0340 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix for for(... in ...)Lars Knoll2017-06-211-6/+6
| | | | | | | | | | | | | | | Change-Id: I7edb3ec722238c0229ca6d0f850cd15bb1bc6937 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Fix nested function callsLars Knoll2017-06-211-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | If one argument of a function call was itself calling a function (or an object/array literal), we'd override the arguments of the outer function call. Change-Id: I41bc93c1217283f22b02e881f96b04286a4c7e7e Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Fix exception handlingLars Knoll2017-06-211-17/+81
| | | | | | | | | | | | | | | | | | | | | | | | Fix all exception handling related test failures in test262. Change-Id: Iba50238627c31705a4878b43abbb8f20f0ecee88 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Fix a couple of compiler warningsLars Knoll2017-06-211-0/+4
| | | | | | | | | | | | | | | Change-Id: If30064de5710b7b9e1aaa42ce1279de643f44e85 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Reserve call args and return value before any other tempsErik Verbruggen2017-06-201-8/+8
| | | | | | | | | | | | | | | Change-Id: Ia24a5d301be2f74ac073c37ddda45f6c0ac8ed8e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix calls where the base is a Reference::NameErik Verbruggen2017-06-201-0/+17
| | | | | | | | | | | | | | | Change-Id: Id86a034ba1d3eaec975704875509eb95e014fa7b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix 'arguments' initializationErik Verbruggen2017-06-201-1/+1
| | | | | | | | | | | | | | | Change-Id: I6fe35924b42908f656363ae1af07a7d8cd67a7ea Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix 'this' handling and make it an rvalue onlyErik Verbruggen2017-06-201-7/+7
| | | | | | | | | | | | | | | Change-Id: I4e99b81e5b73b7eb36d3f05bdf3b9f03d59f882f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix assertion in LocalForeachStatementLars Knoll2017-06-201-1/+3
| | | | | | | | | | | | | | | Change-Id: I7386769ed62de8a5e86e08c23671f8e9e5a5be3c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Remove unused codeLars Knoll2017-06-201-27/+0
| | | | | | | | | | | | | | | Change-Id: Ia891fc48572a5691f4129cef8e9a3ed6871565b9 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Port JSCodeGen in qqmlirbuilder over to new parserLars Knoll2017-06-201-10/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement QML support in Reference. Implement the fallbackNameLookup() method for QML, and emit bytecode to load the qml context and imported script temps in beginFunctionBodyHook() Change-Id: I7e052f10ec064097ab1c1f51d776622a4176ce99 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Reduce usage of _functionLars Knoll2017-06-201-35/+35
| | | | | | | | | | | | | | | Change-Id: I9a64083afe8e23f506735c04dedb8978ddcfd45d Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Remove a couple of references to the IRLars Knoll2017-06-201-93/+70
| | | | | | | | | | | | | | | Change-Id: I716000a6932a6b3d3f6c9f0573747b9c4b8e0e6b Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | No need to initialize locals to undefinedLars Knoll2017-06-201-1/+0
| | | | | | | | | | | | | | | | | | | | | The runtime already does that for us. Change-Id: Iddde1a3fe4775b8a30fc887296f56fc3ebace12f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Handle loads/stores of References betterLars Knoll2017-06-201-49/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is still not ideal and creates too many move instructions, but at least it avoids repeated loads and stores into temps to the largest part. Change-Id: I5286a6598461b229aa12cf88b711922e69f46b70 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Use the proper call for Member referencesLars Knoll2017-06-201-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is required so the this object gets set up correctly. crypto.js passes now :) Change-Id: I995ffe40b3fee6d8a7b1f9e2d7a9887cd8a87275 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Get back some line number informationLars Knoll2017-06-201-17/+7
| | | | | | | | | | | | | | | Change-Id: I7d7845a9d8d147bd363c0f60df41066fab355272 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Properly implement the function prologueLars Knoll2017-06-201-19/+11
| | | | | | | | | | | | | | | | | | | | | Set locals to undefined and declare them for global code Change-Id: I41848f1463fa402a3c2b1f67117be86cc0d697a1 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>