OLD | NEW |
---|---|
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 namespace v8 { | 51 namespace v8 { |
52 namespace internal { | 52 namespace internal { |
53 | 53 |
54 // ----------------------------------------------------------------------------- | 54 // ----------------------------------------------------------------------------- |
55 // Implementation of CpuFeatures | 55 // Implementation of CpuFeatures |
56 | 56 |
57 namespace { | 57 namespace { |
58 | 58 |
59 bool EnableAVX() { | 59 bool EnableAVX() { |
60 #if V8_OS_MACOSX | 60 #if V8_OS_MACOSX |
61 // Mac OS X 10.9 has a bug where AVX transitions were indeed being caused by | 61 // Mac OS X up to 10.9 has a bug where AVX transitions were indeed being |
62 // ISRs, so we detect Mac OS X 10.9 here and disable AVX in that case. | 62 // caused by ISRs, so we detect that here and disable AVX in that case. |
63 char buffer[128]; | 63 char buffer[128]; |
64 size_t buffer_size = arraysize(buffer); | 64 size_t buffer_size = arraysize(buffer); |
65 int ctl_name[] = { CTL_KERN , KERN_OSRELEASE }; | 65 int ctl_name[] = { CTL_KERN , KERN_OSRELEASE }; |
66 if (sysctl(ctl_name, 2, buffer, &buffer_size, nullptr, 0) != 0) { | 66 if (sysctl(ctl_name, 2, buffer, &buffer_size, nullptr, 0) != 0) { |
67 V8_Fatal(__FILE__, __LINE__, "V8 failed to get kernel version"); | 67 V8_Fatal(__FILE__, __LINE__, "V8 failed to get kernel version"); |
68 } | 68 } |
69 // The buffer now contains a string of the form XX.YY.ZZ, where | 69 // The buffer now contains a string of the form XX.YY.ZZ, where |
70 // XX is the major kernel version component. 13.x.x (Mavericks) is | 70 // XX is the major kernel version component. |
71 // affected by this bug, so disable AVX there. | 71 // Make sure the buffer is 0-terminated. |
Sven Panne
2015/01/07 12:08:44
System information of type "string" is always zero
| |
72 if (memcmp(buffer, "13.", 3) == 0) return false; | 72 buffer[arraysize(buffer) - 1] = '\0'; |
73 char* period_pos = strchr(buffer, '.'); | |
74 DCHECK_NOT_NULL(period_pos); | |
75 *period_pos = '\0'; | |
76 long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT | |
77 if (kernel_version_major <= 13) return false; | |
73 #endif // V8_OS_MACOSX | 78 #endif // V8_OS_MACOSX |
74 return FLAG_enable_avx; | 79 return FLAG_enable_avx; |
75 } | 80 } |
76 | 81 |
77 } // namespace | 82 } // namespace |
78 | 83 |
79 | 84 |
80 void CpuFeatures::ProbeImpl(bool cross_compile) { | 85 void CpuFeatures::ProbeImpl(bool cross_compile) { |
81 base::CPU cpu; | 86 base::CPU cpu; |
82 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. | 87 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. |
(...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2772 fprintf(coverage_log, "%s\n", file_line); | 2777 fprintf(coverage_log, "%s\n", file_line); |
2773 fflush(coverage_log); | 2778 fflush(coverage_log); |
2774 } | 2779 } |
2775 } | 2780 } |
2776 | 2781 |
2777 #endif | 2782 #endif |
2778 | 2783 |
2779 } } // namespace v8::internal | 2784 } } // namespace v8::internal |
2780 | 2785 |
2781 #endif // V8_TARGET_ARCH_IA32 | 2786 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |