aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-04-11 16:42:55 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-12 08:03:16 +0200
commitde11a78c625b0865f8cd3d0cfe446cba2bdb719e (patch)
treea4f0fc294ea8da78d728f3bb6fa8ef971f9c9cb5 /src
parent8da17239ed4a68270c74f6a5e5ca04d82d99b547 (diff)
V4 IR: only mark blocks after iterator calculation as loop blocks.
When the iterator calculation contains a condition, newly created basic-blocks were marked as loop blocks. However, their parent was not the loop header. Task-number: QTBUG-38187 Change-Id: I9ee7a3e0bd536c2a005b91f8333931ce929245af Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qv4codegen.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 504edfcd36..0d4eb390d3 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -2212,8 +2212,6 @@ bool Codegen::visit(ForEachStatement *ast)
IR::BasicBlock *foreachbody = _function->newBasicBlock(foreachin, exceptionHandler());
IR::BasicBlock *foreachend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
- enterLoop(ast, foreachin, foreachend, foreachin);
-
int objectToIterateOn = _block->newTemp();
move(_block->TEMP(objectToIterateOn), *expression(ast->expression));
IR::ExprList *args = _function->New<IR::ExprList>();
@@ -2222,6 +2220,7 @@ bool Codegen::visit(ForEachStatement *ast)
int iterator = _block->newTemp();
move(_block->TEMP(iterator), _block->CALL(_block->NAME(IR::Name::builtin_foreach_iterator_object, 0, 0), args));
+ enterLoop(ast, foreachin, foreachend, foreachin);
_block->JUMP(foreachin);
_block = foreachbody;
@@ -2352,8 +2351,6 @@ bool Codegen::visit(LocalForEachStatement *ast)
IR::BasicBlock *foreachbody = _function->newBasicBlock(foreachin, exceptionHandler());
IR::BasicBlock *foreachend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
- enterLoop(ast, foreachin, foreachend, foreachin);
-
variableDeclaration(ast->declaration);
int iterator = _block->newTemp();
@@ -2363,6 +2360,7 @@ bool Codegen::visit(LocalForEachStatement *ast)
move(_block->TEMP(iterator), _block->CALL(_block->NAME(IR::Name::builtin_foreach_iterator_object, 0, 0), args));
_block->JUMP(foreachin);
+ enterLoop(ast, foreachin, foreachend, foreachin);
_block = foreachbody;
int temp = _block->newTemp();