Bug 1319512 - Adjust expression closure tests. r=jandem
authorTom Schuster <evilpies@gmail.com>
Wed, 15 Nov 2017 16:19:37 +0100
changeset 392007 8d8aeee2633fa78ac57eff45dfb28b585b54223a
parent 392006 261ebf2e8bbd7c4604c2c88607b27740532c7201
child 392008 6053c68a9bc63a2fcc6c1449e15cc0e85fa23279
push id32909
push usercbrindusan@mozilla.com
push dateWed, 15 Nov 2017 22:25:14 +0000
treeherdermozilla-central@f41930a869a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1319512
milestone59.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 1319512 - Adjust expression closure tests. r=jandem
js/src/jit-test/lib/syntax.js
js/src/jit-test/tests/asm.js/testBasic.js
js/src/jit-test/tests/basic/function-tosource-constructor.js
js/src/jit-test/tests/basic/function-tosource-exprbody.js
js/src/jit-test/tests/closures/flat-closure-2.js
js/src/jit-test/tests/closures/flat-closure-7.js
js/src/jit-test/tests/coverage/bug1378068.js
js/src/jit-test/tests/ion/bug1368360-1.js
js/src/jit-test/tests/ion/bug1368360-2.js
js/src/jit-test/tests/parser/bug-1298809.js
js/src/jit-test/tests/parser/expr-closure-warn.js
js/src/jit-test/tests/parser/modifier-semicolon-insertion.js
js/src/jit-test/tests/parser/yield-in-formal-destructuring.js
js/src/jit-test/tests/wasm/regress/savedframe-lookup-in-wasm.js
js/src/tests/js1_8/extensions/expclo.js
js/src/tests/js1_8/extensions/expclo2.js
js/src/tests/js1_8/regress/regress-384758.js
js/src/tests/js1_8_5/reflect-parse/expressionClosures.js
--- a/js/src/jit-test/lib/syntax.js
+++ b/js/src/jit-test/lib/syntax.js
@@ -1107,20 +1107,22 @@ function test_syntax(postfixes, check_er
   test_fun_arg("a ");
   test_fun_arg("... ");
   test_fun_arg("...a ");
 
   // ==== Legacy ====
 
   // Expression closures
 
-  test("function f() 1 ");
-  test("function f() 1; ");
-  test("(function () 1 ");
-  test("(function () 1); ");
+  if (getBuildConfiguration().release_or_beta) {
+    test("function f() 1 ");
+    test("function f() 1; ");
+    test("(function () 1 ");
+    test("(function () 1); ");
+  }
 
   // for each...in
 
   enableForEach();
   test("for each ");
   test("for each (");
   test("for each (x ");
   test("for each (x in ");
--- a/js/src/jit-test/tests/asm.js/testBasic.js
+++ b/js/src/jit-test/tests/asm.js/testBasic.js
@@ -1,27 +1,30 @@
 load(libdir + "asm.js");
 load(libdir + "asserts.js");
 
+if (getBuildConfiguration().release_or_beta) {
+    assertAsmTypeFail(USE_ASM + 'function f() 0');
+    assertAsmTypeFail(USE_ASM + 'function f() 0; return 0');
+    assertAsmTypeFail(USE_ASM + 'function f() 0; return f');
+}
+
 assertAsmTypeFail(USE_ASM);
 assertAsmTypeFail(USE_ASM + 'return');
-assertAsmTypeFail(USE_ASM + 'function f() 0');
 assertAsmTypeFail(USE_ASM + 'function f(){}');
 assertAsmTypeFail(USE_ASM + 'function f(){} return 0');
-assertAsmTypeFail(USE_ASM + 'function f() 0; return 0');
 assertAsmTypeFail(USE_ASM + 'function f(){} return g');
 assertAsmTypeFail(USE_ASM + 'function f(){} function f(){} return f');
 assertAsmTypeFail(USE_ASM + 'function f(){}; function g(){}; return {f, g}');
 assertAsmTypeFail(USE_ASM + 'var f = f;');
 assertAsmTypeFail(USE_ASM + 'var f=0; function f(){} return f');
 assertAsmTypeFail(USE_ASM + 'var f=glob.Math.imul; return {}');
 assertAsmTypeFail('glob', USE_ASM + 'var f=glob.Math.imul; function f(){} return f');
 assertAsmTypeFail('glob','foreign', USE_ASM + 'var f=foreign.foo; function f(){} return f');
 assertAsmTypeFail(USE_ASM + 'function f(){} var f=[f,f]; return f');
-assertAsmTypeFail(USE_ASM + 'function f() 0; return f');
 assertAsmTypeFail('"use strict";' + USE_ASM + 'function f() {} return f');
 assertAsmTypeFail(USE_ASM + '"use strict"; function f() {} return f');
 assertAsmTypeFail(USE_ASM + '"use foopy" + 1; function f() {} return f');
 assertAsmTypeFail(USE_ASM + 'function f() { "use strict"; } return f');
 assertEq(asmLink(asmCompile(USE_ASM + '"use asm"; function f() {} return f'))(), undefined);
 assertEq(asmLink(asmCompile(USE_ASM + '"use foopy"; function f() {} return f'))(), undefined);
 assertEq(asmLink(asmCompile(USE_ASM + '"use foopy"; "use blarg"; function f() {} return f'))(), undefined);
 assertEq(asmLink(asmCompile(USE_ASM + 'function f() { "use asm"; } return f'))(), undefined);
--- a/js/src/jit-test/tests/basic/function-tosource-constructor.js
+++ b/js/src/jit-test/tests/basic/function-tosource-constructor.js
@@ -5,10 +5,12 @@ assertEq(decompileFunction(f), f.toStrin
 f = Function("a", "...rest", "return rest[42] + b;");
 assertEq(f.toString(), "function anonymous(a,...rest\n) {\nreturn rest[42] + b;\n}");
 assertEq(f.toSource(), "(function anonymous(a,...rest\n) {\nreturn rest[42] + b;\n})")
 assertEq(decompileFunction(f), f.toString());
 f = Function("");
 assertEq(f.toString(), "function anonymous(\n) {\n\n}");
 f = Function("", "(abc)");
 assertEq(f.toString(), "function anonymous(\n) {\n(abc)\n}");
-f = Function("", "return function (a,b) a + b;")();
-assertEq(f.toString(), "function (a,b) a + b");
+if (getBuildConfiguration().release_or_beta) {
+    f = Function("", "return function (a,b) a + b;")();
+    assertEq(f.toString(), "function (a,b) a + b");
+}
--- a/js/src/jit-test/tests/basic/function-tosource-exprbody.js
+++ b/js/src/jit-test/tests/basic/function-tosource-exprbody.js
@@ -1,8 +1,10 @@
+if (getBuildConfiguration().release_or_beta)
+eval(`
 function f1(foo, bar) foo + bar;
 assertEq(f1.toString(), "function f1(foo, bar) foo + bar");
 assertEq(f1.toString(), f1.toSource());
 assertEq(decompileFunction(f1), f1.toString());
 // No semicolon on purpose
 function f2(foo, bar) foo + bar
 assertEq(f2.toString(), "function f2(foo, bar) foo + bar");
 assertEq(f2.toString(), f2.toSource());
@@ -24,8 +26,9 @@ long\
 string\
 test\
 '
 // a comment followed by some space
 
 
 assertEq(f7.toString(), "function (foo, bar) foo + bar + '\\\nlong\\\nstring\\\ntest\\\n'");
 assertEq(f7.toSource(), "(" + f7.toString() + ")");
+`);
--- a/js/src/jit-test/tests/closures/flat-closure-2.js
+++ b/js/src/jit-test/tests/closures/flat-closure-2.js
@@ -1,16 +1,16 @@
 // |jit-test| need-for-each
 
 actual = '';
 expected = 'nocrash,';
 
 let z = {};
 for (var i = 0; i < 4; ++i) {
     for each (var e in [{}, 1, {}]) {
-        +(function () z)();
+        +(function () { return z; })();
     }
 }
 
 appendToActual('nocrash')
 
 
 assertEq(actual, expected)
--- a/js/src/jit-test/tests/closures/flat-closure-7.js
+++ b/js/src/jit-test/tests/closures/flat-closure-7.js
@@ -1,15 +1,15 @@
 actual = '';
 expected = '0 0 0 0 0 0 0 0 0,';
 
     var o = [];
     for (var a = 0; a < 9; ++a) {
         var unused = 0;
         let zero = 0;
         for (var ee = 0; ee < 1; ++ee) {
-          o.push((function () zero)());
+          o.push((function () { return zero; })());
         }
     }
     appendToActual(o.join(" "));
 
 
 assertEq(actual, expected)
--- a/js/src/jit-test/tests/coverage/bug1378068.js
+++ b/js/src/jit-test/tests/coverage/bug1378068.js
@@ -1,8 +1,10 @@
+if (getBuildConfiguration().release_or_beta)
+eval(`
 m = {
     i() {},
     n() {},
     d() {},
     n() {},
     n() {},
     n() {},
     s() {}
@@ -34,8 +36,9 @@ function ()[{
 }, {
     n() {}
 }, {
     n() {}
 }];
 t = function () {};
 getLcovInfo();
 relazifyFunctions();
+`);
--- a/js/src/jit-test/tests/ion/bug1368360-1.js
+++ b/js/src/jit-test/tests/ion/bug1368360-1.js
@@ -1,9 +1,9 @@
 // |jit-test| error: ReferenceError
 var t = {};
-function r(y) t.y = y;
+function r(y) { return t.y = y; }
 function g() {
     for (let [x = r(x)] of x) {}
 }
 r(0);
 r(0);
 g();
--- a/js/src/jit-test/tests/ion/bug1368360-2.js
+++ b/js/src/jit-test/tests/ion/bug1368360-2.js
@@ -1,9 +1,9 @@
 // |jit-test| error: ReferenceError
 var t = {};
-function r(y) t.y = y;
+function r(y) { return t.y = y; }
 function g() {
     for (let [x = r(x)] in x) {}
 }
 r(0);
 r(0);
 g();
--- a/js/src/jit-test/tests/parser/bug-1298809.js
+++ b/js/src/jit-test/tests/parser/bug-1298809.js
@@ -1,6 +1,9 @@
-function f() {
-  if (0)
-    function g() x;
-  else;
+if (getBuildConfiguration().release_or_beta) {
+    eval(`
+    function f() {
+      if (0)
+        function g() { x };
+      else;
+    }
+    f();`)
 }
-f();
--- a/js/src/jit-test/tests/parser/expr-closure-warn.js
+++ b/js/src/jit-test/tests/parser/expr-closure-warn.js
@@ -2,16 +2,19 @@
 
 var release_or_beta = getBuildConfiguration().release_or_beta;
 
 function testWarn(code) {
   if (release_or_beta) {
     // Warning for expression closure is non-release-only (not Release/Beta).
     testPass(code);
     return;
+  } else {
+    // !!! expression closures are currently completely disabled in Nightly
+    return;
   }
 
   enableLastWarning();
   var g = newGlobal();
   g.code = code;
   g.eval('eval(code)');
   var warning = getLastWarning();
   assertEq(warning !== null, true, "warning should be caught for " + code);
--- a/js/src/jit-test/tests/parser/modifier-semicolon-insertion.js
+++ b/js/src/jit-test/tests/parser/modifier-semicolon-insertion.js
@@ -1,12 +1,8 @@
-Reflect.parse(`
-function a()f1()
-f2()
-`);
 Reflect.parse(`
 let a
 f2()
 `);
 Reflect.parse(`
 let a=1
 f2()
 `);
--- a/js/src/jit-test/tests/parser/yield-in-formal-destructuring.js
+++ b/js/src/jit-test/tests/parser/yield-in-formal-destructuring.js
@@ -1,1 +1,1 @@
-function d([{ [yield]: {} } ]) f
+function d([{ [yield]: {} } ]) { f }
--- a/js/src/jit-test/tests/wasm/regress/savedframe-lookup-in-wasm.js
+++ b/js/src/jit-test/tests/wasm/regress/savedframe-lookup-in-wasm.js
@@ -1,12 +1,12 @@
 g = newGlobal();
 g.parent = this;
 g.eval(`(function() {
-  Debugger(parent).onExceptionUnwind = function(frame) frame.eval("")
+  Debugger(parent).onExceptionUnwind = function(frame) { return frame.eval(""); }
 })()`);
 
 var module = new WebAssembly.Module(wasmTextToBinary(`
   (module (import $imp "" "inc") (func) (func $start (call $imp)) (start $start) (export "" $start))
 `));
 
 var imports = {
     "": {
--- a/js/src/tests/js1_8/extensions/expclo.js
+++ b/js/src/tests/js1_8/extensions/expclo.js
@@ -1,8 +1,9 @@
+// |reftest| skip-if(!release_or_beta)
 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
 /*
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/licenses/publicdomain/
  * Contributor: Brendan Eich
  */
 
 var summary = "Flat expression closure source coordinate fencepost test";
--- a/js/src/tests/js1_8/extensions/expclo2.js
+++ b/js/src/tests/js1_8/extensions/expclo2.js
@@ -1,8 +1,9 @@
+// |reftest| skip-if(!release_or_beta)
 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
 /*
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/licenses/publicdomain/
  * Contributor: Brendan Eich
  */
 
 var summary = "Partial flat expression closure upvar order test";
--- a/js/src/tests/js1_8/regress/regress-384758.js
+++ b/js/src/tests/js1_8/regress/regress-384758.js
@@ -1,8 +1,9 @@
+// |reftest| skip-if(!release_or_beta)
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //-----------------------------------------------------------------------------
 var BUGNUMBER = 384758;
 var summary = 'Statement can not follow expression closure with out intervening ;';
--- a/js/src/tests/js1_8_5/reflect-parse/expressionClosures.js
+++ b/js/src/tests/js1_8_5/reflect-parse/expressionClosures.js
@@ -1,9 +1,9 @@
-// |reftest| skip-if(!xulRuntime.shell)
+// |reftest| skip-if(!xulRuntime.shell||!release_or_beta)
 function test() {
 
 // expression closures
 
 assertDecl("function inc(x) (x + 1)", funDecl(ident("inc"), [ident("x")], binExpr("+", ident("x"), lit(1))));
 assertExpr("(function(x) (x+1))", funExpr(null, [ident("x")], binExpr("+", ident("x"), lit(1))));
 
 }