}
}
-
void Assembler::storeValue(QV4::Value value, V4IR::Temp* destination)
{
Address addr = loadTempAddress(ScratchRegister, destination);
}
}
- _as->copyValue(targetTemp, sourceTemp);
+ // The target is not a physical register, nor is the source. So we can do a memory-to-memory copy:
+ _as->memcopyValue(_as->loadTempAddress(Assembler::ReturnValueRegister, targetTemp), sourceTemp,
+ Assembler::ScratchRegister);
}
void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
for (V4IR::ExprList *it = args; it; it = it->next, ++i) {
V4IR::Expr *arg = it->expr;
Q_ASSERT(arg != 0);
- _as->copyValue(_as->stackLayout().argumentAddressForCall(i), arg);
+ Pointer dst(_as->stackLayout().argumentAddressForCall(i));
+ if (arg->asTemp() && arg->asTemp()->kind != V4IR::Temp::PhysicalRegister)
+ _as->memcopyValue(dst, arg->asTemp(), Assembler::ScratchRegister);
+ else
+ _as->copyValue(dst, arg);
}
return argc;
for (V4IR::ExprList *it = args; it; it = it->next, ++i) {
V4IR::Expr *arg = it->expr;
Q_ASSERT(arg != 0);
- _as->copyValue(_as->stackLayout().argumentAddressForCall(i), arg);
+ Pointer dst(_as->stackLayout().argumentAddressForCall(i));
+ if (arg->asTemp() && arg->asTemp()->kind != V4IR::Temp::PhysicalRegister)
+ _as->memcopyValue(dst, arg->asTemp(), Assembler::ScratchRegister);
+ else
+ _as->copyValue(dst, arg);
}
return argc;
}
template <typename Result>
void copyValue(Result result, V4IR::Expr* source);
+ // The scratch register is used to calculate the temp address for the source.
+ void memcopyValue(Pointer target, V4IR::Temp *sourceTemp, RegisterID scratchRegister)
+ {
+ Q_ASSERT(sourceTemp->kind != V4IR::Temp::PhysicalRegister);
+ Q_ASSERT(target.base != scratchRegister);
+ JSC::MacroAssembler::loadDouble(loadTempAddress(scratchRegister, sourceTemp), FPGpr0);
+ JSC::MacroAssembler::storeDouble(FPGpr0, target);
+ }
+
void storeValue(QV4::Value value, RegisterID destination)
{
Q_UNUSED(value);