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

Side by Side Diff: src/x64/assembler-x64.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 | « 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 #include <cstring>
8
9 #if V8_TARGET_ARCH_X64
10
7 #if V8_OS_MACOSX 11 #if V8_OS_MACOSX
8 #include <sys/sysctl.h> 12 #include <sys/sysctl.h>
9 #endif 13 #endif
10 14
11 #if V8_TARGET_ARCH_X64
12
13 #include "src/base/bits.h" 15 #include "src/base/bits.h"
16 #if V8_OS_WIN
17 #include "src/base/win32-headers.h"
18 #endif
14 #include "src/macro-assembler.h" 19 #include "src/macro-assembler.h"
15 #include "src/v8.h" 20 #include "src/v8.h"
16 21
17 namespace v8 { 22 namespace v8 {
18 namespace internal { 23 namespace internal {
19 24
20 // ----------------------------------------------------------------------------- 25 // -----------------------------------------------------------------------------
21 // Implementation of CpuFeatures 26 // Implementation of CpuFeatures
22 27
23 namespace { 28 namespace {
24 29
25 bool EnableAVX() { 30 bool EnableAVX() {
26 #if V8_OS_MACOSX 31 #if V8_OS_MACOSX
27 // Mac OS X up to 10.9 has a bug where AVX transitions were indeed being 32 // Mac OS X up to 10.9 has a bug where AVX transitions were indeed being
28 // caused by ISRs, so we detect that here and disable AVX in that case. 33 // caused by ISRs, so we detect that here and disable AVX in that case.
29 char buffer[128]; 34 char buffer[128];
30 size_t buffer_size = arraysize(buffer); 35 size_t buffer_size = arraysize(buffer);
31 int ctl_name[] = { CTL_KERN , KERN_OSRELEASE }; 36 int ctl_name[] = {CTL_KERN, KERN_OSRELEASE};
32 if (sysctl(ctl_name, 2, buffer, &buffer_size, nullptr, 0) != 0) { 37 if (sysctl(ctl_name, 2, buffer, &buffer_size, nullptr, 0) != 0) {
33 V8_Fatal(__FILE__, __LINE__, "V8 failed to get kernel version"); 38 V8_Fatal(__FILE__, __LINE__, "V8 failed to get kernel version");
34 } 39 }
35 // The buffer now contains a string of the form XX.YY.ZZ, where 40 // The buffer now contains a string of the form XX.YY.ZZ, where
36 // XX is the major kernel version component. 41 // XX is the major kernel version component.
37 char* period_pos = strchr(buffer, '.'); 42 char* period_pos = strchr(buffer, '.');
38 DCHECK_NOT_NULL(period_pos); 43 DCHECK_NOT_NULL(period_pos);
39 *period_pos = '\0'; 44 *period_pos = '\0';
40 long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT 45 long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT
41 if (kernel_version_major <= 13) return false; 46 if (kernel_version_major <= 13) return false;
47 #elif V8_OS_WIN
48 // The same problem seems to appear on Windows XP and Vista.
49 OSVERSIONINFOEX osvi;
50 DWORDLONG mask = 0;
51 memset(&osvi, 0, sizeof(osvi));
52 osvi.dwOSVersionInfoSize = sizeof(osvi);
53 osvi.dwMajorVersion = 6;
54 osvi.dwMinorVersion = 1;
55 VER_SET_CONDITION(mask, VER_MAJORVERSION, VER_GREATER_EQUAL);
56 VER_SET_CONDITION(mask, VER_MINORVERSION, VER_GREATER_EQUAL);
57 if (!VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, mask)) {
58 return false;
59 }
42 #endif // V8_OS_MACOSX 60 #endif // V8_OS_MACOSX
43 return FLAG_enable_avx; 61 return FLAG_enable_avx;
44 } 62 }
45 63
46 } // namespace 64 } // namespace
47 65
48 66
49 void CpuFeatures::ProbeImpl(bool cross_compile) { 67 void CpuFeatures::ProbeImpl(bool cross_compile) {
50 base::CPU cpu; 68 base::CPU cpu;
51 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. 69 CHECK(cpu.has_sse2()); // SSE2 support is mandatory.
(...skipping 3333 matching lines...) Expand 10 before | Expand all | Expand 10 after
3385 3403
3386 3404
3387 bool RelocInfo::IsInConstantPool() { 3405 bool RelocInfo::IsInConstantPool() {
3388 return false; 3406 return false;
3389 } 3407 }
3390 3408
3391 3409
3392 } } // namespace v8::internal 3410 } } // namespace v8::internal
3393 3411
3394 #endif // V8_TARGET_ARCH_X64 3412 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698