Bug 886803 - Populate both script and function box bindings for new Function() functions, so heavyweight tests work. r=jandem, a=bajaj
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 08 Jul 2013 07:01:20 -0600
changeset 143503 ba6c735171209d7823e256c4f9e9729ab8ee558c
parent 143502 d2db7b4b2b9eecadceb619c33e4936c633ec3ce7
child 143504 5f5646dc9d94b77c3dff3333d80c9371dbb6ef77
push id3964
push userryanvm@gmail.com
push dateTue, 09 Jul 2013 13:18:38 +0000
treeherdermozilla-aurora@ba6c73517120 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, bajaj
bugs886803
milestone24.0a2
Bug 886803 - Populate both script and function box bindings for new Function() functions, so heavyweight tests work. r=jandem, a=bajaj
js/src/frontend/Parser.cpp
js/src/jit-test/tests/basic/bug886803.js
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -860,18 +860,25 @@ Parser<FullParseHandler>::standaloneFunc
     if (!tokenStream.matchToken(TOK_EOF)) {
         report(ParseError, false, null(), JSMSG_SYNTAX_ERROR);
         return null();
     }
 
     if (!FoldConstants(context, &pn, this))
         return null();
 
-    InternalHandle<Bindings*> bindings(script, &script->bindings);
-    if (!funpc.generateFunctionBindings(context, bindings))
+    InternalHandle<Bindings*> scriptBindings(script, &script->bindings);
+    if (!funpc.generateFunctionBindings(context, scriptBindings))
+        return null();
+
+    // Also populate the internal bindings of the function box, so that
+    // heavyweight tests while emitting bytecode work.
+    InternalHandle<Bindings*> funboxBindings =
+        InternalHandle<Bindings*>::fromMarkedLocation(&(*funbox)->bindings);
+    if (!funpc.generateFunctionBindings(context, funboxBindings))
         return null();
 
     return pn;
 }
 
 template <>
 bool
 Parser<FullParseHandler>::checkFunctionArguments()
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug886803.js
@@ -0,0 +1,3 @@
+
+f = Function("with({}) { var i; }");
+f();