Get rid of engine pointer in isel
authorSimon Hausmann <simon.hausmann@digia.com>
Sat, 17 Aug 2013 18:48:56 +0000 (20:48 +0200)
committerLars Knoll <lars.knoll@digia.com>
Sun, 18 Aug 2013 10:32:53 +0000 (12:32 +0200)
Change-Id: I58759712624713cd2215621dca4ccc86fa9a9194
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/compiler/qv4compiler.cpp
src/qml/compiler/qv4compiler_p.h
src/qml/compiler/qv4isel_masm.cpp
src/qml/compiler/qv4isel_masm_p.h
src/qml/compiler/qv4isel_moth.cpp
src/qml/compiler/qv4isel_moth_p.h
src/qml/compiler/qv4isel_p.cpp
src/qml/compiler/qv4isel_p.h
src/qml/jsruntime/qv4functionobject.cpp
src/qml/jsruntime/qv4script.cpp

index 11c0873..322a399 100644 (file)
@@ -44,7 +44,7 @@
 #include <qv4isel_p.h>
 #include <qv4engine_p.h>
 
-QV4::Compiler::JSUnitGenerator::JSUnitGenerator(QV4::ExecutionEngine *engine, QQmlJS::V4IR::Module *module)
+QV4::Compiler::JSUnitGenerator::JSUnitGenerator(QQmlJS::V4IR::Module *module)
     : irModule(module)
     , stringDataSize(0)
     , jsClassDataSize(0)
index c6dacfd..6c50073 100644 (file)
@@ -58,7 +58,7 @@ struct JSClassMember;
 namespace Compiler {
 
 struct JSUnitGenerator {
-    JSUnitGenerator(QV4::ExecutionEngine *engine, QQmlJS::V4IR::Module *module);
+    JSUnitGenerator(QQmlJS::V4IR::Module *module);
 
     QQmlJS::V4IR::Module *irModule;
 
index 1210e38..fc113c2 100644 (file)
@@ -673,8 +673,8 @@ JSC::MacroAssemblerCodeRef Assembler::link()
     return codeRef;
 }
 
-InstructionSelection::InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module)
-    : EvalInstructionSelection(engine, module)
+InstructionSelection::InstructionSelection(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module)
+    : EvalInstructionSelection(execAllocator, module)
     , _block(0)
     , _function(0)
     , _as(0)
@@ -695,7 +695,7 @@ void InstructionSelection::run(V4IR::Function *function)
     qSwap(_function, function);
     qSwap(_reentryBlocks, reentryBlocks);
     Assembler* oldAssembler = _as;
-    _as = new Assembler(this, _function, engine()->executableAllocator);
+    _as = new Assembler(this, _function, executableAllocator);
 
     V4IR::Optimizer opt(_function);
     opt.run();
index a74f1c5..fa14d8b 100644 (file)
@@ -815,7 +815,7 @@ class Q_QML_EXPORT InstructionSelection:
         public EvalInstructionSelection
 {
 public:
-    InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module);
+    InstructionSelection(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module);
     ~InstructionSelection();
 
     virtual void run(V4IR::Function *function);
@@ -956,8 +956,8 @@ class Q_QML_EXPORT ISelFactory: public EvalISelFactory
 {
 public:
     virtual ~ISelFactory() {}
-    virtual EvalInstructionSelection *create(QV4::ExecutionEngine *engine, V4IR::Module *module)
-    { return new InstructionSelection(engine, module); }
+    virtual EvalInstructionSelection *create(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module)
+    { return new InstructionSelection(execAllocator, module); }
     virtual bool jitCompileRegexps() const
     { return true; }
 };
index c1d926c..a10de5b 100644 (file)
@@ -188,8 +188,8 @@ private:
     }
 };
 
-InstructionSelection::InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module)
-    : EvalInstructionSelection(engine, module)
+InstructionSelection::InstructionSelection(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module)
+    : EvalInstructionSelection(execAllocator, module)
     , _function(0)
     , _block(0)
     , _codeStart(0)
index b1755ef..484d703 100644 (file)
@@ -70,7 +70,7 @@ class Q_QML_EXPORT InstructionSelection:
         public EvalInstructionSelection
 {
 public:
-    InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module);
+    InstructionSelection(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module);
     ~InstructionSelection();
 
     virtual void run(V4IR::Function *function);
