aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index dbf1a43fa7..bac61c1cc8 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -2354,8 +2354,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
unsigned returnAddress = entryBlock->newTemp();
- entryBlock->MOVE(entryBlock->TEMP(returnAddress), entryBlock->CONST(IR::UndefinedType, 0));
- setLocation(exitBlock->RET(exitBlock->TEMP(returnAddress)), ast->lastSourceLocation());
+//### setLocation(exitBlock->RET(exitBlock->TEMP(returnAddress)), ast->lastSourceLocation());
qSwap(_function, function);
qSwap(_block, entryBlock);
@@ -2363,6 +2362,16 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
qSwap(_returnAddress, returnAddress);
qSwap(_scopeAndFinally, scopeAndFinally);
+ {
+ auto retTemp = Reference::fromTemp(this, _returnAddress);
+ retTemp.store(Reference::fromConst(this, Encode::undefined()));
+ }
+
+ { // reserve space for outgoing call arguments
+ _function->tempCount += _variableEnvironment->maxNumberOfArguments;
+ _function->currentTemp = _function->tempCount;
+ }
+
for (FormalParameterList *it = formals; it; it = it->next) {
_function->RECEIVE(it->name.toString());
}
@@ -2392,11 +2401,6 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn), 0));
}
- { // reserve space for outgoing call arguments
- _function->tempCount += _variableEnvironment->maxNumberOfArguments;
- _function->currentTemp = _function->tempCount;
- }
-
beginFunctionBodyHook();
sourceElements(body);
@@ -3349,7 +3353,9 @@ void Codegen::Reference::store(const Reference &r) const
if (r.type == Const) {
QV4::Moth::Instruction::MoveConst move;
move.source = r.constant;
- move.result = base;
+ move.result = b;
+ codegen->bytecodeGenerator->addInstruction(move);
+ return;
}
Moth::Param x = r.asRValue();
Q_ASSERT(base != x);