aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qv4compileddata.cpp2
-rw-r--r--src/qml/compiler/qv4compileddata_p.h2
-rw-r--r--src/qml/compiler/qv4isel_masm.cpp5
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp9
-rw-r--r--src/qml/compiler/qv4isel_moth_p.h1
-rw-r--r--src/qml/jsruntime/qv4engine.cpp14
-rw-r--r--src/qml/jsruntime/qv4engine_p.h1
7 files changed, 33 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index a434f6c0dc..4c1b05b04e 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -133,9 +133,11 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
linkBackendToEngine(engine);
+#if 0
runtimeFunctionsSortedByAddress.resize(runtimeFunctions.size());
memcpy(runtimeFunctionsSortedByAddress.data(), runtimeFunctions.data(), runtimeFunctions.size() * sizeof(QV4::Function*));
qSort(runtimeFunctionsSortedByAddress.begin(), runtimeFunctionsSortedByAddress.end(), functionSortHelper);
+#endif
return runtimeFunctions[data->indexOfRootFunction];
}
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 854df1185b..235202a832 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -330,7 +330,7 @@ struct CompilationUnit
QV4::Value *runtimeRegularExpressions;
QV4::InternalClass **runtimeClasses;
QVector<QV4::Function *> runtimeFunctions;
- QVector<QV4::Function *> runtimeFunctionsSortedByAddress;
+// QVector<QV4::Function *> runtimeFunctionsSortedByAddress;
QV4::Function *linkToEngine(QV4::ExecutionEngine *engine);
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
index 22f6c3311a..deb0cd1500 100644
--- a/src/qml/compiler/qv4isel_masm.cpp
+++ b/src/qml/compiler/qv4isel_masm.cpp
@@ -67,6 +67,8 @@ using namespace QV4;
CompilationUnit::~CompilationUnit()
{
+ foreach (Function *f, runtimeFunctions)
+ engine->allFunctions.remove(reinterpret_cast<quintptr>(f->code));
UnwindHelper::deregisterFunctions(runtimeFunctions);
}
@@ -83,6 +85,9 @@ void CompilationUnit::linkBackendToEngine(ExecutionEngine *engine)
}
UnwindHelper::registerFunctions(runtimeFunctions);
+
+ foreach (Function *f, runtimeFunctions)
+ engine->allFunctions.insert(reinterpret_cast<quintptr>(f->code), f);
}
QV4::ExecutableAllocator::ChunkOfPages *CompilationUnit::chunkForFunction(int functionIndex)
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 37772ca90f..3e7b1911e9 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -1112,6 +1112,12 @@ Param InstructionSelection::getParam(V4IR::Expr *e) {
}
+CompilationUnit::~CompilationUnit()
+{
+ foreach (QV4::Function *f, runtimeFunctions)
+ engine->allFunctions.remove(reinterpret_cast<quintptr>(f->codeData));
+}
+
void CompilationUnit::linkBackendToEngine(QV4::ExecutionEngine *engine)
{
runtimeFunctions.resize(data->functionTableSize);
@@ -1126,4 +1132,7 @@ void CompilationUnit::linkBackendToEngine(QV4::ExecutionEngine *engine)
if (QV4::Debugging::Debugger *debugger = engine->debugger)
debugger->setPendingBreakpoints(runtimeFunction);
}
+
+ foreach (QV4::Function *f, runtimeFunctions)
+ engine->allFunctions.insert(reinterpret_cast<quintptr>(f->codeData), f);
}
diff --git a/src/qml/compiler/qv4isel_moth_p.h b/src/qml/compiler/qv4isel_moth_p.h
index 1b4d8b6d77..43e792ccc7 100644
--- a/src/qml/compiler/qv4isel_moth_p.h
+++ b/src/qml/compiler/qv4isel_moth_p.h
@@ -58,6 +58,7 @@ class StackSlotAllocator;
struct CompilationUnit : public QV4::CompiledData::CompilationUnit
{
+ virtual ~CompilationUnit();
virtual void linkBackendToEngine(QV4::ExecutionEngine *engine);
QVector<QByteArray> codeRefs;
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()
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index 88cafe5fa0..b793509321 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -206,6 +206,7 @@ struct Q_QML_EXPORT ExecutionEngine
String *id_name;
QSet<CompiledData::CompilationUnit*> compilationUnits;
+ QMap<quintptr, QV4::Function*> allFunctions;
quint32 m_engineId;