OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/base/cpu.h" | 5 #include "src/base/cpu.h" |
6 | 6 |
7 #if V8_LIBC_MSVCRT | 7 #if V8_LIBC_MSVCRT |
8 #include <intrin.h> // __cpuid() | 8 #include <intrin.h> // __cpuid() |
9 #endif | 9 #endif |
10 #if V8_OS_LINUX | 10 #if V8_OS_LINUX |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 | 293 |
294 CPU::CPU() | 294 CPU::CPU() |
295 : stepping_(0), | 295 : stepping_(0), |
296 model_(0), | 296 model_(0), |
297 ext_model_(0), | 297 ext_model_(0), |
298 family_(0), | 298 family_(0), |
299 ext_family_(0), | 299 ext_family_(0), |
300 type_(0), | 300 type_(0), |
301 implementer_(0), | 301 implementer_(0), |
302 architecture_(0), | 302 architecture_(0), |
303 variant_(0), | |
Benedikt Meurer
2014/12/19 06:32:09
The 0 default is not safe as we would default to d
arajp
2014/12/19 10:45:31
Done.
| |
303 part_(0), | 304 part_(0), |
304 has_fpu_(false), | 305 has_fpu_(false), |
305 has_cmov_(false), | 306 has_cmov_(false), |
306 has_sahf_(false), | 307 has_sahf_(false), |
307 has_mmx_(false), | 308 has_mmx_(false), |
308 has_sse_(false), | 309 has_sse_(false), |
309 has_sse2_(false), | 310 has_sse2_(false), |
310 has_sse3_(false), | 311 has_sse3_(false), |
311 has_ssse3_(false), | 312 has_ssse3_(false), |
312 has_sse41_(false), | 313 has_sse41_(false), |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 char* implementer = cpu_info.ExtractField("CPU implementer"); | 390 char* implementer = cpu_info.ExtractField("CPU implementer"); |
390 if (implementer != NULL) { | 391 if (implementer != NULL) { |
391 char* end ; | 392 char* end ; |
392 implementer_ = strtol(implementer, &end, 0); | 393 implementer_ = strtol(implementer, &end, 0); |
393 if (end == implementer) { | 394 if (end == implementer) { |
394 implementer_ = 0; | 395 implementer_ = 0; |
395 } | 396 } |
396 delete[] implementer; | 397 delete[] implementer; |
397 } | 398 } |
398 | 399 |
400 char* variant = cpu_info.ExtractField("CPU variant"); | |
401 if (variant != NULL) { | |
402 char* end ; | |
403 variant_ = strtol(variant, &end, 0); | |
404 if (end == variant) { | |
405 variant_ = -1; | |
406 } | |
407 delete[] variant; | |
408 } | |
409 | |
399 // Extract part number from the "CPU part" field. | 410 // Extract part number from the "CPU part" field. |
400 char* part = cpu_info.ExtractField("CPU part"); | 411 char* part = cpu_info.ExtractField("CPU part"); |
401 if (part != NULL) { | 412 if (part != NULL) { |
402 char* end ; | 413 char* end ; |
403 part_ = strtol(part, &end, 0); | 414 part_ = strtol(part, &end, 0); |
404 if (end == part) { | 415 if (end == part) { |
405 part_ = 0; | 416 part_ = 0; |
406 } | 417 } |
407 delete[] part; | 418 delete[] part; |
408 } | 419 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
541 char* implementer = cpu_info.ExtractField("CPU implementer"); | 552 char* implementer = cpu_info.ExtractField("CPU implementer"); |
542 if (implementer != NULL) { | 553 if (implementer != NULL) { |
543 char* end ; | 554 char* end ; |
544 implementer_ = strtol(implementer, &end, 0); | 555 implementer_ = strtol(implementer, &end, 0); |
545 if (end == implementer) { | 556 if (end == implementer) { |
546 implementer_ = 0; | 557 implementer_ = 0; |
547 } | 558 } |
548 delete[] implementer; | 559 delete[] implementer; |
549 } | 560 } |
550 | 561 |
562 char* variant = cpu_info.ExtractField("CPU variant"); | |
563 if (variant != NULL) { | |
564 char* end ; | |
565 variant_ = strtol(variant, &end, 0); | |
566 if (end == variant) { | |
567 variant_ = -1; | |
568 } | |
569 delete[] variant; | |
570 } | |
571 | |
551 // Extract part number from the "CPU part" field. | 572 // Extract part number from the "CPU part" field. |
552 char* part = cpu_info.ExtractField("CPU part"); | 573 char* part = cpu_info.ExtractField("CPU part"); |
553 if (part != NULL) { | 574 if (part != NULL) { |
554 char* end ; | 575 char* end ; |
555 part_ = strtol(part, &end, 0); | 576 part_ = strtol(part, &end, 0); |
556 if (end == part) { | 577 if (end == part) { |
557 part_ = 0; | 578 part_ = 0; |
558 } | 579 } |
559 delete[] part; | 580 delete[] part; |
560 } | 581 } |
561 | 582 |
562 #endif | 583 #endif |
563 } | 584 } |
564 | 585 |
565 } } // namespace v8::base | 586 } } // namespace v8::base |
OLD | NEW |