Bug 1317400 - Part 1.1: Remove a space after comma in parameter list for generated function source. r=till
authorTooru Fujisawa <arai_a@mac.com>
Sat, 04 Mar 2017 20:36:07 +0900
changeset 375040 2e84f5f909ff1d1bfa1a0dc864951079be59facd
parent 375039 dd076a9610d4ede1314d5d3f36870a68c6a1d322
child 375041 7397faeecc701270fd8f10d12bd0cc1efb7fc48c
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1317400
milestone54.0a1
Bug 1317400 - Part 1.1: Remove a space after comma in parameter list for generated function source. r=till
js/src/jit-test/tests/asm.js/testSource.js
js/src/jit-test/tests/basic/function-tosource-constructor.js
js/src/jit-test/tests/latin1/function.js
js/src/jsfun.cpp
js/src/tests/jstests.list
--- a/js/src/jit-test/tests/asm.js/testSource.js
+++ b/js/src/jit-test/tests/asm.js/testSource.js
@@ -162,24 +162,24 @@ var g = function g0(glob, ffi) {
 
 }
 
 var funcBody2 = funcBody.replace('function f2', 'function g0');
 assertEq(g.toString(), funcBody2);
 assertEq(g.toSource(), '(' + funcBody2 + ')');
 
 f2 = new Function('glob', 'ffi', bodyOnly);
-assertEq(f2.toString(), "function anonymous(glob, ffi\n) {\n" + bodyOnly + "\n}");
-assertEq(f2.toSource(), "(function anonymous(glob, ffi\n) {\n" + bodyOnly + "\n})");
+assertEq(f2.toString(), "function anonymous(glob,ffi\n) {\n" + bodyOnly + "\n}");
+assertEq(f2.toSource(), "(function anonymous(glob,ffi\n) {\n" + bodyOnly + "\n})");
 
 if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
     var m = new Function('glob', 'ffi', bodyOnly);
     assertEq(isAsmJSModuleLoadedFromCache(m), true);
