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

Unified Diff: src/platform-linux.cc

Issue 385069: Fix some style issues in the ARM code.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: src/platform-linux.cc
===================================================================
--- src/platform-linux.cc (revision 3292)
+++ src/platform-linux.cc (working copy)
@@ -89,7 +89,9 @@
}
-bool OS::fgrep_vfp(const char* file_name, const char* string) {
+bool OS::ArmCpuHasFeature(OS::CpuFeature feature) {
+ const char* search_string = NULL;
+ const char* file_name = "/proc/cpuinfo";
// Simple detection of VFP at runtime for Linux.
// It is based on /proc/cpuinfo, which reveals hardware configuration
// to user-space applications. According to ARM (mid 2009), no similar
@@ -100,13 +102,20 @@
// and not using STL string and ifstream because,
// on Linux, it's reading from a (non-mmap-able)
// character special device.
+ switch (feature) {
+ case VFP:
+ search_string = "vfp";
+ break;
+ default:
+ UNREACHABLE();
+ }
FILE* f = NULL;
+ const char* what = search_string;
if (NULL == (f = fopen(file_name, "r")))
return false;
- const char* what = string;
int k;
while (EOF != (k = fgetc(f))) {
if (k == *what) {
@@ -118,13 +127,13 @@
fclose(f);
return true;
} else {
- what = string;
+ what = search_string;
}
}
}
fclose(f);
- // Did not find string in the file file_name.
+ // Did not find string in the proc file.
return false;
}
« src/arm/codegen-arm.cc ('K') | « src/platform.h ('k') | src/platform-nullos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698