Bug 1108930 - Part 3: Call WeakMap with new. r=evilpie
authorTooru Fujisawa <arai_a@mac.com>
Thu, 05 Feb 2015 00:59:14 +0900
changeset 227477 e0d0cca6c17e08f6e2ec5e9e6abf0fbebe5ad51d
parent 227476 754f851ff0c87a8788339684b4cb3983a7bd0297
child 227478 65c74fc6e769c07901f04090a3d4fbffbddbc471
push id28230
push userryanvm@gmail.com
push dateWed, 04 Feb 2015 19:42:59 +0000
treeherdermozilla-central@3cda3997f45d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs1108930
milestone38.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 1108930 - Part 3: Call WeakMap with new. r=evilpie
js/src/jit-test/tests/collections/WeakMap-clear.js
js/src/jit-test/tests/collections/WeakMap-constructor-4.js
js/src/jit-test/tests/collections/WeakMap-constructor-5.js
js/src/jit-test/tests/collections/WeakMap-surfaces.js
js/src/jit-test/tests/debug/onNewScript-01.js
js/src/jit-test/tests/debug/onNewScript-02.js
js/src/tests/js1_8_5/extensions/weakmap.js
--- a/js/src/jit-test/tests/collections/WeakMap-clear.js
+++ b/js/src/jit-test/tests/collections/WeakMap-clear.js
@@ -1,10 +1,10 @@
 var key = {};
-var wm = WeakMap();
+var wm = new WeakMap();
 
 assertEq(wm.has(key), false);
 // Clearing an already empty WeakMap
 wm.clear();
 assertEq(wm.has(key), false);
 
 // Clearing a WeakMap with a live key
 wm.set(key, 42);
--- a/js/src/jit-test/tests/collections/WeakMap-constructor-4.js
+++ b/js/src/jit-test/tests/collections/WeakMap-constructor-4.js
@@ -1,6 +1,6 @@
-// WeakMap(x) throws if x is not iterable (unless x is undefined).
+// new WeakMap(x) throws if x is not iterable (unless x is undefined).
 
 load(libdir + "asserts.js");
 var nonIterables = [true, 1, -0, 3.14, NaN, {}, Math, this];
 for (let k of nonIterables)
     assertThrowsInstanceOf(function () { new WeakMap(k); }, TypeError);
--- a/js/src/jit-test/tests/collections/WeakMap-constructor-5.js
+++ b/js/src/jit-test/tests/collections/WeakMap-constructor-5.js
@@ -1,23 +1,23 @@
-// WeakMap(arr) throws if arr contains holes (or undefined values).
+// new WeakMap(arr) throws if arr contains holes (or undefined values).
 
 load(libdir + "asserts.js");
 
 var k1 = {};
 var v1 = 42;
 var k2 = {};
 var v2 = 43;
 var k3 = {};
 var v3 = {};
 
 assertThrowsInstanceOf(function () { new WeakMap([undefined]); }, TypeError);
 assertThrowsInstanceOf(function () { new WeakMap([null]); }, TypeError);
 assertThrowsInstanceOf(function () { new WeakMap([[k1, v1], [k2, v2], , [k3, k3]]); }, TypeError);
 assertThrowsInstanceOf(function () { new WeakMap([[k1, v1], [k2, v2], ,]); }, TypeError);
 
-// WeakMap(iterable) throws if iterable doesn't have array-like objects
+// new WeakMap(iterable) throws if iterable doesn't have array-like objects
 
 assertThrowsInstanceOf(function () { new WeakMap([1, 2, 3]); }, TypeError);
 assertThrowsInstanceOf(function () {
   let s = new Set([1, 2, "abc"]);
   new WeakMap(s);
 }, TypeError);
--- a/js/src/jit-test/tests/collections/WeakMap-surfaces.js
+++ b/js/src/jit-test/tests/collections/WeakMap-surfaces.js
@@ -7,18 +7,17 @@ assertEq(desc.writable, true);
 
 assertEq(typeof WeakMap, 'function');
 assertEq(Object.keys(WeakMap).length, 0);
 assertEq(WeakMap.length, 1);
 assertEq(WeakMap.name, "WeakMap");
 
 assertEq(Object.getPrototypeOf(WeakMap.prototype), Object.prototype);
 assertEq(Object.prototype.toString.call(WeakMap.prototype), "[object WeakMap]");
-assertEq(Object.prototype.toString.call(new WeakMap), "[object WeakMap]");
-assertEq(Object.prototype.toString.call(WeakMap()), "[object WeakMap]");
+assertEq(Object.prototype.toString.call(new WeakMap()), "[object WeakMap]");
 assertEq(Object.keys(WeakMap.prototype).join(), "");
 assertEq(WeakMap.prototype.constructor, WeakMap);
 
 function checkMethod(name, arity) { 
     var desc = Object.getOwnPropertyDescriptor(WeakMap.prototype, name);
     assertEq(desc.enumerable, false);
     assertEq(desc.configurable, true);
     assertEq(desc.writable, true);
--- a/js/src/jit-test/tests/debug/onNewScript-01.js
+++ b/js/src/jit-test/tests/debug/onNewScript-01.js
@@ -1,13 +1,13 @@
 // Basic newScript hook tests.
 
 var g = newGlobal();
 var dbg = Debugger(g);
-var seen = WeakMap();
+var seen = new WeakMap();
 var hits = 0;
 dbg.onNewScript = function (s) {
     // Exceptions thrown from onNewScript are swept under the rug, but they
     // will at least prevent hits from being the expected number.
     assertEq(s instanceof Debugger.Script, true);
     assertEq(!seen.has(s), true);
     seen.set(s, true);
     hits++;
--- a/js/src/jit-test/tests/debug/onNewScript-02.js
+++ b/js/src/jit-test/tests/debug/onNewScript-02.js
@@ -1,13 +1,13 @@
 // Creating a new script with any number of subscripts triggers the newScript hook exactly once.
 
 var g = newGlobal();
 var dbg = Debugger(g);
-var seen = WeakMap();
+var seen = new WeakMap();
 var hits;
 dbg.onNewScript = function (s) {
     assertEq(s instanceof Debugger.Script, true);
     assertEq(!seen.has(s), true);
     seen.set(s, true);
     hits++;
 };
 
--- a/js/src/tests/js1_8_5/extensions/weakmap.js
+++ b/js/src/tests/js1_8_5/extensions/weakmap.js
@@ -75,17 +75,17 @@ function test()
         } catch (x) {
             thrown = true;
         }
 
         check(function() thrown, todo);
     }
 
     var key = {};
-    var map = WeakMap();
+    var map = new WeakMap();
 
     check(function() !map.has(key));
     map.set(key, 42);
     check(function() map.get(key) == 42);
     check(function() typeof map.get({}) == "undefined");
     check(function() map.get({}, "foo") == "foo");
 
     gc(); gc(); gc();