diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-08-20 16:54:29 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-08-20 16:54:29 +0200 |
commit | 461892e492e0bef399714557498380703b3e029b (patch) | |
tree | ad82e1ae8286bbe650b2ee19ad393a4ab8996bb1 /src/qml/compiler/qv4isel_p.cpp | |
parent | a71e35a95c9f352db91fb82d8a564d01ba961341 (diff) | |
parent | 90aaff37be419ca1f1da40df64424c0d88bfaf19 (diff) |
Merge branch 'wip/v4' of ssh://codereview.qt-project.org/qt/qtdeclarative into dev
Conflicts:
src/qml/compiler/qv4codegen.cpp
src/qml/compiler/qv4codegen_p.h
src/qml/compiler/qv4isel_moth.cpp
src/qml/jsruntime/qv4context_p.h
src/qml/jsruntime/qv4functionobject.cpp
src/qml/jsruntime/qv4runtime.cpp
src/qml/jsruntime/qv4runtime_p.h
src/qml/jsruntime/qv4script.cpp
sync.profile
Change-Id: I1d785e2134bffac9553a1c16eed12816cbd1ad2c
Diffstat (limited to 'src/qml/compiler/qv4isel_p.cpp')
-rw-r--r-- | src/qml/compiler/qv4isel_p.cpp | 50 |
1 files changed, 11 insertions, 39 deletions
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp index 7194473849..96199b59d2 100644 --- a/src/qml/compiler/qv4isel_p.cpp +++ b/src/qml/compiler/qv4isel_p.cpp @@ -58,17 +58,13 @@ QTextStream qout(stderr, QIODevice::WriteOnly); using namespace QQmlJS; using namespace QQmlJS::V4IR; -EvalInstructionSelection::EvalInstructionSelection(QV4::ExecutionEngine *engine, Module *module) - : _engine(engine) +EvalInstructionSelection::EvalInstructionSelection(QV4::ExecutableAllocator *execAllocator, Module *module) + : QV4::Compiler::JSUnitGenerator(module) , useFastLookups(true) + , executableAllocator(execAllocator) { - assert(engine); + assert(execAllocator); assert(module); - - createFunctionMapping(0, module->rootFunction); - foreach (V4IR::Function *f, module->functions) { - assert(_irToVM.contains(f)); - } } EvalInstructionSelection::~EvalInstructionSelection() @@ -77,39 +73,15 @@ EvalInstructionSelection::~EvalInstructionSelection() EvalISelFactory::~EvalISelFactory() {} -QV4::Function *EvalInstructionSelection::createFunctionMapping(QV4::Function *outer, Function *irFunction) +QV4::CompiledData::CompilationUnit *EvalInstructionSelection::compile() { - QV4::Function *vmFunction = _engine->newFunction(irFunction->name ? *irFunction->name : QString()); - _irToVM.insert(irFunction, vmFunction); - - vmFunction->hasDirectEval = irFunction->hasDirectEval; - vmFunction->usesArgumentsObject = irFunction->usesArgumentsObject; - vmFunction->hasNestedFunctions = !irFunction->nestedFunctions.isEmpty(); - vmFunction->isStrict = irFunction->isStrict; - vmFunction->isNamedExpression = irFunction->isNamedExpression; - vmFunction->sourceFile = irFunction->sourceFile; - - if (outer) - outer->addNestedFunction(vmFunction); - - foreach (const QString *formal, irFunction->formals) - if (formal) - vmFunction->formals.append(_engine->newString(*formal)); - foreach (const QString *local, irFunction->locals) - if (local) - vmFunction->locals.append(_engine->newString(*local)); - - foreach (V4IR::Function *function, irFunction->nestedFunctions) - createFunctionMapping(vmFunction, function); - - return vmFunction; -} + Function *rootFunction = irModule->rootFunction; + if (!rootFunction) + return 0; + foreach (V4IR::Function *f, irModule->functions) + run(f); -QV4::Function *EvalInstructionSelection::vmFunction(Function *f) { - QV4::Function *function = _irToVM[f]; - if (!function->code) - run(function, f); - return function; + return backendCompileStep(); } void IRDecoder::visitMove(V4IR::Move *s) |