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

Side by Side Diff: src/platform-linux.cc

Issue 5862002: Version 3.0.2. (Closed)
Patch Set: Created 10 years 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
« ChangeLog ('K') | « src/parser.cc ('k') | src/preparser.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 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
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 char* search_string = NULL; 137 const int max_items = 2;
138 const char* search_strings[max_items] = { NULL, NULL };
139 int search_items = 0;
138 // Simple detection of VFP at runtime for Linux. 140 // Simple detection of VFP at runtime for Linux.
139 // It is based on /proc/cpuinfo, which reveals hardware configuration 141 // It is based on /proc/cpuinfo, which reveals hardware configuration
140 // to user-space applications. According to ARM (mid 2009), no similar 142 // to user-space applications. According to ARM (mid 2009), no similar
141 // facility is universally available on the ARM architectures, 143 // facility is universally available on the ARM architectures,
142 // so it's up to individual OSes to provide such. 144 // so it's up to individual OSes to provide such.
143 switch (feature) { 145 switch (feature) {
144 case VFP3: 146 case VFP3:
145 search_string = "vfpv3"; 147 search_strings[0] = "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);
146 break; 154 break;
147 case ARMv7: 155 case ARMv7:
148 search_string = "ARMv7"; 156 search_strings[0] = "ARMv7" ;
157 search_items = 1;
158 ASSERT(search_items <= max_items);
149 break; 159 break;
150 default: 160 default:
151 UNREACHABLE(); 161 UNREACHABLE();
152 } 162 }
153 163
154 if (CPUInfoContainsString(search_string)) { 164 for (int i = 0; i < search_items; ++i) {
155 return true; 165 if (CPUInfoContainsString(search_strings[i])) {
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")) {
165 return true; 166 return true;
166 } 167 }
167 } 168 }
168 169
169 return false; 170 return false;
170 } 171 }
171 #endif // def __arm__ 172 #endif // def __arm__
172 173
173 174
174 int OS::ActivationFrameAlignment() { 175 int OS::ActivationFrameAlignment() {
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 } 945 }
945 946
946 // This sampler is no longer the active sampler. 947 // This sampler is no longer the active sampler.
947 active_sampler_ = NULL; 948 active_sampler_ = NULL;
948 } 949 }
949 950
950 951
951 #endif // ENABLE_LOGGING_AND_PROFILING 952 #endif // ENABLE_LOGGING_AND_PROFILING
952 953
953 } } // namespace v8::internal 954 } } // namespace v8::internal
OLDNEW
« ChangeLog ('K') | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698