| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously all list types used as arguments or return types for methods
had to be looked up via the imports. However, builtin types are not part
of the imports at run time. Therefore, recognize list types already
early on, when generating the IR. This is the same way we do it for
property types and it allows us to easily identify lists of builtins.
Pick-to: 6.5
Fixes: QTBUG-109147
Change-Id: I91fa9c8fc99c1e0155cc5db5faddd928ca7fabbc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
| |
... and check the tdz only once on function calls.
Task-number: QTBUG-108362
Change-Id: I534e2604fb68b3b9145b7b7dd003e988e9df17d0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
We will need the statement indices when tracking value type references.
New value type references shall only be written back in the same
statement they were created in.
Task-number: QTBUG-99766
Change-Id: I83f908df034e7da8ba46ccacaa29bd9d78020d20
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
|
|
| |
Change-Id: I287a6e63397c2c6140c3bc3e7d83f3212709531e
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
This is required for better warnings in qmlcompiler's type propagator.
Remains optional as to not consume superfluous memory when not needed (during normal QML engine operation).
Change-Id: I50293f878e4f6659935925f5f2266427d2f64d7b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
You should declare functions with formal parameters if you want to use
parameters passed by the signal. We need to generate two different
warnings because there are two code paths by which such parameters are
injected. If we compile with qmlcachegen, it simply inserts a lookup
instruction in to the byte code. This lookup then triggers our special
hack expressly made for signal parameters. If we don't compile using
qmlcachegen, a function declaration with formal parameters is
synthesized. We mark those formal parameters as injected and warn if
we see one of them used.
[ChangeLog][QML][Important Behavior Changes] The automatic injection of
signal parameters into signal handlers is deprecated. This is because we
cannot determine the names of the signal parameters at compile time.
Furthermore, also for human readers it is difficult to discern between
arguments, context properties, properties of the current object, and
properties of the root object of the component. Requiring the signal
parameters to be explicitly named resolves some of this confusion. You
can turn the deprecation warning off using the "qt.qml.compiler" and
"qt.qml.context" logging categories.
Task-number: QTBUG-89943
Pick-to: 6.1
Change-Id: If0a5082adb735a73efd793868b3a55bc7d694cbe
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This collides with injected signal parameters. qmlcachegen cannot tell
those cases apart.
[ChangeLog][QML][Important Behavior Changes] QML warns about JavaScript
variables being used before their declaration now. This is almost always
a mistake. It is particularly dangerous in the presence of injected
signal parameters because qmlcachegen cannot identify a name collision
between an injected signal parameter and a variable being used before
its declaration. It therefore miscompiles such code. You can turn off
the deprecation warning using the "qt.qml.compiler" logging category.
Pick-to: 6.1
Task-number: QTBUG-89943
Change-Id: I8a9424ca8c6edd562402fe5c560ba7e8344b5585
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is needed in a few places outside of declarative, so this change
restores the loc member in DiagnosticMessage and moves
QQmlJS::AST::SourceLocation into common's QQmlJS namespace/directory.
QQmlError is unaffected and retains only line/column.
Amends d4d197d06279f9257647628f7e1ccc9ec763a6bb
Change-Id: Ifb9d344228e3c6e9e26fc4fe112686f9336ea2b2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
Provide different export macros and different top level headers for
each, don't include runtime headers from compiler sources.
Change-Id: I7dc3f8c95839a00a871ba045ec65af87123154be
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
functions
These can be declared using the new typescript-like syntax and using
type names that are also used for signal parameters and property types.
This merely affects their signature on the C++ side and allows the
corresponding invocation.
Change-Id: Icaed4ee0dc7aa71330f99d96e073a2a63d409bbe
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
| |
Change-Id: Ia9ba819ce77eee7e582cf90aacf5baa4813d9fca
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
The tracing JIT won't be finished. Therefore, remove the parts that have
already been integrated.
Change-Id: If72036be904bd7fc17ba9bcba0a317f8ed6cb30d
Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
|
|\
| |
| |
| |
| |
| |
| | |
Conflicts:
tests/auto/qml/qv4assembler/tst_qv4assembler.cpp
Change-Id: I9d31c982881a617099354bf8acceb76332f11496
|
| |
| |
| |
| |
| |
| |
| |
| | |
All uses have been refactored out in previous commits, so now also
remove the field.
Change-Id: Ic6fb92f70a0451db04ddf40344239a69312faf8f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/qml/compiler/qqmltypecompiler.cpp
src/qml/compiler/qv4bytecodehandler.cpp
src/qml/compiler/qv4codegen.cpp
src/qml/compiler/qv4compileddata_p.h
src/qml/compiler/qv4compiler.cpp
src/qml/compiler/qv4instr_moth.cpp
src/qml/compiler/qv4instr_moth_p.h
src/qml/jit/qv4baselinejit.cpp
src/qml/jit/qv4baselinejit_p.h
src/qml/jsruntime/qv4function.cpp
src/qml/jsruntime/qv4vme_moth.cpp
Change-Id: I8fb4d6f19677bcec0a4593b250f2eda5ae85e3d2
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
After enabling lookups in QML files, we can remove all the code that
tries to deal with (type) compile time detection of access to id objects
and properties of the scope/context object. This also allows removing
quite a bit of run-time code paths and even byte code instructions.
Task-number: QTBUG-69898
Change-Id: I7b26d7983393594a3ef56466d3e633f1822b76f4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When resolving names in the context of QML bindings, we now direct
runtime access to QQmlContextWrapper::resolveQmlPropertyLookupGetter. At the
moment this does basically the same as Runtime::method_loadName, which
we called earlier. However this now provides the opportunity to optimize
lookups in the QML context in a central place.
When performing a call on a scope or context object property, we also
did not use a CallName() instruction - which would have gotten the
thisObject wrong - but instead we use a dedicated
CallScopeObjectProperty and CallContextObjectProperty instruction. These
rely on identifying these properties at compile time, which goes away
with lookups (and also doesn't work when using ahead-of-time
compilation). Therefore the qml context property lookup is using a
getPropertyAndBase style signature and
Runtime::method_callQmlContextPropertyLookup uses that.
For the tests to pass, some error expectations need adjusting. In
particular the compile-time detection of write attempts to id objects is
now delayed to the run-time.
The old code path is still there and will be removed separately in the
next commit (as it is massive).
Task-number: QTBUG-69898
Change-Id: Iad1ff93d3758c4db984a7c2d003beee21ed2275c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When analyzing the bytecode from top-to-bottom in a single pass, we
don't know when a jump back to previously seen code occurs. For example,
in the baseline JIT we would already have generated code for some
bytecode when we see a jump back (like at the end of a loop body), and
we can't go back and insert a label to jump to.
As JavaScript has no goto's, the only backward jumps are at the end of
loops, so there are very few cases where we need to actually generate
labels.
This was previously handled by analyzing the bytecode twice: once to
collect all jump targets, and then second pass over the bytecode to do
the actual JITting (which would use the jump targets to insert labels).
We can now do that with one single pass. So the trade-off is to store
4 bytes more per function plus 4 bytes for each loop, instead of having
to analyze all functions only to find where all jumps are each time that
function is JITted.
Change-Id: I3abfcb69f65851a397dbd4a9762ea5e9e57495f6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Collect type information about values used in a function. These include
all parameters, and the results of many bytecode instructions. For array
loads/stores, it also tracks if the access is in-bounds of a
SimpleArrayData.
Collection is only enabled when the qml-tracing feature is turned on
while configuring.
In subsequent patches this is used to generated optimized JITted code.
Change-Id: I63985c334c3fdc55fca7fb4addfe3e535989aac5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
| |
If a tagged template gets evaluated multiple times, the
underlying template object is shared.
Change-Id: Ie2f476fbc93d5991322ce1087c42719a8d8333ae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Add new enum value QV4::Compiler::ContextType::ScriptImportedByQML, which
behaves exactly the same as ContextType::Global. A follow-up patch will change
the behavior slightly.
Task-number: QTBUG-69408
Change-Id: I20d27804fd1433f2229704546bcd78a0ac108c01
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
Collect the location of the import/export statement and include it in
the exception thrown.
Change-Id: I7966dfd53ed67d2d7087acde2dd8ff67c64cb044
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
| |
Doing the tail call in the runtime will come in a follow-up patch
Change-Id: I8224aac0edbdc765ee9b97703948edd52fd33f3e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I70043699d15daf858c47d30018060aef31810abb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I1855eb303225d1784b019f8eebab0ad8bf2cdf5e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I4c0cfc3a120fc0b246760886b576e92d3f7623ff
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we access a lexically scoped variable after the initializer, then we
know it's either initialized or at least undefined, so we don't need to
do the TDZ check anymore.
The ES tests ensure that we don't optimize too much and the newly
revived tst_v4misc test ensures that we do not generate the TDZ check
instruction for certain scenarios.
Change-Id: I6706d1feb22217f323124ee698ebadb70324693b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With const and let it is possible to access the declared member before
initialization. This is expected to throw a type reference error at
run-time.
We initialize such variables with the empty value when entering their
scope and check upon access for that. For locals we place the lexically
scoped variables at the end. For register allocated lexical variables we
group them into one batch and remember the index/size.
Change-Id: Icb493ee0de0525bb682e1bc58981a4dfd33f750e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
| |
When registering a default export, make sure that the local name
points either to an entry that we've entered into the environment or
the synthetic entry we create.
Change-Id: I37e160dc1e3231214bb68f72d6bb0746d7aee3b3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The evaluation of a module can have side-effects by modifying the global
object or objects in it. Therefore even a seemingly empty import such as
import "./foo.js"
needs to be listed in the module requests. It's also important that they
are evaluated in the order of declaration. Therefore we collect all
module requests separately - even those that don't have import variables
to process. This patch also ensures that the export and import
declarations are visited in the correct order, by unifying both AST
nodes to be hooked into the statement list.
The fact that we connect the module list items into a statement list is
solely an artifact of re-using defineFunction() which takes a
StatementList as body.
Change-Id: I75dc357b2aecfc324d9a9fe66952eff1ec1dfd8a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Default export declarations require a binding setup step at run-time, so
we hook it into the ESModule's statement list to make it visible to the
code gen visitor.
We also reserve local slot zero for the default export.
Change-Id: Ie064caad0422b92cfdadbd7d94db72a05e95c0cc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The entry point from the parsing perspective into modules is not
QV4::Script but QV4::ExecutionEngine::compileModule.
For convenience, the ESModule AST node gets a body, which is the
statement list connected between the ModuleItemList items that are not
import/export declarations.
The QV4::Module allocates a call context where the exported variables
are stored as named locals. This will also become the module namespace
object.
The imports in turn is an array of value pointers that point into the
locals array of the context of the imported modules.
The default module loading in ExecutionEngine assumes the accessibility
of module urls via QFile (so local file system or resource). This is
what qmljs also uses and QJSEngine as well via public API in the future.
The test runner compiles the modules manually and injects them, because
they need to be compiled together with the test harness code.
The QML type loader will the mechanism for injection in the future for
module imports from .qml files.
Change-Id: I93be9cfe54c651fdbd08c5e1d22d58f47284e54f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for a default constructor if none is given.
Fix support for computed method names, by unifying the
handling between static and non static methods. Fix our
table generation, so that we write UINT_MAX as the string
index for undefined strings and not a reference to the
empty string, as that can actually be a valid method
name.
Add support for getter and setter methods in classes.
Change-Id: If52c57d6a67424b0218b86339b95aed9d0351e47
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
| |
This makes them really const. The codegen needs some smaller changes
to ensure that writing to the variable when it's being defined is
allowed.
Change-Id: I781b4bc9c0e0397b9d00cad3daf758a062c17600
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Most of the class creation is done inside the runtime
in the CreateClass method. Added a corresponding
instruction to the interpreter and jit.
The compiled data now contains an array of classes
containing the compile time generated layout of the class.
Currently, classes without an explicit constructor and
classes with inheritance are not supported.
Done-with: Yulong Bai <yulong.bai@qt.io>
Change-Id: I0185dcc1e3b0b8f44deff74e44a8262fc646aa9e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
maxNumberOfArguments isn't used anymore.
Change-Id: Ibb891101b971b4b0b01be7897e6d1490e1dde62c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
There's no need to force lookups by name in an outer function
just because an inner function uses eval(). The lookup by name
is only required on the call context level, where eval() could
add new variables.
Change-Id: I8cad6d27524f496304342dfe1449ea913ef99fca
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
| |
There's no need for a temp register to store the old context in,
as PopContext can simply retrieve the old context from
the current one.
Change-Id: Ife9cfdff7fa8e47fc71e844a7798de88dbc79e26
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: Ib60b56ac6a7111446e01235564a4cf92ad8ad025
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Add a CompilerContext for with, whose only purpose it
is to trigger variable lookup by name. This avoids looking
up variables declared inside the with() {} block by name and
we do not lookup variables outside the with block by name
neither anymore.
Change-Id: I52e9fb2daa9601f9e5102714c002dc506ad5ed23
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove the need for a specialized catch context, instead
use a regular block context, that also captures the
catched variable.
This also removes the need to do lookups by name inside
a catch expression.
Change-Id: I8b037add7f423922e2a76b4c0da646ca7e25813a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is still to some extend work in progress as
lexically scoped for loops won't yet do the right
thing.
let and const variables are still accessible before
they are declared, and the global scope doesn't yet
have a proper context for lexically declared variables.
Change-Id: Ie39f74a8fccdaead437fbf07f9fc228a444c26ed
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: If22845b19c72362249347083edef591f7032f468
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I0e98ccba9ae3026cd8bfdc4cae100f280b5aa22c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Move variable resolving into the context, and avoid creating
ExecutionContext's whereever we can. This prepares things for
block scoping, where this becomes rather important to be
able to achieve decent performance.
Change-Id: Idf3d3c12cf348a2c3da01989c26c8529ceb36c12
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
| |
And make it an enum class. The new name fits better, as it's mainly
used to determine the type of the context when parsing. Also already
added the 'Block' value that will be needed.
Change-Id: I70d963b6a0b22db1a3c607cce6bdd2054b29e000
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Commit da5fffbd34d8be68f8ee4c649881dbb673c9c0a5 introduced deferencing
of the formals parameter list that can be a null pointer if the declared
function has no parameters.
Change-Id: Id7dce0f78b16266e672f0ae430ee4f979de5734d
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
Required to get proper destructuring working.
Change-Id: I99fc20a9f1bace1fe3981d88ce5466f9c8d98245
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
| |
Some smaller changes to the codegen are included as well to ensure
that we catch all uses of generators and properly throw an unimplemented
error on them for now.
Change-Id: Ib915a0e862e128644ff00dfe989507783c912c66
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|