aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qv4codegen_p.h4
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h4
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp7
3 files changed, 8 insertions, 7 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index 56bed33c19..f55ef026a8 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -219,7 +219,7 @@ public:
}
static Reference fromArgument(Codegen *cg, int index) {
Reference r(cg, StackSlot);
- r.theStackSlot = Moth::StackSlot::createArgument(index);
+ r.theStackSlot = Moth::StackSlot::createArgument(cg->currentContext()->arguments.size(), index);
r.stackSlotIsLocalOrArgument = true;
return r;
}
@@ -614,6 +614,8 @@ public:
QQmlRefPointer<QV4::CompiledData::CompilationUnit> generateCompilationUnit(bool generateUnitData = true);
static QQmlRefPointer<QV4::CompiledData::CompilationUnit> createUnitForLoading();
+ Context *currentContext() const { return _context; }
+
protected:
friend class ScanFunctions;
friend struct ControlFlow;
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h
index 19d521dbe3..87814775c0 100644
--- a/src/qml/compiler/qv4instr_moth_p.h
+++ b/src/qml/compiler/qv4instr_moth_p.h
@@ -192,10 +192,10 @@ public:
return t;
}
- static StackSlot createArgument(int index) {
+ static StackSlot createArgument(int nFormals, int index) {
Q_ASSERT(index >= 0);
StackSlot t;
- t.index = -index - 1;
+ t.index = index - nFormals;
return t;
}
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index c1787f4eec..e3a9815f54 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -458,10 +458,9 @@ QV4::ReturnedValue VME::exec(Function *function)
QV4::Scope scope(engine);
{
int nFormals = function->nFormals;
- stack = scope.alloc(function->compiledFunction->nRegisters + nFormals) + nFormals;
- auto cc = engine->current;
- for (int i = 0, ei = std::min<int>(cc->callData->argc, nFormals); i != ei; ++i)
- stack[-i-1] = cc->callData->args[i];
+ stack = scope.alloc(function->compiledFunction->nRegisters + nFormals + 1);
+ memcpy(stack, &engine->current->callData->thisObject, (nFormals + 1)*sizeof(Value));
+ stack += nFormals + 1;
}
if (QV4::Debugging::Debugger *debugger = engine->debugger())