@@ -192,8 +192,8 @@ class Q_QML_EXPORT ISelFactory: public EvalISelFactory
 {
 public:
     virtual ~ISelFactory() {}
-    virtual EvalInstructionSelection *create(QV4::ExecutionEngine *engine, V4IR::Module *module)
-    { return new InstructionSelection(engine, module); }
+    virtual EvalInstructionSelection *create(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module)
+    { return new InstructionSelection(execAllocator, module); }
     virtual bool jitCompileRegexps() const
     { return false; }
 };
index 8c49cbd..5972e3a 100644 (file)
@@ -58,12 +58,12 @@ QTextStream qout(stderr, QIODevice::WriteOnly);
 using namespace QQmlJS;
 using namespace QQmlJS::V4IR;
 
-EvalInstructionSelection::EvalInstructionSelection(QV4::ExecutionEngine *engine, Module *module)
-    : _engine(engine)
-    , useFastLookups(true)
-    , jsUnitGenerator(engine, module)
+EvalInstructionSelection::EvalInstructionSelection(QV4::ExecutableAllocator *execAllocator, Module *module)
+    : useFastLookups(true)
+    , executableAllocator(execAllocator)
+    , jsUnitGenerator(module)
 {
-    assert(engine);
+    assert(execAllocator);
     assert(module);
 }
 
index 0872311..c8e0f6c 100644 (file)
@@ -53,7 +53,7 @@
 QT_BEGIN_NAMESPACE
 
 namespace QV4 {
-struct ExecutionEngine;
+struct ExecutableAllocator;
 struct Function;
 }
 
@@ -62,7 +62,7 @@ namespace QQmlJS {
 class Q_QML_EXPORT EvalInstructionSelection
 {
 public:
-    EvalInstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module);
+    EvalInstructionSelection(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module);
     virtual ~EvalInstructionSelection() = 0;
 
     QV4::CompiledData::CompilationUnit *compile();
@@ -77,14 +77,12 @@ public:
     int registerJSClass(QQmlJS::V4IR::ExprList *args) { return jsUnitGenerator.registerJSClass(args); }
 
 protected:
-    QV4::ExecutionEngine *engine() const { return _engine; }
     virtual void run(V4IR::Function *function) = 0;
     virtual QV4::CompiledData::CompilationUnit *backendCompileStep() = 0;
 
-private:
-    QV4::ExecutionEngine *_engine;
 protected:
     bool useFastLookups;
+    QV4::ExecutableAllocator *executableAllocator;
     QV4::Compiler::JSUnitGenerator jsUnitGenerator;
 };
 
@@ -92,7 +90,7 @@ class Q_QML_EXPORT EvalISelFactory
 {
 public:
     virtual ~EvalISelFactory() = 0;
-    virtual EvalInstructionSelection *create(QV4::ExecutionEngine *engine, V4IR::Module *module) = 0;
+    virtual EvalInstructionSelection *create(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module) = 0;
     virtual bool jitCompileRegexps() const = 0;
 };
 
index fc5300c..bb3154e 100644 (file)
@@ -213,7 +213,7 @@ Value FunctionCtor::construct(Managed *that, Value *args, int argc)
     QQmlJS::Codegen cg(v4->current, f->strictMode);
     cg(QString(), function, fe, &module);
 
-    QScopedPointer<QQmlJS::EvalInstructionSelection> isel(v4->iselFactory->create(v4, &module));
+    QScopedPointer<QQmlJS::EvalInstructionSelection> isel(v4->iselFactory->create(v4->executableAllocator, &module));
     QV4::CompiledData::CompilationUnit *compilationUnit = isel->compile();
     QV4::Function *vmf = compilationUnit->linkToEngine(v4);
 
index d801978..2ae7b3d 100644 (file)
@@ -176,7 +176,7 @@ void Script::parse()
         Codegen cg(scope, strictMode);
         cg(sourceFile, sourceCode, program, &module,
            parseAsBinding ? QQmlJS::Codegen::QmlBinding : QQmlJS::Codegen::EvalCode, inheritedLocals);
-        QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(v4, &module));
+        QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(v4->executableAllocator, &module));
         if (inheritContext)
             isel->setUseFastLookups(false);
         QV4::CompiledData::CompilationUnit *compilationUnit = isel->compile();