aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4isel_masm.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@me.com>2013-10-04 11:55:38 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-10 09:54:12 +0200
commit42aa10adc93068acbcdc503342c8db92c5b5b899 (patch)
tree06c153615ee85bf476c5e51c12c503b236807098 /src/qml/compiler/qv4isel_masm.cpp
parente34477bfaf318fe26cd935728eeec144cc1659fa (diff)
V4: Remove more jumps.
Do not generate jump instructions when the target immediately follows the current basic block, even if there are intermediate jumps in between as long as they jump to the same basic block. In the IR snippet below, no jumps will be generated at all. … L8: goto L6; L12: goto L6; L6: goto L4; L11: goto L4; L4: goto L2; L10: goto L2; L2: …. Before this change, the gotos in L8, L6, and L2 were still generated. Change-Id: I718ed0d41c603a6905f2279b782cd9e9cafb7d55 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_masm.cpp')
-rw-r--r--src/qml/compiler/qv4isel_masm.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
index 1146c08d6c..98558bf9bc 100644
--- a/src/qml/compiler/qv4isel_masm.cpp
+++ b/src/qml/compiler/qv4isel_masm.cpp
@@ -667,6 +667,8 @@ void InstructionSelection::run(int functionIndex)
ConvertTemps().toStackSlots(_function);
}
V4IR::Optimizer::showMeTheCode(_function);
+ QSet<V4IR::Jump *> removableJumps = opt.calculateOptionalJumps();
+ qSwap(_removableJumps, removableJumps);
Assembler* oldAssembler = _as;
_as = new Assembler(this, _function, executableAllocator, 6); // 6 == max argc for calls to built-ins with an argument array
@@ -715,6 +717,7 @@ void InstructionSelection::run(int functionIndex)
qSwap(_reentryBlocks, reentryBlocks);
delete _as;
_as = oldAssembler;
+ qSwap(_removableJumps, removableJumps);
}
void *InstructionSelection::addConstantTable(QVector<Primitive> *values)
@@ -1675,7 +1678,8 @@ void InstructionSelection::constructValue(V4IR::Temp *value, V4IR::ExprList *arg
void InstructionSelection::visitJump(V4IR::Jump *s)
{
- _as->jumpToBlock(_block, s->target);
+ if (!_removableJumps.contains(s))
+ _as->jumpToBlock(_block, s->target);
}
void InstructionSelection::visitCJump(V4IR::CJump *s)