Bug 612481 - Only do closed-name analysis for functions. r=dvander
authorJeff Walden <jwalden@mit.edu>
Tue, 16 Nov 2010 14:13:18 -0800
changeset 57828 9baf4ce0920b157152e6f17323ea2fb08a01d498
parent 57827 f3cfb74fd41301d9d01d942a53aaffa30d2678f9
child 57829 c5b733682ecef38251b07cb6811f2ccbdcae522a
push id17032
push userrsayre@mozilla.com
push dateWed, 17 Nov 2010 21:55:39 +0000
treeherdermozilla-central@78a42f77bb90 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs612481
milestone2.0b8pre
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
Bug 612481 - Only do closed-name analysis for functions. r=dvander
js/src/jsemit.cpp
--- a/js/src/jsemit.cpp
+++ b/js/src/jsemit.cpp
@@ -3813,17 +3813,18 @@ MaybeEmitVarDecl(JSContext *cx, JSCodeGe
     {
         CG_SWITCH_TO_PROLOG(cg);
         if (!UpdateLineNumberNotes(cx, cg, pn->pn_pos.begin.lineno))
             return JS_FALSE;
         EMIT_INDEX_OP(prologOp, atomIndex);
         CG_SWITCH_TO_MAIN(cg);
     }
 
-    if (JOF_OPTYPE(pn->pn_op) == JOF_LOCAL &&
+    if (cg->inFunction() &&
+        JOF_OPTYPE(pn->pn_op) == JOF_LOCAL &&
         pn->pn_cookie.slot() < cg->fun->u.i.nvars &&
         cg->shouldNoteClosedName(pn))
     {
         if (!cg->closedVars.append(pn->pn_cookie.slot()))
             return JS_FALSE;
     }
 
     if (result)