Bug 730497 - preparatory parser sanity enhancements (r=jorendorff)
authorLuke Wagner <luke@mozilla.com>
Mon, 27 Feb 2012 16:36:04 -0800
changeset 88385 9b0319298e0ebd12cfc9e6777e1c24f059b96b12
parent 88384 065dc9204d09edfd1d9f90a29a665dfcc6846297
child 88386 33bc225041990a73d8dab30980940dc80754a87d
push id157
push userMs2ger@gmail.com
push dateWed, 07 Mar 2012 19:27:10 +0000
reviewersjorendorff
bugs730497
milestone13.0a1
Bug 730497 - preparatory parser sanity enhancements (r=jorendorff)
js/src/frontend/BytecodeEmitter.cpp
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -1155,17 +1155,17 @@ BindKnownGlobal(JSContext *cx, BytecodeE
         if (globalbce == bce) {
             pn->pn_cookie = dn->pn_cookie;
             pn->pn_dflags |= PND_BOUND;
             return true;
         }
 
         // Otherwise, find the atom's index by using the originating bce's
         // global use table.
-        index = globalbce->globalUses[dn->pn_cookie.asInteger()].slot;
+        index = globalbce->globalUses[dn->pn_cookie.slot()].slot;
     }
 
     if (!bce->addGlobalUse(atom, index, &pn->pn_cookie))
         return false;
 
     if (!pn->pn_cookie.isFree())
         pn->pn_dflags |= PND_BOUND;
 
@@ -1345,17 +1345,17 @@ BindNameToSlot(JSContext *cx, BytecodeEm
             /*
              * Out of tricks, so we must rely on PICs to optimize named
              * accesses from direct eval called from function code.
              */
             return JS_TRUE;
         }
 
         /* Optimize accesses to undeclared globals. */
-        if (!bce->mightAliasLocals() && !TryConvertToGname(bce, pn, &op))
+        if (!TryConvertToGname(bce, pn, &op))
             return JS_TRUE;
 
         jsatomid _;
         if (!bce->makeAtomIndex(atom, &_))
             return JS_FALSE;
 
         pn->setOp(op);
         pn->pn_dflags |= PND_BOUND;
@@ -1847,17 +1847,17 @@ EmitNameOp(JSContext *cx, BytecodeEmitte
         if (!EmitArguments(cx, bce))
             return JS_FALSE;
     } else if (op == JSOP_CALLEE) {
         if (Emit1(cx, bce, op) < 0)
             return JS_FALSE;
     } else {
         if (!pn->pn_cookie.isFree()) {
             JS_ASSERT(JOF_OPTYPE(op) != JOF_ATOM);
-            EMIT_UINT16_IMM_OP(op, pn->pn_cookie.asInteger());
+            EMIT_UINT16_IMM_OP(op, pn->pn_cookie.slot());
         } else {
             if (!EmitAtomOp(cx, pn, op, bce))
                 return JS_FALSE;
         }
     }
 
     /* Need to provide |this| value for call */
     if (callContext) {
@@ -3014,24 +3014,24 @@ EmitDestructuringLHS(JSContext *cx, Byte
 
           case JSOP_SETCONST:
             if (!EmitElemOp(cx, pn, JSOP_ENUMCONSTELEM, bce))
                 return JS_FALSE;
             break;
 
           case JSOP_SETLOCAL:
           {
-            jsuint slot = pn->pn_cookie.asInteger();
+            uint16_t slot = pn->pn_cookie.slot();
             EMIT_UINT16_IMM_OP(JSOP_SETLOCALPOP, slot);
             break;
           }
 
           case JSOP_SETARG:
           {
-            jsuint slot = pn->pn_cookie.asInteger();
+            uint16_t slot = pn->pn_cookie.slot();
             EMIT_UINT16_IMM_OP(pn->getOp(), slot);
             if (Emit1(cx, bce, JSOP_POP) < 0)
                 return JS_FALSE;
             break;
           }
 
           default:
           {
@@ -3653,17 +3653,18 @@ EmitAssignment(JSContext *cx, BytecodeEm
     jsatomid atomIndex = (jsatomid) -1;              /* quell GCC overwarning */
     jsbytecode offset = 1;
 
     switch (lhs->getKind()) {
       case PNK_NAME:
         if (!BindNameToSlot(cx, bce, lhs))
             return false;
         if (!lhs->pn_cookie.isFree()) {
-            atomIndex = lhs->pn_cookie.asInteger();
+            JS_ASSERT(lhs->pn_cookie.level() == 0);
+            atomIndex = lhs->pn_cookie.slot();
         } else {
             if (!bce->makeAtomIndex(lhs->pn_atom, &atomIndex))
                 return false;
             if (!lhs->isConst()) {
                 JSOp op = lhs->isOp(JSOP_SETGNAME) ? JSOP_BINDGNAME : JSOP_BINDNAME;
                 if (!EmitIndex32(cx, op, atomIndex, bce))
                     return false;
                 offset++;