OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()); | 82 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()); |
83 srandom(static_cast<unsigned int>(seed)); | 83 srandom(static_cast<unsigned int>(seed)); |
84 } | 84 } |
85 | 85 |
86 | 86 |
87 uint64_t OS::CpuFeaturesImpliedByPlatform() { | 87 uint64_t OS::CpuFeaturesImpliedByPlatform() { |
88 #if (defined(__VFP_FP__) && !defined(__SOFTFP__)) | 88 #if (defined(__VFP_FP__) && !defined(__SOFTFP__)) |
89 // Here gcc is telling us that we are on an ARM and gcc is assuming that we | 89 // Here gcc is telling us that we are on an ARM and gcc is assuming that we |
90 // have VFP3 instructions. If gcc can assume it then so can we. | 90 // have VFP3 instructions. If gcc can assume it then so can we. |
91 return 1u << VFP3; | 91 return 1u << VFP3; |
| 92 #elif CAN_USE_ARMV7_INSTRUCTIONS |
| 93 return 1u << ARMv7; |
92 #else | 94 #else |
93 return 0; // Linux runs on anything. | 95 return 0; // Linux runs on anything. |
94 #endif | 96 #endif |
95 } | 97 } |
96 | 98 |
97 | 99 |
98 #ifdef __arm__ | 100 #ifdef __arm__ |
99 bool OS::ArmCpuHasFeature(CpuFeature feature) { | 101 bool OS::ArmCpuHasFeature(CpuFeature feature) { |
100 const char* search_string = NULL; | 102 const char* search_string = NULL; |
101 const char* file_name = "/proc/cpuinfo"; | 103 const char* file_name = "/proc/cpuinfo"; |
102 // Simple detection of VFP at runtime for Linux. | 104 // Simple detection of VFP at runtime for Linux. |
103 // It is based on /proc/cpuinfo, which reveals hardware configuration | 105 // It is based on /proc/cpuinfo, which reveals hardware configuration |
104 // to user-space applications. According to ARM (mid 2009), no similar | 106 // to user-space applications. According to ARM (mid 2009), no similar |
105 // facility is universally available on the ARM architectures, | 107 // facility is universally available on the ARM architectures, |
106 // so it's up to individual OSes to provide such. | 108 // so it's up to individual OSes to provide such. |
107 // | 109 // |
108 // This is written as a straight shot one pass parser | 110 // This is written as a straight shot one pass parser |
109 // and not using STL string and ifstream because, | 111 // and not using STL string and ifstream because, |
110 // on Linux, it's reading from a (non-mmap-able) | 112 // on Linux, it's reading from a (non-mmap-able) |
111 // character special device. | 113 // character special device. |
112 switch (feature) { | 114 switch (feature) { |
113 case VFP3: | 115 case VFP3: |
114 search_string = "vfp"; | 116 search_string = "vfp"; |
115 break; | 117 break; |
| 118 case ARMv7: |
| 119 search_string = "ARMv7"; |
| 120 break; |
116 default: | 121 default: |
117 UNREACHABLE(); | 122 UNREACHABLE(); |
118 } | 123 } |
119 | 124 |
120 FILE* f = NULL; | 125 FILE* f = NULL; |
121 const char* what = search_string; | 126 const char* what = search_string; |
122 | 127 |
123 if (NULL == (f = fopen(file_name, "r"))) | 128 if (NULL == (f = fopen(file_name, "r"))) |
124 return false; | 129 return false; |
125 | 130 |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 830 |
826 // This sampler is no longer the active sampler. | 831 // This sampler is no longer the active sampler. |
827 active_sampler_ = NULL; | 832 active_sampler_ = NULL; |
828 active_ = false; | 833 active_ = false; |
829 } | 834 } |
830 | 835 |
831 | 836 |
832 #endif // ENABLE_LOGGING_AND_PROFILING | 837 #endif // ENABLE_LOGGING_AND_PROFILING |
833 | 838 |
834 } } // namespace v8::internal | 839 } } // namespace v8::internal |
OLD | NEW |