Backout a2843362ce9b (Bug 786126) - Are we fast yet regression.
authorNicolas B. Pierron <npierron@mozilla.com>
Fri, 28 Sep 2012 22:58:53 -0700
changeset 108716 963b6aadad7c20b9c5c50791bb79189a8bd07d4a
parent 108715 59665618b6c99e30e014fa5181fc73b6b008c2e3
child 108717 b56f7cb51b1f3d108ae6726482ee0b827a9cdd43
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
bugs786126
milestone18.0a1
backs outa2843362ce9b51a3db6d21a19789be942b368818
Backout a2843362ce9b (Bug 786126) - Are we fast yet regression.
js/src/ion/TypeOracle.cpp
js/src/jsanalyze.h
js/src/jsinterpinlines.h
--- a/js/src/ion/TypeOracle.cpp
+++ b/js/src/ion/TypeOracle.cpp
@@ -368,26 +368,16 @@ TypeInferenceOracle::elementReadIsPacked
 void
 TypeInferenceOracle::elementReadGeneric(JSScript *script, jsbytecode *pc, bool *cacheable, bool *monitorResult)
 {
     MIRType obj = getMIRType(script->analysis()->poppedTypes(pc, 1));
     MIRType id = getMIRType(script->analysis()->poppedTypes(pc, 0));
 
     *cacheable = (obj == MIRType_Object &&
                   (id == MIRType_Value || id == MIRType_Int32 || id == MIRType_String));
-
-    // Turn off cacheing if the element is int32 and we've seen non-native objects as the target
-    // of this getelem.
-    if (*cacheable) {
-        if (id == MIRType_Int32) {
-            if (script->analysis()->getCode(pc).nonNativeGetElement)
-                *cacheable = false;
-        }
-    }
-
     if (*cacheable)
         *monitorResult = (id == MIRType_String || script->analysis()->getCode(pc).getStringElement);
     else
         *monitorResult = true;
 }
 
 bool
 TypeInferenceOracle::elementWriteIsDenseArray(JSScript *script, jsbytecode *pc)
--- a/js/src/jsanalyze.h
+++ b/js/src/jsanalyze.h
@@ -106,21 +106,20 @@ class Bytecode
 
     /* Call whose result should be monitored. */
     bool monitoredTypesReturn : 1;
 
     /*
      * Dynamically observed state about the execution of this opcode. These are
      * hints about the script for use during compilation.
      */
-    bool arrayWriteHole: 1;     /* SETELEM which has written to an array hole. */
-    bool getStringElement:1;    /* GETELEM which has accessed string properties. */
-    bool nonNativeGetElement:1; /* GETELEM on a non-native object. */
-    bool accessGetter: 1;       /* Property read on a shape with a getter hook. */
-    bool notIdempotent: 1;      /* Don't use an idempotent cache for this property read. */
+    bool arrayWriteHole: 1;  /* SETELEM which has written to an array hole. */
+    bool getStringElement:1; /* GETELEM which has accessed string properties. */
+    bool accessGetter: 1;    /* Property read on a shape with a getter hook. */
+    bool notIdempotent: 1;   /* Don't use an idempotent cache for this property read. */
 
     /* Stack depth before this opcode. */
     uint32_t stackDepth;
 
   private:
 
     union {
         /* If this is a JOF_TYPESET opcode, index into the observed types for the op. */
--- a/js/src/jsinterpinlines.h
+++ b/js/src/jsinterpinlines.h
@@ -681,29 +681,16 @@ GetObjectElementOperation(JSContext *cx,
     if (op == JSOP_CALLELEM && JS_UNLIKELY(obj->isXML())) {
         jsid id;
         if (!FetchElementId(cx, obj, rref, &id, res))
             return false;
         return js_GetXMLMethod(cx, obj, id, res);
     }
 #endif
 
-    bool updateAnalysis = false;
-    RootedScript script(cx, NULL);
-    jsbytecode *pc = NULL;
-    if (!cx->fp()->beginsIonActivation()) {
-        // Don't call GetPcScript from inside Ion since it's expensive.
-        types::TypeScript::GetPcScript(cx, &script, &pc);
-        if (script->hasAnalysis())
-            updateAnalysis = true;
-    }
-
-    if (updateAnalysis && !obj->isNative())
-        script->analysis()->getCode(pc).nonNativeGetElement = true;
-
     uint32_t index;
     if (IsDefinitelyIndex(rref, &index)) {
         do {
             if (obj->isDenseArray()) {
                 if (index < obj->getDenseArrayInitializedLength()) {
                     res.set(obj->getDenseArrayElement(index));
                     if (!res.isMagic())
                         break;
@@ -711,18 +698,26 @@ GetObjectElementOperation(JSContext *cx,
             } else if (obj->isArguments()) {
                 if (obj->asArguments().maybeGetElement(index, res))
                     break;
             }
             if (!JSObject::getElement(cx, obj, obj, index, res))
                 return false;
         } while(0);
     } else {
-        if (updateAnalysis)
-            script->analysis()->getCode(pc).getStringElement = true;
+        if (!cx->fp()->beginsIonActivation()) {
+            // Don't update getStringElement if called from Ion code, since
+            // ion::GetPcScript is expensive.
+            RootedScript script(cx);
+            jsbytecode *pc;
+            types::TypeScript::GetPcScript(cx, &script, &pc);
+
+            if (script->hasAnalysis())
+                script->analysis()->getCode(pc).getStringElement = true;
+        }
 
         SpecialId special;
         res.set(rref);
         if (ValueIsSpecial(obj, res, &special, cx)) {
             if (!JSObject::getSpecial(cx, obj, obj, special, res))
                 return false;
         } else {
             JSAtom *name = ToAtom(cx, res);