Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug 601222: Blacklist JITs on samsung i9000s. r=dvander a=blocking-fe…

…nnec

--HG--
branch : GECKO20b7pre_20100929_RELBRANCH
  • Loading branch information...
commit aa92c08b5435a1d96774323bcc85774b17153434 1 parent b31d372
@cgjones cgjones authored
Showing with 55 additions and 1 deletion.
  1. +55 −1 js/src/jscntxt.cpp
View
56 js/src/jscntxt.cpp
@@ -45,6 +45,10 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
+#ifdef ANDROID
+# include <fstream>
+# include <string>
+#endif // ANDROID
#include "jsstdint.h"
@@ -2202,17 +2206,67 @@ JSContext::purge()
FreeOldArenas(runtime, &regExpPool);
}
+static bool
+ComputeIsJITBroken()
+{
+#ifndef ANDROID
+ return false;
+#else // ANDROID
+ if (getenv("JS_IGNORE_JIT_BROKENNESS")) {
+ return false;
+ }
+
+ bool broken = false;
+ std::string line;
+ std::ifstream cpuinfo("/proc/cpuinfo");
+ do {
+ if (0 == line.find("Hardware")) {
+ const char* blacklist[] = {
+ "SGH-T959", // Samsung i9000, Vibrant device
+ "SGH-I897", // Samsung i9000, Captivate device
+ "SCH-I500", // Samsung i9000, Fascinate device
+ "SPH-D700", // Samsung i9000, Epic device
+ NULL
+ };
+ for (const char* hw = blacklist[0]; hw; ++hw) {
+ if (line.npos != line.find(hw)) {
+ broken = true;
+ break;
+ }
+ }
+ break;
+ }
+ std::getline(cpuinfo, line);
+ } while(!cpuinfo.fail() && !cpuinfo.eof());
+ return broken;
+#endif // ifndef ANDROID
+}
+
+static bool
+IsJITBrokenHere()
+{
+ static bool computedIsBroken = false;
+ static bool isBroken = false;
+ if (!computedIsBroken) {
+ isBroken = ComputeIsJITBroken();
+ computedIsBroken = true;
+ }
+ return isBroken;
+}
+
void
JSContext::updateJITEnabled()
{
#ifdef JS_TRACER
traceJitEnabled = ((options & JSOPTION_JIT) &&
+ !IsJITBrokenHere() &&
(debugHooks == &js_NullDebugHooks ||
(debugHooks == &runtime->globalDebugHooks &&
!runtime->debuggerInhibitsJIT())));
#endif
#ifdef JS_METHODJIT
- methodJitEnabled = (options & JSOPTION_METHODJIT)
+ methodJitEnabled = (options & JSOPTION_METHODJIT) &&
+ !IsJITBrokenHere()
# ifdef JS_CPU_X86
&& JSC::MacroAssemblerX86Common::getSSEState() >=
JSC::MacroAssemblerX86Common::HasSSE2
Please sign in to comment.
Something went wrong with that request. Please try again.