summaryrefslogtreecommitdiff
path: root/deps/v8/src/base/cpu.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/base/cpu.cc')
-rw-r--r--deps/v8/src/base/cpu.cc86
1 files changed, 56 insertions, 30 deletions
diff --git a/deps/v8/src/base/cpu.cc b/deps/v8/src/base/cpu.cc
index 5bc8b13a97..56e1c4633c 100644
--- a/deps/v8/src/base/cpu.cc
+++ b/deps/v8/src/base/cpu.cc
@@ -291,32 +291,36 @@ static bool HasListItem(const char* list, const char* item) {
#endif // V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64
-CPU::CPU() : stepping_(0),
- model_(0),
- ext_model_(0),
- family_(0),
- ext_family_(0),
- type_(0),
- implementer_(0),
- architecture_(0),
- part_(0),
- has_fpu_(false),
- has_cmov_(false),
- has_sahf_(false),
- has_mmx_(false),
- has_sse_(false),
- has_sse2_(false),
- has_sse3_(false),
- has_ssse3_(false),
- has_sse41_(false),
- has_sse42_(false),
- has_idiva_(false),
- has_neon_(false),
- has_thumb2_(false),
- has_vfp_(false),
- has_vfp3_(false),
- has_vfp3_d32_(false),
- is_fp64_mode_(false) {
+CPU::CPU()
+ : stepping_(0),
+ model_(0),
+ ext_model_(0),
+ family_(0),
+ ext_family_(0),
+ type_(0),
+ implementer_(0),
+ architecture_(0),
+ variant_(-1),
+ part_(0),
+ has_fpu_(false),
+ has_cmov_(false),
+ has_sahf_(false),
+ has_mmx_(false),
+ has_sse_(false),
+ has_sse2_(false),
+ has_sse3_(false),
+ has_ssse3_(false),
+ has_sse41_(false),
+ has_sse42_(false),
+ has_avx_(false),
+ has_fma3_(false),
+ has_idiva_(false),
+ has_neon_(false),
+ has_thumb2_(false),
+ has_vfp_(false),
+ has_vfp3_(false),
+ has_vfp3_d32_(false),
+ is_fp64_mode_(false) {
memcpy(vendor_, "Unknown", 8);
#if V8_OS_NACL
// Portable host shouldn't do feature detection.
@@ -356,6 +360,8 @@ CPU::CPU() : stepping_(0),
has_ssse3_ = (cpu_info[2] & 0x00000200) != 0;
has_sse41_ = (cpu_info[2] & 0x00080000) != 0;
has_sse42_ = (cpu_info[2] & 0x00100000) != 0;
+ has_avx_ = (cpu_info[2] & 0x10000000) != 0;
+ if (has_avx_) has_fma3_ = (cpu_info[2] & 0x00001000) != 0;
}
#if V8_HOST_ARCH_IA32
@@ -383,7 +389,7 @@ CPU::CPU() : stepping_(0),
// Extract implementor from the "CPU implementer" field.
char* implementer = cpu_info.ExtractField("CPU implementer");
if (implementer != NULL) {
- char* end ;
+ char* end;
implementer_ = strtol(implementer, &end, 0);
if (end == implementer) {
implementer_ = 0;
@@ -391,10 +397,20 @@ CPU::CPU() : stepping_(0),
delete[] implementer;
}
+ char* variant = cpu_info.ExtractField("CPU variant");
+ if (variant != NULL) {
+ char* end;
+ variant_ = strtol(variant, &end, 0);
+ if (end == variant) {
+ variant_ = -1;
+ }
+ delete[] variant;
+ }
+
// Extract part number from the "CPU part" field.
char* part = cpu_info.ExtractField("CPU part");
if (part != NULL) {
- char* end ;
+ char* end;
part_ = strtol(part, &end, 0);
if (end == part) {
part_ = 0;
@@ -535,7 +551,7 @@ CPU::CPU() : stepping_(0),
// Extract implementor from the "CPU implementer" field.
char* implementer = cpu_info.ExtractField("CPU implementer");
if (implementer != NULL) {
- char* end ;
+ char* end;
implementer_ = strtol(implementer, &end, 0);
if (end == implementer) {
implementer_ = 0;
@@ -543,10 +559,20 @@ CPU::CPU() : stepping_(0),
delete[] implementer;
}
+ char* variant = cpu_info.ExtractField("CPU variant");
+ if (variant != NULL) {
+ char* end;
+ variant_ = strtol(variant, &end, 0);
+ if (end == variant) {
+ variant_ = -1;
+ }
+ delete[] variant;
+ }
+
// Extract part number from the "CPU part" field.
char* part = cpu_info.ExtractField("CPU part");
if (part != NULL) {
- char* end ;
+ char* end;
part_ = strtol(part, &end, 0);
if (end == part) {
part_ = 0;