aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4ssa.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-08-22 12:11:40 +0200
committerErik Verbruggen <erik.verbruggen@digia.com>2014-08-26 16:45:26 +0200
commitb926452f6c98e35fd87706fc637240cb47bac4bf (patch)
tree4cda0562b5544115177b732ad5df6f092d87d0a6 /src/qml/compiler/qv4ssa.cpp
parent39286a50c32321981adb82ea47c93b7398b257d8 (diff)
V4: disable type inference and loop peeling for the interpreter.
Loop peeling is always disabled. Type inference is still enabled for QML code, because of the static-type nature of the properties. This speeds up crypto.js by 20%. Change-Id: Ibf51cb36f8904d64df0793980d463451dfd361e2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4ssa.cpp')
-rw-r--r--src/qml/compiler/qv4ssa.cpp45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 774d8fb88c..d67b88b718 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -1794,6 +1794,9 @@ public:
void reset()
{
+ worklist.assign(worklist.size(), false);
+ worklistSize = 0;
+
foreach (Stmt *s, stmts) {
if (!s)
continue;
@@ -3934,6 +3937,7 @@ void optimizeSSA(StatementWorklist &W, DefUses &defUses, DominatorTree &df)
// constant propagation:
if (Const *sourceConst = m->source->asConst()) {
+ Q_ASSERT(sourceConst->type != UnknownType);
replaceUses(targetTemp, sourceConst, W);
defUses.removeDef(*targetTemp);
W.remove(s);
@@ -3998,7 +4002,8 @@ void optimizeSSA(StatementWorklist &W, DefUses &defUses, DominatorTree &df)
doneSomething = true;
break;
case OpUPlus:
- constOperand->type = unop->type;
+ if (unop->type != UnknownType)
+ constOperand->type = unop->type;
doneSomething = true;
break;
case OpCompl:
@@ -5057,7 +5062,7 @@ Optimizer::Optimizer(IR::Function *function)
, inSSA(false)
{}
-void Optimizer::run(QQmlEnginePrivate *qmlEngine)
+void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool peelLoops)
{
#if defined(SHOW_SSA)
qout << "##### NOW IN FUNCTION " << (function->name ? qPrintable(*function->name) : "anonymous!")
@@ -5093,13 +5098,15 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine)
showMeTheCode(function);
// cfg2dot(function, loopDetection.allLoops());
- QVector<LoopDetection::LoopInfo *> innerLoops = loopDetection.innermostLoops();
- LoopPeeling(df).run(innerLoops);
+ if (peelLoops) {
+ QVector<LoopDetection::LoopInfo *> innerLoops = loopDetection.innermostLoops();
+ LoopPeeling(df).run(innerLoops);
-// cfg2dot(function, loopDetection.allLoops());
- showMeTheCode(function);
- if (!innerLoops.isEmpty())
- verifyImmediateDominators(df, function);
+// cfg2dot(function, loopDetection.allLoops());
+ showMeTheCode(function);
+ if (!innerLoops.isEmpty())
+ verifyImmediateDominators(df, function);
+ }
}
verifyCFG(function);
@@ -5123,18 +5130,20 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine)
StatementWorklist worklist(function);
-// qout << "Running type inference..." << endl;
- TypeInference(qmlEngine, defUses).run(worklist);
- showMeTheCode(function);
+ if (doTypeInference) {
+// qout << "Running type inference..." << endl;
+ TypeInference(qmlEngine, defUses).run(worklist);
+ showMeTheCode(function);
-// qout << "Doing reverse inference..." << endl;
- ReverseInference(defUses).run(function);
-// showMeTheCode(function);
+// qout << "Doing reverse inference..." << endl;
+ ReverseInference(defUses).run(function);
+// showMeTheCode(function);
-// qout << "Doing type propagation..." << endl;
- TypePropagation(defUses).run(function, worklist);
-// showMeTheCode(function);
- verifyNoPointerSharing(function);
+// qout << "Doing type propagation..." << endl;
+ TypePropagation(defUses).run(function, worklist);
+// showMeTheCode(function);
+ verifyNoPointerSharing(function);
+ }
static bool doOpt = qgetenv("QV4_NO_OPT").isEmpty();
if (doOpt) {