Commit Graph

117 Commits

Author SHA1 Message Date
Leander Beernaert 494dc05ea1 Extend qmlcachge to support --retain with CMake
Add missing code so we can use the --retain argument when running
qmlcachgen from a CMake project.

Change-Id: I0b4a2f2ea6c424ba698ee178a332f585271b945e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-08-13 07:52:51 +00:00
Leander Beernaert 059d792264 Add support for generating qmlcache_loader without qrc
Added support for response file expansion to qmlcachegen.

Add the option --standalone-namespace to qmlcachegen so we can
generate qmlcache_loader from a collection of resource paths
instead of operating on qrc files. This is necessary, since the
namespace identifier is extraced from the qrc file name, which
we no longer have.

This pach was made in order to tend to the cmake port's version of
qtquickcompiler support which does not rely on qrc files.

Change-Id: If15190f3492e6695f5a6e61bf8816998760541f7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-31 12:33:44 +00:00
Simon Hausmann 880a143eb5 Merge remote-tracking branch 'origin/dev' into wip/qt6
Change-Id: I4476733af61fcf3a2af1d121a4585c3fae1c240e
2019-07-12 20:36:48 +02:00
Ulf Hermann f5e4f07841 Disentangle includes and namespaces
Avoid using namespace in headers and include only the headers we
actually need.

Change-Id: I526a0f874dc09b07693fd87070665be396d3b637
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-11 11:14:54 +02:00
Ulf Hermann 9a8dd594b5 Merge JSCodeGen and QQmlJSCodeGenerator
Change-Id: I2219cba0dd3782cb2e0b09b8f3c4d5472e6e5d7e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-10 18:22:40 +02:00
Alexandru Croitor 9c5af084a9 Merge remote-tracking branch 'origin/dev' into wip/qt6
Change-Id: Ifc24fbd99ee216e528a213fdbfd2892b3df419fe
2019-07-08 11:36:14 +02:00
Alexandru Croitor 1c5c5f7aad Fix Qt6 build in preparation of qt5 submodule update
Fixes the QTextStream usages.

Change-Id: I0c009a82fb644a9f3c3d42ec410d18b680977f23
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-08 05:56:02 +02:00
Ulf Hermann 40ded579bd Simplify codegen error handling
There can only ever be one error, either a syntax error or a reference
error. We record the error type as we want to get rid of the virtual
throw<X>Error methods in favor of an explicit compilation result.

Change-Id: Ie228490aad8efb7885083f6485f931299567f54c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-04 16:03:36 +02:00
Ulf Hermann e72637deed Move saveToDisk into SaveableUnitPointer
This way we can keep the flag mutilation closely local to the place
where we write the data. Also, SaveableUnitPointer doesn't need a full
CompilationUnit this way.

Change-Id: I01872e4c406cb2ccbaa1fa35325cc063b1e8a7df
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-24 11:13:05 +02:00
Ulf Hermann d4d197d062 Simplify errors and diagnostics
We only need two classes to describe all possible diagnostics:

* A low-level private POD DiagnosticMessage. This is easily copied and
  passed around internally. It doesn't need to adhere to a stable API
  and it doesn't carry any extra baggage.

* The high-level public QQmlError with its stable interface. This can
  internally also use a DiagnosticMessage as storage.

Change-Id: I52be88d9b5d9855a661b8032b01eedb43a0fb0b3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-14 19:08:51 +02:00
Ulf Hermann ae1c2375f5 Add abstraction for temporarily setting StaticData when saving
The StaticData flag needs to be saved to disk, but removed again
afterwards so that we can free() the malloc'd data. This also allows us
to avoid copying all the data into a byte array before saving.

Change-Id: I96513f8d98acf0ea0b4514d96376b487e8444917
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-17 10:34:31 +00:00
Ulf Hermann 7f7d87c68d Split CompiledData::CompilationUnit in two
We need a CompilationUnit that only holds the data needed for
compilation and another one that is executable by the runtime.

Change-Id: I704d859ba028576a18460f5e3a59f210f64535d3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-16 12:09:23 +00:00
Ulf Hermann a8b3536d6e Move compileModule() into qv4codegen.cpp
This is a better fit for the method. In turn, remove all the
V4_BOOTSTRAP conditions from qv4engine_p.h and make sure we don't
include or compile it in bootstrap mode.

