diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-07-23 12:22:11 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-08-18 16:05:55 +0200 |
commit | 2ae518d3a4ea994dfb6c120f826ef7c801b70807 (patch) | |
tree | 60b14fe12a75619cfef8494789dd72ddb610ff8b /src/qml/compiler/qv4jsir_p.h | |
parent | 7e5a589b905969a5712b801cec01be257fbc237c (diff) |
V4 IR: Add loop peeling.
By peeling the first iteration off of a loop and putting it in front of
the loop, type inference can deduce more type information for esp. loop
induction variables. To prevent increasing the code size too much, only
the inner-most loops are peeled.
This gives a 10% speed-up on crypto.js.
Change-Id: I57f9611695bc8defc0bff84e440b8a20b2c8a34e
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4jsir_p.h')
-rw-r--r-- | src/qml/compiler/qv4jsir_p.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h index e3499363dc..33580a720c 100644 --- a/src/qml/compiler/qv4jsir_p.h +++ b/src/qml/compiler/qv4jsir_p.h @@ -879,7 +879,7 @@ public: Stmt *JUMP(BasicBlock *target); Stmt *CJUMP(Expr *cond, BasicBlock *iftrue, BasicBlock *iffalse); - Stmt *RET(Temp *expr); + Stmt *RET(Expr *expr); BasicBlock *containingGroup() const { @@ -899,10 +899,10 @@ public: return _groupStart; } - void markAsGroupStart() + void markAsGroupStart(bool mark = true) { Q_ASSERT(!isRemoved()); - _groupStart = true; + _groupStart = mark; } // Returns the index of the basic-block. @@ -1065,20 +1065,20 @@ public: void setBasicBlock(IR::BasicBlock *block); - template <typename _Expr> - _Expr *operator()(_Expr *expr) + template <typename ExprSubclass> + ExprSubclass *operator()(ExprSubclass *expr) { return clone(expr); } - template <typename _Expr> - _Expr *clone(_Expr *expr) + template <typename ExprSubclass> + ExprSubclass *clone(ExprSubclass *expr) { Expr *c = expr; qSwap(cloned, c); expr->accept(this); qSwap(cloned, c); - return static_cast<_Expr *>(c); + return static_cast<ExprSubclass *>(c); } static Const *cloneConst(Const *c, Function *f) @@ -1137,8 +1137,10 @@ protected: virtual void visitSubscript(Subscript *); virtual void visitMember(Member *); -private: +protected: IR::BasicBlock *block; + +private: IR::Expr *cloned; }; |