aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix crashes when parsing destructuring expressionsLars Knoll2018-04-161-1/+1
| | | | | | | | | | x = [y] = z would crash because [y] is a literal and not a valid lvalue in ES5, something our parser didn't catch correctly. Change-Id: I0d7abd9b3f812f1de61c77dccfab5d1778dac793 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* init variables where they are declared when possible (clang-tidy)Shawn Rutledge2018-02-261-26/+11
| | | | | | | | clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-3/+3
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix "Expression depends on non-NOTIFYable properties" regressionMitch Curtis2018-02-171-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CONSTANT properties are by nature non-NOTIFYable. The issue behind the regression is caused by the fact that we were capturing a property regardless of whether or not it was const. There were two states that captureRequired was expressing: true: We're reading the property of a QObject, and we're not quite sure where the QObject comes from or what it is. So, when reading that property at run-time, make sure that we capture where we read that property so that if it changes we can re-evaluate the entire expression. false: We're reading the property of a QObject, and we know that it's the scope object or context object, which we know very well. Instead of registering a property capture every time, we can do that ahead of time and then register all those captures in one shot in registerQmlDependencies(). There is a third state that is only relevant when captureRequired is false: We're reading a property from the scope or context object, but it's a CONSTANT property, so we don't need to register a dependency at all. This patch adds replaces captureRequired with the PropertyCapturePolicy enum, which accounts for the third state and, as a bonus, makes the code easier to understand. Task-number: QTBUG-66361 Change-Id: I6cef1deb76538fbdacf1324b4467403dd40dd7de Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-02-021-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp src/qml/compiler/qqmlirbuilder.cpp src/qml/compiler/qqmlirbuilder_p.h src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4codegen_p.h src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4compilercontext_p.h src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4jsir.cpp src/qml/compiler/qv4jsir_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4runtimecodegen.cpp src/qml/jsruntime/qv4script.cpp src/qml/jsruntime/qv4script_p.h src/qml/qml/qqmltypeloader.cpp src/quick/items/qquickanimatedimage.cpp src/quick/items/qquickanimatedimage_p_p.h src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp tests/auto/qml/qmlplugindump/qmlplugindump.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp tools/qmljs/qmljs.cpp Done-with: Shawn Rutledge <shawn.rutledge@qt.io> Done-with: Lars Knoll <lars.knoll@qt.io> Done-with: Ulf Hermann <ulf.hermann@qt.io> Change-Id: I010e6525440a85f3b9a10bb9083f8e4352751b1d
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-241-3/+5
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/debugger/qqmlprofiler_p.h src/qml/jsruntime/qv4engine.cpp src/qml/memory/qv4mm.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlobjectcreator_p.h src/qml/types/qqmldelegatemodel.cpp src/quick/items/qquickitem_p.h src/quick/items/qquickwindow.cpp tests/auto/quick/touchmouse/BLACKLIST tests/benchmarks/qml/holistic/tst_holistic.cpp Change-Id: I520f349ab4b048dd337d9647113564fc257865c2
| | * Use potentially intercepted URL as ID for compilation unitsUlf Hermann2017-12-211-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We generally have to pass a URL and a file name everywhere because the logical URL might be something else than the actual file being loaded. For example a QQmlFileSelector might modify the URL to be loaded for a specific file. This resulting URL, however, should not be used to resolve further URLs defined in the file loaded that way. As we need to access QQmlTypeLoader::m_url as string more often now, cache it and avoid frequent translations between QUrl and QString. Furthermore, QQmlDataBlob's URLs are changed to follow the same semantics. The finalUrl is the one that should be used to resolve further URLs, the url is the one used to load the content, and subject to any redirects or interceptions. This changes the semantics of URL redirects. Previously a redirected URL was used as the base URL for furher URL resolution. This doesn't work because redirection occurs after interception and interception should not influence the resolution of further URLs. We now use the original URL as base URL for resolution of further URLs and rely on the server to redirect those, too. Task-number: QTBUG-61209 Change-Id: I93822f820bed2515995de3cb118099218b510ca4 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | | V4: Get rid of Reference::This and treat it as a stack slotErik Verbruggen2017-11-141-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This actually generates better code, for example for 'this.x'. Previously: LoadReg (this) GetLookupA acc(0) Now: GetLookup (this)(0) Change-Id: I7e4125d3dff707e9af9691f8b00c5c398087e395 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Refactor Call/Construct instructionsLars Knoll2017-11-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Give them a pointer to argc and argv instead of a pointer to a full callData. Like this we can construct the callData at the end of the JS stack and avoid the need to create an additional copy in VME::exec(). This also opens up the option of completely avoiding all copies for calls into runtime methods. Also make sure that the calldata we pass into other functions is always at the top of the JS stack. Change-Id: I3d0eb49f7bfd7adb9ddabb213422087c66e5a520 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Fix delayed loading of arguments in binary expressionsErik Verbruggen2017-09-201-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider the following functions: function f(x) { return x + (++x) } function g(x) { return x + x } In f() it is not correct to delay the load of x on the left-hand side of the + operator, while in g() it is. The reason is that calculating the right-hand side of the + operator in f() will change the value of x. So, if an argument is written to in an expression in a statement, it cannot be delay-loaded. The same is true for member/field accesses, because the accessors can be overwritten and do anything. Change-Id: I5bed4b0d03919edc1c94a82127e2dd705fc1d9b1 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix invalid condition inversion for conditional jumpsErik Verbruggen2017-09-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | We now have separate instructions for comparissons, which put the result in the accumulator. Then a JumpTrue/JumpFalse is generated to do the actual jump. Change-Id: I50a9d5899a6e071f4997931de6e8eb62596723cd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Unify JSStackFrame and CallDataLars Knoll2017-09-011-2/+2
| | | | | | | | | | | | | | | Change-Id: I4494dae8166026074c9efc74bac62de9d3fa2342 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Cleanup closure handling in codegenLars Knoll2017-08-281-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | We don't really need closure's to part of the Reference type. Instead simply load them into the accumulator when needed, and use a reference to the Accumulator instead. Change-Id: I4ca8c60083c9f2fa0da1db6c3c53718e3a32fc6f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Store the actual string for name in ReferenceLars Knoll2017-08-211-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Delay desolving the name to an index until we actually need it. This avoids storing strings that are never used in the string table. Change-Id: I935a2d07c03234097b4cf6cfe98231528ac3b15c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Split store-on-stack functions for "known destination"Erik Verbruggen2017-08-181-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the destination slot is known, there is no need to return and use it. This also works around certain versions of GCC that won't recognize the cast-to-void pattern to ignore return results. Change-Id: Iabf7ab1141c4f606030f2dda10ef69d1b090fb72 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Remove the Load/StoreScopedArgument instructionsLars Knoll2017-08-181-7/+0
| | | | | | | | | | | | | | | | | | | | | They are not used anymore. Change-Id: I0cb3754899a30d5f88279ff31296fd73edf90a9a Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Don't use a return value register for regular functionsErik Verbruggen2017-08-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | don't use the return value register for normal functions anymore. It's still needed for eval code and qml bindings that have an implicit return value, as the accumulator gets clobbered too easily in those cases. Also get rid of the exit block we used to generate. Adjust the control flow handlers to correctly unwind. This required adding some jump instructions that left the accumulator untouched (as it now holds the return value) and using those in handlers. Change-Id: I2ca1afaf7234cb632e5d26ba5b10ec3f11f50c93 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Keep order of arguments on the stackLars Knoll2017-08-041-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't reverse the arguments order when copying them. In addition, copy the this object as well, so we don't need to access the context anymore to access it. Change-Id: I38055c55387c4253cb53dd12fa69126840fa1270 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Store arguments in the stack frame before the locals/tempsErik Verbruggen2017-08-031-11/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-7/+7
| | | | | | | | | | | | | | | Change-Id: Ib7839ac09f520aaff3fadfdb37ea63d85a257bfd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Rename a number of types from Temp(orary) to StackSlotErik Verbruggen2017-08-031-42/+30
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Add commonly used JumpCompare instructionsErik Verbruggen2017-08-021-0/+1
| | | | | | | | | | | | | | | Change-Id: I00d4ed5d8b6ab30ee3459d1cc7a2737144474f8a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Allow for more values to be in the accumulatorErik Verbruggen2017-08-021-7/+61
| | | | | | | | | | | | | | | | | | | | | 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-27/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+4
| | | | | | | | | | | | | | | Change-Id: I9f4a5a8470c1abc6b07a28c71fdad0d208e1fea1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Remove Moth::Param from the interpreter instructionsErik Verbruggen2017-07-191-18/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 bug when a ternary expression was used in a if conditionErik Verbruggen2017-07-041-29/+58
| | | | | | | | | | | | | | | | | | | | | | | | 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-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 save/restore the QML temps between functionsLars Knoll2017-07-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This only worked by chance before, as they always for the same temp indices. Change-Id: Ib2c8b912fa1dee8b1f12c8f9d895bc023bc265d3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Move the Runtime codegen into it's own fileLars Knoll2017-07-031-21/+1
| | | | | | | | | | | | | | | Change-Id: I3d09fc4b8aebe19acae0ba5a688491428a4af715 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Move Codegen::ScanFunctions into it's own fileLars Knoll2017-07-031-74/+1
| | | | | | | | | | | | | | | Change-Id: I2c6c2fa09bc58a26a350011f5d525ec9f4b89d7f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Split up qv4codegen into several filesLars Knoll2017-07-031-224/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | 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 cleanup of the code baseLars Knoll2017-07-031-16/+8
| | | | | | | | | | | | | | | Change-Id: I8cd7cf7d208c60d7ef1648be927a19b65611127f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Smaller cleanupsLars Knoll2017-06-301-18/+3
| | | | | | | | | | | | | | | | | | | | | Remove an unused function, and rename some variables. Change-Id: I47491d40b0a3cee430e284bd4cc9df9b07d7d0b3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Remove now unused filesLars Knoll2017-06-301-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Get rid of IR::Module and IR::FunctionLars Knoll2017-06-301-7/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-7/+2
| | | | | | | | | | | | | | | | | | | | | 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/+8
| | | | | | | | | | | | | | | Change-Id: I79b49655a55f98906723351ef7dd79099697bea1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Don't use IR::Function for temp allocation anymoreLars Knoll2017-06-301-7/+4
| | | | | | | | | | | | | | | Change-Id: Id9ab6f3e9f5ae1c1bedb0b34bf1fac6abfe0bbfc Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Introduce a QQmlJS::ModuleLars Knoll2017-06-301-8/+15
| | | | | | | | | | | | | | | | | | | | | 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-137/+137
| | | | | | | | | | | | | | | | | | | | | 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-8/+0
| | | | | | | | | | | | | | | Change-Id: I6a1475740999975bc88f511bc3a4c6b091f3f027 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Get rid of inheritedLocals in the codegenLars Knoll2017-06-291-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Only register QML dependencies for reads from scope/context propsErik Verbruggen2017-06-291-5/+10
| | | | | | | | | | | | | | | Change-Id: I76ba10f16fc5b481cf1d149ebc45193fdab390fb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Mark QML id objects as read-onlyErik Verbruggen2017-06-291-2/+4
| | | | | | | | | | | | | | | Change-Id: I39510d59ee6f05a6e45718fd33a1815fb7c46d81 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Remove MoveConst and put constants in ParamErik Verbruggen2017-06-291-1/+2
| | | | | | | | | | | | | | | Change-Id: I7a289dff5cacc23c238e79e44eb96c690691da3b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Don't use the ISel's anymoreLars Knoll2017-06-221-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | | | | | Change-Id: If2a2f6257905cf76b28feafe43e5f089ca8ade7f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>