Change-Id: I5933b0724e561313ca20c420b83e4d70e63bddf5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-08 12:05:30 +00:00
Qt Forward Merge Bot 187b2e0efc Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I2f0b4f8543a448c9acffe0932e0fd67c0b7412f4
2019-03-27 10:27:56 +01:00
Simon Hausmann 516523750d Enable lookups for imported scripts and worker scripts
This is straight-forward to enable, with the minor adjustment that we
need to handle the case where a global lookup is done without a calling
qml context (worker script). We don't know at compile time whether a
script will be imported directly or used as a worker script, so we have
to generate the global qml lookup instruction regardless and handle it
at run-time.

Change-Id: Ia033afa214d919d906c676498dd3eceb1c5639d8
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-03-25 10:26:11 +00:00
Qt Forward Merge Bot a1e38651ce Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	.qmake.conf
	src/qmltest/quicktest.cpp
	tests/auto/qml/qmlcachegen/qmlcachegen.pro

Change-Id: I70e96e8817d59647f876b8b77b30cdeede8f0662
2019-03-25 10:13:23 +01:00
Simon Hausmann 78888f485f Enable lookups in QML files when compiling ahead of time
This should have been enabled in the series earlier when for
QTBUG-69898.

Change-Id: Ide7507d5dcf439463c22b631d49d654624737d1f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-03-22 12:42:37 +00:00
Simon Hausmann 90a08b0c52 Fix memory "leaks" in qmlcachegen
The CompilationUnit class owns the unit data. An exception was made in
bootstrap builds, where it was up to the caller to free the memory. This
lead to cases in qmlcachegen where we didn't free the memory. This is
best fixed by unifying the behavior.

This fixes the build when using an ASAN enabled build, as the runtime
aborts after calling qmlcachegen due to "leaks".

Change-Id: I8b55b4e302a9569a1d4e09eeb488c479368b50f0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-03-22 12:42:32 +00:00
Qt Forward Merge Bot 7a349710cc Merge remote-tracking branch 'origin/5.12' into 5.13
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
2019-03-21 10:59:45 +01:00
Simon Hausmann 5cfccf3089 Remove dead compile time QML context/scope property and id object code
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>
2019-03-20 09:16:52 +00:00
Qt Forward Merge Bot e912c646e2 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/qml/compiler/qv4codegen.cpp

Change-Id: I66b7db42bf208855889094ace0267326595ce03c
2019-03-18 13:49:23 +01:00
Simon Hausmann 24ec7b6c83 Fix up global name determination when compiling ahead of time
The list of names is still suboptimal, but at least it's shared now.

Task-number: QTBUG-69898
Change-Id: I16c9839c4a1f097053b28caea894b67757972826
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-03-15 13:04:46 +00:00
Ulf Hermann b84927dc2b qmlcachegen: Eliminate foreach
Change-Id: Ic13e5af7ddb92cf5988988ebe1c2b7470a5f8c1e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-04 14:29:09 +00:00
Ulf Hermann 21ffde85a1 Add option to retain sources when generating QML cache
By default any .qrc files are filtered and QML and JS sources dropped
when generating the cache. The new QTQUICK_COMPILER_RETAINED_RESOURCES
option allows the specification of .qrc files to be kept as they are.
The source fils specified in them will be available to the application.

Change-Id: If45bcd95c29fe4b91f5817573964ff55b1db8a00
Fixes: QTBUG-72430
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-01-04 14:13:49 +00:00
Jüri Valdmann 8b418d9be7 Clone ContextType::Global as ContextType::ScriptImportedByQML
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>
2018-11-01 15:07:01 +00:00
Simon Hausmann 4b2b1fc121 Add support for compiling ES modules ahead of time
This is also pretty straight-forward by adding .mjs as supported
extension in the qmake and cmake support.

This also tweaks qv4engine.cpp to share the same module compilation
function across all code paths.

Change-Id: Ia0e23c78a794f2330ecf8f991ee6ea948f4ac89d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-08-17 11:06:18 +00:00
Simon Hausmann 193db4c526 Clean up internal QML unit creation API
Since the callers always end up assigning the returned unit pointer back
to the compilation unit's data member, we might as well do that inside
the function and return void instead.

Change-Id: I7a7f3e7a0c89ffe2f9474149fcf61736609b363d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-07-31 17:08:37 +00:00
Simon Hausmann 8e45393d10 Fix import of precompiled .js files
Loading those must not fail the file relocation test, so set the source
file names to empty, as we also do for .qml files.

