aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@me.com>2013-10-01 17:44:54 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-02 16:07:33 +0200
commit10278163081c25f1b3e659b6769f0635776ab89a (patch)
tree7661c2e70a980b722635605e23691dc6171f7e6a /src/qml/compiler
parent4ea580a339af1949b6892689098e5cc2f4d108ca (diff)
V4 IR: fix type inference.
When a phi-node couldn't be fully typed (e.g., when one of the temps was not yet typed), VarType was assumed. When a circular dependency between two phi-nodes occurred, like with a condition inside a loop, then depending on the ordering of the work-list, the two phi-nodes could start oscillating between VarType and the correct type. The fix is to check if one of the temps is not fully typed, and if so, assume whatever we currently have as the result and have the statement re-scheduled. Full typing will occur when the temp with the missing type information is typed. Change-Id: I950d81fe7fa8272cb37f7eea5b88092d1eb4817e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qv4ssa.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index a058ed51da..3d6cd442fd 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -1503,11 +1503,19 @@ protected:
_ty = run(s->d->incoming[0]);
for (int i = 1, ei = s->d->incoming.size(); i != ei; ++i) {
TypingResult ty = run(s->d->incoming[i]);
+ if (!ty.fullyTyped && _ty.fullyTyped) {
+ // When one of the temps not fully typed, we already know that we cannot completely type this node.
+ // So, pick the type we calculated upto this point, and wait until the unknown one will be typed.
+ // At that point, this statement will be re-scheduled, and then we can fully type this node.
+ _ty.fullyTyped = false;
+ break;
+ }
_ty.type |= ty.type;
_ty.fullyTyped &= ty.fullyTyped;
}
switch (_ty.type) {
+ case UnknownType:
case UndefinedType:
case NullType:
case BoolType: