diff --git a/js/src/jsemit.cpp b/js/src/jsemit.cpp index 1f865da78738..35691a00061d 100644 --- a/js/src/jsemit.cpp +++ b/js/src/jsemit.cpp @@ -2232,18 +2232,8 @@ BindNameToSlot(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) return JS_TRUE; if (level >= JS_DISPLAY_SIZE) return JS_TRUE; - - /* FIXME: bug 545575 will make this all better. */ if (cg->flags & TCF_FUN_HEAVYWEIGHT) return JS_TRUE; - { - JSTreeContext *tc = cg; - do { - tc = tc->parent; - if (tc->flags & TCF_FUN_HEAVYWEIGHT) - return JS_TRUE; - } while (tc->staticLevel != level); - } if (FUN_FLAT_CLOSURE(cg->fun)) { op = JSOP_GETDSLOT; diff --git a/js/src/jsparse.cpp b/js/src/jsparse.cpp index af2a5372b51a..fc4e3607b143 100644 --- a/js/src/jsparse.cpp +++ b/js/src/jsparse.cpp @@ -2235,28 +2235,7 @@ Parser::setFunctionKinds(JSFunctionBox *funbox, uint32& tcflags) JSDefinition *lexdep = ALE_DEFN(ale)->resolve(); if (!lexdep->isFreeVar()) { - uintN lexdepLevel = lexdep->frameLevel(); - JS_ASSERT(lexdepLevel <= funbox->level); - - /* FIXME: bug 545575 will make this all better. */ - JSFunctionBox *afunbox = funbox; - do { - /* - * NB: (funbox->tcflags & TCF_FUN_HEAVYWEIGHT) was - * checked first thing, so here we need only check - * after each step up the funbox->parent chain. - * - * As usual if we run out of funboxes we must use - * tcflags to handle the Function constructor case. - */ - if ((afunbox->parent ? afunbox->parent->tcflags : tcflags) - & TCF_FUN_HEAVYWEIGHT) { - nupvars = 0; - goto break2; - } - afunbox = afunbox->parent; - } while (afunbox && afunbox->level != lexdepLevel); - + JS_ASSERT(lexdep->frameLevel() <= funbox->level); ++nupvars; if (lexdep->isAssigned()) break; @@ -2265,7 +2244,6 @@ Parser::setFunctionKinds(JSFunctionBox *funbox, uint32& tcflags) if (!ale) mutation = false; - break2: if (nupvars == 0) { FUN_METER(onlyfreevar); FUN_SET_KIND(fun, JSFUN_NULL_CLOSURE); diff --git a/js/src/tests/ecma_3/Function/jstests.list b/js/src/tests/ecma_3/Function/jstests.list index fee2a4ecc03a..343f20df34df 100644 --- a/js/src/tests/ecma_3/Function/jstests.list +++ b/js/src/tests/ecma_3/Function/jstests.list @@ -9,7 +9,6 @@ script regress-137181.js script regress-193555.js script regress-313570.js script regress-49286.js -script regress-558720.js script regress-58274.js script regress-85880.js script regress-94506.js diff --git a/js/src/tests/ecma_3/Function/regress-558720.js b/js/src/tests/ecma_3/Function/regress-558720.js deleted file mode 100644 index 3de0745bd432..000000000000 --- a/js/src/tests/ecma_3/Function/regress-558720.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/licenses/publicdomain/ - */ - -var gTestfile = 'regress-558720.js'; -var BUGNUMBER = 558720; -var summary = 'bad closure optimization inside "with"'; -var actual; -var expect; - -printBugNumber(BUGNUMBER); -printStatus(summary); - -var a = new Function("a","b","with(a){return(function(){return b})()}"); -var actual = a({b:"green"}) || "red"; - -eval("function a(a,b){with(a){return(function(){return b})()}}"); -var expect = a({b:"green"}) || "red"; - -reportCompare(expect, actual, summary); - -printStatus("All tests passed!");