| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/jsruntime/qv4engine_p.h
src/quick/items/qquickitemsmodule.cpp
src/quick/items/qquicktext.cpp
src/quick/util/qquickpixmapcache.cpp
tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
|
| |\
| | |
| | |
| | | |
Change-Id: Ie8ea118ed0a1a9a1c3d81e1e34d85c03c695c9a4
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Commit 75c22465cf8fe262edfe6178bb9ca19661fb710e regressed in allowing
locals and arguments to be passed directly as further arguments to function
calls, but that's incorrect when considering
var i = 2;
testFunction(i, i += 2)
where it is instrumental to place the first argument into a temp (making a
copy) instead of passing it directly.
Change-Id: Iffcf6c6eda92a8fb665982cda1db0b96359cd092
Task-number: QTBUG-45879
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is a cleaner separation and further reduces include dependencies
in the definitions of our basic data structured.
Change-Id: I18aa86cdea0c0dfbc16075d4d617af97e638811e
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|
|/ /
| |
| |
| |
| | |
Change-Id: Ie48dc8f95daa4738e690902b5d33010afa7b974f
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The old code would evaluate the expression in the switch
statement once for every case label. This is not only slower
than it should be, but can also lead to unexpected results in
case the expression doesn't always evaluate to the same value
or has side effects.
Task-number: QTBUG-41630
Change-Id: Id93baca7e3aa09ce884967ef6524d4c4f055bcd6
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|
| |
| |
| |
| |
| |
| |
| | |
Avoid repeated instantiation of end() in loops, use variable instead.
Change-Id: I3bb1c6918cfd16a5dcefbcc03c442e99fe9bf76b
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.
Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
This takes the time taken in qmlErrors for my (admittedly terribly morbid)
testcase from ~104ms to ~1ms.
Change-Id: I288086caa6e6b58f67e9feb6f1761c3310f01ead
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
| |
| |
| |
| |
| | |
Change-Id: Ic62ae1cbd24c0089e0df6bc6758d262cf49d0b91
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|/
|
|
|
|
|
|
| |
The methods don't require a context, and thus shouldn't be
implemented there.
Change-Id: If058e0c5067093a4161f2275ac4288aa2bc500f3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
| |
- Renamed LICENSE.LGPL to LICENSE.LGPLv21
- Added LICENSE.LGPLv3 & LICENSE.GPLv2
- Removed LICENSE.GPL
Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0
Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
|
|
|
|
|
| |
Change-Id: Ibd3e747918dc0bc939fcbd173585fb1e4d4f08fb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also centralized the context state saver and added line number saving, so that the
JS jobs for evaluation of breakpoint conditions don't change the state of the current
engine context.
Task-number: QTBUG-37119
Task-number: QTCREATORBUG-11516
Change-Id: Ia21b3d64e239e5b67f3c07e1c006d8e6748f29b6
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We perform loop detection to be able to assign to each block its loop,
an chain them up from inner loop to outer loop. The new algorithm works
on each basic block just once, and looks at a basic block just the
number of connections it has. As it relies on the dominator tree it is
more robust on actually finding al looping constructs and only those
rather than relying on the statements used. It assumes that a basic
block is analyzed before the one that dominate it (to guarantee finding
outer loop headers before inner loop headers), so blocks are ordered to
work on them in a way that guarantees that, using dominator tree depth,
that is trivially available.
Loop detection allows us to then schedule the loop body before the part
after the loop (the header dominates both so just domination cannot
choose between both), and can be used to optimize loops (either
unrolling the first iteration or hoisting constant parts out of it).
It also helps with generated JavaScript code: in order to simulate gotos
or other unconditional branches, nested labeled do-while(false) loops
are often used in combination with break/continue to "jump" between
"loops".
Change-Id: Idfcc74589e057b191f74880ffd309d0a9c301811
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a couple of reasons to split the temporaries off from the
arguments and locals:
Temporaries are invisible, and changes to them cannot be observed.
On the other hand, arguments and locals are visible, and writes to them
can be seen from other places (nested functions), or by using the
arguments array. So, in practice these correspond to memory locations.
(One could argue that if neither nested functions, nor eval(), nor
arguments[] is used, the loads/stores are invisible too. But that's an
optimization, and changing locals/arguments to temporaries can be done
in a separate pass.)
Because of the "volatile" nature of arguments and locals, their usage
cannot be optimized. All optimizations (SSA construction, register
allocation, copy elimination, etc.) work on temporaries. Being able to
easily ignore all non-temporaries has the benefit that optimizations can
be faster.
Previously, Temps were not uniquely numbered: argument 1, local 1, and
temporary 1 all had the same number and were distinguishable by their
type. So, for any mapping from Temp to something else, a QHash was used.
Now that Temps only hold proper temporaries, the indexes do uniquely
identify them. Add to that the fact that after transforming to SSA form
all temporaries are renumbered starting from 0 and without any holes in
the numbering, many of those datastructures can be changed to simple
vectors. That change gives a noticeable performance improvement.
One implication of this change is that a number of functions that took
a Temp as their argument, now need to take Temp-or-ArgLocal, so Expr.
However, it turns out that there are very few places where that applies,
as many of those places also need to take constants or names. However,
explicitly separating memory loads/stores for arguments/locals from
temporaries adds the benefit that it's now easier to do a peep-hole
optimizer for those load/store operations in the future: when a load is
directly preceded by a store, it can be eliminated if the value is
still available in a temporary.
Change-Id: I4114006b076795d9ea9fe3649cdb3b9d7b7508f0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|\
| |
| |
| | |
Change-Id: I996a85744753598bb48c7e0d7954049202f4f037
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is among other things needed to fix the qml import scanner to detect
dependencies from .js files correctly.
The patch also fixes the use of Q_QML_EXPORT towards Q_QML_PRIVATE_EXPORT
where appropriate and corrects the wrong include path for the double conversion
code to actually be relative to the file it is included from. This worked by
accident because of other include paths present in the build.
Change-Id: I338583dad2f76300819af8ab0dae8e5724c84430
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|\|
| |
| |
| | |
Change-Id: I1214586499ab2876c8bc55a99367a0c938c8b919
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When the iterator calculation contains a condition, newly created
basic-blocks were marked as loop blocks. However, their parent was not
the loop header.
Task-number: QTBUG-38187
Change-Id: I9ee7a3e0bd536c2a005b91f8333931ce929245af
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BasicBlocks have an index property which points to the index of that
basic block in the container array in Function. This property can be
used to store calculated information about basic blocks in a vector,
where the vector index corresponds to the basic block index. This is
a lot cheaper than storing any information in a
QHash<BasicBlock *, ....>.
However, this numbering requires that no re-ordering or deletion of
blocks happens. This change cleans up all that handling which was
scattered over a number of places.
Change-Id: I337abd39c030b9d30c82b7bbcf2ba89e50a08e63
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
| |
Change-Id: Iea540b768232ea423ea7f04e41655198931cf36d
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Object literals with array indices are now created with one
run-time call, instead of an initial one for non-integral keys
followed by sub-sequent define_builtin_property calls.
* Cleaned up propert name retrieval. Instead of using a visitor,
it's easier to define a virtual method on the PropertyName type. The visitor
doesn't buy us much as it's not possible to recurse within property names, and
this way we can use it also from the function scanner to correctly determine
the number of arguments needed for object literal initalizations.
* Similarly the duplicated/common name member for all property assignments
has been moved into PropertyName, for convenient access without AST casts.
* Removed now unused builtin_define_property/settergetter functions from IR,
run-time and moth.
Change-Id: I90d54c81ea5f3f500f4f4a9c14f7caf5135e7f9f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
| |
QQmlJS::MASM -> QV4::JIT
QQmlJS::V4IR -> QV4::IR
Change-Id: I707e8990459114a699c200fe3c22cec3c8df1afc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
| |
This avoids a hack in QV4::Codegen where we created a V4::String
on the stack to convert to an array index.
Change-Id: I9a88d45817bbcde52a4037a52fbae299b8c9cb1a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
| |
Instead of querying for the context, scope or imported scripts object on each
access, do it once at the beginning of the expression in the IR and re-use the
temp. The optimizer will optimize away unused temps.
Change-Id: I703e737469030c4454d23c567873012a2b537d71
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
| |
References to id addressed QML objects are member expressions, which are unlike
other member expressions by not being lvalues. Handle this correctly.
Task-Number: QTBUG-34890
Change-Id: Ied6230edbc561128ad36bf0d1a1918185204deec
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Any new blocks generated as part of the initializer were incorrectly
marked as belonging to a loop. For example, if a LocalForStatement
would contain a ternary expression, the generated then and else blocks
would be marked. This would confuse the block scheduling, because all
blocks are postponed unil the condition block (“group start”) is
scheduled.
Task-number: QTBUG-33754
Change-Id: I45919ebeac356f015bb91fe0210472b3df0b56d8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
| |
Get rid of the SimpleCallContext, instead simply
use the CallContext data structure, but don't
initialize the unused variables.
Change-Id: I11b311986da180c62c815b516a2c55844156d0ab
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
| |
Also fix up the generated string for the reference error.
Change-Id: I327a8eb682017297a799f8bae650267727039616
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
| |
Change-Id: Iee1280462bec296de1ff2f7572cfc98035195235
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
This makes sure we get the right exception in the engine
in case there are multiple parse errors in the code, and
avoids running into assertions.
Change-Id: I8a11c6d043d09caf57a3e4c6aad5834e99cc1761
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
With a growing number of functions per module, these calls become
expensive and are unnecessary. defineFunction in the code generator
can simply return the correct index right away.
Change-Id: I8ab56a3083bf215674a1b46c502b415be694e465
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
| |
The global scope is compiled as EvalCode. Because of this
we were never using global lookups anymore, slowing down
the v8 test suite by ~20%.
Change-Id: I6c47ccf90f4d9ec3bf531bbb689d3f1511f69968
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is done by re-using the JS code generator from the new compiler. A few bugs were
fixed on the way:
* The index into the compiledData->runtimeFunctions array is not the same as the function
index when they are collected (from the AST), as for example binding expressions may create
extra V4IR::Function objects that break the 1:1 mapping. Therefore the JS code gen will return
a mapping from incoming function index to V4IR::Module::Function (and thus runtimeFunction)
* Binding expressions in the old backend get usually unpacked from their ExpressionStatement node.
The reference to that node is lost, and instead of trying to preserve it, we simply synthesize it
again. This won't be necessary anymore with the new compiler in the future.
* Commit 1c29d63d6045cf9d58cbc0f850de8fa50bf75d09 ensured to always look up locals by name, and so
we have to do the same when initializing the closures of nested functions inside binding expressions
(in qv4codegen.cpp)
* Had to change the Qml debugger service auto-test, which does toString() on a function that is now compiled.
Even if we implemented FunctionPrototype::toString() to do what v8 does by extracting the string from the
file, it wouldn't help in this test, because it feeds the input from a string instead of a file.
* In tst_parserstress we now end up compiling all JS code, which previously was only parsed. This triggers
some bugs in the SSA handling. Those tests are skipped and tracked in QTBUG-34047
Change-Id: I44df51085510da0fd3d99eb5f1c7d4d17bcffdcf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
parameter
Testcase: (covered in parserstress)
function foo(x) {
var x = 42;
}
In variableDeclaration, the lookup for "x" with findMember will return -1, and
instead code for checking against arguments using indexOfArgument is needed.
The easiest fix is to simply use identifier(), which handles this accordingly.
Change-Id: I6a738d6196d4bff1fc987f111aebbaa83ed8f88f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to determine the type of lookup we need (name or directly in
environment members), we used Codegen::_mode, which is set to the currently
suitable mode depending on the function (parameter to defineFunction). However
that's not quite correct, the look-up mode depends on the function itself, not
where it was called from. This patch corrects that by moving the compilation
mode into the Environment itself.
This is needed by follow-up patches.
Additionally the "bool deletable" parameter to the builtin_declare_vars was
always set to false, because it used mode instead of _mode, which was never set
to Eval or QmlBinding. This will be cleaned up in a future patch.
Change-Id: I878f187945e5de091689ab5d70a0f33eb5a9e38f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Testcase (part of parserstress in tests/auto/qml):
outer: {
do {
inner: {}
} while (false)
}
The labelled statement visitor, when hitting the outter label, would call
enterLoop(), which sets _labelledStatement back to zero. That then gets added
to the Loop object the do-while loop creates, and the duplicate labelled
statement check then for inner would unconditionally dereference
loop->labelledStatement.
In all other places where we access loop->labelledStatement we have a null
pointer check, so let's have one here as well.
Change-Id: I9d5925a2abf4db691c49c0cdec3550938ee02efa
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This has the benefit of blocking the GUI thread less and speeding up type
creation in the GUI thread (for types that import js libraries).
This patch also brings one behavioral change: Due to the parsing at type
instantiation type, things like syntax errors for script imports would only
generate a run-time warning and the code in the QML file would just see
"undefined". Errors in the script now generate real errors at component
compilation time, meaning the errors come out earlier and as real errors.
This patch implements the separation for the VME only (to keep the size
of this patch small).
Change-Id: I82f7f3a2d3d4524ea12a7ab62abd8640aba6a47f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Also clean up a few other direct uses of Value
Change-Id: Ie27d42c1b31b9e6d16d0a60071cb5e4e1c5b9e8b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|\
| |
| |
| |
| |
| | |
Pull in the remaining bits of the new compiler/vme branch.
Change-Id: I4706011c5eaf35f893d0733c4e130a31ce0ebb66
|
| |
| |
| |
| |
| |
| |
| | |
Always look up locals by name
Change-Id: I2fa14499f6d8749f450bfe2b8a53d684b93bd1dc
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This introduces Singleton support for QML (Composite Singleton). For
now, the Singleton support is only availabe for QML types in modules
or (remote and local) directories with qmldir file. However, in the
future this support may be expanded to arbitrary QML file imports
without by leaving out the qmldir requirement.
You define a QML type as a Singleton with the following two steps:
1. By adding a pragma Singleton to a type's QML file:
pragma Singleton
The pragma and import statements can be mixed and their order does
not matter. Singleton is the only supported pragma for now. Others
will generate errors.
2. By specifying a qmldir file for the directory of your imported
type and prepending the type with "singleton" keyword as follows:
singleton TestTypeSingleton TestTypeSingleton.qml
Alternatively you may specify a qmldir file for a module and specify
your type as a singleton as follows:
singleton TestTypeSingleton 1.0 TestTypeSingleton.qml
Composite Singletons may be included in a module and may be used with
a local namespace qualifier when imported with:
"import xxx as NameSpace"
A singleton instance is created at first use and stored into the
QmlEngine (one instance per engine) and eventually released by the
engine's destructor.
CompositeSingletonType has a dual nature and will return true to both
isComposite() and isSingleton() calls. In most cases its enough to
check for just isComposite() or isSingleton(). However, there is a
isCompositeSingleton() available as well.
I used "qlalr --no-debug --no-lines --qt qqmljs.g" to generate the
qqmljsparser and qqmljsgrammar files from qqmljs.g.
Unit tests are included.
Change-Id: I91b303612c5e132143b325b9a8f982e9355bc90e
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
|