diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-09-01 13:11:00 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-05 20:26:42 +0200 |
commit | c5694ba5739527c016893079ef659fa8d19161e8 (patch) | |
tree | 2db13e88045d01adde48cde19eadca6cd0bdbb79 /src/qml/compiler/qv4isel_p.h | |
parent | 87ccf530772caa5d388d97b556183fb20930ef38 (diff) |
Make it possible to supply an external JS unit generator to the isel
This is needed for QML unit generation, when we share the JS generator
for QML types/strings and JS code.
Change-Id: I50f0c1fa6721d6e3e59417c6c256c82aec124e8f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_p.h')
-rw-r--r-- | src/qml/compiler/qv4isel_p.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/qml/compiler/qv4isel_p.h b/src/qml/compiler/qv4isel_p.h index ef601cd152..ac6ea64c9f 100644 --- a/src/qml/compiler/qv4isel_p.h +++ b/src/qml/compiler/qv4isel_p.h @@ -59,30 +59,40 @@ struct Function; namespace QQmlJS { -class Q_QML_EXPORT EvalInstructionSelection : public QV4::Compiler::JSUnitGenerator +class Q_QML_EXPORT EvalInstructionSelection { public: - EvalInstructionSelection(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module); + EvalInstructionSelection(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator); virtual ~EvalInstructionSelection() = 0; QV4::CompiledData::CompilationUnit *compile(); void setUseFastLookups(bool b) { useFastLookups = b; } + int registerString(const QString &str) { return jsGenerator->registerString(str); } + uint registerGetterLookup(const QString &name) { return jsGenerator->registerGetterLookup(name); } + uint registerSetterLookup(const QString &name) { return jsGenerator->registerSetterLookup(name); } + uint registerGlobalGetterLookup(const QString &name) { return jsGenerator->registerGlobalGetterLookup(name); } + int registerRegExp(QQmlJS::V4IR::RegExp *regexp) { return jsGenerator->registerRegExp(regexp); } + int registerJSClass(QQmlJS::V4IR::ExprList *args) { return jsGenerator->registerJSClass(args); } + QV4::Compiler::JSUnitGenerator *jsUnitGenerator() const { return jsGenerator; } + protected: virtual void run(V4IR::Function *function) = 0; virtual QV4::CompiledData::CompilationUnit *backendCompileStep() = 0; -protected: bool useFastLookups; QV4::ExecutableAllocator *executableAllocator; + QV4::Compiler::JSUnitGenerator *jsGenerator; + QScopedPointer<QV4::Compiler::JSUnitGenerator> ownJSGenerator; + V4IR::Module *irModule; }; class Q_QML_EXPORT EvalISelFactory { public: virtual ~EvalISelFactory() = 0; - virtual EvalInstructionSelection *create(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module) = 0; + virtual EvalInstructionSelection *create(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator) = 0; virtual bool jitCompileRegexps() const = 0; }; |