Index: src/compiler/x64/linkage-x64.cc |
diff --git a/src/compiler/x64/linkage-x64.cc b/src/compiler/x64/linkage-x64.cc |
index 3a92bb16c7a1a8abef0faa1f714f5c3de259a65c..7d34ef2cfae42b602fe2ce5105f790897c52cc92 100644 |
--- a/src/compiler/x64/linkage-x64.cc |
+++ b/src/compiler/x64/linkage-x64.cc |
@@ -14,6 +14,12 @@ namespace v8 { |
namespace internal { |
namespace compiler { |
+#ifdef _WIN64 |
+const bool kWin64 = true; |
+#else |
+const bool kWin64 = false; |
+#endif |
+ |
struct LinkageHelperTraits { |
static Register ReturnValueReg() { return rax; } |
static Register ReturnValue2Reg() { return rdx; } |
@@ -21,26 +27,24 @@ struct LinkageHelperTraits { |
static Register ContextReg() { return rsi; } |
static Register RuntimeCallFunctionReg() { return rbx; } |
static Register RuntimeCallArgCountReg() { return rax; } |
-#ifdef _WIN64 |
static RegList CCalleeSaveRegisters() { |
- return rbx.bit() | rdi.bit() | rsi.bit() | r12.bit() | r13.bit() | |
- r14.bit() | r15.bit(); |
+ if (kWin64) { |
+ return rbx.bit() | rdi.bit() | rsi.bit() | r12.bit() | r13.bit() | |
+ r14.bit() | r15.bit(); |
+ } else { |
+ return rbx.bit() | r12.bit() | r13.bit() | r14.bit() | r15.bit(); |
+ } |
} |
static Register CRegisterParameter(int i) { |
- static Register register_parameters[] = {rcx, rdx, r8, r9}; |
- return register_parameters[i]; |
+ if (kWin64) { |
+ static Register register_parameters[] = {rcx, rdx, r8, r9}; |
+ return register_parameters[i]; |
+ } else { |
+ static Register register_parameters[] = {rdi, rsi, rdx, rcx, r8, r9}; |
+ return register_parameters[i]; |
+ } |
} |
- static int CRegisterParametersLength() { return 4; } |
-#else |
- static RegList CCalleeSaveRegisters() { |
- return rbx.bit() | r12.bit() | r13.bit() | r14.bit() | r15.bit(); |
- } |
- static Register CRegisterParameter(int i) { |
- static Register register_parameters[] = {rdi, rsi, rdx, rcx, r8, r9}; |
- return register_parameters[i]; |
- } |
- static int CRegisterParametersLength() { return 6; } |
-#endif |
+ static int CRegisterParametersLength() { return kWin64 ? 4 : 6; } |
}; |