From 6221ca4d35688d5a5e57871a9185be843e4d297e Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Mon, 27 Feb 2012 16:36:04 -0800 Subject: [PATCH] Bug 730497 - preparatory parser sanity enhancements (r=jorendorff) --HG-- extra : rebase_source : 4e89da8ce6b0f107fabd1944575c4c181283eeac --- js/src/frontend/BytecodeEmitter.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 15fda2f5e76..1569daa043c 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -1160,7 +1160,7 @@ BindKnownGlobal(JSContext *cx, BytecodeEmitter *bce, ParseNode *dn, ParseNode *p // 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)) @@ -1350,7 +1350,7 @@ BindNameToSlot(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn) } /* Optimize accesses to undeclared globals. */ - if (!bce->mightAliasLocals() && !TryConvertToGname(bce, pn, &op)) + if (!TryConvertToGname(bce, pn, &op)) return JS_TRUE; jsatomid _; @@ -1852,7 +1852,7 @@ EmitNameOp(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, JSBool callContex } 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; @@ -3019,14 +3019,14 @@ EmitDestructuringLHS(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmit 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; @@ -3658,7 +3658,8 @@ EmitAssignment(JSContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp op, Par 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;