Compile binding expressions in the QQmlCompiler
authorSimon Hausmann <simon.hausmann@digia.com>
Tue, 8 Oct 2013 09:44:57 +0000 (11:44 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 11 Oct 2013 20:54:52 +0000 (22:54 +0200)
commitc39393e7de5b808adbc9c5771ecca161c9660d7c
treec52afa21711b88deee42f85b7fc79c152089c399
parent74a02a83809f6942732ec18125403e8ee32c574f
Compile binding expressions in the QQmlCompiler

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>
18 files changed:
src/qml/compiler/qqmlcodegenerator.cpp
src/qml/compiler/qqmlcodegenerator_p.h
src/qml/compiler/qv4codegen.cpp
src/qml/parser/qqmljsengine_p.h
src/qml/qml/ftw/qfinitestack_p.h
src/qml/qml/qqmlcompileddata.cpp
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlcompiler_p.h
src/qml/qml/qqmlinstruction.cpp
src/qml/qml/qqmlinstruction_p.h
src/qml/qml/qqmlobjectcreator.cpp
src/qml/qml/qqmlscript.cpp
src/qml/qml/qqmlscript_p.h
src/qml/qml/qqmltypeloader.cpp
src/qml/qml/qqmlvme.cpp
tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
tests/auto/qml/parserstress/tst_parserstress.cpp
tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp