Bug 922395 - OdinMonkey: move the check for generators (r=jorendorff)
authorLuke Wagner <luke@mozilla.com>
Thu, 10 Oct 2013 13:11:41 -0400
changeset 164195 e3be5e632c351103fd20e5bfa3ec0af96274fea5
parent 164194 0194c6474d7ad1ec14cc8a1b1f70f06afb111f7e
child 164196 322bcb7a90da9953d8aece87401396863c9675cc
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs922395
milestone27.0a1
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 922395 - OdinMonkey: move the check for generators (r=jorendorff)
js/src/frontend/Parser.cpp
js/src/jit-test/tests/asm.js/testBasic.js
js/src/jit-test/tests/generators/es6-syntax.js
js/src/jit/AsmJS.cpp
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -2601,17 +2601,17 @@ Parser<ParseHandler>::maybeParseDirectiv
                     if (tokenStream.sawOctalEscape()) {
                         report(ParseError, false, null(), JSMSG_DEPRECATED_OCTAL);
                         return false;
                     }
                     pc->sc->strict = true;
                 }
             }
         } else if (directive == context->names().useAsm) {
-            if (pc->sc->isFunctionBox() && !pc->isGenerator())
+            if (pc->sc->isFunctionBox())
                 return asmJS(list);
             return report(ParseWarning, false, pn, JSMSG_USE_ASM_DIRECTIVE_FAIL);
         }
     }
     return true;
 }
 
 /*
--- a/js/src/jit-test/tests/asm.js/testBasic.js
+++ b/js/src/jit-test/tests/asm.js/testBasic.js
@@ -100,16 +100,17 @@ function assertTypeFailInEval(str)
     }
     assertEq(caught, true);
     options("werror");
 }
 assertTypeFailInEval('function f({}) { "use asm"; function g() {} return g }');
 assertTypeFailInEval('function f({global}) { "use asm"; function g() {} return g }');
 assertTypeFailInEval('function f(global, {imports}) { "use asm"; function g() {} return g }');
 assertTypeFailInEval('function f(g = 2) { "use asm"; function g() {} return g }');
+assertTypeFailInEval('function *f() { "use asm"; function g() {} return g }');
 
 function assertLinkFailInEval(str)
 {
     if (!isAsmJSCompilationAvailable())
         return;
 
     var caught = false;
     var oldOpts = options("werror");
--- a/js/src/jit-test/tests/generators/es6-syntax.js
+++ b/js/src/jit-test/tests/generators/es6-syntax.js
@@ -27,12 +27,8 @@ assertSyntaxError("function* f(...yield)
 // For each.
 assertSyntaxError("for yield");
 assertSyntaxError("for yield (;;) {}");
 assertSyntaxError("for yield (x of y) {}");
 assertSyntaxError("for yield (var i in o) {}");
 
 // Expression bodies.
 assertSyntaxError("function* f() yield 7");
-
-// Asm.js.
-load(libdir + "asm.js");
-assertAsmDirectiveFail("function* f() { 'use asm'; function g() { return 0; } return g; })()")
--- a/js/src/jit/AsmJS.cpp
+++ b/js/src/jit/AsmJS.cpp
@@ -6477,16 +6477,19 @@ EstablishPreconditions(ExclusiveContext 
         return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Disabled by javascript.options.asmjs in about:config");
 
     if (!parser.options().compileAndGo)
         return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Temporarily disabled for event-handler and other cloneable scripts");
 
     if (cx->compartment()->debugMode())
         return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Disabled by debugger");
 
+    if (parser.pc->isGenerator())
+        return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Disabled by generator context");
+
 #ifdef JS_WORKER_THREADS
     if (ParallelCompilationEnabled(cx)) {
         if (!EnsureWorkerThreadsInitialized(cx))
             return Warn(parser, JSMSG_USE_ASM_TYPE_FAIL, "Failed compilation thread initialization");
     }
 #endif
 
     return true;