Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: src/x64/assembler-x64.cc

Issue 808333005: [x86] Blacklist AVX for all Mac OS versions up to 10.9. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/ia32/assembler-ia32.cc ('K') | « src/ia32/assembler-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/x64/assembler-x64.h" 5 #include "src/x64/assembler-x64.h"
6 6
7 #if V8_OS_MACOSX 7 #if V8_OS_MACOSX
8 #include <sys/sysctl.h> 8 #include <sys/sysctl.h>
9 #endif 9 #endif
10 10
11 #if V8_TARGET_ARCH_X64 11 #if V8_TARGET_ARCH_X64
12 12
13 #include "src/base/bits.h" 13 #include "src/base/bits.h"
14 #include "src/macro-assembler.h" 14 #include "src/macro-assembler.h"
15 #include "src/v8.h" 15 #include "src/v8.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 19
20 // ----------------------------------------------------------------------------- 20 // -----------------------------------------------------------------------------
21 // Implementation of CpuFeatures 21 // Implementation of CpuFeatures
22 22
23 namespace { 23 namespace {
24 24
25 bool EnableAVX() { 25 bool EnableAVX() {
26 #if V8_OS_MACOSX 26 #if V8_OS_MACOSX
27 // Mac OS X 10.9 has a bug where AVX transitions were indeed being caused by 27 // Mac OS X up to 10.9 has a bug where AVX transitions were indeed being
28 // ISRs, so we detect Mac OS X 10.9 here and disable AVX in that case. 28 // caused by ISRs, so we detect that here and disable AVX in that case.
29 char buffer[128]; 29 char buffer[128];
30 size_t buffer_size = arraysize(buffer); 30 size_t buffer_size = arraysize(buffer);
31 int ctl_name[] = { CTL_KERN , KERN_OSRELEASE }; 31 int ctl_name[] = { CTL_KERN , KERN_OSRELEASE };
32 if (sysctl(ctl_name, 2, buffer, &buffer_size, nullptr, 0) != 0) { 32 if (sysctl(ctl_name, 2, buffer, &buffer_size, nullptr, 0) != 0) {
33 V8_Fatal(__FILE__, __LINE__, "V8 failed to get kernel version"); 33 V8_Fatal(__FILE__, __LINE__, "V8 failed to get kernel version");
34 } 34 }
35 // The buffer now contains a string of the form XX.YY.ZZ, where 35 // The buffer now contains a string of the form XX.YY.ZZ, where
36 // XX is the major kernel version component. 13.x.x (Mavericks) is 36 // XX is the major kernel version component.
37 // affected by this bug, so disable AVX there. 37 // Make sure the buffer is 0-terminated.
Sven Panne 2015/01/07 12:08:44 Same here.
38 if (memcmp(buffer, "13.", 3) == 0) return false; 38 buffer[arraysize(buffer) - 1] = '\0';
39 char* period_pos = strchr(buffer, '.');
40 DCHECK_NOT_NULL(period_pos);
41 *period_pos = '\0';
42 long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT
43 if (kernel_version_major <= 13) return false;
39 #endif // V8_OS_MACOSX 44 #endif // V8_OS_MACOSX
40 return FLAG_enable_avx; 45 return FLAG_enable_avx;
41 } 46 }
42 47
43 } // namespace 48 } // namespace
44 49
45 50
46 void CpuFeatures::ProbeImpl(bool cross_compile) { 51 void CpuFeatures::ProbeImpl(bool cross_compile) {
47 base::CPU cpu; 52 base::CPU cpu;
48 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. 53 CHECK(cpu.has_sse2()); // SSE2 support is mandatory.
(...skipping 3328 matching lines...) Expand 10 before | Expand all | Expand 10 after
3377 3382
3378 3383
3379 bool RelocInfo::IsInConstantPool() { 3384 bool RelocInfo::IsInConstantPool() {
3380 return false; 3385 return false;
3381 } 3386 }
3382 3387
3383 3388
3384 } } // namespace v8::internal 3389 } } // namespace v8::internal
3385 3390
3386 #endif // V8_TARGET_ARCH_X64 3391 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/ia32/assembler-ia32.cc ('K') | « src/ia32/assembler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698