Also added tests for all the scenarios: no embedded file paths for AOT
files but absolute paths for run-time created cache files.

Change-Id: I3fc92e89cfd0da512afeac22bd0da3e915ec46ea
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-07-31 07:28:03 +00:00
Qt Forward Merge Bot dd333172e2 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I800f39ea59efd6049d3226ec27b8ecb3f6e9ae28
2018-06-29 01:02:07 +02:00
Simon Hausmann d6177808d6 Clarify error message when using eval in signal handlers
Task-number: QTBUG-64024
Change-Id: If8f749ef9ec072928cb352ad7cd4dcf140b6ed53
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-06-28 07:56:46 +00:00
Simon Hausmann 1e7cd1acf6 Remove obsolete option
The check-if-supported option does not make sense anymore since the
generated output is cross-platform.

Change-Id: If7802267b51b445d2e41387d556a344616e9afc8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2018-06-26 08:54:23 +00:00
Liang Qi 6e5251dd3d Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/qml/qml/qqmltypeloader.cpp

Change-Id: If9874faf23e813b05ee4cf042133a528d73ba72a
2018-05-15 15:32:04 +02:00
Simon Hausmann 0a2aaee61c Fix .import within .js files with CONFIG+=qtquickcompiler
When loading a .js file without QQC, we scan the sources and use the
ScriptDirectivesCollector to extract things like .pragma library or
.import ahead of time. That information is passed on to the compilation
unit generator for serialization. When compiling .js files ahead of
time, we also used the same collector, but we forgot to save the data
into the right location before serialization, so we essentially lost the
imports. This patch fixes that by centralizing this code into the
ScriptDirectivesCollector itself.

[ChangeLog][QtQml] Fix regression with .import in .js files not working
when using CONFIG+=qtquickcompiler.

Change-Id: I5413c14b1b8bd3114a997011534fe55cdb7634aa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-05-11 19:18:45 +00:00
Lars Knoll e9492e7b7b Rename the CompilationMode enum to ContextType
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>
2018-05-02 14:17:13 +00:00
Simon Hausmann 1a3447a040 Clean up manual reference of QQmlTypeData and QQmlPropertyCache
We have a few places in the type loader where we do adventurous manual
reference counting, where getType() returns a raw pointer that has been
addref()'ed and then sometimes somehow we call release() later. Commit
0b394e30bb is an example of where this can
easily go wrong. As a consequence and also in preparation for future
work on the type loader, this patch starts replacing the manual
reference counting there.

Changing the return type from QQmlTypeData *getType() to a
QQmlRefPointer<> itself is not sufficient though, as the implicit
operator T*() will still allow the caller to store the result as a raw
pointer. Therefore this patch removes the "unsafe" implicit extraction
operator.

As a result of that change, other types that are sometimes stored in
QQmlRefPointer are also affected and their usage needs to be adapted
to QQmlRefPointer usage or manual raw pointer extraction with .data().

Change-Id: I18fd40634047f13196a237f4e6766cbef3bfbea2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-04-26 09:56:39 +00:00
Lars Knoll 44cfb771c2 Disentangle some includes by moving QQmlJS::Directives into qqmljsengine_p.h
Change-Id: Iee5a5a9edc8b79649a8f43612584ecf046a9aa2c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-25 14:19:23 +00:00
Shawn Rutledge 499ec43937 use nullptr consistently (clang-tidy)
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>
2018-02-26 07:13:18 +00:00
Mitch Curtis 15416b1ffc qmlcachegen: fix error messages for js files
Change-Id: I3c9e33f882358fd4cb8b1b8764bf083ddbd792b1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-02-20 16:31:53 +00:00
Simon Hausmann 51673f868a Fix CONFIG+=qtquickcompiler with multiple resource files
Fix command line option handling to allow for processing of multiple
.qrc files as input files when generating the loader.cpp file.

