| 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/cpu.h" | 5 #include "src/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_POSIX | 10 #if V8_OS_POSIX |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } | 345 } |
| 346 | 346 |
| 347 // Extract architecture from the "CPU Architecture" field. | 347 // Extract architecture from the "CPU Architecture" field. |
| 348 // The list is well-known, unlike the the output of | 348 // The list is well-known, unlike the the output of |
| 349 // the 'Processor' field which can vary greatly. | 349 // the 'Processor' field which can vary greatly. |
| 350 // See the definition of the 'proc_arch' array in | 350 // See the definition of the 'proc_arch' array in |
| 351 // $KERNEL/arch/arm/kernel/setup.c and the 'c_show' function in | 351 // $KERNEL/arch/arm/kernel/setup.c and the 'c_show' function in |
| 352 // same file. | 352 // same file. |
| 353 char* architecture = cpu_info.ExtractField("CPU architecture"); | 353 char* architecture = cpu_info.ExtractField("CPU architecture"); |
| 354 if (architecture != NULL) { | 354 if (architecture != NULL) { |
| 355 char* end; | 355 if (strcmp(architecture, "AArch64") == 0) { |
| 356 architecture_ = strtol(architecture, &end, 10); | 356 architecture_ = 8; |
| 357 if (end == architecture) { | 357 } else { |
| 358 architecture_ = 0; | 358 char* end; |
| 359 architecture_ = strtol(architecture, &end, 10); |
| 360 if (end == architecture) { |
| 361 architecture_ = 0; |
| 362 } |
| 359 } | 363 } |
| 360 delete[] architecture; | 364 delete[] architecture; |
| 361 | 365 |
| 362 // Unfortunately, it seems that certain ARMv6-based CPUs | 366 // Unfortunately, it seems that certain ARMv6-based CPUs |
| 363 // report an incorrect architecture number of 7! | 367 // report an incorrect architecture number of 7! |
| 364 // | 368 // |
| 365 // See http://code.google.com/p/android/issues/detail?id=10812 | 369 // See http://code.google.com/p/android/issues/detail?id=10812 |
| 366 // | 370 // |
| 367 // We try to correct this by looking at the 'elf_format' | 371 // We try to correct this by looking at the 'elf_format' |
| 368 // field reported by the 'Processor' field, which is of the | 372 // field reported by the 'Processor' field, which is of the |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 if (end == part) { | 494 if (end == part) { |
| 491 part_ = 0; | 495 part_ = 0; |
| 492 } | 496 } |
| 493 delete[] part; | 497 delete[] part; |
| 494 } | 498 } |
| 495 | 499 |
| 496 #endif | 500 #endif |
| 497 } | 501 } |
| 498 | 502 |
| 499 } } // namespace v8::internal | 503 } } // namespace v8::internal |
| OLD | NEW |