From 9c56bfaed476fa7d8f1cfbfe6abc86165747b199 Mon Sep 17 00:00:00 2001 From: Gary Kwong Date: Mon, 23 Jul 2012 13:39:18 -0700 Subject: [PATCH] Bug 776191 - Add missing case of 'with' deoptimization, r=dvander --- js/src/frontend/Parser.cpp | 5 +---- js/src/jit-test/tests/basic/testBug776191.js | 7 +++++++ 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 js/src/jit-test/tests/basic/testBug776191.js diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index f963f50f0a4..2bab5044322 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -1132,11 +1132,8 @@ LeaveFunction(ParseNode *fn, Parser *parser, PropertyName *funName = NULL, * by eval and function statements (which both flag the function as * having an extensible scope) or any enclosing 'with'. */ - if (funtc->sc->funHasExtensibleScope() || - (outer_dn && tc->innermostWith && - outer_dn->pn_pos < tc->innermostWith->pn_pos)) { + if (funtc->sc->funHasExtensibleScope() || tc->innermostWith) DeoptimizeUsesWithin(dn, fn->pn_pos); - } if (!outer_dn) { AtomDefnAddPtr p = tc->lexdeps->lookupForAdd(atom); diff --git a/js/src/jit-test/tests/basic/testBug776191.js b/js/src/jit-test/tests/basic/testBug776191.js new file mode 100644 index 00000000000..c821cf84c8b --- /dev/null +++ b/js/src/jit-test/tests/basic/testBug776191.js @@ -0,0 +1,7 @@ +(function() { + let(a, b, c) { + ((function() { + with({}) let(b) { ((function() { c = 0 })()) } + })()) + } +})()