diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-11-07 09:02:09 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-15 18:46:49 +0000 |
commit | 1417f3878574978182b669147bc4aed6870f4838 (patch) | |
tree | ea9fb28b2f1e4880cbeed4cbf18f21e787de0fd1 /src/qml/compiler | |
parent | 6b738e3224c26fcce148b569188e2a25520e54d6 (diff) |
Don't create a CallContext if arguments are being used in strict mode
The strict arguments object doesn't need a callcontext.
Change-Id: I1d6419c456b28741167f76937906faffd2d5d3b4
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 5 | ||||
-rw-r--r-- | src/qml/compiler/qv4compilercontext_p.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index 04d16d412e..b9d223bab0 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -1503,7 +1503,7 @@ Codegen::Reference Codegen::referenceForName(const QString &name, bool isLhs) } const int argIdx = c->findArgument(name); if (argIdx != -1) { - Q_ASSERT(!c->argumentsCanEscape && c->usesArgumentsObject != Context::ArgumentsObjectUsed); + Q_ASSERT(!c->argumentsCanEscape && (c->usesArgumentsObject != Context::ArgumentsObjectUsed || c->isStrict)); return Reference::fromArgument(this, argIdx, _volataleMemoryLocations.isVolatile(name)); } c = c->parent; @@ -2074,7 +2074,8 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, bool allVarsEscape = _context->hasWith || _context->hasTry || _context->hasDirectEval; if (_context->compilationMode == QmlBinding // we don't really need this for bindings, but we do for signal handlers, and we don't know if the code is a signal handler or not. - || (!_context->canUseSimpleCall() && _context->compilationMode != GlobalCode && (_context->compilationMode != EvalCode || _context->isStrict))) { + || (!_context->canUseSimpleCall() && _context->compilationMode != GlobalCode && + (_context->compilationMode != EvalCode || _context->isStrict))) { Instruction::CreateCallContext createContext; bytecodeGenerator->addInstruction(createContext); } diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h index 0b7ac1fb0c..3db30ea23d 100644 --- a/src/qml/compiler/qv4compilercontext_p.h +++ b/src/qml/compiler/qv4compilercontext_p.h @@ -218,7 +218,7 @@ struct Context { return nestedContexts.isEmpty() && locals.isEmpty() && !hasTry && !hasWith && - usesArgumentsObject == ArgumentsObjectNotUsed && !hasDirectEval; + (usesArgumentsObject == ArgumentsObjectNotUsed || isStrict) && !hasDirectEval; } int findArgument(const QString &name) |