aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4isel_moth.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@me.com>2013-10-02 14:41:35 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-03 07:06:35 +0200
commitf9305f9ffaf8dd443369a156f7f7650de6372265 (patch)
tree1d9c0e1dbe921b2a96d0ffdcd6111aafb093cdde /src/qml/compiler/qv4isel_moth.cpp
parentc860d1399b4ff5f3a5b1b2630bc33112c88c13e8 (diff)
V4: invert conditions when the true block follows the test.
Change-Id: I5044acd4263b71734e4eb5d7e74b1a4a8414741e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_moth.cpp')
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index af914c79e7..4bea6322e6 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -651,14 +651,22 @@ void InstructionSelection::visitCJump(V4IR::CJump *s)
Instruction::CJump jump;
jump.offset = 0;
jump.condition = condition;
- ptrdiff_t trueLoc = addInstruction(jump) + (((const char *)&jump.offset) - ((const char *)&jump));
- _patches[s->iftrue].append(trueLoc);
- if (s->iffalse != _nextBlock) {
- Instruction::Jump jump;
- jump.offset = 0;
+ if (s->iftrue == _nextBlock) {
+ jump.invert = true;
ptrdiff_t falseLoc = addInstruction(jump) + (((const char *)&jump.offset) - ((const char *)&jump));
_patches[s->iffalse].append(falseLoc);
+ } else {
+ jump.invert = false;
+ ptrdiff_t trueLoc = addInstruction(jump) + (((const char *)&jump.offset) - ((const char *)&jump));
+ _patches[s->iftrue].append(trueLoc);
+
+ if (s->iffalse != _nextBlock) {
+ Instruction::Jump jump;
+ jump.offset = 0;
+ ptrdiff_t falseLoc = addInstruction(jump) + (((const char *)&jump.offset) - ((const char *)&jump));
+ _patches[s->iffalse].append(falseLoc);
+ }
}
}