diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-28 09:43:32 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-29 06:54:02 +0000 |
commit | a7fc82e2e95657e048e43fe438d07b63349c38cd (patch) | |
tree | 48dfcfc88fb60cdb89efaabed53fcc6b82634e1a /src/qml/compiler/qv4codegen_p.h | |
parent | 2d1a50228571a82ab7a098a64ef04b4ccfe7ee15 (diff) |
Optimize access to lexically scoped variables
If we access a lexically scoped variable after the initializer, then we
know it's either initialized or at least undefined, so we don't need to
do the TDZ check anymore.
The ES tests ensure that we don't optimize too much and the newly
revived tst_v4misc test ensures that we do not generate the TDZ check
instruction for certain scenarios.
Change-Id: I6706d1feb22217f323124ee698ebadb70324693b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen_p.h')
-rw-r--r-- | src/qml/compiler/qv4codegen_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index b7992bd8f2..d780df394b 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -685,7 +685,7 @@ public: void handleTryFinally(AST::TryStatement *ast); - Reference referenceForName(const QString &name, bool lhs); + Reference referenceForName(const QString &name, bool lhs, const QQmlJS::AST::SourceLocation &accessLocation = QQmlJS::AST::SourceLocation()); QQmlRefPointer<QV4::CompiledData::CompilationUnit> generateCompilationUnit(bool generateUnitData = true); static QQmlRefPointer<QV4::CompiledData::CompilationUnit> createUnitForLoading(); |