-    assertEq(m.toString(), "function anonymous(glob, ffi\n) {\n" + bodyOnly + "\n}");
-    assertEq(m.toSource(), "(function anonymous(glob, ffi\n) {\n" + bodyOnly + "\n})");
+    assertEq(m.toString(), "function anonymous(glob,ffi\n) {\n" + bodyOnly + "\n}");
+    assertEq(m.toSource(), "(function anonymous(glob,ffi\n) {\n" + bodyOnly + "\n})");
 }
 
 })();
 
 
 (function() {
 /*
  * THREE ARGUMENTS
@@ -222,24 +222,24 @@ var g = function g0(glob, ffi, heap) {
 
 }
 
 funcBody2 = funcBody.replace('function f3', 'function g0');
 assertEq(g.toString(), funcBody2);
 assertEq(g.toSource(), '(' + funcBody2 + ')');
 
 f3 = new Function('glob', 'ffi', 'heap', bodyOnly);
-assertEq(f3.toString(), "function anonymous(glob, ffi, heap\n) {\n" + bodyOnly + "\n}");
-assertEq(f3.toSource(), "(function anonymous(glob, ffi, heap\n) {\n" + bodyOnly + "\n})");
+assertEq(f3.toString(), "function anonymous(glob,ffi,heap\n) {\n" + bodyOnly + "\n}");
+assertEq(f3.toSource(), "(function anonymous(glob,ffi,heap\n) {\n" + bodyOnly + "\n})");
 
 if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
     var m = new Function('glob', 'ffi', 'heap', bodyOnly);
     assertEq(isAsmJSModuleLoadedFromCache(m), true);
-    assertEq(m.toString(), "function anonymous(glob, ffi, heap\n) {\n" + bodyOnly + "\n}");
-    assertEq(m.toSource(), "(function anonymous(glob, ffi, heap\n) {\n" + bodyOnly + "\n})");
+    assertEq(m.toString(), "function anonymous(glob,ffi,heap\n) {\n" + bodyOnly + "\n}");
+    assertEq(m.toSource(), "(function anonymous(glob,ffi,heap\n) {\n" + bodyOnly + "\n})");
 }
 
 })();
 
 /* Modules in "use strict" context */
 (function() {
 
 var funcSource =
--- a/js/src/jit-test/tests/basic/function-tosource-constructor.js
+++ b/js/src/jit-test/tests/basic/function-tosource-constructor.js
@@ -1,14 +1,14 @@
 var f = Function("a", "b", "return a + b;");
-assertEq(f.toString(), "function anonymous(a, b\n) {\nreturn a + b;\n}");
-assertEq(f.toSource(), "(function anonymous(a, b\n) {\nreturn a + b;\n})");
+assertEq(f.toString(), "function anonymous(a,b\n) {\nreturn a + b;\n}");
+assertEq(f.toSource(), "(function anonymous(a,b\n) {\nreturn a + b;\n})");
 assertEq(decompileFunction(f), f.toString());
 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(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");
+f = Function("", "return function (a,b) a + b;")();
+assertEq(f.toString(), "function (a,b) a + b");
--- a/js/src/jit-test/tests/latin1/function.js
+++ b/js/src/jit-test/tests/latin1/function.js
@@ -1,16 +1,16 @@
 function test() {
     var arg1TwoByte = "arg1\u1200";
     var arg2Latin1 = "arg2";
 
     var bodyLatin1 = "return arg2 * 3";
 
     var f = Function(arg1TwoByte, arg2Latin1, bodyLatin1);
     assertEq(f(10, 20), 60);
-    assertEq(f.toSource().includes("arg1\u1200, arg2"), true);
+    assertEq(f.toSource().includes("arg1\u1200,arg2"), true);
 
     var bodyTwoByte = "return arg1\u1200 + arg2;";
     f = Function(arg1TwoByte, arg2Latin1, bodyTwoByte);
     assertEq(f(30, 40), 70);
-    assertEq(f.toSource().includes("arg1\u1200, arg2"), true);
+    assertEq(f.toSource().includes("arg1\u1200,arg2"), true);
 }
 test();
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -1681,17 +1681,17 @@ FunctionConstructor(JSContext* cx, const
                 return false;
 
             // Steps 9.b, 9.d.iii.
             if (!sb.append(str))
                  return false;
 
             if (i < args.length() - 2) {
                 // Step 9.d.iii.
-                if (!sb.append(", "))
+                if (!sb.append(","))
                     return false;
             }
         }
     }
 
     if (!sb.append('\n'))
         return false;
 
--- a/js/src/tests/jstests.list
+++ b/js/src/tests/jstests.list
@@ -348,48 +348,22 @@ skip script test262/built-ins/TypedArray
 skip script test262/built-ins/TypedArrays/no-args-proto-from-ctor-realm.js
 skip script test262/built-ins/TypedArrays/object-arg-proto-from-ctor-realm.js
 skip script test262/built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-custom-species-proto-from-ctor-realm.js
 skip script test262/built-ins/TypedArrays/typedarray-arg-proto-from-ctor-realm.js
 skip script test262/built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-custom-proto-from-ctor-realm.js
 skip script test262/built-ins/WeakMap/proto-from-ctor-realm.js
 skip script test262/built-ins/WeakSet/proto-from-ctor-realm.js
 
-# https://bugzilla.mozilla.org/show_bug.cgi?id=1317400
-skip script test262/built-ins/Function/prototype/toString/AsyncFunction.js
-skip script test262/built-ins/Function/prototype/toString/Function.js
-skip script test262/built-ins/Function/prototype/toString/GeneratorFunction.js
-skip script test262/built-ins/Function/prototype/toString/async-function-declaration.js
-skip script test262/built-ins/Function/prototype/toString/async-function-expression.js
-skip script test262/built-ins/Function/prototype/toString/async-method.js
+# https://bugzilla.mozilla.org/show_bug.cgi?id=1216630
 skip script test262/built-ins/Function/prototype/toString/class-declaration-complex-heritage.js
 skip script test262/built-ins/Function/prototype/toString/class-declaration-explicit-ctor.js
 skip script test262/built-ins/Function/prototype/toString/class-declaration-implicit-ctor.js
 skip script test262/built-ins/Function/prototype/toString/class-expression-explicit-ctor.js
 skip script test262/built-ins/Function/prototype/toString/class-expression-implicit-ctor.js
-skip script test262/built-ins/Function/prototype/toString/function-declaration-non-simple-parameter-list.js
-skip script test262/built-ins/Function/prototype/toString/function-declaration.js
-skip script test262/built-ins/Function/prototype/toString/function-expression.js
-skip script test262/built-ins/Function/prototype/toString/generator-function-declaration.js
-skip script test262/built-ins/Function/prototype/toString/generator-function-expression.js
-skip script test262/built-ins/Function/prototype/toString/generator-method.js
-skip script test262/built-ins/Function/prototype/toString/getter-class-static.js
-skip script test262/built-ins/Function/prototype/toString/getter-class.js
-skip script test262/built-ins/Function/prototype/toString/getter-object.js
-skip script test262/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js
-skip script test262/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js
-skip script test262/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js
-skip script test262/built-ins/Function/prototype/toString/method-class-static.js
-skip script test262/built-ins/Function/prototype/toString/method-class.js
-skip script test262/built-ins/Function/prototype/toString/method-computed-property-name.js
-skip script test262/built-ins/Function/prototype/toString/method-object.js
-skip script test262/built-ins/Function/prototype/toString/setter-class-static.js
-skip script test262/built-ins/Function/prototype/toString/setter-class.js
-skip script test262/built-ins/Function/prototype/toString/setter-object.js
-skip script test262/built-ins/Function/prototype/toString/unicode.js
 
 # https://bugzilla.mozilla.org/show_bug.cgi?id=1317397
 skip script test262/built-ins/RegExp/prototype/Symbol.search/lastindex-no-restore.js
 skip script test262/built-ins/RegExp/prototype/exec/failure-lastindex-no-access.js
 skip script test262/built-ins/RegExp/prototype/exec/success-lastindex-no-access.js
 
 # https://bugzilla.mozilla.org/show_bug.cgi?id=1317395
 skip script test262/built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js
@@ -554,8 +528,16 @@ skip script test262/built-ins/Date/proto
 skip script test262/built-ins/Date/prototype/setMonth/new-value-time-clip.js
 
 # ES2017: https://github.com/tc39/ecma262/pull/453
 skip script test262/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration-n.js
 
 # Expects TypeError, but RangeError thrown.
 skip script test262/built-ins/DataView/prototype/setFloat64/detached-buffer-after-toindex-byteoffset.js
 skip script test262/built-ins/DataView/prototype/setInt16/detached-buffer-after-toindex-byteoffset.js
+
+# Removed from the proposal: https://github.com/tc39/Function-prototype-toString-revision/issues/19
+skip script test262/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js
+skip script test262/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js
+skip script test262/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js
+
+# https://github.com/tc39/Function-prototype-toString-revision/issues/20
+skip script test262/built-ins/Function/prototype/toString/AsyncFunction.js