aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4regalloc.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move JIT infrastructure into it's own directoryLars Knoll2014-02-221-1646/+0
| | | | | | | | This is a starting point to clean up some of the code base for the JIT. Change-Id: I388ce8df7d4ab87095e227cf36643f4be2594b7d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-02-111-7/+27
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/jsruntime/qv4arrayobject.cpp src/qml/jsruntime/qv4context.cpp Change-Id: Ied5b23bec4dc14abe51127c507aed668f855c1e1
| * V4 regalloc: fix interval splitting when register pressure is high.Erik Verbruggen2014-01-311-7/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a register is needed for an interval, but none is available, one of the used registers will be chosen and spilled to the stack (meaning it will be split) before the current position. However, if a register is used at the current position for an incoming parameter, its interval has to be split after the current position. This patch adds/fixes the latter case. This fixes crypto.js on x86. The specific problem there was that the result of an operation needed a register, and chose the one from one of the incoming parameters (which then should get spilled/split). However, this interval was already split, and started exactly at that the current position. So splitting before the current position did nothing, resulting in it staying alive and using the same register as the result. So any subsequent use of would have the invalid value. Task-number: QTBUG-36430 Change-Id: I228fc210b009aa0b16b08a374fc955fabfbb6d12 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Rename some filesLars Knoll2014-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Rename qv4value_def_p.h -> qv4value_p.h and qv4value_p.h to qv4value_inl_p.h. It makes more sense to have the class definition in the file that is named after the class and move the inline methods into a _inl file. Doing this now, as I expect we'll be needing a few more _inl files soon. Change-Id: Ib59e9380e9e976254c6b4369574157f39b1b5f51 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-241-10/+6
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/dialogs/qquickmessagedialog.cpp src/imports/dialogs/qquickmessagedialog_p.h src/qml/debugger/qqmlprofilerservice_p.h src/qml/jsruntime/qv4regexpobject.cpp tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro Change-Id: Ic8a43366b44d6970966acbf03b206d0dee00c28d
| * Merge "Merge remote-tracking branch 'origin/release' into stable" into ↵Simon Hausmann2014-01-241-3/+0
| |\ | | | | | | | | | refs/staging/stable
| | * Merge remote-tracking branch 'origin/release' into stableSimon Hausmann2014-01-241-3/+0
| | |\ | | | | | | | | | | | | Change-Id: I4b0f2d63aff78b50656a519c088afc4a076747f7
| | | * V4: remove more superfluous spills.Erik Verbruggen2014-01-231-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Spills for targets of phi-nodes are already inserted by the renumbering, so they don't need to be added (again) while resolving edges. This fixes a problem with crypto.js. Change-Id: I4b1d79fc92236b4a6b0b6d6d30ada17c8581a093 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | | V4: fix life-time hole check.Erik Verbruggen2014-01-241-7/+6
| |/ / | | | | | | | | | | | | | | | | | | | | | This check was incorrect when a jump happened from before (or after) the life-time interval into a life-time hole. Change-Id: Idacf304a96d39f372249a48e18b00891531d9859 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-01-171-1/+3
|\| | | | | | | | | | | Change-Id: Id265682aa7db9be1c0b305ab3207b2c932a25a9f
| * | V4: fix range splitting when split is between intervals.Erik Verbruggen2014-01-171-1/+3
| |/ | | | | | | | | | | | | | | | | | | | | Also added some "white-box" unit tests and sprinkled in a bit of documentation. The case that went wrong is covered by the test rangeSplitting_1: before the fix, the new interval would have two ranges: [66-64],[70-71]. The first range is invalid and should not be there at all. Change-Id: If0742f4e6a96d98ea5d696f95126886ba66f92bb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-01-171-73/+89
|\| | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/imports/dialogs/DefaultFileDialog.qml src/imports/widgets/qquickqfiledialog.cpp Change-Id: I00de6dd05cb773f01254061d585a82c90b229acd
| * V4: relieve more memory allocator pressure.Erik Verbruggen2014-01-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | For _ZN13BenchmarkDemo11initPhysicsEv from the Octane testsuite, the total allocated memory drops from 1.5GB to 51MB. Peak memory usage stays at 29MB. Again, slow implementations of malloc()/free() will see a performance improvement. Change-Id: I21bc2f0d3735de0980fc9b3745906016e2e48a61 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * V4: lower memory allocator pressure.Erik Verbruggen2014-01-161-65/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | Changes to datastructures and more re-using of locally used temporary vectors. For the test regress-74474-002.js this lowers the total allocated memory from 1.98GB to 158MB. Thse peak memory usage stays at 75MB. There is no functional change. This should give a modest performance improvement which mainly depends on the speed of malloc()/free(). Change-Id: I1877c1903e59a33ee79ff2b801ef6f2c1cee30a6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * V4: remove unnecessary spills and order them correctly.Erik Verbruggen2014-01-161-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When doing edge resolving, too many spills were generated, and the dependency tracking of moves was not complete. Now we only insert spills that are caused by phi-nodes (because any other spill would be generated at the point a variable was defined). However, there can still be multiple dependencies between the moves generated by the edge resolving. Instead of only checking the first dependency, all of them are tracked. The bug report was a case where an unneccesary spill was generated, that got tracked, but "suppressed" the other (valid!) dependent move. The randomness was caused by the hash seeding of QHash. Task-number: QTBUG-35840 Change-Id: Ifbc3c8fc13de53c46a8b5859721b2497189921a3 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Classify struct Use with Q_MOVABLE_TYPE.Sérgio Martins2014-01-091-0/+3
|/ | | | | | | It's movable, private, !isLarge and used by QLists in this code. Change-Id: I08c6e7e65625aba1bc798a3911a20d6d2ddc73fb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 IR: reverse propagate int32 truncation.Erik Verbruggen2013-12-041-1/+8
| | | | | Change-Id: I5cb0c7798d0e530f3137710bf0e723bd7b64dc89 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix build in release mode with forced assertsKonstantin Ritt2013-12-031-1/+1
| | | | | Change-Id: I0e35533af7f65200a8bc3c4024c29344fa6f4b7a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support for accelerated property access to QML types and namespace supportSimon Hausmann2013-11-281-1/+1
| | | | | | | | | | | * Resolve lookups in namespaces at compile time and instruct the SSA optimizer to eliminate reads from the namespace (QQmlTypeWrapper) if possible. For example access to attached properties of types (i.e. MyNameSpace.ListView.isCurrentItem) requires neither reading the namespace nor the type. * Add support for accelerated lookup of attached properties Change-Id: Ib0b66404ed7e70e1d4a46a1ac8218743a4cc8608 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial support for accelerated property access to QML singletons and enumsSimon Hausmann2013-11-251-0/+8
| | | | | | | | | With this patch we determine the meta-object of singletons, propagate it into the IR and load them separately using a dedicated run-time function. In addition enums in singletons and QML types are resolved at compile time. Change-Id: I01ce1288391b476d1c9af669cb2987a44c885703 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* IR Cleanup, resolve ID objects through array subscriptsSimon Hausmann2013-11-251-2/+1
| | | | | | | | | | | | ...instead of a special MEMBER type. This allows removing the type member from V4IR::Member altogether (and thus unshadow from V4IR::Expr::type). By not requiring the base of a id lookup member expression to be a NAME, we can also speed up repeated id lookups by fetching the id object array wrapper only once per function. Change-Id: I3e9b8f498d32ace4a0cc2254f49e02ecc124f79c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Improve type interference for QObject propertiesSimon Hausmann2013-11-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Propagate QObject properties in member expressions across temporaries as part of the type interference SSA pass. This replaces the earlier attempt to resolving QObject properties in fieldMemberExpression() in the codegen, but it was incomplete and now things like the following are fully resolved: var tmp = blah.somePropertyThatReturnsAQQuickItem; <-- QQuickItem property return type propagated into tmp var width = tmp.width; <-- and picked up here again to resolve the index of width instead of by name With this patch Temp gets a helper structure with a function pointer, initialized to aid the resolution of properties in Qt meta objects. This structure is propagated into the temps until it reaches the next member expression that uses the temp. Similarly QObjectType is added as IR type, next to VarType. The resolution inside the SSA type interference pass also requires passing through the QQmlEngine from the upper caller levels, in order to resolve the property type to a potential QMetaObject property. Change-Id: I14c98fa455db57603da46613ce49c174d0944291 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix compiler warnings with mingw64.Erik Verbruggen2013-11-181-0/+1
| | | | | | | Task-number: QTBUG-34152 Change-Id: Ibb93d1cac8c343a7ca34ce7d010f24fc56ba89df Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix property dependency generation for accelerated QML QObject propertiesSimon Hausmann2013-11-121-1/+1
| | | | | | | | | | | | | | The previous approach of collecting the dependencies through an IR visitor doesn't work, because it relies on a fixed structure - for example MEMBER(NAME, prop) - which we can't guarantee (it's usually MEMBER(TEMP, prop)). But it turns out that we can only pre-calculate dependencies for context, scope or id properties, so we can do that right away in the QML specific JS codegen, store that information in the IR function and use it from there in the data structure generator as well as in the isel as a parameter to getQObjectProperty to tell the run-time whether capture is required or not. Change-Id: I33711c3420d6534c653c2a6a4284f0fc12e941cf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove unused _info on non-debug buildsShawn Rutledge2013-11-121-0/+7
| | | | | | | | | Otherwise clang generates a warning which is fatal because of treating warnings as errors. Change-Id: I47c280edf6b0f8efa5ce24f9e92551304aed15fb Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* V4 JIT: fix invalid sanity assert.Erik Verbruggen2013-11-121-2/+22
| | | | | | | | | | | | | If there are multiple incoming edges to a block, and there are one or more phi nodes at the start, then only check the temp uses for the edge we are resolving. Task-number: QTBUG-34770 Change-Id: Ibb5c7c323d6be8bc1ed492b08ed098de2f2726cc Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* Move conversion of this object into generated codeLars Knoll2013-11-051-0/+1
| | | | | | | | | | | | When a non strict mode function uses the this object, we need to make sure it's being correctly converted into a object before being accessed. So far this was being done by ScriptFunction::call. Move this into the generated code to avoid overhead for methods not using 'this', and simplify our ScriptFunction::call() implementation. Change-Id: I739f4a89d29ed8082ce59e48d1523776224fc29d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-4/+16
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Speed up lookups of imported scriptsSimon Hausmann2013-10-311-1/+1
| | | | | | | | | | The QQmlContextData stores the JS objects of imported scripts in a QList<PersistentValue>. Instead of indexing into that list, this patch changes ctxt->importedScripts to be a JavaScript array, that in the IR we can index via subscript. Change-Id: Ie2c35fb5294a20a0b7084bb51d19671a27195fec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement loading of resolved imported scriptsSimon Hausmann2013-10-311-1/+7
| | | | | | | | We can resolve the use of names that refer to imported scripts at compile time and load them at run-time by index through context->importedScripts. Change-Id: I681b19e7d68dbf3b9a68af00b4cea2a9254c2d78 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement setting of values to resolved QObject propertiesSimon Hausmann2013-10-311-0/+7
| | | | | | | | After the resolution of a property, we can set it by index at run-time instead of via name resolution. Change-Id: I479599dabe343cf9e6582dcda12291aebfcce418 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial support for resolving meta-property access for the scope and context ↵Simon Hausmann2013-10-311-0/+19
| | | | | | | | | | | | | | | | | objects at QML compile time This avoids having to do a string lookup for ids and in the import cache at run-time, before we can do a string hash lookup in the property cache. Instead we resolve final properties in the context and scope object at compile time and look them up at run-time using their index instead. The dependencies to these properties are also tracked separately and recorded in the compiled data. This is merely the initial patch. There's a lot left to do, such as having specialized getter and setters for specific property types. Setters are missing altogether right now and will fall back to name lookup. Change-Id: If3cb4e7c9454ef4850a615f0935b311c9395b165 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up id object lookupsSimon Hausmann2013-10-291-0/+6
| | | | | | | | | | | | | | | | | We can resolve lookups for objects referenced by id at QML compile time and use a run-time helper to extract the id object out of the QML context data by index instead of name. Dependencies to id objects are also tracked at compile time and registered separately before entering the generated function code. The lookup of id objects is encoded in the IR as special member lookups. Members will also then in the future be used to for property lookups in context and scope properties, as well as any other property lookups in QObjects where we can determine the meta-object. Change-Id: I36cf3ceb11b51a983da6cad5b61c3bf574acc20a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Rework IR code generation for try/catch/finallyLars Knoll2013-10-291-0/+1
| | | | | | | | | | | | | | | | | | Simplify the generated code. Add a special block to catch exceptions thrown inside a catch() statement. store the exception on the stack when entering finally and rethrow it at the end. This ensure correct behavior for break/continue/return statements inside finally. Don't check for exceptions after calling push_catch_scope and pop_scope in the JIT'ed code. This can lead to infinite loops when throwing inside an exception handler. Change-Id: I67e9325794e2fd25b0773b21e02fbaadb43faab0 Change-Id: Ic1ea9c0c43eec1d49177dc1ab4552a1da04e96fe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework exception handlingLars Knoll2013-10-291-5/+2
| | | | | | | | | | | | | | Start the work to remove c++ exceptions from our JS exception handling. Rather rely on engine->hasException. Check the flag after we return from any runtime call in the JIT. Implement new try/catch handling code in qv4codegen and for the JIT that doesn't rely on exceptions. As an added bonus, we can remove the Try statement in the IR. Change-Id: Ic95addd6ae03371c43c47e04cac26afdce23a061 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement >>> inline for the JIT backendLars Knoll2013-10-121-1/+1
| | | | | | | | | The unsigned right shift operations can use a signed int as input, unifying the handling with the other shift operations. The only difference now is in the type of the return value. Change-Id: Ia9b83568951d1c1c77322d07cd734e2c37d34573 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* V4 JIT: fix register allocator after change to s/uint32 usage.Erik Verbruggen2013-10-121-8/+2
| | | | | | | | Now that shifts can take a signed int32, reflect it in the check if a binop will generate a call. Change-Id: I3cab436bace31cdda327cf6132aa873b6c5456b1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 JIT: clean-up conversion functions and add toUInt32.Erik Verbruggen2013-10-121-11/+33
| | | | | Change-Id: I7ac685145fa41db2a0e02c4d15d1d287d80621f8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 JIT: ISel for bitwise or/xor.Erik Verbruggen2013-10-101-1/+1
| | | | | | | Removes another 4mln calls when running v8-bench.js. Change-Id: I7fd777e4e6303f989391c4d1e361277cc24b37e8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 JIT: generate some strict (not) equal conditionsErik Verbruggen2013-10-101-20/+6
| | | | | | | | | | | Checks for strict (not) equal to null, undefined, or a boolean value can be generated without reserving extra registers, or doing a call. This reduces the amount of runtime calls from >25mln to ~6500 for v8-bench.js Change-Id: If08d1124b2869227654b1233a89833c5b5e7b40c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use a QVector instead of a QListLars Knoll2013-10-031-8/+8
| | | | | | | | This makes the code go quite a bit faster (saves ~7-8% of the total amount of instructions executed when running crypto.js Change-Id: I6b3bd08eca98b45593262e2fc6e0ce5056257e76 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4: remove inplace operationsErik Verbruggen2013-09-301-22/+2
| | | | | | | | | Inplace operations are expanded when building the IR, so the neither the IR, nor the instruction selection backends or runtime need to handle them. Change-Id: Id01f9544e137dd52364cf2ed2c10931c31ddfff3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 regalloc: fix the case where too few regs are available.Erik Verbruggen2013-09-281-5/+15
| | | | | | | | | | When all registers are allocated, and a new range gets active, some other range will have to be split and spilled to the stack. This gets slightly more complicated when the temporary is defined by a phi-node, so in that case, the temporary is immediately spilled. Change-Id: Iaab8b8e88849866e5841ae752377796e8540e30f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 regalloc: fix intersection calculation.Erik Verbruggen2013-09-251-7/+10
| | | | | | | | | | | | | | The previous version was plain wrong: when the first interval had more than one range, those ranges would never be checked for intersection. This version iterates over all ranges in the first interval, and returns the index of the first range in the second interval that overlaps with that range. Iterating over the second interval is cut off when an interval is found that starts after the current one end (the ranges of both intervals are sorted). Change-Id: I87c254a645164eb6639925c2e3b7fd7c1b1bfa0a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: fix move mappingErik Verbruggen2013-09-251-1/+3
| | | | | | | | | | | | When resolving conflicting register use between basic blocks, only insert the resolving moves into the successor when it has one incoming edge. Because of the absence of critical edges, this implies that it is also save to insert those moves into the predecessor block if there is more than one incoming edge (the predecessor will only have one outgoing edge). Change-Id: I83c41b4ca86946d3aa09619f20ddab3e692136f2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 JIT: generate code for unary not operator.Erik Verbruggen2013-09-251-0/+3
| | | | | Change-Id: I00a47d261a76db0b938f8c9300be9afc06b42d02 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 JIT: generate inline code for more binops.Erik Verbruggen2013-09-201-0/+8
| | | | | | | Bitwise-and, shift left, and shift-right. Change-Id: Ifa949c60261054218797302673822f480f47bd6e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 IR: rename ObjectType to VarTypeErik Verbruggen2013-09-201-1/+1
| | | | | | | | | The ObjectType was a misnomer: it was used to indicate that the expression could have multiple types, or that the type could not be inferred statically. Change-Id: Ic48a0cd1dd7ae7bfafd361e0c9792ab161417039 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: Fix SSA decomposition when no regalloc is used.Erik Verbruggen2013-09-131-137/+0
| | | | | | | | | Add scheduling for moves generated by removing phi nodes by re-using the MoveMapping class from the register allocator. This change applies to both the JIT when no register allocator is used, and the interpreter. Change-Id: I38eac5b13759c7790132d1ef07fa17fcb53187e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove qSort usages from declarativeGiuseppe D'Angelo2013-09-131-7/+9
| | | | | | | | | QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I8fa7d0186cc8f0ba562695974829e37f1eb87f2f Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>