| 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_(-1), |
| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 382 |
| 382 #elif V8_HOST_ARCH_ARM | 383 #elif V8_HOST_ARCH_ARM |
| 383 | 384 |
| 384 #if V8_OS_LINUX | 385 #if V8_OS_LINUX |
| 385 | 386 |
| 386 CPUInfo cpu_info; | 387 CPUInfo cpu_info; |
| 387 | 388 |
| 388 // Extract implementor from the "CPU implementer" field. | 389 // Extract implementor from the "CPU implementer" field. |
| 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 } |
| 409 | 420 |
| 410 // Extract architecture from the "CPU Architecture" field. | 421 // Extract architecture from the "CPU Architecture" field. |
| 411 // The list is well-known, unlike the the output of | 422 // The list is well-known, unlike the the output of |
| 412 // the 'Processor' field which can vary greatly. | 423 // the 'Processor' field which can vary greatly. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 architecture_ = __detect_mips_arch_revision(); | 544 architecture_ = __detect_mips_arch_revision(); |
| 534 #endif | 545 #endif |
| 535 | 546 |
| 536 #elif V8_HOST_ARCH_ARM64 | 547 #elif V8_HOST_ARCH_ARM64 |
| 537 | 548 |
| 538 CPUInfo cpu_info; | 549 CPUInfo cpu_info; |
| 539 | 550 |
| 540 // Extract implementor from the "CPU implementer" field. | 551 // Extract implementor from the "CPU implementer" field. |
| 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 |