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