Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: src/base/cpu.cc

Issue 866393002: Version 4.1.0.13 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.1
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if (end == architecture) { 431 if (end == architecture) {
432 architecture_ = 0; 432 architecture_ = 0;
433 } 433 }
434 delete[] architecture; 434 delete[] architecture;
435 435
436 // Unfortunately, it seems that certain ARMv6-based CPUs 436 // Unfortunately, it seems that certain ARMv6-based CPUs
437 // report an incorrect architecture number of 7! 437 // report an incorrect architecture number of 7!
438 // 438 //
439 // See http://code.google.com/p/android/issues/detail?id=10812 439 // See http://code.google.com/p/android/issues/detail?id=10812
440 // 440 //
441 // We try to correct this by looking at the 'elf_format' 441 // We try to correct this by looking at the 'elf_platform'
442 // field reported by the 'Processor' field, which is of the 442 // field reported by the 'Processor' field, which is of the
443 // form of "(v7l)" for an ARMv7-based CPU, and "(v6l)" for 443 // form of "(v7l)" for an ARMv7-based CPU, and "(v6l)" for
444 // an ARMv6-one. For example, the Raspberry Pi is one popular 444 // an ARMv6-one. For example, the Raspberry Pi is one popular
445 // ARMv6 device that reports architecture 7. 445 // ARMv6 device that reports architecture 7.
446 if (architecture_ == 7) { 446 if (architecture_ == 7) {
447 char* processor = cpu_info.ExtractField("Processor"); 447 char* processor = cpu_info.ExtractField("Processor");
448 if (HasListItem(processor, "(v6l)")) { 448 if (HasListItem(processor, "(v6l)")) {
449 architecture_ = 6; 449 architecture_ = 6;
450 } 450 }
451 delete[] processor; 451 delete[] processor;
452 } 452 }
453
454 // elf_platform moved to the model name field in Linux v3.8.
455 if (architecture_ == 7) {
456 char* processor = cpu_info.ExtractField("model name");
457 if (HasListItem(processor, "(v6l)")) {
458 architecture_ = 6;
459 }
460 delete[] processor;
461 }
453 } 462 }
454 463
455 // Try to extract the list of CPU features from ELF hwcaps. 464 // Try to extract the list of CPU features from ELF hwcaps.
456 uint32_t hwcaps = ReadELFHWCaps(); 465 uint32_t hwcaps = ReadELFHWCaps();
457 if (hwcaps != 0) { 466 if (hwcaps != 0) {
458 has_idiva_ = (hwcaps & HWCAP_IDIVA) != 0; 467 has_idiva_ = (hwcaps & HWCAP_IDIVA) != 0;
459 has_neon_ = (hwcaps & HWCAP_NEON) != 0; 468 has_neon_ = (hwcaps & HWCAP_NEON) != 0;
460 has_vfp_ = (hwcaps & HWCAP_VFP) != 0; 469 has_vfp_ = (hwcaps & HWCAP_VFP) != 0;
461 has_vfp3_ = (hwcaps & (HWCAP_VFPv3 | HWCAP_VFPv3D16 | HWCAP_VFPv4)) != 0; 470 has_vfp3_ = (hwcaps & (HWCAP_VFPv3 | HWCAP_VFPv3D16 | HWCAP_VFPv4)) != 0;
462 has_vfp3_d32_ = (has_vfp3_ && ((hwcaps & HWCAP_VFPv3D16) == 0 || 471 has_vfp3_d32_ = (has_vfp3_ && ((hwcaps & HWCAP_VFPv3D16) == 0 ||
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 if (end == part) { 586 if (end == part) {
578 part_ = 0; 587 part_ = 0;
579 } 588 }
580 delete[] part; 589 delete[] part;
581 } 590 }
582 591
583 #endif 592 #endif
584 } 593 }
585 594
586 } } // namespace v8::base 595 } } // namespace v8::base
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698