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