Evaluate bindings more intelligently during construction
authorAaron Kennedy <aaron.kennedy@nokia.com>
Wed, 30 May 2012 09:16:13 +0000 (10:16 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 29 Aug 2012 04:38:54 +0000 (06:38 +0200)
commit04774bb14c81688f86a2b31b8624bde8ebf59062
tree9d04d18712988caca2a3f193feb94cfaa35b47bb
parentd65fb68de12b6d811f7b94ba3209847f73ca94cc
Evaluate bindings more intelligently during construction

Instead of just evaluating bindings in a fixed order, and possibly
having to evaluate a single binding multiple times, prior to reading
a property, we check if there are any bindings "pending" on it and
evaluate them then.  A pending binding is one that has been assigned
to the property, but not yet evaluated.

To minimize side effects we only do this for "safe" bindings.  A
safe binding is one that has no side effects, which we currently
define as not calling functions or otherwise assigning values during
its evaluation.  This isn't an entirely foolproof way to ensure that
the evaluation has no side effects, but it should be good enough.

Change-Id: I98aa76a95719e5d182e8941738d64f8d409f404a
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
19 files changed:
src/qml/qml/qqmlabstractbinding_p.h
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlcompiler_p.h
src/qml/qml/qqmldata_p.h
src/qml/qml/qqmlengine.cpp
src/qml/qml/qqmlinstruction_p.h
src/qml/qml/qqmlrewrite.cpp
src/qml/qml/qqmlrewrite_p.h
src/qml/qml/qqmlvme.cpp
src/qml/qml/v4/qv4bindings.cpp
src/qml/qml/v4/qv4bindings_p.h
src/qml/qml/v4/qv4compiler.cpp
src/qml/qml/v4/qv4instruction.cpp
src/qml/qml/v4/qv4instruction_p.h
src/qml/qml/v8/qv8bindings.cpp
src/qml/qml/v8/qv8bindings_p.h
src/qml/qml/v8/qv8qobjectwrapper.cpp
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
tests/auto/qml/v4/tst_v4.cpp