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

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

Issue 869133002: [x86] Blacklist AVX for Windows versions before 6.1 (Windows 7). (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
« no previous file with comments | « no previous file | src/x64/assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 // OF THE POSSIBILITY OF SUCH DAMAGE. 31 // OF THE POSSIBILITY OF SUCH DAMAGE.
32 32
33 // The original source code covered by the above license above has been modified 33 // The original source code covered by the above license above has been modified
34 // significantly by Google Inc. 34 // significantly by Google Inc.
35 // Copyright 2012 the V8 project authors. All rights reserved. 35 // Copyright 2012 the V8 project authors. All rights reserved.
36 36
37 #include "src/ia32/assembler-ia32.h" 37 #include "src/ia32/assembler-ia32.h"
38 38
39 #include <cstring>
40
41 #if V8_TARGET_ARCH_IA32
42
39 #if V8_OS_MACOSX 43 #if V8_OS_MACOSX
40 #include <sys/sysctl.h> 44 #include <sys/sysctl.h>
41 #endif 45 #endif
42 46
43 #if V8_TARGET_ARCH_IA32
44
45 #include "src/base/bits.h" 47 #include "src/base/bits.h"
46 #include "src/base/cpu.h" 48 #include "src/base/cpu.h"
49 #if V8_OS_WIN
50 #include "src/base/win32-headers.h"
51 #endif
47 #include "src/disassembler.h" 52 #include "src/disassembler.h"
48 #include "src/macro-assembler.h" 53 #include "src/macro-assembler.h"
49 #include "src/v8.h" 54 #include "src/v8.h"
50 55
51 namespace v8 { 56 namespace v8 {
52 namespace internal { 57 namespace internal {
53 58
54 // ----------------------------------------------------------------------------- 59 // -----------------------------------------------------------------------------
55 // Implementation of CpuFeatures 60 // Implementation of CpuFeatures
56 61
57 namespace { 62 namespace {
58 63
59 bool EnableAVX() { 64 bool EnableAVX() {
60 #if V8_OS_MACOSX 65 #if V8_OS_MACOSX
61 // Mac OS X up to 10.9 has a bug where AVX transitions were indeed being 66 // Mac OS X up to 10.9 has a bug where AVX transitions were indeed being
62 // caused by ISRs, so we detect that here and disable AVX in that case. 67 // caused by ISRs, so we detect that here and disable AVX in that case.
63 char buffer[128]; 68 char buffer[128];
64 size_t buffer_size = arraysize(buffer); 69 size_t buffer_size = arraysize(buffer);
65 int ctl_name[] = { CTL_KERN , KERN_OSRELEASE }; 70 int ctl_name[] = { CTL_KERN , KERN_OSRELEASE };
66 if (sysctl(ctl_name, 2, buffer, &buffer_size, nullptr, 0) != 0) { 71 if (sysctl(ctl_name, 2, buffer, &buffer_size, nullptr, 0) != 0) {
67 V8_Fatal(__FILE__, __LINE__, "V8 failed to get kernel version"); 72 V8_Fatal(__FILE__, __LINE__, "V8 failed to get kernel version");
68 } 73 }
69 // The buffer now contains a string of the form XX.YY.ZZ, where 74 // The buffer now contains a string of the form XX.YY.ZZ, where
70 // XX is the major kernel version component. 75 // XX is the major kernel version component.
71 char* period_pos = strchr(buffer, '.'); 76 char* period_pos = strchr(buffer, '.');
72 DCHECK_NOT_NULL(period_pos); 77 DCHECK_NOT_NULL(period_pos);
73 *period_pos = '\0'; 78 *period_pos = '\0';
74 long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT 79 long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT
75 if (kernel_version_major <= 13) return false; 80 if (kernel_version_major <= 13) return false;
81 #elif V8_OS_WIN
82 // The same problem seems to appear on Windows XP and Vista.
83 OSVERSIONINFOEX osvi;
84 DWORDLONG mask = 0;
85 memset(&osvi, 0, sizeof(osvi));
86 osvi.dwOSVersionInfoSize = sizeof(osvi);
87 osvi.dwMajorVersion = 6;
88 osvi.dwMinorVersion = 1;
89 VER_SET_CONDITION(mask, VER_MAJORVERSION, VER_GREATER_EQUAL);
90 VER_SET_CONDITION(mask, VER_MINORVERSION, VER_GREATER_EQUAL);
91 if (!VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, mask)) {
92 return false;
93 }
76 #endif // V8_OS_MACOSX 94 #endif // V8_OS_MACOSX
77 return FLAG_enable_avx; 95 return FLAG_enable_avx;
78 } 96 }
79 97
80 } // namespace 98 } // namespace
81 99
82 100
83 void CpuFeatures::ProbeImpl(bool cross_compile) { 101 void CpuFeatures::ProbeImpl(bool cross_compile) {
84 base::CPU cpu; 102 base::CPU cpu;
85 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. 103 CHECK(cpu.has_sse2()); // SSE2 support is mandatory.
(...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 fprintf(coverage_log, "%s\n", file_line); 2799 fprintf(coverage_log, "%s\n", file_line);
2782 fflush(coverage_log); 2800 fflush(coverage_log);
2783 } 2801 }
2784 } 2802 }
2785 2803
2786 #endif 2804 #endif
2787 2805
2788 } } // namespace v8::internal 2806 } } // namespace v8::internal
2789 2807
2790 #endif // V8_TARGET_ARCH_IA32 2808 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698