Bug 883377 - Part 4: Fix existing tests. r=jandem
authorTooru Fujisawa <arai_a@mac.com>
Sat, 03 Dec 2016 07:44:22 +0900
changeset 325134 67447b2f92944a6a1eaaa06026c9f1d670a8946c
parent 325133 d85f460926f103fec2c319e5524c0c03c853b534
child 325135 a182612850f93496d6e1a4d753fd0e61fc1581c8
push id84606
push userarai_a@mac.com
push dateFri, 02 Dec 2016 22:51:40 +0000
treeherdermozilla-inbound@deb743b033b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs883377
milestone53.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 883377 - Part 4: Fix existing tests. r=jandem
js/src/jit-test/tests/basic/constructor-name.js
js/src/jit-test/tests/basic/functionnames.js
js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
js/src/jit-test/tests/saved-stacks/function-display-name.js
js/src/jit-test/tests/self-test/assertDeepEq.js
js/src/tests/ecma_2017/AsyncFunctions/BoundNames.js
js/src/tests/ecma_5/extensions/error-tostring-function.js
js/src/tests/ecma_6/Class/className.js
js/src/tests/ecma_6/Object/accessor-name.js
--- a/js/src/jit-test/tests/basic/constructor-name.js
+++ b/js/src/jit-test/tests/basic/constructor-name.js
@@ -12,17 +12,17 @@ function makeInstance() {
 function makeObject() {
   let object = {};
   return object;
 }
 
 let tests = [
   { name: "Ctor",                     object: new Ctor        },
   { name: "nested.Ctor",              object: new nested.Ctor },
-  { name: "makeInstance/LexicalCtor", object: makeInstance()  },
+  { name: "LexicalCtor",              object: makeInstance()  },
   { name: null,                       object: {}              },
   { name: null,                       object: nested.object   },
   { name: null,                       object: makeObject()    },
 ];
 
 for (let { name, object } of tests) {
   assertEq(getConstructorName(object), name);
 }
--- a/js/src/jit-test/tests/basic/functionnames.js
+++ b/js/src/jit-test/tests/basic/functionnames.js
@@ -35,46 +35,46 @@ assertName(Bar, 'Bar');
 var Foo = function (){
     assertName(arguments.callee, 'Foo<')
     return function(){};
 }();
 assertName(Foo, 'Foo</<');
 
 /* various properties and such */
 var x = {fox: { bax: function(){} } };
-assertName(x.fox.bax, 'x.fox.bax');
+assertName(x.fox.bax, 'bax');
 var foo = {foo: {foo: {}}};
 foo.foo.foo = function(){};
 assertName(foo.foo.foo, 'foo.foo.foo');
 var z = {
     foz: function() {
              var baz = function() {
                  var y = {bay: function() {}};
-                 assertName(y.bay, 'z.foz/baz/y.bay');
+                 assertName(y.bay, 'bay');
              };
-             assertName(baz, 'z.foz/baz');
+             assertName(baz, 'baz');
              baz();
          }
 };
-assertName(z.foz, 'z.foz');
+assertName(z.foz, 'foz');
 z.foz();
 
 var outer = function() {
     x.fox.bax.nx = function(){};
     var w = {fow: { baw: function(){} } };
     assertName(x.fox.bax.nx, 'outer/x.fox.bax.nx')
-    assertName(w.fow.baw, 'outer/w.fow.baw');
+    assertName(w.fow.baw, 'baw');
 };
 assertName(outer, 'outer');
 outer();
 function Fuz(){};
 Fuz.prototype = {
   add: function() {}
 }
-assertName(Fuz.prototype.add, 'Fuz.prototype.add');
+assertName(Fuz.prototype.add, 'add');
 
 var x = 1;
 x = function(){};
 assertName(x, 'x');
 
 var a = {b: {}};
 a.b.c = (function() {
     assertName(arguments.callee, 'a.b.c<')
@@ -89,39 +89,39 @@ a.b();
 var bar = 'bar';
 a.b[bar] = function(){};
 assertName(a.b.bar, 'a.b[bar]');
 
 a.b = function() {
     assertName(arguments.callee, 'a.b<');
     return { a: function() {} }
 }();
-assertName(a.b.a, 'a.b</<.a');
+assertName(a.b.a, 'a');
 
 a = {
     b: function(a) {
         if (a)
             return function() {};
         else
             return function() {};
     }
 };
-assertName(a.b, 'a.b');
-assertName(a.b(true), 'a.b/<')
-assertName(a.b(false), 'a.b/<')
+assertName(a.b, 'b');
+assertName(a.b(true), 'b/<')
+assertName(a.b(false), 'b/<')
 
 function f(g) {
     assertName(g, 'x<');
     return g();
 }
 var x = f(function () { return function() {}; });
 assertName(x, 'x</<');
 
 var a = {'b': function(){}};
-assertName(a.b, 'a.b');
+assertName(a.b, 'b');
 
 function g(f) {
   assertName(f, '');
 }
 label: g(function () {});
 
 var z = [function() {}];
 assertName(z[0], 'z<');
@@ -133,25 +133,25 @@ a = { 1: function () {} };
 assertName(a[1], 'a[1]');
 
 a = {
   "embedded spaces": function(){},
   "dots.look.like.property.references": function(){},
   "\"\'quotes\'\"": function(){},
   "!@#$%": function(){}
 };
-assertName(a["embedded spaces"], 'a["embedded spaces"]');
-assertName(a["dots.look.like.property.references"], 'a["dots.look.like.property.references"]');
-assertName(a["\"\'quotes\'\""], 'a["\\\"\'quotes\'\\\""]');
-assertName(a["!@#$%"], 'a["!@#$%"]');
+assertName(a["embedded spaces"], 'embedded spaces');
+assertName(a["dots.look.like.property.references"], 'dots.look.like.property.references');
+assertName(a["\"\'quotes\'\""], '"\'quotes\'"');
+assertName(a["!@#$%"], '!@#$%');
 
 a.b = {};
 a.b.c = {};
 a.b["c"]["d e"] = { f: { 1: { "g": { "h i": function() {} } } } };
-assertName(a.b.c["d e"].f[1].g["h i"], 'a.b.c["d e"].f[1].g["h i"]');
+assertName(a.b.c["d e"].f[1].g["h i"], 'h i');
 
 this.m = function () {};
 assertName(m, "this.m");
 
 function N() {
   this.o = function () {}
 }
 let n = new N()
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
@@ -19,17 +19,17 @@ root.eval(
   function makeObject() {
     let object = {};
     return object;
   }
 
   this.tests = [
     { name: "Ctor",                     fn: () => new Ctor             },
     { name: "nested.Ctor",              fn: () => new nested.Ctor      },
-    { name: "makeInstance/LexicalCtor", fn: () => makeInstance()       },
+    { name: "LexicalCtor",              fn: () => makeInstance()       },
     { name: null,                       fn: () => ({})                 },
     { name: null,                       fn: () => (nested.object = {}) },
     { name: null,                       fn: () => makeObject()         },
   ];
   `
 );
 
 for (let { name, fn } of root.tests) {
--- a/js/src/jit-test/tests/saved-stacks/function-display-name.js
+++ b/js/src/jit-test/tests/saved-stacks/function-display-name.js
@@ -1,15 +1,14 @@
 // Test the functionDisplayName of SavedFrame instances.
 
 function uno() { return dos(); }
 const dos = () => tres.quattro();
-const tres = {
-  quattro: () => saveStack()
-};
+let tres = {};
+tres.quattro = () => saveStack()
 
 const frame = uno();
 
 assertEq(frame.functionDisplayName, "tres.quattro");
 assertEq(frame.parent.functionDisplayName, "dos");
 assertEq(frame.parent.parent.functionDisplayName, "uno");
 assertEq(frame.parent.parent.parent.functionDisplayName, null);
 
--- a/js/src/jit-test/tests/self-test/assertDeepEq.js
+++ b/js/src/jit-test/tests/self-test/assertDeepEq.js
@@ -72,17 +72,18 @@ assertNotDeepEq(p, q);
 assertNotDeepEq(q, p);
 q.prop = 1;
 assertDeepEq(q, p);
 
 // functions
 assertNotDeepEq(() => 1, () => 2);
 assertNotDeepEq((...x) => 1, x => 1);
 assertNotDeepEq(function f(){}, function g(){});
-var f1 = function () {}, f2 = function () {};
+// Avoid setting name property.
+var [f1, f2] = [function () {}, function () {}];
 assertDeepEq(f1, f1);
 assertDeepEq(f1, f2);  // same text, close enough
 f1.prop = 1;
 assertNotDeepEq(f1, f2);
 f2.prop = 1;
 assertDeepEq(f1, f2);
 
 // recursion
--- a/js/src/tests/ecma_2017/AsyncFunctions/BoundNames.js
+++ b/js/src/tests/ecma_2017/AsyncFunctions/BoundNames.js
@@ -5,17 +5,17 @@ print(BUGNUMBER + ": " + summary);
 
 async function test() {}
 assertEq(test.name, "test");
 
 var test2 = (async function test2() {});
 assertEq(test2.name, "test2");
 
 var anon = async function() {};
-assertEq(anon.name, "");
+assertEq(anon.name, "anon");
 
 if (typeof Reflect !== "undefined" && Reflect.parse) {
   var tree = Reflect.parse("export default async function() {}", { target: "module" });
   assertEq(tree.body[0].declaration.id.name, "*default*");
 }
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_5/extensions/error-tostring-function.js
+++ b/js/src/tests/ecma_5/extensions/error-tostring-function.js
@@ -22,24 +22,24 @@ function ErrorToString(v)
 // extension-land test.
 
 assertEq(ErrorToString(function f(){}), "f");
 assertEq(ErrorToString(function g(){}), "g");
 assertEq(ErrorToString(function(){}), "");
 
 var fn1 = function() {};
 fn1.message = "ohai";
-assertEq(ErrorToString(fn1), "ohai");
+assertEq(ErrorToString(fn1), "fn1: ohai");
 
 var fn2 = function blerch() {};
 fn2.message = "fnord";
 assertEq(ErrorToString(fn2), "blerch: fnord");
 
 var fn3 = function() {};
 fn3.message = "";
-assertEq(ErrorToString(fn3), "");
+assertEq(ErrorToString(fn3), "fn3");
 
 /******************************************************************************/
 
 if (typeof reportCompare === "function")
   reportCompare(true, true);
 
 print("Tests complete!");
--- a/js/src/tests/ecma_6/Class/className.js
+++ b/js/src/tests/ecma_6/Class/className.js
@@ -169,61 +169,63 @@ let ExtendedExpr3 = class ExtendedExpr3 
 testName(ExtendedExpr3, undefined, false, false, true);
 delete ExtendedExpr3.name;
 testName(ExtendedExpr3, "base", false, false, false);
 
 // ---- anonymous ----
 
 // Anonymous class expressions don't get name properties unless specified in a
 // static manner.
-let Anon = class {
+// Use property assignment to avoid setting name property.
+let tmp = {};
+let Anon = tmp.value = class {
     constructor() {}
 };
 testName(Anon, "", false, false, false);
 
-let AnonDefault = class { };
+let AnonDefault = tmp.value = class { };
 testName(AnonDefault, "", false, false, false);
 
-let AnonWithGetter = class {
+let AnonWithGetter = tmp.value = class {
     constructor() {}
     static get name() { return "base"; }
 };
 testName(AnonWithGetter, "base", false, true, false);
 
-let AnonWithSetter = class {
+let AnonWithSetter = tmp.value = class {
     constructor() {}
     static set name(v) {}
 };
 testName(AnonWithSetter, undefined, false, false, true);
 
-let AnonWithGetterSetter = class {
+let AnonWithGetterSetter = tmp.value = class {
     constructor() {}
     static get name() { return "base"; }
     static set name(v) {}
 };
 testName(AnonWithGetterSetter, "base", false, true, true);
 
 
-let ExtendedAnon1 = class extends Anon {
+let ExtendedAnon1 = tmp.value = class extends Anon {
     constructor() {}
 };
 testName(ExtendedAnon1, "", false, false, false);
 
-let ExtendedAnonDefault = class extends Anon { };
+let ExtendedAnonDefault = tmp.value = class extends Anon { };
 testName(ExtendedAnonDefault, "", false, false, false);
 
-let ExtendedAnon2 = class extends AnonWithGetterSetter {
+let ExtendedAnon2 = tmp.value = class extends AnonWithGetterSetter {
     constructor() {}
     static get name() { return "extend"; }
 };
 testName(ExtendedAnon2, "extend", false, true, false);
 delete ExtendedAnon2.name;
 testName(ExtendedAnon2, "base", false, false, false);
 
-let ExtendedAnon3 = class extends AnonWithGetterSetter {
+let ExtendedAnon3 = tmp.value = class extends AnonWithGetterSetter {
     constructor() {}
     static set name(v) {}
 };
 testName(ExtendedAnon3, undefined, false, false, true);
 delete ExtendedAnon3.name;
 testName(ExtendedAnon3, "base", false, false, false);
 
 // ---- mixed ----
--- a/js/src/tests/ecma_6/Object/accessor-name.js
+++ b/js/src/tests/ecma_6/Object/accessor-name.js
@@ -22,15 +22,14 @@ assertEq(name(o, "a", false), "set a");
 o = {get 123() { }, set 123(v) {}}
 assertEq(name(o, "123", true), "get 123");
 assertEq(name(o, "123", false), "set 123");
 
 o = {get case() { }, set case(v) {}}
 assertEq(name(o, "case", true), "get case");
 assertEq(name(o, "case", false), "set case");
 
-// Congratulations on implementing these!
-assertEq(name({get ["a"]() {}}, "a", true), "");
-assertEq(name({get [123]() {}}, "123", true), "");
-assertEq(name({set ["a"](v) {}}, "a", false), "");
-assertEq(name({set [123](v) {}}, "123", false), "");
+assertEq(name({get ["a"]() {}}, "a", true), "get a");
+assertEq(name({get [123]() {}}, "123", true), "get 123");
+assertEq(name({set ["a"](v) {}}, "a", false), "set a");
+assertEq(name({set [123](v) {}}, "123", false), "set 123");
 
 reportCompare(true, true);