aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4ssa.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove now unused filesLars Knoll2017-06-301-5848/+0
| | | | | | | | | 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>
* Add support for post increment/decrementErik Verbruggen2017-06-211-6/+6
| | | | | Change-Id: Ie3f03a548105fe49d29e3d60bf823435f21b0340 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change temp allocation when generating IRLars Knoll2017-06-091-3/+3
| | | | | | | | | For functions that won't get optimized, it's useful to limit the number of temporaries as much as possible. Change-Id: I6e9be3129c064fdc4c01e1ec6f1617e901c05935 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Disable loop peelingLars Knoll2017-05-121-1/+5
| | | | | | | | | | Loop peeling does in our current JIT not give us any measurable performance benefits (no measurable diff in any of the v8 benchmarks), and significantly increases the size of the generated JIT code. Change-Id: Icab7887300f9c1cd5891983cbfe5885fc2b4db91 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Simon Hausmann2017-04-271-152/+184
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qtqmlglobal.h src/qtqmlglobal_p.h src/jsruntime/qv4global_p.h src/qml/compiler/compiler.pri src/qml/compiler/qv4ssa.cpp src/qmldevtools/qtqmldevtoolsglobal_p.h tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp Change-Id: I55c5d015b2cb1053b83b9c61caaf004fb49ee486
| * V4: Fix issues with very small loops5.8Erik Verbruggen2017-04-181-152/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Loops consisting of just a single basic block (e.g. a do-while loop with no nested loops or if statements) have a back-edge to themselves. There were 2 problems: - loop detection would create LoopInfo for any loop header referred to by blocks inside the loop (and a 1 block loop doesn't have body blocks), nor would it mark the loop header as such - when splitting critical edges, the newly inserted block would not be marked as part of the loop This is a problem specifically for 1 block loops: the block ends with a CJUMP, so the back-edge is a critical edge. So the new block inserted by edge splitting wouldn't be marked as belonging to the loop. The end result was that the life-time intervals for temporaries that are defined before the loop, but that are used inside the loop, and not after the loop, would have their life-time ended before the loop ends (instead of spanning the whole loop, *including* the back-edge). This in turns could lead to the stack/register allocator re-using the storage for that temporary, resulting in strange things happening. Task-number: QTBUG-59012 Change-Id: Ic946c73913711272efea2151cb85350412ca2fde Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Silence GCC 7 warnings about implicit fallthrough in Qt codeThiago Macieira2017-04-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This only deals with Qt code. MASM has a lot of those left. We should just update from upstream instead to get the fixes. qv4regalloc.cpp:660:52: warning: this statement may fall through [-Wimplicit-fallthrough=] if (leftSource->type == DoubleType || rightSource->type == DoubleType) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ qv4regalloc.cpp:666:13: note: here case OpBitAnd: ^~~~ Change-Id: I7814054a102a407d876ffffd14b6b0e2d6b03689 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-241-71/+124
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/quick/accessible/qaccessiblequickview_p.h src/quick/items/qquickmousearea.cpp src/quick/util/qquickanimatorjob.cpp tools/qmlplugindump/main.cpp Change-Id: I84474cf39895b9b757403971d2e9196e8c9d1809
| * Fix move ordering while resolving edges in register allocationErik Verbruggen2017-02-041-61/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When register allocation on an IR in SSA form is done, the last step is to turn the Phi nodes into moves and swaps and put those instructions in the predecessors. As the Phi nodes are conceptually "executed in parallel", this can result in cycles: r1 <- r0 r0 <- r1 These have to be turned into a swap instruction. Also, the moves have to be ordered in order to make sure that no values are overwritten: r1 <- r0 r2 <- r1 Here the two moves need to be switched. The comments in the code document the algorithm. Change-Id: I4151988681f7554b00a3eb70d224e6e2f29ebf04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Prevent propagating results of a phi node into another phi nodeErik Verbruggen2017-02-011-8/+37
| | | | | | | | | | | | | | | | | | .. of the same basic block. Phi nodes are "executed in parallel", so such a situation will lead to interesting results. Task-number: QTBUG-58553 Change-Id: Ibed439df91d46ea416dcb0a20457310e91dce8b4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Fix libs build with msvc on Chinese locale on WindowsLiang Qi2017-02-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chinese locale means Code Page 936 here. It's also related with removing C4819 warnings. And it's also following Conventions in Qt source code: All code is ascii only (7-bit characters only, run man ascii if unsure) See also http://wiki.qt.io/Coding_Conventions Task-number: QTBUG-56155 Task-number: QTBUG-58161 Change-Id: I1c38a6ce74670716f730663edbcdec3919b438c2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Add fixes for INTEGRITYKimmo Ollila2017-01-311-7/+7
| | | | | | | | | | | | | | Full definitions of types are needed in static_casts. Change-Id: I028ffc40a76cdb16cb297a181b3d9dfe9d09c945 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | qml: Remove last foreach, and mark QT_NO_FOREACHRobin Burchell2017-01-171-1/+1
| | | | | | | | | | | | | | Just src/imports/ to go... Change-Id: Ib4484676e24655cb950b3c4bb6495ff0e7f9700f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-141-9/+6
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp src/qml/qml/qqmlimport.cpp src/quick/items/context2d/qquickcontext2dtexture_p.h tools/qmleasing/splineeditor.h Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-281-9/+6
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The renderers added in 5.8 had to be adapted to the changed profiling macros from 5.6. Conflicts: src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp src/quick/util/qquickprofiler_p.h tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp Change-Id: Icb370b7c95aab12589ad73881ac6d178759a5c6b
| | * Merge remote-tracking branch 'origin/5.6' into 5.75.7Liang Qi2016-11-251-9/+6
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/quick/util/qquickprofiler_p.h Change-Id: I11a89c2a166115d6697adfba09928805643e709e
| | | * Improved robustness of the optimizer when removing expressionsSimon Hausmann2016-11-221-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example during dead code elimination we may invalidate statements, but at the same time there may still be instances left in the work list of optimizeSSA(). When we encounter then, we should not process them any further. Task-number: QTBUG-56255 Change-Id: I4c24b1a225ce1bde112172e9606f91c426c19f19 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-231-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4object_p.h Change-Id: Iff4d3aba7710a999b8befdc493cbe959e1ce02f9
| * | | Add a missing break statementLars Knoll2016-11-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Converting a constant to null or undefined shouldn't happen in practice, but it still shouldn't run into the Q_UNIMPLEMENTED. Change-Id: I994a55defd7f4e29628732a8a9071bc785a80ee2 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2016-11-031-0/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: tools/qmljs/qmljs.cpp Change-Id: Ifa9e74bdb780eaff22fbc9ba1c514d0078a3fb29
| * | | Fix crash when loop peeling and basic block mergingSimon Hausmann2016-10-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When trying to merge the second (original) loop header block of a peeled loop, we would end up with dangling references to that block from the loop body blocks. There's no trivial way to find all these quickly from the header, so for now don't merge these blocks into the predecessor. Change-Id: I2b5e39c5596ffd8c21ca9871af3a8150a019f2a8 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | Qml compiler: replace 'foreach' with 'range for'Anton Kudryavtsev2016-09-091-41/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and with 'index-based for' in one place. Change-Id: I4df75bd5921f9ee8b5744067adbaafbc46452f87 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | Merge remote-tracking branch 'origin/5.8' into devSimon Hausmann2016-08-271-34/+89
|\| | | | | | | | | | | | | | | Change-Id: Iaf83f4c74b25b08764005267713db91c95732fc0
| * | | V4: Replace the ranges QVector with a QVarLengthArrayErik Verbruggen2016-08-241-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduces the instruction count of Optimizer::lifeTimeIntervals with about 33% on x86_64, and the number of malloc calls with about 20%. Change-Id: I2ca303a3919dc940f29e40b2487016ff85e678fb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | V4: Remove another use of QSetErik Verbruggen2016-08-241-19/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduces the instruction count of Optimizer::lifeTimeIntervals with about 35% on x86_64, and the amount of malloc calls with 25%. Change-Id: I1f1d847addee86c63ab7ac17bec926500e2901e1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | V4: Sort unprocessed ranges in reverse orderErik Verbruggen2016-08-231-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents the copy overhead that a removeFirst() would impose. Change-Id: I4d3507784792e9bc3c4347f43ea6fdb087c6f201 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | V4: Replace a QSet with a QVector in calculateOptionalJumpsErik Verbruggen2016-08-231-10/+26
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of storing a bunch of statement IDs in a QSet, the parent basic block of the terminator statement (specifically: the jump) is used as an index into a bit vector. If the bit is set, this indicates that the jump can be omitted. This reduces the number of allocations from 1 hash node per optional jump, to 1 per function. The allocation will also be smaller then a hash node. Change-Id: Ia34468534b96dd9cefa837523bf89ad233de92e8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | V4: merge basic blocks where possibleErik Verbruggen2016-07-111-4/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The algorithmic complexity of some algorithms/functions in the optimizer are directy related to the number of basic blocks, so reducing the basic block count improves them. Two basic blocks can be merged when a block has one outgoing edge, and the successor has one incoming edge. Change-Id: Ifc870c8022f3aac8adf77c3ec5f826bed33c668d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | V4: Change uses of StmtVisitor/ExprVisitor to use new style visitors.Erik Verbruggen2016-06-081-406/+471
| | | | | | | | | | | | | | | Change-Id: I668c829bf04e0e16ed94db169507cc5290deec50 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Convert comparison methods to the new runtime syntaxLars Knoll2016-04-111-8/+8
|/ / | | | | | | | | Change-Id: Iad4dadddefca2d6322d4f778272b75d64e1a746f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Replace qQNaN() and friends with qt_qnan().Erik Verbruggen2016-04-051-1/+1
| | | | | | | | | | | | | | | | These constexpr functions can be inlined, and the compiler can be a bit smarter with code generation. Change-Id: I4ea87c794dd8e375749e18d273d01bb848231113 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QML: add type info for the built-in qml context.Erik Verbruggen2016-04-051-1/+10
| | | | | | | | | | | | | | | | | | | | Previously, the type for the target temp would be 'var', which would subsequently be corrected to qobject through a member access. That resulted in typing the defining move again, which is unnecessary. Change-Id: Ife993a667331e69aea64ac2af0f64096a142a583 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | QML: do not re-use the resolver data for members.Erik Verbruggen2016-04-041-22/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On successful lookup, the resolver data was cleared and re-used for the resolved member. The effect is that a second time the resolver is used, it will not be able to do the same lookup, resulting in it returning an unknown type. Because the same expression might need to be resolved multiple times (e.g. when a dependency changes type), this results in the wrong type (var), and then more iterations to propagate this wrong type to all usages. Instead, return a new resolver with its own data for the resolved member. This way, a member access on this result can be resolved correctly by this new resolver. Change-Id: Ia930c08a2e4a2182d800192547fc03cba209c78c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: prevent re-adding currentStmt to the worklist in type inference.Erik Verbruggen2016-03-301-2/+10
| | | | | | | | | | | | | | | | | | Adding the statement that is currently inferred to the worklist can happen when it's a member access where the base is discovered due to static QML lookup. Change-Id: I0e1b7011c4cfd691320d9b8dbcc660a65a558853 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: Fix debug output for the type inference pass.Erik Verbruggen2016-03-301-0/+11
| | | | | | | | | | Change-Id: Ia09b9ed4689b850a5575c72d63ca9677baf631e1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: Move BitVector to the util header, so it can be re-used.v5.7.0-alpha1Erik Verbruggen2016-03-071-115/+0
| | | | | | | | | | Change-Id: I994ff9277fbbcebf2e45b3146859eb75264b83f4 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | V4 IR: Store the phi-node parameters directly in the class.Erik Verbruggen2016-03-061-27/+25
| | | | | | | | | | | | | | | | | | | | | | | | Every time one of the paramets was accessed, the chain of loads was: phi->d->incoming->heapdata[i] Now it is: phi[i + offsetof(incoming)] This also removes at least one malloc (for the Data), and usually two (when the number of parameters is <= 4, which is most of the cases). Change-Id: I953e784647148266ae5a49a93a203d0d22cdcb63 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | V4: Replace foreach with range based for loops for statements.Erik Verbruggen2016-03-051-24/+25
| | | | | | | | | | | | | | | | Function::basicBlocks() returns a const reference to a QVector, so it can safely be iterated over without qAsConst. Change-Id: Ie9a17edfff7c1fbdc3601121935aef4b41338a35 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: Replace foreach with range based for loops for statements.Erik Verbruggen2016-03-051-15/+15
| | | | | | | | | | | | | | | | BasicBlock::statements() returns a const reference to a QVector, so it can safely be iterated over without qAsConst. Change-Id: If4e47e0e113adbc87253bb3478208a3a38fed9e2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | V4: Replace foreach with range-based for loops on QVarLengthArrays.Erik Verbruggen2016-03-041-23/+23
| | | | | | | | | | | | | | | | QVarLengthArray is not shared, so it will not detach and make a copy of the data when begin() is called. Change-Id: I9114d99fc0cabb17d68993408bea01695754437a Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Qml: replace QStringLiteral with QLatin1StringAnton Kudryavtsev2016-02-101-1/+1
| | | | | | | | | | | | | | ... in string comparisons. It's more efficient. Change-Id: I3be5a2be9ba5d55546472eac28f5f639a496bf3b Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Don't deep copy std::vector [-Wclazy-foreach]Sérgio Martins2016-02-081-5/+5
| | | | | | | | | | Change-Id: Ic326786a64c9b6dcd8cee1b45dec45de9cd90414 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-101-1/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h tests/auto/quick/qquicklistview/tst_qquicklistview.cpp tests/auto/quick/qquicktextedit/qquicktextedit.pro tests/auto/quick/qquicktextinput/qquicktextinput.pro Change-Id: I95d2c20a8619e5b8fa361c941a16dd8dce3e04e7
| * V4: Replace QVector with (Q)VarLengthArray in BasicBlock.Erik Verbruggen2016-01-061-1/+1
| | | | | | | | | | | | | | | | | | This prevents extra mallocs in nearly all cases, because the number of incoming edges is not that big. The outgoing edge count has a maximum of two. Change-Id: I89195809952ce6087c5af51d717a4c2d8ac6b853 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Replace all occurrences of qSNaN() with qQNaN()Ulf Hermann2015-12-071-1/+1
|/ | | | | | | | | | | We generally don't want to produce signalling NaNs as those cannot be used in any further arithmetic operations. In particular -(qSNaN()) claims it's not a double. Task-number: QTBUG-49753 Change-Id: I23cec4fec2ddf08c02a7d53db7f3b9ba46b6c288 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* V4: do not run optimizer for functions of >300 statements.Erik Verbruggen2015-10-231-2/+5
| | | | | | | | | | | | | | | | | | | The time it takes to run the optimizer depends on both the number of IR statements, and the number of basic-blocks. Many functions that have more than 300 statements are either the %entry point, or methods that set a large number of member variables. Both are not performance sensitive, so skipping them won't hurt execution speed. Actually, not optimizing them does improve startup speed. Basic blocks need to contain at least one statement (the terminator), so a large number basic blocks always results in at least an equal number of IR statements. Therefore they do not need to be taken into account. (An example of an excessive amount of basic blocks is a switch with 9000 cases: this will generate ~27000 basic blocks.) Change-Id: Iabf809d8ad293f4f27ece06d136aa281991a1b0f Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QML: Sanitize reading environment variables.Friedemann Kleint2015-10-221-4/+4
| | | | | | | | | | | Where possible, use qEnvironmentVariableIsSet()/ qEnvironmentVariableIsEmpty() instead of checking on the return value of qgetenv(). Where the value is required, add a check using one of qEnvironmentVariableIsSet()/Empty(). Change-Id: Ia8b7534e6f5165bd8a6b4e63ccc139c42dd03056 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Remove line numbers for statements without side-effects.Erik Verbruggen2015-10-151-46/+95
| | | | | | | | | | | | | When debug mode is not enabled, line numbers are only used in order to generate usable stack traces. Therefore statements that cannot fail/throw do not need line numbers associated with them. Of course, when debug mode is enabled, this is not applicable. The effect is that the generated code for such statements shrinks by 2 loads and 1 store. Change-Id: I4ec425dd20b56043e8ca0e4c68afc683eb9b50e7 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Initialize member variable.Erik Verbruggen2015-10-131-0/+1
| | | | | | | It's never used (because it's qSwap()ed), but still. Change-Id: I64cbb39dcd9f9368c73b5b9bf98dc1f3a52a13ef Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>