[INFER] Kludge for recompilation thrashing in sunspider-crypto-md5.
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 14 Apr 2011 17:28:04 -0700
changeset 75717 5838535af4c7e275c22f8d7f3ca62e626769ac63
parent 75716 f3a11a539c790e7ad435132615e40a664c67cfb7
child 75718 cb06710a8eb7a21aba2453138c2497f4316bce24
push id235
push userbzbarsky@mozilla.com
push dateTue, 27 Sep 2011 17:13:04 +0000
treeherdermozilla-beta@2d1e082d176a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
[INFER] Kludge for recompilation thrashing in sunspider-crypto-md5.
js/src/jsinfer.cpp
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -2035,16 +2035,42 @@ TypeCompartment::dynamicPush(JSContext *
      * necessarily, if we have condensed the constraints but not reanalyzed the
      * parent). The parent is listening for isUninlineable changes on the
      * function, so we can treat this as a state change on the function to
      * trigger any necessary reanalysis.
      */
     if (script->fun && !script->fun->getType()->unknownProperties())
         ObjectStateChange(cx, script->fun->getType(), false);
 
+    /*
+     * If we unexpectedly read a hole out of an array, mark all array reads in
+     * the script as undefined. :FIXME: bug 650163 remove hack.
+     */
+    if (script->types && JSOp(*pc) == JSOP_GETELEM && type == TYPE_UNDEFINED) {
+        unsigned offset = 0;
+        while (offset < script->length) {
+            if (JSOp(script->code[offset]) == JSOP_GETELEM && script->types->pushedArray[offset]) {
+                js::types::TypeSet *pushed = script->types->pushed(offset, 0);
+                if (!pushed->hasType(TYPE_UNDEFINED)) {
+                    pushed->addType(cx, TYPE_UNDEFINED);
+                    TypeResult *result = (TypeResult *) cx->calloc_(sizeof(TypeResult));
+                    if (!result) {
+                        setPendingNukeTypes(cx);
+                        return checkPendingRecompiles(cx);
+                    }
+                    result->offset = offset;
+                    result->type = TYPE_UNDEFINED;
+                    result->next = script->typeResults;
+                    script->typeResults = result;
+                }
+            }
+            offset += analyze::GetBytecodeLength(pc);
+        }
+    }
+
     return checkPendingRecompiles(cx);
 }
 
 bool
 TypeCompartment::processPendingRecompiles(JSContext *cx)
 {
     /* Steal the list of scripts to recompile, else we will try to recursively recompile them. */
     Vector<JSScript*> *pending = pendingRecompiles;