Task-number: QTBUG-66161
Change-Id: I1ecd40bf863c6570ccf42846106791b7f53fe432
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-02-08 10:21:59 +00:00
Liang Qi a9a9fa0c47 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
	src/qml/compiler/qqmlirbuilder.cpp
	src/qml/compiler/qqmlirbuilder_p.h
	src/qml/compiler/qqmltypecompiler.cpp
	src/qml/compiler/qv4codegen.cpp
	src/qml/compiler/qv4codegen_p.h
	src/qml/compiler/qv4compileddata_p.h
	src/qml/compiler/qv4compiler.cpp
	src/qml/compiler/qv4compilercontext_p.h
	src/qml/compiler/qv4isel_moth.cpp
	src/qml/compiler/qv4jsir.cpp
	src/qml/compiler/qv4jsir_p.h
	src/qml/jit/qv4isel_masm.cpp
	src/qml/jsruntime/qv4engine.cpp
	src/qml/jsruntime/qv4functionobject.cpp
        src/qml/jsruntime/qv4runtimecodegen.cpp
	src/qml/jsruntime/qv4script.cpp
	src/qml/jsruntime/qv4script_p.h
	src/qml/qml/qqmltypeloader.cpp
	src/quick/items/qquickanimatedimage.cpp
	src/quick/items/qquickanimatedimage_p_p.h
	src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp
	tests/auto/qml/qmlplugindump/qmlplugindump.pro
	tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
	tools/qmlcachegen/qmlcachegen.cpp
	tools/qmljs/qmljs.cpp

Done-with: Shawn Rutledge <shawn.rutledge@qt.io>
Done-with: Lars Knoll <lars.knoll@qt.io>
Done-with: Ulf Hermann <ulf.hermann@qt.io>
Change-Id: I010e6525440a85f3b9a10bb9083f8e4352751b1d
2018-02-02 15:59:32 +01:00
Simon Hausmann e5b157275d Add support for compiling QML/JS files ahead of time in resources
This is bringing over the loading infrastructure from the Qt Quick
Compiler that allows embedding qml/js files in resources and compiling
them ahead of time.

At the moment, the approach of generating one cpp file per qml/js file
and the loader stub is needed because the build system does not support
dynamic resource generation. In addition, as per QTBUG-60961, we must
ensure that the generated data structures are aligned.

To retain compatibility this is enabled via CONFIG += qtquickcompiler,
but we may need to find a new name (but should keep the old one in any
case).

Task-number: QTBUG-60961
Change-Id: Ia9839bf98d3af4c50636b6e06815364a9fc7ee57
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-01-28 16:37:26 +00:00
Simon Hausmann 1ab5d14615 Minor data structure cleanup
The cache files are architecture and ABI independent, so we can remove
any associated field/code as well as the workaround for Android.

Change-Id: Ia52a5be886fc22a2105460e003e7a76af7dc1818
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-01-22 09:21:38 +00:00
Simon Hausmann 0c2b18778a Fix illegal name setup in qmlcachegen
After commit c2b4c6393f we must also
initialize the set in order to benefit from the improved lookup on the
cache side.

Change-Id: I0f66f118b912ed66a281d16caea67500f9c14046
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-01-18 09:32:45 +00:00
Lars Knoll c2b4c6393f Use a more optimized lookup for global properties
Force the use of a global lookup if we know that the
property can and will be found in the global object.
This is possible, as the global object is frozen in QML
mode and can't be overwritten.

Shaves of .5% on the delegates_item_states benchmark, and
will significantly speed up all accesses to e.g. the Math
object.

Change-Id: Ia1e248781a13ebaeb8bc43652e53a6fdde336d0d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-01-17 09:20:59 +00:00
Ulf Hermann 52bc4fbfba Use potentially intercepted URL as ID for compilation units
We generally have to pass a URL and a file name everywhere because the
logical URL might be something else than the actual file being loaded.
For example a QQmlFileSelector might modify the URL to be loaded for a
specific file. This resulting URL, however, should not be used to
resolve further URLs defined in the file loaded that way.

As we need to access QQmlTypeLoader::m_url as string more often now,
cache it and avoid frequent translations between QUrl and QString.

Furthermore, QQmlDataBlob's URLs are changed to follow the same
semantics. The finalUrl is the one that should be used to resolve
further URLs, the url is the one used to load the content, and subject
to any redirects or interceptions.

This changes the semantics of URL redirects. Previously a redirected URL
was used as the base URL for furher URL resolution. This doesn't work
because redirection occurs after interception and interception should
not influence the resolution of further URLs. We now use the original
URL as base URL for resolution of further URLs and rely on the server to
redirect those, too.

