Reviewers: Sven Panne, danno,

Description:
Set SAHF flag correctly in 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=

Please review this at https://codereview.chromium.org/298823008/

SVN Base: git://github.com/v8/v8.git@master

Affected files (+6, -6 lines):
  M src/cpu.cc


Index: src/cpu.cc
diff --git a/src/cpu.cc b/src/cpu.cc
index 8d9afd84ae444c1288d7ad3205ea51293932638a..1464c2d61cabd4f0c59da328a55662d0a756a97b 100644
--- a/src/cpu.cc
+++ b/src/cpu.cc
@@ -300,6 +300,10 @@ CPU::CPU() : stepping_(0),
     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 @@ CPU::CPU() : stepping_(0),
   // 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
   }
+#endif

 #elif V8_HOST_ARCH_ARM



--
--
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