diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-05-15 14:09:07 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-23 13:19:08 +0000 |
commit | 7a90818f3188ecd17fbbcc7207aaed50c00e82ee (patch) | |
tree | 0023e6b42a316f82e6a8c0e3f3165ce8b7cb5766 /src/qml/compiler/qv4compilercontext.cpp | |
parent | df616013cabfe255398868ab742d54e8558bff12 (diff) |
Set the usesThis flag on the function context
While the old code was also leading to correct results,
it was less efficient, as we would have added the
ConvertThisToObject instruction multiple times (once
for each block that uses 'this'.
Change-Id: Ia1f99b681b4494110d189f1bb6dded18fa413b53
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compilercontext.cpp')
-rw-r--r-- | src/qml/compiler/qv4compilercontext.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compilercontext.cpp b/src/qml/compiler/qv4compilercontext.cpp index 7acc8256f0..bd9d19f491 100644 --- a/src/qml/compiler/qv4compilercontext.cpp +++ b/src/qml/compiler/qv4compilercontext.cpp @@ -195,7 +195,8 @@ void Context::emitBlockHeader(Codegen *codegen) } } - if (usesThis && !isStrict) { + if (usesThis) { + Q_ASSERT(!isStrict); // make sure we convert this to an object Instruction::ConvertThisToObject convert; bytecodeGenerator->addInstruction(convert); |