Task-number: QTBUG-61209
Change-Id: I93822f820bed2515995de3cb118099218b510ca4
Reviewed-by: Michael Brasser <michael.brasser@live.com>
2017-12-21 16:02:50 +00:00
J-P Nurmi 93ad68de3a Fix build for QML modules with qmlcache config enabled
Since we're now storing bytecode in the cache, the --check-if-supported
option doesn't make sense anymore. Return EXIT_SUCCESS for backwards
compatibility. qmlcache.prf no longer needs the system call either.

Change-Id: Ic3e6de4e404a3d255b57d4bc14e1206c528925a8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-12-08 16:25:06 +00:00
Lars Knoll aceb0d0cd2 Merge remote-tracking branch 'origin/dev' into HEAD
Conflicts:
	src/qml/compiler/qv4codegen.cpp
	src/qml/compiler/qv4compileddata.cpp
	src/qml/compiler/qv4compileddata_p.h
	src/qml/compiler/qv4isel_moth_p.h
	src/qml/compiler/qv4ssa.cpp
	src/qml/jit/qv4assembler_p.h
	src/qml/jit/qv4isel_masm_p.h
	src/qml/jit/qv4regalloc.cpp
	src/qml/jsruntime/qv4engine.cpp
	src/qml/jsruntime/qv4qmlcontext_p.h
	src/qml/jsruntime/qv4regexp.cpp
	src/qml/jsruntime/qv4regexp_p.h
	src/qml/jsruntime/qv4regexpobject.cpp
	src/qml/jsruntime/qv4runtime.cpp
	src/qml/jsruntime/qv4vme_moth.cpp
	src/qml/qml/v8/qqmlbuiltinfunctions.cpp
	tests/auto/qml/qml.pro
	tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
	tools/qmlcachegen/qmlcachegen.cpp

Change-Id: I1577e195c736f3414089036b957a01cb91a3ca23
2017-10-22 12:26:28 +02:00
Simon Hausmann fa00f0a020 Error out when compiling signal handlers with arguments in qml files
Ahead of time we cannot tell whether the use of "arguments" in a signal
hander refers to the JS arguments object or a potential arguments signal
parameter. Resolving that requires access to information we currently
don't have. The QML engine has it at run-time (in
SignalHandlerConverter) and that's why it works there accordingly.
However when generating caches ahead of time, let's rather produce an
error message with a hint how to work around it instead of producing
differing behavior at run-time.

Task-number: QTBUG-60011
Change-Id: I9e460bd467dbb5998f12a44c439223ea44e7bbad
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-12 19:50:16 +00:00
Erik Verbruggen d6615c16b4 Fix disabling fast lookups for QML
This was accidentally enabled because we previously generated the
lookups in the isel (so second part of code generation), where we now
do it in codegen itself (so early on).

Change-Id: I591fbb7a26d94b985c934c5ffca0068b80fac58a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-07 10:30:48 +00:00
Lars Knoll bac9b54dfb Split up qv4codegen into several files
And changed the namespace of those classes to
QV4::Compiler.

ScanFunctions should over time also move into its
own file.

Change-Id: If084acea4a9a20b9c79ad47dac19e02dc720e098
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-07-03 06:09:13 +00:00
Lars Knoll 29e41a9ee6 Remove now unused files
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>
2017-06-30 11:58:44 +00:00
Lars Knoll 56f29d005c Pass the JSUnitGenerator into the codegen
Allow registering all the required data to generate the
proper compilationunit already in the codegenerator.

Change-Id: I36345cc01927b3f8dc3ba6d91da175bd6abe124a
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-06-19 12:50:37 +00:00
Simon Hausmann 9b961334cf Fix support for jsTr() and QT_TR_NOOP in list elements when caching
Similar to the Qt Quick Compiler we need to do the expression
simplification pass at cache generation time to extract translation
calls in list elements.

Change-Id: I267fc9647ab82bc83d6b087c06c0036df38238ff
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-06 11:19:16 +00:00
Simon Hausmann fcb9a74078 Fix loading of ahead-of-time generated cache files when cross-compiling
The target ABI is something that we must include correctly at cache
generation time. The corresponding qmake variable is available in qtbase
now, so we can use that and embed it in the generated data.

