aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-08-16 21:25:39 +0200
committerLars Knoll <lars.knoll@digia.com>2013-08-16 21:38:07 +0200
commit33149123187fda2bc96bd0288502cca97016791d (patch)
tree69cda0e37a2165df2188e6852113cb88206a8b5e /src
parentfa7428adb543fb304bd05ec095d08306df976ba5 (diff)
Eliminate all vm functions on the isel side
Change-Id: I7c0e50498c937ce554b019f98829fa8c5d96c18e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qv4compileddata.cpp4
-rw-r--r--src/qml/compiler/qv4isel_masm.cpp6
-rw-r--r--src/qml/compiler/qv4isel_masm_p.h2
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp9
-rw-r--r--src/qml/compiler/qv4isel_moth_p.h3
-rw-r--r--src/qml/compiler/qv4isel_p.cpp23
-rw-r--r--src/qml/compiler/qv4isel_p.h4
-rw-r--r--src/qml/jsruntime/qv4engine.cpp6
-rw-r--r--src/qml/jsruntime/qv4engine_p.h2
9 files changed, 13 insertions, 46 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index 7f02509a80..e0a3cbc836 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -80,6 +80,10 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
for (int i = 0; i < data->stringTableSize; ++i)
runtimeStrings[i] = engine->newIdentifier(data->stringAt(i)->qString());
+ runtimeFunctions.resize(data->functionTableSize);
+ for (int i = 0; i < data->functionTableSize; ++i)
+ runtimeFunctions[i] = new QV4::Function(engine, runtimeStrings[data->functionAt(i)->nameIndex]);
+
runtimeRegularExpressions = new QV4::Value[data->regexpTableSize];
for (int i = 0; i < data->regexpTableSize; ++i) {
const CompiledData::RegExp *re = data->regexpAt(i);
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
index 8dbf0b9dc3..c564c3d10f 100644
--- a/src/qml/compiler/qv4isel_masm.cpp
+++ b/src/qml/compiler/qv4isel_masm.cpp
@@ -686,7 +686,7 @@ InstructionSelection::~InstructionSelection()
delete _as;
}
-void InstructionSelection::run(QV4::Function *vmFunction, V4IR::Function *function)
+void InstructionSelection::run(V4IR::Function *function)
{
QVector<Lookup> lookups;
QSet<V4IR::BasicBlock*> reentryBlocks;
@@ -767,10 +767,8 @@ QV4::CompiledData::CompilationUnit *InstructionSelection::backendCompileStep()
compilationUnit->runtimeFunctions.reserve(jsUnitGenerator.irModule->functions.size());
compilationUnit->codeRefs.resize(jsUnitGenerator.irModule->functions.size());
int i = 0;
- foreach (V4IR::Function *irFunction, jsUnitGenerator.irModule->functions) {
- compilationUnit->runtimeFunctions << _irToVM[irFunction];
+ foreach (V4IR::Function *irFunction, jsUnitGenerator.irModule->functions)
compilationUnit->codeRefs[i++] = codeRefs[irFunction];
- }
return compilationUnit;
}
diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h
index 4461f16b3e..a74f1c5cc1 100644
--- a/src/qml/compiler/qv4isel_masm_p.h
+++ b/src/qml/compiler/qv4isel_masm_p.h
@@ -818,7 +818,7 @@ public:
InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module);
~InstructionSelection();
- virtual void run(QV4::Function *vmFunction, V4IR::Function *function);
+ virtual void run(V4IR::Function *function);
protected:
virtual QV4::CompiledData::CompilationUnit *backendCompileStep();
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 523d426d41..3622f2a4fe 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -191,7 +191,6 @@ private:
InstructionSelection::InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module)
: EvalInstructionSelection(engine, module)
, _function(0)
- , _vmFunction(0)
, _block(0)
, _codeStart(0)
, _codeNext(0)
@@ -206,7 +205,7 @@ InstructionSelection::~InstructionSelection()
{
}
-void InstructionSelection::run(QV4::Function *vmFunction, V4IR::Function *function)
+void InstructionSelection::run(V4IR::Function *function)
{
V4IR::BasicBlock *block = 0, *nextBlock = 0;
@@ -220,7 +219,6 @@ void InstructionSelection::run(QV4::Function *vmFunction, V4IR::Function *functi
uchar *codeEnd = codeStart + codeSize;
qSwap(_function, function);
- qSwap(_vmFunction, vmFunction);
qSwap(block, _block);
qSwap(nextBlock, _nextBlock);
qSwap(patches, _patches);
@@ -284,7 +282,6 @@ void InstructionSelection::run(QV4::Function *vmFunction, V4IR::Function *functi
qSwap(_stackSlotAllocator, stackSlotAllocator);
delete stackSlotAllocator;
qSwap(_function, function);
- qSwap(_vmFunction, vmFunction);
qSwap(block, _block);
qSwap(nextBlock, _nextBlock);
qSwap(patches, _patches);
@@ -302,10 +299,8 @@ QV4::CompiledData::CompilationUnit *InstructionSelection::backendCompileStep()
compilationUnit->runtimeFunctions.reserve(jsUnitGenerator.irModule->functions.size());
compilationUnit->codeRefs.resize(jsUnitGenerator.irModule->functions.size());
int i = 0;
- foreach (V4IR::Function *irFunction, jsUnitGenerator.irModule->functions) {
- compilationUnit->runtimeFunctions << _irToVM[irFunction];
+ foreach (V4IR::Function *irFunction, jsUnitGenerator.irModule->functions)
compilationUnit->codeRefs[i++] = codeRefs[irFunction];
- }
return compilationUnit;
}
diff --git a/src/qml/compiler/qv4isel_moth_p.h b/src/qml/compiler/qv4isel_moth_p.h
index 4c0d96c4f5..b1755ef003 100644
--- a/src/qml/compiler/qv4isel_moth_p.h
+++ b/src/qml/compiler/qv4isel_moth_p.h
@@ -73,7 +73,7 @@ public:
InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module);
~InstructionSelection();
- virtual void run(QV4::Function *vmFunction, V4IR::Function *function);
+ virtual void run(V4IR::Function *function);
protected:
virtual QV4::CompiledData::CompilationUnit *backendCompileStep();
@@ -171,7 +171,6 @@ private:
QByteArray squeezeCode() const;
V4IR::Function *_function;
- QV4::Function *_vmFunction;
V4IR::BasicBlock *_block;
V4IR::BasicBlock *_nextBlock;
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp
index 6cfe7626af..8c49cbd431 100644
--- a/src/qml/compiler/qv4isel_p.cpp
+++ b/src/qml/compiler/qv4isel_p.cpp
@@ -65,11 +65,6 @@ EvalInstructionSelection::EvalInstructionSelection(QV4::ExecutionEngine *engine,
{
assert(engine);
assert(module);
-
- createFunctionMapping(0, module->rootFunction);
- foreach (V4IR::Function *f, module->functions) {
- assert(_irToVM.contains(f));
- }
}
EvalInstructionSelection::~EvalInstructionSelection()
@@ -78,27 +73,13 @@ EvalInstructionSelection::~EvalInstructionSelection()
EvalISelFactory::~EvalISelFactory()
{}
-QV4::Function *EvalInstructionSelection::createFunctionMapping(QV4::Function *outer, Function *irFunction)
-{
- QV4::Function *vmFunction = _engine->newFunction(irFunction->name ? *irFunction->name : QString());
- _irToVM.insert(irFunction, vmFunction);
-
- foreach (V4IR::Function *function, irFunction->nestedFunctions)
- createFunctionMapping(vmFunction, function);
-
- return vmFunction;
-}
-
QV4::CompiledData::CompilationUnit *EvalInstructionSelection::compile()
{
Function *rootFunction = jsUnitGenerator.irModule->rootFunction;
if (!rootFunction)
return 0;
- for (QHash<V4IR::Function*, QV4::Function*>::Iterator it = _irToVM.begin(), end = _irToVM.end();
- it != end; ++it) {
- if (!(*it)->code)
- run(it.value(), it.key());
- }
+ foreach (V4IR::Function *f, jsUnitGenerator.irModule->functions)
+ run(f);
return backendCompileStep();
}
diff --git a/src/qml/compiler/qv4isel_p.h b/src/qml/compiler/qv4isel_p.h
index e265a1e39d..0872311c72 100644
--- a/src/qml/compiler/qv4isel_p.h
+++ b/src/qml/compiler/qv4isel_p.h
@@ -77,15 +77,13 @@ public:
int registerJSClass(QQmlJS::V4IR::ExprList *args) { return jsUnitGenerator.registerJSClass(args); }
protected:
- QV4::Function *createFunctionMapping(QV4::Function *outer, V4IR::Function *irFunction);
QV4::ExecutionEngine *engine() const { return _engine; }
- virtual void run(QV4::Function *vmFunction, V4IR::Function *function) = 0;
+ virtual void run(V4IR::Function *function) = 0;
virtual QV4::CompiledData::CompilationUnit *backendCompileStep() = 0;
private:
QV4::ExecutionEngine *_engine;
protected:
- QHash<V4IR::Function *, QV4::Function *> _irToVM;
bool useFastLookups;
QV4::Compiler::JSUnitGenerator jsUnitGenerator;
};
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 36ab994274..2fe32c2ae0 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -374,12 +374,6 @@ ExecutionContext *ExecutionEngine::pushGlobalContext()
return current;
}
-Function *ExecutionEngine::newFunction(const QString &name)
-{
- Function *f = new Function(this, newIdentifier(name));
- return f;
-}
-
FunctionObject *ExecutionEngine::newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(SimpleCallContext *))
{
BuiltinFunctionOld *f = new (memoryManager) BuiltinFunctionOld(scope, name, code);
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index 3dfc070f89..62cdf44206 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -240,8 +240,6 @@ struct Q_QML_EXPORT ExecutionEngine
void pushContext(SimpleCallContext *context);
ExecutionContext *popContext();
- Function *newFunction(const QString &name);
-
FunctionObject *newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(SimpleCallContext *));
FunctionObject *newScriptFunction(ExecutionContext *scope, Function *function);
BoundFunction *newBoundFunction(ExecutionContext *scope, FunctionObject *target, Value boundThis, const QVector<Value> &boundArgs);