aboutsummaryrefslogtreecommitdiffstats
path: root/qv4isel_masm.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-22 15:03:43 +0200
committerLars Knoll <lars.knoll@digia.com>2012-10-23 10:34:12 +0200
commit43f970df35a5fa71e0616fc8f9f56a9c4c737291 (patch)
tree0e122736d35e4a8a31070a411a45ec2f614bebca /qv4isel_masm.cpp
parent89b2015c02cb42f688ee114c5b3eb24c9da8aa69 (diff)
[masm] Cleanup: Eliminate ScratchRegister2 on AMD64
Functions like loadArgument and storeValue that work right above the macro assembler may use ScratchRegister because they only call functions that do not "allocate" that register themselves. copyValue on the other hand is a higher-level function and may not use ScratchRegister because the functions it calls (i.e. loadArgument) may clobber it. In the 64-bit case of quickly copying one VM value to another location, we might as well use the ReturnValueRegister as intermediate register and therefore re-allow the use of ScratchRegister in the lower-level loadArgument/storeArgument functions. Change-Id: I9f0c0d326e5af87101972f0cceb86cffe4ebdd0d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'qv4isel_masm.cpp')
-rw-r--r--qv4isel_masm.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/qv4isel_masm.cpp b/qv4isel_masm.cpp
index cd294cac28..e5c78ab1db 100644
--- a/qv4isel_masm.cpp
+++ b/qv4isel_masm.cpp
@@ -743,9 +743,11 @@ void InstructionSelection::callRuntimeMethodImp(IR::Temp *result, const char* na
template <typename Result, typename Source>
void InstructionSelection::copyValue(Result result, Source source)
{
-#if CPU(X86_64)
- loadArgument(source, ScratchRegister);
- storeArgument(ScratchRegister, result);
+#ifdef VALUE_FITS_IN_REGISTER
+ // Use ReturnValueRegister as "scratch" register because loadArgument
+ // and storeArgument are functions that may need a scratch register themselves.
+ loadArgument(source, ReturnValueRegister);
+ storeArgument(ReturnValueRegister, result);
#else
loadDouble(source, FPGpr0);
storeDouble(FPGpr0, result);