| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Task-number: QTBUG-89977
Change-Id: I975a859d5252e2721475f86ced6c8dab06ae8c9c
Reviewed-by: Lars Knoll <lars.knoll@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>
|
|
|
|
|
|
|
|
|
|
|
| |
Add an atomic isInterrupted flag to BaseEngine and check that in
addition to the hasException flag on checkException(). Add some more
exception checks to cover all possible infinite loops. Also, remove the
writeBarrierActive member from QV4::EngineBase. It isn't used.
Fixes: QTBUG-49080
Change-Id: I86b3114e3e61aff3e5eb9b020749a908ed801c2b
Reviewed-by: Simon Hausmann <simon.hausmann@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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change the encoding, so that even instructions are short ones,
odd instructions long. This implies that the lowest bit encodes
whether an instruction is short or long (1 vs 4 byte encoded).
This prepares for allowing us to extend the totoal number of
instructions beyond 128.
Change-Id: I4732e7241d3593b24ad25cd69555edc25f38d2f6
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The old code was rather convoluted and expanded to quite
a bit of bytecode. It was also very hard to fix some
of the remaining issues with unwinding in there.
The new code handles unwinding a bit differently. Basically,
we now have three instructions to do what the spec requires.
SetUnwindHandler is the same as the old SetExceptionHandler
instruction. It basically tells the runtime where to jump to
to handle any abrupt completion (ie. throw/break/continue/return)
that requires unwinding.
UnwindToLabel is a new instruction that is used for unwinding
break/continue/return statements. It takes two arguments, one
telling the runtime how many levels to unwind and the second
a target label to jump to when unwinding is done.
UnwindDispatch is the third instruction and is invoked at
the end of each unwind block to dispatch the the parent
unwind handler if required and thus implement the support
for the levelled unwinding.
Change-Id: I079a39d0d897b3ecc2f0dc631ca29b25eae05250
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
| |
It's being used for more than just exception handling,
unwinding for return or break/continue statements also
goes through those handlers.
Change-Id: I145c7909540a1adca431de6a98d9c115ddf23612
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following sequence:
StoreReg rX
LoadReg rX
Can be optimized by dropping the LoadReg, as the value is still in the
accumulator. Also, the sequence:
StoreReg rX
MoveReg rY, rX
Can be optimized to:
StoreReg rX
StoreReg rY
This last optimization prevents one load from the JS stack (reading rX).
Both cases are only valid if there is no label on the second
instruction.
Change-Id: Ibd4543459e1eab4da55e92248eba544c707c5456
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Create a Block scope per iteration as defined in the ES spec. So
closures created inside the loop will remember the iteration variable
at that loop iteration.
Add support for destructuring of the left hand side expression or
declaration.
Change-Id: Id06ef94e2a4b93646827da4f6ce922eb436e5a31
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>
|
|
|
|
|
|
|
|
|
| |
The parser can also handle rest parameters correctly, this will
however require some additional work in the runtime to support
it correctly.
Change-Id: Ib6f4d27683774966b2d2aac075494d2f5066d2a2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With the QV4::Moth::BytecodeGenerator::Jump type we are relying on the
compiler doing a return value optimization. That however is not required
by the C++11 standard and the GHS compiler does indeed not do that here,
resulting in a ~Jump destructor call in the following sequence _before_
link() is called:
Jump generateJump() { ...; return Jump(...); }
...
generateJump().link();
The destructor however verifies that link() was called, which fails.
Fix this by making Jump a move-only type, which the compiler will issue
if it doesn't perform a return value optimization.
Task-number: QTBUG-66917
Change-Id: I97cc9a5d7f97d61e573ad8bc309cf48ab18eb25d
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Debug instructions are used to trigger break points and are added for
every source line.
We also need to insert Debug instructions before Ret, so that we can
step out. We also need to assign line numbers to the entry and return
points of "abbreviated" QML functions (by simulating lbrace and
rbrace) so that we can set break points on them. The line numbers on Ret
need to be negative, so that you cannot (accidentally) set break points
on them. A typical signal handler or binding in QML consists of only one
line and if you set a break point on that line, you want it to hit only
once, when entering the function. If the line numbers on Ret were
positive, it would be hit again on exit. Some of the tests in
tst_qqmldebugjs implicitly check for that.
Also the new interpreter does something on the left brace, so a
function actually starts there, not on the first statement.
Change-Id: Id9dfb20e35696b420d0950deab988f7cc5197bfc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Change-Id: If95a5733594a1beaa41063249a364988190844c5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I90daee5388f5aba5a5c1cd643379adc9a8e05039
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
As a first step, use only one byte for the instruction type.
Change-Id: I762a05233c277a7144472793bc71e41d9e8e82cb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
Instead add it to the unencoded instruction vector
Change-Id: I7e88d808bb94f75aecdf9d3ed9bace2055c1da5d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
And add Wide and XWide instructions that will get used
as prefixes later on.
Change-Id: I993865395ee2ac7d30eba2e41e7b437bfdb54391
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
Don't use the old instruction structures in the VME anymore,
instead directly decode into scoped registers.
Change-Id: Ie03ebad98050ebfd9eb9cc7e9273e5db92884a89
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
Simplify the naming conventions, so that both the instruction
struct and enum start with upper case letters.
Change-Id: I60c5a95d729e0b68b5a40f7db0e8f90be5938032
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
| |
Don't emit any Line instructions anymore, and instead store
the info in a side table in the compiled data, where it can
be looked up on demand.
Change-Id: Idcaf3bf4ee4129fd62f9e717bf1277dc6a34fe19
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Change-Id: Ib7839ac09f520aaff3fadfdb37ea63d85a257bfd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Change-Id: I00d4ed5d8b6ab30ee3459d1cc7a2737144474f8a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Change-Id: I9f4a5a8470c1abc6b07a28c71fdad0d208e1fea1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Change-Id: I281954d1f421c9aaaa9100a1505db0ba225cf488
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
| |
Change-Id: Id9ab6f3e9f5ae1c1bedb0b34bf1fac6abfe0bbfc
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Differences:
- push parameters on the stack, including space for CallData members
- call instructions calculate the argument start
- use temp space above the calldata to evaluate arguments
- fewer temporaries are needed when a call is done while generating the
arguments of another call
- when calling the function, the js stack space above the callData is
not used, allowing for optimizations in the future
- Array and ObjectLiteral use the same mechanism
Change-Id: Id100fa06f12cc9d941b0f90b0b81b8270a8e4f5d
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
| |
Make sure all libs and tests compile again after
the latest changes.
Change-Id: I749d3d2d0109cc97df2ecec93809ea8a1b3014a9
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|
|
|
|
|
| |
Change-Id: I7d7845a9d8d147bd363c0f60df41066fab355272
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|
|
|
|
|
|
|
|
| |
Implement exception handling, and make it conformant
with the spec.
Change-Id: I6d8222617180f96f628f18e11444488e50e5c043
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace Loop and ScopeAndFinally with a single ControlFlow
data structure, that can deal with non local control flow.
The control flow data structure can do required cleanup
of internal scopes (for catch or with), emit finally
statements and dispatch to the right continuation.
Also implemented support for the with statement again.
Change-Id: I8bb5414151d0312cb28f8d10e99f8d2b64484100
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|
|
|
|
|
|
|
| |
These will simplify foreach and switch handling.
Change-Id: I7fb67481d7d1b82b03c03fd0987b182ea9542c7a
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|
|
|
|
|
|
|
|
| |
Those Labels can be linked to a code location further ahead.
Change-Id: I82f1a719654162db0e0abb46df602ee2e01154da
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
| |
Change-Id: Ifcd57713e1cfa9514d3955e26f739a359cdaa8e5
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
| |
Add Label and Jump classes to facilitate the handling, and
resolve them to proper offsets at finalize() time.
Change-Id: Ic140a3ceb848fb29657a1b156c97b806db6dc434
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|
|
|
|
|
|
|
| |
And a commented out finalize() call to the bytecodegenerator
Change-Id: Iaaf8981ee658e19b6816589d4340a8e5744764b7
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|
|
Use the generator to store the list of instructions, labels
and patches. The finalize() method can then create the
final bytecode out of that list.
Change-Id: If2ea3118ed6e8744545bb918ecc4bbc87d6a3ff1
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
|