[INFER] Fix test failures.
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 05 Sep 2011 09:05:45 -0700
changeset 76587 fc5a768a97b565915a960ad337a58403c7c610ab
parent 76586 584386505971537c7ea479e51995a3c66abaf7ea
child 76588 1412233cafa1f9c0df4832751092181c7da16c76
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
milestone9.0a1
[INFER] Fix test failures.
js/src/jscntxt.h
js/src/jsinfer.cpp
js/src/jsscript.h
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -1491,17 +1491,17 @@ class AutoGCRooter {
         NAMESPACES =   -8, /* js::AutoNamespaceArray */
         XML =          -9, /* js::AutoXMLRooter */
         OBJECT =      -10, /* js::AutoObjectRooter */
         ID =          -11, /* js::AutoIdRooter */
         VALVECTOR =   -12, /* js::AutoValueVector */
         DESCRIPTOR =  -13, /* js::AutoPropertyDescriptorRooter */
         STRING =      -14, /* js::AutoStringRooter */
         IDVECTOR =    -15, /* js::AutoIdVector */
-        OBJVECTOR =   -16, /* js::AutoObjectVector */
+        OBJVECTOR =   -16  /* js::AutoObjectVector */
     };
 
     private:
     /* No copy or assignment semantics. */
     AutoGCRooter(AutoGCRooter &ida);
     void operator=(AutoGCRooter &ida);
 };
 
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -3173,17 +3173,17 @@ ScriptAnalysis::resolveNameAccess(JSCont
 
     NameAccess access;
     PodZero(&access);
 
     if (!JSID_IS_ATOM(id))
         return access;
     JSAtom *atom = JSID_TO_ATOM(id);
 
-    JSScript *script = this->script, *prev = NULL;
+    JSScript *script = this->script;
     while (script->hasFunction && script->nesting()) {
         if (!script->ensureRanInference(cx))
             return access;
 
         /*
          * Don't resolve names in scripts which use 'let' or 'with'. New names
          * bound here can mask variables of the script itself.
          *
@@ -3218,17 +3218,16 @@ ScriptAnalysis::resolveNameAccess(JSCont
             access.index = index;
             return access;
         } else if (kind != NONE) {
             return access;
         }
 
         if (!script->nesting()->parent)
             return access;
-        prev = script;
         script = script->nesting()->parent;
     }
 
     return access;
 }
 
 /* Analyze type information for a single bytecode. */
 bool
@@ -4086,35 +4085,42 @@ ScriptAnalysis::analyzeTypes(JSContext *
          * Check whether NAME accesses can be resolved in parent scopes, and
          * detach from the parent if so. Even if outdated activations of this
          * function are live when the parent is called again, we do not need to
          * consider this reentrance as no state in the parent will be used.
          */
         if (!nesting->parent->ensureRanInference(cx))
             return;
 
+        bool detached = false;
+
         /* Don't track for leaf scripts which have no free variables. */
-        if (!usesScopeChain() && !script->isOuterFunction)
+        if (!usesScopeChain() && !script->isOuterFunction) {
             DetachNestingParent(script);
+            detached = true;
+        }
 
         /*
          * If the names bound by the script are extensible (DEFFUN, EVAL, ...),
          * don't resolve NAME accesses into the parent.
          */
-        if (nesting->parent && extendsScope())
+        if (!detached && extendsScope()) {
             DetachNestingParent(script);
+            detached = true;
+        }
 
         /*
          * Don't track for parents which add call objects or are generators,
          * don't resolve NAME accesses into the parent.
          */
-        if (nesting->parent &&
+        if (!detached &&
             (nesting->parent->analysis()->addsScopeObjects() ||
              js_GetOpcode(cx, nesting->parent, nesting->parent->code) == JSOP_GENERATOR)) {
             DetachNestingParent(script);
+            detached = true;
         }
     }
 
     TypeInferenceState state(cx);
 
     unsigned offset = 0;
     while (offset < script->length) {
         Bytecode *code = maybeCode(offset);
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -536,22 +536,20 @@ struct JSScript : public js::gc::Cell {
     uint16          nClosedArgs; /* number of args which are closed over. */
     uint16          nClosedVars; /* number of vars which are closed over. */
 
     /*
      * To ensure sizeof(JSScript) % gc::Cell::CellSize  == 0 on we must pad
      * the script with 4 bytes. We use them to store tiny scripts like empty
      * scripts.
      */
-#if JS_BITS_PER_WORD == 32
-#define JS_SCRIPT_INLINE_DATA_LIMIT 0
-#else
+#if JS_BITS_PER_WORD == 64
 #define JS_SCRIPT_INLINE_DATA_LIMIT 4
+    uint8           inlineData[JS_SCRIPT_INLINE_DATA_LIMIT];
 #endif
-    uint8           inlineData[JS_SCRIPT_INLINE_DATA_LIMIT];
 
     const char      *filename;  /* source filename or null */
     JSAtom          **atoms;    /* maps immediate index to literal struct */
   private:
     size_t          useCount;  /* Number of times the script has been called
                                  * or has had backedges taken. Reset if the
                                  * script's JIT code is forcibly discarded. */
   public: