Reduce ExecutionEngine dependencies in the moth and masm isel
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 16 Aug 2013 14:53:36 +0000 (16:53 +0200)
committerLars Knoll <lars.knoll@digia.com>
Fri, 16 Aug 2013 17:16:49 +0000 (19:16 +0200)
Change-Id: Ic3d0287e15c404c5527fa6fe0dfa759631b66dd4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/compiler/qv4isel_masm.cpp
src/qml/compiler/qv4isel_masm_p.h
src/qml/compiler/qv4isel_moth.cpp

index bd78256..a998e8b 100644 (file)
@@ -212,8 +212,8 @@ const int Assembler::calleeSavedRegisterCount = sizeof(calleeSavedRegisters) / s
 
 const Assembler::VoidType Assembler::Void;
 
-Assembler::Assembler(InstructionSelection *isel, V4IR::Function* function, QV4::ExecutionEngine *engine)
-    : _function(function), _isel(isel), _engine(engine), _nextBlock(0)
+Assembler::Assembler(InstructionSelection *isel, V4IR::Function* function, QV4::ExecutableAllocator *executableAllocator)
+    : _function(function), _isel(isel), _executableAllocator(executableAllocator), _nextBlock(0)
 {
 }
 
@@ -577,7 +577,7 @@ JSC::MacroAssemblerCodeRef Assembler::link()
         }
     }
 
-    JSC::JSGlobalData dummy(_engine->executableAllocator);
+    JSC::JSGlobalData dummy(_executableAllocator);
     JSC::LinkBuffer linkBuffer(dummy, this, 0);
 
     QVector<uint> lineNumberMapping(codeLineNumberMappings.count() * 2);
@@ -688,7 +688,7 @@ void InstructionSelection::run(QV4::Function *vmFunction, V4IR::Function *functi
     qSwap(_function, function);
     qSwap(_reentryBlocks, reentryBlocks);
     Assembler* oldAssembler = _as;
-    _as = new Assembler(this, _function, engine());
+    _as = new Assembler(this, _function, engine()->executableAllocator);
 
     V4IR::Optimizer opt(_function);
     opt.run();
index f05aa01..3cde647 100644 (file)
@@ -75,7 +75,7 @@ struct CompilationUnit : public QV4::CompiledData::CompilationUnit
 class Assembler : public JSC::MacroAssembler
 {
 public:
-    Assembler(InstructionSelection *isel, V4IR::Function* function, QV4::ExecutionEngine *engine);
+    Assembler(InstructionSelection *isel, V4IR::Function* function, QV4::ExecutableAllocator *executableAllocator);
 #if CPU(X86)
 
 #undef VALUE_FITS_IN_REGISTER
@@ -797,7 +797,7 @@ private:
     QHash<V4IR::BasicBlock *, QVector<DataLabelPtr> > _labelPatches;
     V4IR::BasicBlock *_nextBlock;
 
-    QV4::ExecutionEngine *_engine;
+    QV4::ExecutableAllocator *_executableAllocator;
     InstructionSelection *_isel;
 
     struct CodeLineNumerMapping
index 7b06901..cbf7b48 100644 (file)
@@ -280,9 +280,6 @@ void InstructionSelection::run(QV4::Function *vmFunction, V4IR::Function *functi
 
     codeRefs.insert(_function, squeezeCode());
 
-    if (QV4::Debugging::Debugger *debugger = engine()->debugger)
-        debugger->setPendingBreakpoints(_vmFunction);
-
     qSwap(_currentStatement, cs);
     qSwap(_stackSlotAllocator, stackSlotAllocator);
     delete stackSlotAllocator;
@@ -1106,6 +1103,9 @@ QV4::Function *CompilationUnit::linkBackendToEngine(QV4::ExecutionEngine *engine
 
         runtimeFunction->codeData = reinterpret_cast<const uchar *>(codeRefs.at(i).constData());
 
+        if (QV4::Debugging::Debugger *debugger = engine->debugger)
+            debugger->setPendingBreakpoints(runtimeFunction);
+
         if (compiledFunction == compiledRootFunction) {
             assert(!rootRuntimeFunction);
             rootRuntimeFunction = runtimeFunction;