Change-Id: Icd6e44824f5151535ce9ddac27687b7877288725
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-04-06 08:14:52 +00:00
Simon Hausmann e2863c80fe Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9 2017-03-25 10:59:43 +00:00
Thiago Macieira 755250f2f9 QHash: use the public functions to set the global hash seed
Task-number: QTBUG-47566
Change-Id: I4a7dc1fe14154695b968fffd14abd2e3189c6ad2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-03-16 05:47:54 +00:00
Simon Hausmann 7f32589663 Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	src/qml/compiler/qqmltypecompiler.cpp
	src/qml/compiler/qqmltypecompiler_p.h
	src/qml/qml/qqmltypeloader.cpp
	src/qml/qml/qqmltypeloader_p.h

Change-Id: I4894555ab7a0879b56bbda7a46d16d1c40c19e7c
2017-03-15 10:44:33 +01:00
Simon Hausmann 77e0dc0485 Fix support for enums and translations in list elements
QQC uses valid constructs like ListElement { dayOfWeek: Locale.Sunday },
where the enums are resolved at type compilation time. Syntactically
Locale.Sunday is a JS expression, but as scripts are not permitted for
list elements, we must retain the values in string form when generating
the binary (cache) qml representation.

This is a forward port of commit
736f4f9c847d1102f6ac77674c831f0555ff445e from the qml compiler, and also
matches QTRD-3226.

Change-Id: I3e615f224d4ab222a50f3271735cb8f7a24f5f11
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-03-10 21:00:41 +00:00
Simon Hausmann e0add0b655 Fix relocation related errors when loading AOT caches
The original directory of the source file the cache was created from -
when generating ahead of time - is unlikely going to be identical to the
final location for example on a deployed device. Therefore when
generating caches ahead of time, don't store the source path, don't
attempt to verify it when loading and don't try to save the cache file
at run-time again.

We still need set the sourceFileIndex at load-time though, in order to
make relative path url resolution work (for example source: "my.png" in
an Image element).

Change-Id: I3d6952f5d0a165cfa2cb400191a9f6ffe6be69f4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-09 08:19:56 +00:00
Simon Hausmann 55e558144d Fix time stamp related errors when loading AOT caches
Cache files created ahead of time do not require a timestamp match
towards the source file. This is because we cannot guarantee that all
transport mechanism from source to deployment preserve the timestamp at
the required resolution (if at all) and the source may also not be
present at all (obfuscated deployment chosen).

For cache files created at run-time however we'll continue to require
time stamp verification.

Change-Id: Ia7cdf3d063edd5bb1e6985089f1a666c970a0bd0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-09 08:19:49 +00:00
Simon Hausmann ba6de61acd Fix skipping of qml cache generation on unsupported architectures
Detect support for the target architecture at qmake time and gently
skip the process.

Change-Id: I7cc22a0cfb9a8b503c182062a56e506035f84fa2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-07 07:06:44 +00:00
Simon Hausmann 1102f6ca7f Fix qmlcachegen command line parameters
Add support for specifying the output file name

Change-Id: I3ec3cecae2334a7640baa928c0739c5521496d2d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-03-07 07:06:28 +00:00
Robert Loehning ba68c32568 Do not crash when qmlcachegen is called without arguments
Change-Id: Ib91271e0ac365f69e43dfc0981c74dcfd69d6ab3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-02-23 18:23:47 +00:00
Simon Hausmann 7cab0a31de Fix crash when generating cache files
Make sure that the allocator in bootstrap builds really just allocates
memory for the generated code and otherwise doesn't try to allocate
executable memory.

Change-Id: Ic40724903706ae98ef272a028e7d8299400e232b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-08 16:18:13 +00:00
Simon Hausmann 835f8a9038 Allow selecting armv7 as target architecture in qmlcachegen
Change-Id: I36e8f95e83ea3de6553145efc762e3bc46f60071
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-02-01 11:52:40 +00:00
Simon Hausmann eeb08d9537 Re-do QML type compilation of ahead-of-time generated QML cache files
As we currently lack the ability to do type resolution at AOT cache
generation time, we need to re-do the work after loading the cache file,
making us essentially only re-use the code and avoiding the step of
parsing.

Change-Id: I12844692d4766345d8a313b59d21abf1f868e2d1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-31 17:09:26 +00:00
Simon Hausmann 27c678cea6 Added tool to generate QML cache files
This is an initial preview that will allow generating cache files ahead
of time, with some limitations:

* There's no support for import dependency resolution
* Only ARMv7 is supported as cross-compile target

Change-Id: I894237f55ba0c0a71f0ed5dda2ff6f7e5bd6603e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-01-31 17:09:15 +00:00