OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #endif | 47 #endif |
48 | 48 |
49 namespace v8 { | 49 namespace v8 { |
50 namespace internal { | 50 namespace internal { |
51 | 51 |
52 #if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64 | 52 #if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64 |
53 | 53 |
54 // Define __cpuid() for non-MSVC compilers. | 54 // Define __cpuid() for non-MSVC compilers. |
55 #if !V8_CC_MSVC | 55 #if !V8_CC_MSVC |
56 | 56 |
57 static V8_INLINE(void __cpuid(int cpu_info[4], int info_type)) { | 57 static V8_INLINE void __cpuid(int cpu_info[4], int info_type) { |
58 #if defined(__i386__) && defined(__pic__) | 58 #if defined(__i386__) && defined(__pic__) |
59 // Make sure to preserve ebx, which contains the pointer | 59 // Make sure to preserve ebx, which contains the pointer |
60 // to the GOT in case we're generating PIC. | 60 // to the GOT in case we're generating PIC. |
61 __asm__ volatile ( | 61 __asm__ volatile ( |
62 "mov %%ebx, %%edi\n\t" | 62 "mov %%ebx, %%edi\n\t" |
63 "cpuid\n\t" | 63 "cpuid\n\t" |
64 "xchg %%edi, %%ebx\n\t" | 64 "xchg %%edi, %%ebx\n\t" |
65 : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3]) | 65 : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3]) |
66 : "a"(info_type) | 66 : "a"(info_type) |
67 ); | 67 ); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 #if V8_OS_WIN | 457 #if V8_OS_WIN |
458 SYSTEM_INFO info; | 458 SYSTEM_INFO info; |
459 GetSystemInfo(&info); | 459 GetSystemInfo(&info); |
460 return info.dwNumberOfProcessors; | 460 return info.dwNumberOfProcessors; |
461 #else | 461 #else |
462 return static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN)); | 462 return static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN)); |
463 #endif | 463 #endif |
464 } | 464 } |
465 | 465 |
466 } } // namespace v8::internal | 466 } } // namespace v8::internal |
OLD | NEW |