diff options
| author | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-06-20 16:43:20 +0200 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2017-06-20 18:07:13 +0000 |
| commit | 5557ea8c79b4cc21f381ddef8a14c4c33ced82ce (patch) | |
| tree | decb48bfc3ed7e1f3bf44282c5c7b79dbc87be29 /src/qml/compiler/qv4codegen.cpp | |
| parent | 57de6922ea24285184c7447b499676a7338b8759 (diff) | |
Reserve call args and return value before any other temps
Change-Id: Ia24a5d301be2f74ac073c37ddda45f6c0ac8ed8e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
| -rw-r--r-- | src/qml/compiler/qv4codegen.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index d76c9ad16f..3ed6a76af7 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -2364,6 +2364,14 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, savedBytecodeGenerator = bytecodeGenerator; bytecodeGenerator = &bytecode; + { // reserve space for outgoing call arguments + Q_ASSERT(function->tempCount == 0); + int minNrOfStackEntries = offsetof(QV4::CallData, args)/sizeof(QV4::Value); + function->tempCount = minNrOfStackEntries + _variableEnvironment->maxNumberOfArguments; + function->currentTemp = function->tempCount; + } + + unsigned returnAddress = bytecodeGenerator->newTemp(); if (function->usesArgumentsObject) _variableEnvironment->enter(QStringLiteral("arguments"), Environment::VariableDeclaration, AST::VariableDeclaration::FunctionScope); @@ -2399,14 +2407,6 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, } } - { // reserve space for outgoing call arguments - Q_ASSERT(function->tempCount == 0); - int minNrOfStackEntries = offsetof(QV4::CallData, args)/sizeof(QV4::Value); - function->tempCount = minNrOfStackEntries + _variableEnvironment->maxNumberOfArguments; - function->currentTemp = function->tempCount; - } - - unsigned returnAddress = bytecodeGenerator->newTemp(); auto exitBlock = bytecodeGenerator->newLabel(); qSwap(_function, function); |
