void InstructionSelection::visitRet(IR::Ret *s)
{
if (IR::Temp *t = s->expr->asTemp()) {
- Address addr = loadTempAddress(Gpr0, t);
- add32(TrustedImm32(addr.offset), addr.base, Gpr0);
- push(Gpr0);
-
+ Address addr = loadTempAddress(Gpr1, t);
+ add32(TrustedImm32(addr.offset), addr.base, Gpr1);
add32(TrustedImm32(offsetof(Context, result)), ContextRegister, Gpr0);
- push(Gpr0);
-
- callAbsolute(__qmljs_copy);
-
- add32(TrustedImm32(2 * sizeof(void*)), StackPointerRegister);
+ callHelper(__qmljs_copy, Gpr1, Gpr0);
return;
}
Q_UNIMPLEMENTED();
_callsToLink.append(ctl);
}
+ template <typename Arg1>
+ void callHelper(FunctionPtr function, Arg1 arg1) {
+ push(arg1);
+ callAbsolute(function);
+ add32(TrustedImm32(1 * sizeof(void*)), StackPointerRegister);
+ }
+
+ template <typename Arg1, typename Arg2>
+ void callHelper(FunctionPtr function, Arg1 arg1, Arg2 arg2) {
+ push(arg2);
+ push(arg1);
+ callAbsolute(function);
+ add32(TrustedImm32(2 * sizeof(void*)), StackPointerRegister);
+ }
+
+ template <typename Arg1, typename Arg2, typename Arg3>
+ void callHelper(FunctionPtr function, Arg1 arg1, Arg2 arg2, Arg3 arg3) {
+ push(arg3);
+ push(arg2);
+ push(arg1);
+ callAbsolute(function);
+ add32(TrustedImm32(3 * sizeof(void*)), StackPointerRegister);
+ }
+
struct CallToLink {
Call call;
FunctionPtr externalFunction;