| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 fclose(f); | 130 fclose(f); |
| 131 | 131 |
| 132 // Did not find string in the proc file. | 132 // Did not find string in the proc file. |
| 133 return false; | 133 return false; |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool OS::ArmCpuHasFeature(CpuFeature feature) { | 136 bool OS::ArmCpuHasFeature(CpuFeature feature) { |
| 137 const int max_items = 2; | 137 const char* search_string = NULL; |
| 138 const char* search_strings[max_items] = { NULL, NULL }; | |
| 139 int search_items = 0; | |
| 140 // Simple detection of VFP at runtime for Linux. | 138 // Simple detection of VFP at runtime for Linux. |
| 141 // It is based on /proc/cpuinfo, which reveals hardware configuration | 139 // It is based on /proc/cpuinfo, which reveals hardware configuration |
| 142 // to user-space applications. According to ARM (mid 2009), no similar | 140 // to user-space applications. According to ARM (mid 2009), no similar |
| 143 // facility is universally available on the ARM architectures, | 141 // facility is universally available on the ARM architectures, |
| 144 // so it's up to individual OSes to provide such. | 142 // so it's up to individual OSes to provide such. |
| 145 switch (feature) { | 143 switch (feature) { |
| 146 case VFP3: | 144 case VFP3: |
| 147 search_strings[0] = "vfpv3"; | 145 search_string = "vfpv3"; |
| 148 // Some old kernels will report vfp for A8, not vfpv3, so we check for | |
| 149 // A8 explicitely. The cpuinfo file report the CPU Part which for Cortex | |
| 150 // A8 is 0xc08. | |
| 151 search_strings[1] = "0xc08"; | |
| 152 search_items = 2; | |
| 153 ASSERT(search_items <= max_items); | |
| 154 break; | 146 break; |
| 155 case ARMv7: | 147 case ARMv7: |
| 156 search_strings[0] = "ARMv7" ; | 148 search_string = "ARMv7"; |
| 157 search_items = 1; | |
| 158 ASSERT(search_items <= max_items); | |
| 159 break; | 149 break; |
| 160 default: | 150 default: |
| 161 UNREACHABLE(); | 151 UNREACHABLE(); |
| 162 } | 152 } |
| 163 | 153 |
| 164 for (int i = 0; i < search_items; ++i) { | 154 if (CPUInfoContainsString(search_string)) { |
| 165 if (CPUInfoContainsString(search_strings[i])) { | 155 return true; |
| 156 } |
| 157 |
| 158 if (feature == VFP3) { |
| 159 // Some old kernels will report vfp not vfpv3. Here we make a last attempt |
| 160 // to detect vfpv3 by checking for vfp *and* neon, since neon is only |
| 161 // available on architectures with vfpv3. |
| 162 // Checking neon on its own is not enough as it is possible to have neon |
| 163 // without vfp. |
| 164 if (CPUInfoContainsString("vfp") && CPUInfoContainsString("neon")) { |
| 166 return true; | 165 return true; |
| 167 } | 166 } |
| 168 } | 167 } |
| 169 | 168 |
| 170 return false; | 169 return false; |
| 171 } | 170 } |
| 172 #endif // def __arm__ | 171 #endif // def __arm__ |
| 173 | 172 |
| 174 | 173 |
| 175 int OS::ActivationFrameAlignment() { | 174 int OS::ActivationFrameAlignment() { |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 } | 944 } |
| 946 | 945 |
| 947 // This sampler is no longer the active sampler. | 946 // This sampler is no longer the active sampler. |
| 948 active_sampler_ = NULL; | 947 active_sampler_ = NULL; |
| 949 } | 948 } |
| 950 | 949 |
| 951 | 950 |
| 952 #endif // ENABLE_LOGGING_AND_PROFILING | 951 #endif // ENABLE_LOGGING_AND_PROFILING |
| 953 | 952 |
| 954 } } // namespace v8::internal | 953 } } // namespace v8::internal |
| OLD | NEW |