aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-05-11 10:09:12 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2017-06-09 07:55:33 +0000
commit5efbd7165d6867aa376f23c20edcfe49e80518c6 (patch)
tree2cb510332dcc5973c4c017775567e25677c01e0d /src/qml/compiler/qv4codegen_p.h
parent4ea6d985fa76786a965443f814f3f9b59620e056 (diff)
Change temp allocation when generating IR
For functions that won't get optimized, it's useful to limit the number of temporaries as much as possible. Change-Id: I6e9be3129c064fdc4c01e1ec6f1617e901c05935 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen_p.h')
-rw-r--r--src/qml/compiler/qv4codegen_p.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index 742ee79648..1cbe6949a1 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -231,6 +231,17 @@ protected:
}
};
+ struct TempScope {
+ TempScope(QV4::IR::Function *f)
+ : function(f),
+ tempCountForScope(f->currentTemp) {}
+ ~TempScope() {
+ function->currentTemp = tempCountForScope;
+ }
+ QV4::IR::Function *function;
+ int tempCountForScope;
+ };
+
Environment *newEnvironment(AST::Node *node, Environment *parent, CompilationMode compilationMode)
{
Environment *env = new Environment(parent, compilationMode);
@@ -293,7 +304,6 @@ protected:
}
QV4::IR::Expr *member(QV4::IR::Expr *base, const QString *name);
- QV4::IR::Expr *subscript(QV4::IR::Expr *base, QV4::IR::Expr *index);
QV4::IR::Expr *argument(QV4::IR::Expr *expr);
QV4::IR::Expr *reference(QV4::IR::Expr *expr);
QV4::IR::Expr *unop(QV4::IR::AluOp op, QV4::IR::Expr *expr, const AST::SourceLocation &loc = AST::SourceLocation());