[x86] Blacklist AVX for Windows versions before 6.1 (Windows 7).
BUG=v8:3846 LOG=y Review URL: https://codereview.chromium.org/869133002 Cr-Commit-Position: refs/heads/master@{#26239}
This commit is contained in:
parent
35b88a352d
commit
65299cf463
@ -36,14 +36,19 @@
|
|||||||
|
|
||||||
#include "src/ia32/assembler-ia32.h"
|
#include "src/ia32/assembler-ia32.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#if V8_TARGET_ARCH_IA32
|
||||||
|
|
||||||
#if V8_OS_MACOSX
|
#if V8_OS_MACOSX
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if V8_TARGET_ARCH_IA32
|
|
||||||
|
|
||||||
#include "src/base/bits.h"
|
#include "src/base/bits.h"
|
||||||
#include "src/base/cpu.h"
|
#include "src/base/cpu.h"
|
||||||
|
#if V8_OS_WIN
|
||||||
|
#include "src/base/win32-headers.h"
|
||||||
|
#endif
|
||||||
#include "src/disassembler.h"
|
#include "src/disassembler.h"
|
||||||
#include "src/macro-assembler.h"
|
#include "src/macro-assembler.h"
|
||||||
#include "src/v8.h"
|
#include "src/v8.h"
|
||||||
@ -73,6 +78,19 @@ bool EnableAVX() {
|
|||||||
*period_pos = '\0';
|
*period_pos = '\0';
|
||||||
long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT
|
long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT
|
||||||
if (kernel_version_major <= 13) return false;
|
if (kernel_version_major <= 13) return false;
|
||||||
|
#elif V8_OS_WIN
|
||||||
|
// The same problem seems to appear on Windows XP and Vista.
|
||||||
|
OSVERSIONINFOEX osvi;
|
||||||
|
DWORDLONG mask = 0;
|
||||||
|
memset(&osvi, 0, sizeof(osvi));
|
||||||
|
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||||
|
osvi.dwMajorVersion = 6;
|
||||||
|
osvi.dwMinorVersion = 1;
|
||||||
|
VER_SET_CONDITION(mask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||||
|
VER_SET_CONDITION(mask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||||
|
if (!VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, mask)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#endif // V8_OS_MACOSX
|
#endif // V8_OS_MACOSX
|
||||||
return FLAG_enable_avx;
|
return FLAG_enable_avx;
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,18 @@
|
|||||||
|
|
||||||
#include "src/x64/assembler-x64.h"
|
#include "src/x64/assembler-x64.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#if V8_TARGET_ARCH_X64
|
||||||
|
|
||||||
#if V8_OS_MACOSX
|
#if V8_OS_MACOSX
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if V8_TARGET_ARCH_X64
|
|
||||||
|
|
||||||
#include "src/base/bits.h"
|
#include "src/base/bits.h"
|
||||||
|
#if V8_OS_WIN
|
||||||
|
#include "src/base/win32-headers.h"
|
||||||
|
#endif
|
||||||
#include "src/macro-assembler.h"
|
#include "src/macro-assembler.h"
|
||||||
#include "src/v8.h"
|
#include "src/v8.h"
|
||||||
|
|
||||||
@ -39,6 +44,19 @@ bool EnableAVX() {
|
|||||||
*period_pos = '\0';
|
*period_pos = '\0';
|
||||||
long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT
|
long kernel_version_major = strtol(buffer, nullptr, 10); // NOLINT
|
||||||
if (kernel_version_major <= 13) return false;
|
if (kernel_version_major <= 13) return false;
|
||||||
|
#elif V8_OS_WIN
|
||||||
|
// The same problem seems to appear on Windows XP and Vista.
|
||||||
|
OSVERSIONINFOEX osvi;
|
||||||
|
DWORDLONG mask = 0;
|
||||||
|
memset(&osvi, 0, sizeof(osvi));
|
||||||
|
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||||
|
osvi.dwMajorVersion = 6;
|
||||||
|
osvi.dwMinorVersion = 1;
|
||||||
|
VER_SET_CONDITION(mask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||||
|
VER_SET_CONDITION(mask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||||
|
if (!VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, mask)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#endif // V8_OS_MACOSX
|
#endif // V8_OS_MACOSX
|
||||||
return FLAG_enable_avx;
|
return FLAG_enable_avx;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user