Revision: 21766
Author:   svenpa...@chromium.org
Date:     Wed Jun 11 09:44:14 2014 UTC
Log:      Set SAHF flag correctly for ia32

sahf flag will not be set for ia32 on some old platform because some old processors does not support CPUID's extended features.
This also avoids redundant cpuid check in ia32 for sahf.

BUG=
R=da...@chromium.org

Review URL: https://codereview.chromium.org/298823008

Patch from Weiliang Lin <weiliang....@intel.com>.
http://code.google.com/p/v8/source/detail?r=21766

Modified:
 /branches/bleeding_edge/src/cpu.cc

=======================================
--- /branches/bleeding_edge/src/cpu.cc  Thu Jun  5 12:14:47 2014 UTC
+++ /branches/bleeding_edge/src/cpu.cc  Wed Jun 11 09:44:14 2014 UTC
@@ -300,6 +300,10 @@
     has_sse42_ = (cpu_info[2] & 0x00100000) != 0;
   }

+#if V8_HOST_ARCH_IA32
+  // SAHF is always available in compat/legacy mode,
+  has_sahf_ = true;
+#else
   // Query extended IDs.
   __cpuid(cpu_info, 0x80000000);
   unsigned num_ext_ids = cpu_info[0];
@@ -307,14 +311,10 @@
   // Interpret extended CPU feature information.
   if (num_ext_ids > 0x80000000) {
     __cpuid(cpu_info, 0x80000001);
-    // SAHF is always available in compat/legacy mode,
-    // but must be probed in long mode.
-#if V8_HOST_ARCH_IA32
-    has_sahf_ = true;
-#else
+    // SAHF must be probed in long mode.
     has_sahf_ = (cpu_info[2] & 0x00000001) != 0;
+  }
 #endif
-  }

 #elif V8_HOST_ARCH_ARM

--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to