Disable TypeInference on ARMv6 builds (bug 793740, r=mjrosenb).
authorDavid Anderson <danderson@mozilla.com>
Fri, 28 Sep 2012 12:11:50 -0700
changeset 108643 ff77ff9b20336ad05192dd1dbaad49e5f35c62f8
parent 108642 0c18edd01cd4db9905801b29e5a2135b99f09752
child 108644 8cbeb46ddd8217cfc792afc8bb5bcf0526d119f6
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersmjrosenb
bugs793740
milestone18.0a1
Disable TypeInference on ARMv6 builds (bug 793740, r=mjrosenb).
js/src/jsinfer.cpp
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -2068,30 +2068,52 @@ class TypeConstraintFreezeStack : public
         AddPendingRecompile(cx, script, NULL);
     }
 };
 
 /////////////////////////////////////////////////////////////////////
 // TypeCompartment
 /////////////////////////////////////////////////////////////////////
 
+static inline bool
+TypeInferenceSupported()
+{
+#ifdef JS_METHODJIT
+    // JM+TI will generate FPU instructions with TI enabled. As a workaround,
+    // we disable TI to prevent this on platforms which do not have FPU
+    // support.
+    JSC::MacroAssembler masm;
+    if (!masm.supportsFloatingPoint())
+        return false;
+#endif
+
+#if WTF_ARM_ARCH_VERSION == 6
+    // If building for ARMv6 targets, we can't be guaranteed an FPU,
+    // so we hardcode TI off for consistency (see bug 793740).
+    return false;
+#endif
+
+    return true;
+}
+
 void
 TypeCompartment::init(JSContext *cx)
 {
     PodZero(this);
 
     compiledInfo.outputIndex = RecompileInfo::NoCompilerRunning;
 
-    if (cx && cx->getRunOptions() & JSOPTION_TYPE_INFERENCE) {
-#ifdef JS_METHODJIT
-        JSC::MacroAssembler masm;
-        if (masm.supportsFloatingPoint())
-#endif
-            inferenceEnabled = true;
-    }
+    if (!cx ||
+        !cx->hasRunOption(JSOPTION_TYPE_INFERENCE) ||
+        !TypeInferenceSupported())
+    {
+        return;
+    }
+
+    inferenceEnabled = true;
 }
 
 TypeObject *
 TypeCompartment::newTypeObject(JSContext *cx, JSProtoKey key, Handle<TaggedProto> proto,
                                bool unknown, bool isDOM)
 {
     JS_ASSERT_IF(proto.isObject(), cx->compartment == proto.toObject()->compartment());