From 5e39d56c0974faa28c5060a12064e1ad7f611ea0 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 11 Dec 2012 10:03:40 +0100 Subject: 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 --- qv4isel_p.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'qv4isel_p.h') 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 +#include 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 _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 -- cgit v1.2.3