Revision: 22765
Author:   [email protected]
Date:     Thu Jul 31 15:06:54 2014 UTC
Log:      TF: Clear upper bits of ConvertFloat64ToUint32 because Win64.

[email protected]
BUG=

Review URL: https://codereview.chromium.org/436623002
http://code.google.com/p/v8/source/detail?r=22765

Modified:
 /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc
 /branches/bleeding_edge/src/compiler/x64/linkage-x64.cc

=======================================
--- /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc Thu Jul 31 11:45:22 2014 UTC +++ /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc Thu Jul 31 15:06:54 2014 UTC
@@ -496,6 +496,9 @@
     case kSSEFloat64ToUint32: {
       // TODO(turbofan): X64 SSE cvttsd2siq should support operands.
       __ cvttsd2siq(i.OutputRegister(), i.InputDoubleRegister(0));
+ __ andl(i.OutputRegister(), i.OutputRegister()); // clear upper bits. + // TODO(turbofan): generated code should not look at the upper 32 bits
+      // of the result, but those bits could escape to the outside world.
       break;
     }
     case kSSEInt32ToFloat64: {
=======================================
--- /branches/bleeding_edge/src/compiler/x64/linkage-x64.cc Wed Jul 30 13:54:45 2014 UTC +++ /branches/bleeding_edge/src/compiler/x64/linkage-x64.cc Thu Jul 31 15:06:54 2014 UTC
@@ -14,6 +14,12 @@
 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 @@
   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; }
 };


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to