aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-08-30 10:29:16 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-02 14:32:47 +0200
commite360eaa02fb1a9baae89b473e2b5e8cc9d1bc609 (patch)
tree02256b5944400511182d3749d37bb88e5cb4a2a4 /src/qml/jsruntime/qv4engine.cpp
parent729cde55784e17a0e923caa8142cef6918146cd2 (diff)
Temporarily collect a map of all functions in the engine
At the moment we collect a lot of compilation units (one per binding expression!), which for long running QML accumulates and creates a horrible performance when trying to retrieve back traces. There is work in progress to reduces the number of units down to one per QML file, and then the fixed sorted QVector might proof to be a more efficient data structure for the lookups. But until that code lands, this patch proposes to use a QMap instead for the time being, that tracks all functions. This brings down the qtquickcontrols auto-test run from 2.5 minutes to just under a minute on my machine. Change-Id: I45bf609055877081daa984de90f291a030f2f24f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index b272e69fb0..ca0ea916a3 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -795,6 +795,9 @@ namespace {
Function *ExecutionEngine::functionForProgramCounter(quintptr pc) const
{
+ // ### Use this code path instead of the "else" when the number of compilation units went down to
+ // one per (qml) file.
+#if 0
for (QSet<QV4::CompiledData::CompilationUnit*>::ConstIterator unitIt = compilationUnits.constBegin(), unitEnd = compilationUnits.constEnd();
unitIt != unitEnd; ++unitIt) {
const QVector<Function*> &functions = (*unitIt)->runtimeFunctionsSortedByAddress;
@@ -805,6 +808,17 @@ Function *ExecutionEngine::functionForProgramCounter(quintptr pc) const
return *it;
}
return 0;
+#else
+ QMap<quintptr, Function*>::ConstIterator it = allFunctions.lowerBound(pc);
+ if (it != allFunctions.begin() && allFunctions.count() > 0)
+ --it;
+ if (it == allFunctions.end())
+ return 0;
+
+ if (pc < it.key() || pc >= it.key() + (*it)->codeSize)
+ return 0;
+ return *it;
+#endif
}
QmlExtensions *ExecutionEngine::qmlExtensions()