aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compilerscanfunctions.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-07-03 16:23:35 +0200
committerLars Knoll <lars.knoll@qt.io>2017-07-04 10:25:28 +0000
commitf3561037c9892c9c467f618ce3000567a4924363 (patch)
treed45caf27920ec511bb3c47c3e7e3a105e791b355 /src/qml/compiler/qv4compilerscanfunctions.cpp
parentd5ab38b606fa63e6da1425b6fa607f55b3877007 (diff)
Limit the amount of escaping variables
Calculate more exactly which variables can be referenced from an inner context, and convert all the non escaping ones to temporaries on the stack. Change-Id: I0e33e85b0f6f426ef2812b8ecccee1870492b7b5 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilerscanfunctions.cpp')
-rw-r--r--src/qml/compiler/qv4compilerscanfunctions.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp
index 2a217fbb99..b59beb0315 100644
--- a/src/qml/compiler/qv4compilerscanfunctions.cpp
+++ b/src/qml/compiler/qv4compilerscanfunctions.cpp
@@ -305,6 +305,13 @@ void ScanFunctions::endVisit(FunctionDeclaration *)
leaveEnvironment();
}
+bool ScanFunctions::visit(TryStatement *)
+{
+ // ### should limit to catch(), as try{} finally{} should be ok without
+ _context->hasTry = true;
+ return true;
+}
+
bool ScanFunctions::visit(WithStatement *ast)
{
if (_context->isStrict) {
@@ -312,6 +319,7 @@ bool ScanFunctions::visit(WithStatement *ast)
return false;
}
+ _context->hasWith = true;
return true;
}
@@ -436,6 +444,11 @@ void ScanFunctions::calcEscapingVariables()
c = c->parent;
}
}
+ Context *c = inner->parent;
+ while (c) {
+ c->hasDirectEval |= inner->hasDirectEval;
+ c = c->parent;
+ }
}
static const bool showEscapingVars = qEnvironmentVariableIsSet("QV4_SHOW_ESCAPING_VARS");