diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2012-12-11 10:03:40 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2012-12-11 23:16:32 +0100 |
commit | 5e39d56c0974faa28c5060a12064e1ad7f611ea0 (patch) | |
tree | a2f900ab936799f002e769e9a48d191af773d3d8 /qv4isel_p.h | |
parent | bcdddfda8ca81752b249540b0abaefb46eb5f766 (diff) |
Remove IR::Function from the runtime.
This fixes potential leaks of IR::Functions, lowers the memory usage
of the functions that the VM needs (because the IR fields are not
present in the VM::Function), and makes both managed by the module
respectively the ExecutionEngine.
Change-Id: I6748ad98b062f994eae9dd14f1919aec5aa7c0b0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'qv4isel_p.h')
-rw-r--r-- | qv4isel_p.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/qv4isel_p.h b/qv4isel_p.h index e8c6d387b7..109ff795a5 100644 --- a/qv4isel_p.h +++ b/qv4isel_p.h @@ -31,6 +31,7 @@ #define QV4ISEL_P_H #include <qglobal.h> +#include <QHash> namespace QQmlJS { @@ -41,21 +42,32 @@ struct Module; namespace VM { struct ExecutionEngine; +struct Function; } // namespace VM class EvalInstructionSelection { public: + EvalInstructionSelection(VM::ExecutionEngine *engine, IR::Module *module); virtual ~EvalInstructionSelection() = 0; - virtual void run(IR::Function *function) = 0; + virtual VM::Function *run(IR::Function *function) = 0; + +protected: + VM::Function *createFunctionMapping(VM::ExecutionEngine *engine, IR::Function *irFunction); + VM::Function *vmFunction(IR::Function *f) const { return _irToVM[f]; } + VM::ExecutionEngine *engine() const { return _engine; } + +private: + VM::ExecutionEngine *_engine; + QHash<IR::Function *, VM::Function *> _irToVM; }; class EvalISelFactory { public: virtual ~EvalISelFactory() = 0; - virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine) = 0; + virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine, IR::Module *module) = 0; }; } // namespace QQmlJS |