From: bmeurer@chromium.org Date: Wed, 28 Aug 2013 09:53:13 +0000 (+0000) Subject: Fix accidential inclusion of into namespace v8::internal. X-Git-Tag: upstream/4.7.83~12782 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc4129c7055e8e8f42929f37e12e7b633ebcef2e;p=platform%2Fupstream%2Fv8.git Fix accidential inclusion of into namespace v8::internal. Also cleanup the fallback __cpuid() implementation, and add a comment about preserving the GOT pointer in case of PIC. R=rossberg@chromium.org Review URL: https://codereview.chromium.org/23464014 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16386 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/cpu.cc b/src/cpu.cc index 1bae001..06a0311 100644 --- a/src/cpu.cc +++ b/src/cpu.cc @@ -27,6 +27,10 @@ #include "cpu.h" +#if V8_CC_MSVC +#include // __cpuid() +#endif + #include #include #include @@ -40,33 +44,30 @@ namespace internal { #if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64 -#if V8_CC_MSVC - -#include // NOLINT - -#elif defined(__i386__) && defined(__pic__) +// Define __cpuid() for non-MSVC compilers. +#if !V8_CC_MSVC static V8_INLINE(void __cpuid(int cpu_info[4], int info_type)) { +#if defined(__i386__) && defined(__pic__) + // Make sure to preserve ebx, which contains the pointer + // to the GOT in case we're generating PIC. __asm__ volatile ( - "mov %%ebx, %%edi\n" - "cpuid\n" - "xchg %%edi, %%ebx\n" + "mov %%ebx, %%edi\n\t" + "cpuid\n\t" + "xchg %%edi, %%ebx\n\t" : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3]) : "a"(info_type) ); -} - -#else // !V8_CC_MSVC || (!defined(__i386__) && !defined(__pic__)) - -static V8_INLINE(void __cpuid(int cpu_info[4], int info_type)) { +#else __asm__ volatile ( "cpuid \n\t" : "=a"(cpu_info[0]), "=b"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3]) : "a"(info_type) ); +#endif // defined(__i386__) && defined(__pic__) } -#endif +#endif // !V8_CC_MSVC #elif V8_HOST_ARCH_ARM || V8_HOST_ARCH_MIPS