From f19c8a38da97d0f9ed58a359759fd0bd4594cd2a Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Fri, 27 Jan 2012 18:37:18 -0800 Subject: [PATCH] Back out 602d30678cac because of test failures --- js/src/frontend/Parser.cpp | 13 ++----------- js/src/jit-test/tests/basic/bug714614.js | 5 ----- js/src/jsscript.cpp | 10 ---------- js/src/jsscript.h | 16 ---------------- js/src/jsscriptinlines.h | 2 +- .../tests/ecma_3/ExecutionContexts/10.1.3-1.js | 4 ---- 6 files changed, 3 insertions(+), 47 deletions(-) delete mode 100644 js/src/jit-test/tests/basic/bug714614.js diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 55b9df42daa..f93a67d6e53 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -1331,9 +1331,7 @@ Parser::functionArguments(TreeContext &funtc, FunctionBox *funbox, ParseNode **l * destructuring bindings aren't added to funtc.bindings * until after all arguments have been parsed. */ - bool haveDup = false; if (funtc.decls.lookupFirst(name)) { - haveDup = true; duplicatedArg = name; if (destructuringArg) goto report_dup_and_destructuring; @@ -1341,15 +1339,8 @@ Parser::functionArguments(TreeContext &funtc, FunctionBox *funbox, ParseNode **l #endif uint16_t slot; - if (haveDup) { - /* - * Hack: see comment in Bindings::hasHoles. - */ - funtc.bindings.skipArgument(context, name, &slot); - } else { - if (!funtc.bindings.addArgument(context, name, &slot)) - return false; - } + if (!funtc.bindings.addArgument(context, name, &slot)) + return false; if (!DefineArg(funbox->node, name, slot, &funtc)) return false; break; diff --git a/js/src/jit-test/tests/basic/bug714614.js b/js/src/jit-test/tests/basic/bug714614.js deleted file mode 100644 index fd01dce5614..00000000000 --- a/js/src/jit-test/tests/basic/bug714614.js +++ /dev/null @@ -1,5 +0,0 @@ -function testForVarInWith(foo, foo) { - return eval("with ({}) { for (var x = 0; x < 5; x++); } (function() { return delete x; })"); -} -f = testForVarInWith()(); - diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 338bc5810f5..b7d6ba963ec 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -203,16 +203,6 @@ Bindings::getLocalNameArray(JSContext *cx, Vector *namesp) names[i] = POISON; #endif - if (hasHoles) { - AutoKeepAtoms keep(cx->runtime); - const char *dupchars = ""; - JSAtom *dup = js_Atomize(cx, dupchars, strlen(dupchars)); - if (!dup) - return false; - for (unsigned i = 0; i < n; i++) - names[i] = dup; - } - for (Shape::Range r = lastBinding->all(); !r.empty(); r.popFront()) { const Shape &shape = r.front(); uintN index = uint16_t(shape.shortid()); diff --git a/js/src/jsscript.h b/js/src/jsscript.h index 8e49b257f1c..2265778cf34 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -175,17 +175,6 @@ class Bindings { uint16_t nargs; uint16_t nvars; uint16_t nupvars; - /* - * Hack for handling duplicate parameters. We don't want to create - * duplicate properties in Call objects, so instead we skip that - * argument and record that there are holes so we can patch in fake - * names if needed in the decompiler. - * - * This hack would be obviated by either (a) not using JSObjects - * to represent closure environments, or (b) not using the decompiler - * for Function.toString. - */ - uint16_t hasHoles; public: inline Bindings(JSContext *cx); @@ -268,11 +257,6 @@ class Bindings { *slotp = nargs; return add(cx, name, ARGUMENT); } - void skipArgument(JSContext *cx, JSAtom *name, uint16_t *slotp) { - JS_ASSERT(name != NULL); /* not destructuring */ - hasHoles = true; - *slotp = nargs++; - } bool addDestructuring(JSContext *cx, uint16_t *slotp) { *slotp = nargs; return add(cx, NULL, ARGUMENT); diff --git a/js/src/jsscriptinlines.h b/js/src/jsscriptinlines.h index 257cbc20f16..e3275bd1a60 100644 --- a/js/src/jsscriptinlines.h +++ b/js/src/jsscriptinlines.h @@ -58,7 +58,7 @@ namespace js { inline Bindings::Bindings(JSContext *cx) - : lastBinding(NULL), nargs(0), nvars(0), nupvars(0), hasHoles(false) + : lastBinding(NULL), nargs(0), nvars(0), nupvars(0) {} inline void diff --git a/js/src/tests/ecma_3/ExecutionContexts/10.1.3-1.js b/js/src/tests/ecma_3/ExecutionContexts/10.1.3-1.js index 4085c143523..60fea610b7e 100644 --- a/js/src/tests/ecma_3/ExecutionContexts/10.1.3-1.js +++ b/js/src/tests/ecma_3/ExecutionContexts/10.1.3-1.js @@ -104,10 +104,7 @@ addThis(); /* * f.toString() should preserve any duplicate formal parameter names that exist - * - * Note: this test case is disabled for bug 714614. */ -/* function f5(x,x,x,x) { } @@ -116,7 +113,6 @@ actual = f5.toString().match(/\((.*)\)/)[1]; actual = actual.replace(/\s/g, ''); // for definiteness, remove any white space expect = 'x,x,x,x'; addThis(); -*/ function f6(x,x,x,x)