Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Chris Jones authored

Showing 1 changed file with 55 additions and 1 deletion. Show diff stats Hide diff stats

  1. +55 1 js/src/jscntxt.cpp
56 js/src/jscntxt.cpp
@@ -45,6 +45,10 @@
45 45 #include <stdarg.h>
46 46 #include <stdlib.h>
47 47 #include <string.h>
  48 +#ifdef ANDROID
  49 +# include <fstream>
  50 +# include <string>
  51 +#endif // ANDROID
48 52
49 53 #include "jsstdint.h"
50 54
@@ -2202,17 +2206,67 @@ JSContext::purge()
2202 2206 FreeOldArenas(runtime, &regExpPool);
2203 2207 }
2204 2208
  2209 +static bool
  2210 +ComputeIsJITBroken()
  2211 +{
  2212 +#ifndef ANDROID
  2213 + return false;
  2214 +#else // ANDROID
  2215 + if (getenv("JS_IGNORE_JIT_BROKENNESS")) {
  2216 + return false;
  2217 + }
  2218 +
  2219 + bool broken = false;
  2220 + std::string line;
  2221 + std::ifstream cpuinfo("/proc/cpuinfo");
  2222 + do {
  2223 + if (0 == line.find("Hardware")) {
  2224 + const char* blacklist[] = {
  2225 + "SGH-T959", // Samsung i9000, Vibrant device
  2226 + "SGH-I897", // Samsung i9000, Captivate device
  2227 + "SCH-I500", // Samsung i9000, Fascinate device
  2228 + "SPH-D700", // Samsung i9000, Epic device
  2229 + NULL
  2230 + };
  2231 + for (const char* hw = blacklist[0]; hw; ++hw) {
  2232 + if (line.npos != line.find(hw)) {
  2233 + broken = true;
  2234 + break;
  2235 + }
  2236 + }
  2237 + break;
  2238 + }
  2239 + std::getline(cpuinfo, line);
  2240 + } while(!cpuinfo.fail() && !cpuinfo.eof());
  2241 + return broken;
  2242 +#endif // ifndef ANDROID
  2243 +}
  2244 +
  2245 +static bool
  2246 +IsJITBrokenHere()
  2247 +{
  2248 + static bool computedIsBroken = false;
  2249 + static bool isBroken = false;
  2250 + if (!computedIsBroken) {
  2251 + isBroken = ComputeIsJITBroken();
  2252 + computedIsBroken = true;
  2253 + }
  2254 + return isBroken;
  2255 +}
  2256 +
2205 2257 void
2206 2258 JSContext::updateJITEnabled()
2207 2259 {
2208 2260 #ifdef JS_TRACER
2209 2261 traceJitEnabled = ((options & JSOPTION_JIT) &&
  2262 + !IsJITBrokenHere() &&
2210 2263 (debugHooks == &js_NullDebugHooks ||
2211 2264 (debugHooks == &runtime->globalDebugHooks &&
2212 2265 !runtime->debuggerInhibitsJIT())));
2213 2266 #endif
2214 2267 #ifdef JS_METHODJIT
2215   - methodJitEnabled = (options & JSOPTION_METHODJIT)
  2268 + methodJitEnabled = (options & JSOPTION_METHODJIT) &&
  2269 + !IsJITBrokenHere()
2216 2270 # ifdef JS_CPU_X86
2217 2271 && JSC::MacroAssemblerX86Common::getSSEState() >=
2218 2272 JSC::MacroAssemblerX86Common::HasSSE2

0 comments on commit aa92c08

Please sign in to comment.
Something went wrong with that request. Please try again.