Bug 1108930 - Part 1: Call Map with new. r=evilpie
authorTooru Fujisawa <arai_a@mac.com>
Thu, 05 Feb 2015 00:59:13 +0900
changeset 227475 a24ebc65b9650846d92ff65cd9a1b4e3ac8ea1dc
parent 227474 921109cf8981f8f665ee8d91689f492d12ba5795
child 227476 754f851ff0c87a8788339684b4cb3983a7bd0297
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 1: Call Map with new. r=evilpie
js/src/jit-test/tests/basic/bug808483.js
js/src/jit-test/tests/basic/spread-array.js
js/src/jit-test/tests/basic/spread-call-funapply.js
js/src/jit-test/tests/basic/spread-call-length.js
js/src/jit-test/tests/basic/spread-call.js
js/src/jit-test/tests/collections/Map-clear-1.js
js/src/jit-test/tests/collections/Map-clear-2.js
js/src/jit-test/tests/collections/Map-clear-3.js
js/src/jit-test/tests/collections/Map-clear-4.js
js/src/jit-test/tests/collections/Map-clear-5.js
js/src/jit-test/tests/collections/Map-clear-6.js
js/src/jit-test/tests/collections/Map-clear-gc.js
js/src/jit-test/tests/collections/Map-clear-iterators-1.js
js/src/jit-test/tests/collections/Map-clear-iterators-2.js
js/src/jit-test/tests/collections/Map-constructor-1.js
js/src/jit-test/tests/collections/Map-constructor-2.js
js/src/jit-test/tests/collections/Map-constructor-3.js
js/src/jit-test/tests/collections/Map-constructor-4.js
js/src/jit-test/tests/collections/Map-constructor-5.js
js/src/jit-test/tests/collections/Map-constructor-duplicates.js
js/src/jit-test/tests/collections/Map-constructor-generator-1.js
js/src/jit-test/tests/collections/Map-constructor-generator-2.js
js/src/jit-test/tests/collections/Map-constructor-generator-3.js
js/src/jit-test/tests/collections/Map-constructor-generator-exception.js
js/src/jit-test/tests/collections/Map-delete-size.js
js/src/jit-test/tests/collections/Map-iterator-1.js
js/src/jit-test/tests/collections/Map-iterator-2.js
js/src/jit-test/tests/collections/Map-iterator-add-1.js
js/src/jit-test/tests/collections/Map-iterator-add-2.js
js/src/jit-test/tests/collections/Map-iterator-add-remove.js
js/src/jit-test/tests/collections/Map-iterator-order.js
js/src/jit-test/tests/collections/Map-iterator-pairs-1.js
js/src/jit-test/tests/collections/Map-iterator-pairs-2.js
js/src/jit-test/tests/collections/Map-iterator-pairs-3.js
js/src/jit-test/tests/collections/Map-iterator-proxies-1.js
js/src/jit-test/tests/collections/Map-iterator-proxies-2.js
js/src/jit-test/tests/collections/Map-iterator-remove-1.js
js/src/jit-test/tests/collections/Map-iterator-remove-2.js
js/src/jit-test/tests/collections/Map-iterator-remove-3.js
js/src/jit-test/tests/collections/Map-iterator-remove-4.js
js/src/jit-test/tests/collections/Map-iterator-remove-5.js
js/src/jit-test/tests/collections/Map-iterator-remove-6.js
js/src/jit-test/tests/collections/Map-iterators-3.js
js/src/jit-test/tests/collections/Map-set-size.js
js/src/jit-test/tests/collections/Map-size.js
js/src/jit-test/tests/collections/Map-surfaces-1.js
js/src/jit-test/tests/collections/Map-values-1.js
js/src/jit-test/tests/collections/Map-values-2.js
js/src/jit-test/tests/collections/Set-iterator-proxies-2.js
js/src/jit-test/tests/collections/constructor-errors.js
js/src/jit-test/tests/collections/iterator-gc.js
js/src/jit-test/tests/collections/iterator-proto-1.js
js/src/jit-test/tests/collections/iterator-proto-2.js
js/src/jit-test/tests/collections/iterator-proto-surfaces.js
js/src/jit-test/tests/structured-clone/Map-Set-cross-compartment.js
js/src/tests/ecma_6/shell.js
--- a/js/src/jit-test/tests/basic/bug808483.js
+++ b/js/src/jit-test/tests/basic/bug808483.js
@@ -1,12 +1,12 @@
 pSandbox = newGlobal();
 evalcx("\
     x = ArrayBuffer;\
-    y = Map();\
+    y = new Map();\
     x += 1;\
     w = x;\
     x += '0';\
     z = x;\
 ", pSandbox);
 evalcx("\
     x + '0';\
 ", pSandbox);
--- a/js/src/jit-test/tests/basic/spread-array.js
+++ b/js/src/jit-test/tests/basic/spread-array.js
@@ -15,17 +15,17 @@ assertEqArray([...[1, 2, 3],,,,...[]], [
 
 assertEqArray([...[undefined]], [undefined]);
 
 // other iterable objects
 assertEqArray([...new Int32Array([1, 2, 3])], [1, 2, 3]);
 assertEqArray([..."abc"], ["a", "b", "c"]);
 assertEqArray([...[1, 2, 3][Symbol.iterator]()], [1, 2, 3]);
 assertEqArray([...Set([1, 2, 3])], [1, 2, 3]);
-assertEqArray([...Map([["a", "A"], ["b", "B"], ["c", "C"]])].map(([k, v]) => k + v), ["aA", "bB", "cC"]);
+assertEqArray([...new Map([["a", "A"], ["b", "B"], ["c", "C"]])].map(([k, v]) => k + v), ["aA", "bB", "cC"]);
 let itr = {};
 itr[Symbol.iterator] = function () {
     return {
         i: 1,
         next: function() {
             if (this.i < 4)
                 return { value: this.i++, done: false };
             else
--- a/js/src/jit-test/tests/basic/spread-call-funapply.js
+++ b/js/src/jit-test/tests/basic/spread-call-funapply.js
@@ -76,13 +76,13 @@ function checkRest(f) {
   assertEqArray(f.apply(null, ...[[]]), []);
   assertEqArray(f.apply(null, ...[[1]]), [1]);
   assertEqArray(f.apply(null, ...[[1, 2]]), [1, 2]);
   assertEqArray(f.apply(null, ...[[1, 2, 3, 4]]), [1, 2, 3, 4]);
 
   assertEqArray(f.apply(null, ...[[undefined]]), [undefined]);
 
   // other iterable objects
-  assertEqArray(f.apply(null, ...Map([[["a", "A"], ["b", "B"]]])).map(([k, v]) => k + v), ["aA", "bB"]);
+  assertEqArray(f.apply(null, ...new Map([[["a", "A"], ["b", "B"]]])).map(([k, v]) => k + v), ["aA", "bB"]);
 }
 
 checkRest(function(...x) x);
 checkRest((...x) => x);
--- a/js/src/jit-test/tests/basic/spread-call-length.js
+++ b/js/src/jit-test/tests/basic/spread-call-length.js
@@ -18,17 +18,17 @@ function checkLength(f, makeFn) {
 
   assertEq(makeFn("...[undefined]")(f), 1);
 
   // other iterable objects
   assertEq(makeFn("...arg")(f, new Int32Array([1, 2, 3])), 3);
   assertEq(makeFn("...arg")(f, "abc"), 3);
   assertEq(makeFn("...arg")(f, [1, 2, 3][Symbol.iterator]()), 3);
   assertEq(makeFn("...arg")(f, Set([1, 2, 3])), 3);
-  assertEq(makeFn("...arg")(f, Map([["a", "A"], ["b", "B"], ["c", "C"]])), 3);
+  assertEq(makeFn("...arg")(f, new Map([["a", "A"], ["b", "B"], ["c", "C"]])), 3);
   let itr = {};
   itr[Symbol.iterator] = function() {
       return {
           i: 1,
           next: function() {
               if (this.i < 4)
                   return { value: this.i++, done: false };
               else
--- a/js/src/jit-test/tests/basic/spread-call.js
+++ b/js/src/jit-test/tests/basic/spread-call.js
@@ -13,17 +13,17 @@ function checkCommon(f, makeFn) {
   assertEqArray(makeFn("1, ...[2, 3]")(f), [1, 2, 3]);
   assertEqArray(makeFn("1, ...[], 2, 3")(f), [1, 2, 3]);
 
   // other iterable objects
   assertEqArray(makeFn("...arg")(f, new Int32Array([1, 2, 3])), [1, 2, 3]);
   assertEqArray(makeFn("...arg")(f, "abc"), ["a", "b", "c"]);
   assertEqArray(makeFn("...arg")(f, [1, 2, 3][Symbol.iterator]()), [1, 2, 3]);
   assertEqArray(makeFn("...arg")(f, Set([1, 2, 3])), [1, 2, 3]);
-  assertEqArray(makeFn("...arg")(f, Map([["a", "A"], ["b", "B"], ["c", "C"]])).map(([k, v]) => k + v), ["aA", "bB", "cC"]);
+  assertEqArray(makeFn("...arg")(f, new Map([["a", "A"], ["b", "B"], ["c", "C"]])).map(([k, v]) => k + v), ["aA", "bB", "cC"]);
   let itr = {};
   itr[Symbol.iterator] = function() {
       return {
           i: 1,
           next: function() {
               if (this.i < 4)
                   return { value: this.i++, done: false };
               else
--- a/js/src/jit-test/tests/collections/Map-clear-1.js
+++ b/js/src/jit-test/tests/collections/Map-clear-1.js
@@ -1,8 +1,8 @@
 // Clearing an empty Map has no effect.
 
-var m = Map();
+var m = new Map();
 for (var i = 0; i < 2; i++) {
     m.clear();
     assertEq(m.size, 0);
     assertEq(m.has(undefined), false);
 }
--- a/js/src/jit-test/tests/collections/Map-clear-2.js
+++ b/js/src/jit-test/tests/collections/Map-clear-2.js
@@ -1,11 +1,11 @@
 // Clearing a Map removes its entries; the Map remains usable afterwards.
 
-var m = Map([["a", "b"], ["b", "c"]]);
+var m = new Map([["a", "b"], ["b", "c"]]);
 assertEq(m.size, 2);
 m.clear();
 assertEq(m.size, 0);
 assertEq(m.has("a"), false);
 assertEq(m.get("a"), undefined);
 assertEq(m.delete("a"), false);
 assertEq(m.has("b"), false);
 for (var pair of m)
--- a/js/src/jit-test/tests/collections/Map-clear-3.js
+++ b/js/src/jit-test/tests/collections/Map-clear-3.js
@@ -1,10 +1,10 @@
 // Clearing a Map with a nontrivial number of elements works.
 
-var m = Map();
+var m = new Map();
 for (var i = 0; i < 100; i++)
     m.set(i, i);
 assertEq(m.size, i);
 m.clear();
 assertEq(m.size, 0);
 m.set("a", 1);
 assertEq(m.get("a"), 1);
--- a/js/src/jit-test/tests/collections/Map-clear-4.js
+++ b/js/src/jit-test/tests/collections/Map-clear-4.js
@@ -1,10 +1,10 @@
 // Clearing a Map after deleting some entries works.
 
-var m = Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]);
+var m = new Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]);
 for (var [k, v] of m)
     if (k !== "c")
         m.delete(k);
 m.clear();
 assertEq(m.size, 0);
 assertEq(m.has("c"), false);
 assertEq(m.has("d"), false);
--- a/js/src/jit-test/tests/collections/Map-clear-5.js
+++ b/js/src/jit-test/tests/collections/Map-clear-5.js
@@ -1,12 +1,12 @@
 // Map.clear is unaffected by deleting/monkeypatching Map.prototype.{delete,iterator}.
 
 var data = [["a", 1], ["b", 2]];
-var m1 = Map(data), m2 = Map(data);
+var m1 = new Map(data), m2 = new Map(data);
 
 delete Map.prototype.delete;
 delete Map.prototype.iterator;
 m1.clear();
 assertEq(m1.size, 0);
 
 Map.prototype.delete = function () { throw "FAIL"; };
 Map.prototype.iterator = function () { throw "FAIL"; };
--- a/js/src/jit-test/tests/collections/Map-clear-6.js
+++ b/js/src/jit-test/tests/collections/Map-clear-6.js
@@ -1,6 +1,6 @@
 // Clearing a Map doesn't affect expando properties.
 
-var m = Map();
+var m = new Map();
 m.x = 3;
 m.clear();
 assertEq(m.x, 3);
--- a/js/src/jit-test/tests/collections/Map-clear-gc.js
+++ b/js/src/jit-test/tests/collections/Map-clear-gc.js
@@ -1,13 +1,13 @@
 // Clearing a Map removes any strong references to its keys and values.
 
 load(libdir + "referencesVia.js");
 
-var m = Map();
+var m = new Map();
 var k = {}, v = {};
 m.set(k, v);
 assertEq(referencesVia(m, "key", k), true);
 assertEq(referencesVia(m, "value", v), true);
 m.clear();
 if (typeof findReferences == 'function') {
     assertEq(referencesVia(m, "key", k), false);
     assertEq(referencesVia(m, "value", v), false);
--- a/js/src/jit-test/tests/collections/Map-clear-iterators-1.js
+++ b/js/src/jit-test/tests/collections/Map-clear-iterators-1.js
@@ -1,23 +1,23 @@
 // A Map iterator does not visit entries removed by clear().
 
 load(libdir + "iteration.js");
 
-var m = Map();
+var m = new Map();
 var it = m[Symbol.iterator]();
 m.clear();
 assertIteratorDone(it, undefined);
 
-m = Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]);
+m = new Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]);
 it = m[Symbol.iterator]();
 assertIteratorNext(it, ["a", 1]);
 m.clear();
 assertIteratorDone(it, undefined);
 
 var log = "";
-m = Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]);
+m = new Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]);
 for (var [k, v] of m) {
     log += k + v;
     if (k == "b")
         m.clear();
 }
 assertEq(log, "a1b2");
--- a/js/src/jit-test/tests/collections/Map-clear-iterators-2.js
+++ b/js/src/jit-test/tests/collections/Map-clear-iterators-2.js
@@ -1,12 +1,12 @@
 // A Map iterator continues to visit entries added after a clear().
 
 load(libdir + "asserts.js");
 load(libdir + "iteration.js");
 
-var m = Map([["a", 1]]);
+var m = new Map([["a", 1]]);
 var it = m[Symbol.iterator]();
 assertIteratorNext(it, ["a", 1]);
 m.clear();
 m.set("b", 2);
 assertIteratorNext(it, ["b", 2]);
 assertIteratorDone(it, undefined);
--- a/js/src/jit-test/tests/collections/Map-constructor-1.js
+++ b/js/src/jit-test/tests/collections/Map-constructor-1.js
@@ -1,7 +1,8 @@
 // The Map constructor creates an empty Map by default.
 
-assertEq(Map().size, 0);
-assertEq((new Map).size, 0);
-assertEq(Map(undefined).size, 0);
-assertEq(new Map(undefined).size, 0);
-assertEq(new Map(null).size, 0);
+var m = new Map();
+assertEq(m.size, 0);
+m = new Map(undefined);
+assertEq(m.size, 0);
+m = new Map(null);
+assertEq(m.size, 0);
--- a/js/src/jit-test/tests/collections/Map-constructor-2.js
+++ b/js/src/jit-test/tests/collections/Map-constructor-2.js
@@ -1,6 +1,6 @@
 // The Map constructor can take an argument that is an array of pairs.
 
 var arr = [["zero", 0], ["one", 1], ["two", 2]];
-var m = Map(arr);
+var m = new Map(arr);
 for (var [k, v] of arr)
     assertEq(m.get(k), v);
--- a/js/src/jit-test/tests/collections/Map-constructor-3.js
+++ b/js/src/jit-test/tests/collections/Map-constructor-3.js
@@ -1,9 +1,9 @@
 // Map can take an argument that is an array of singleton arrays.
 
 var arr = [["a"], ["b"], ["c"]];
-var m = Map(arr);
+var m = new Map(arr);
 assertEq(m.size, 3);
 for (var [k, _] of arr) {
     assertEq(m.has(k), true);
     assertEq(m.get(k), undefined);
 }
--- a/js/src/jit-test/tests/collections/Map-constructor-4.js
+++ b/js/src/jit-test/tests/collections/Map-constructor-4.js
@@ -1,6 +1,6 @@
-// Map(x) throws if x is not iterable (unless x is undefined).
+// new Map(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 () { Map(k); }, TypeError);
+    assertThrowsInstanceOf(function () { new Map(k); }, TypeError);
--- a/js/src/jit-test/tests/collections/Map-constructor-5.js
+++ b/js/src/jit-test/tests/collections/Map-constructor-5.js
@@ -1,15 +1,15 @@
-// Map(arr) throws if arr contains holes (or undefined values).
+// new Map(arr) throws if arr contains holes (or undefined values).
 
 load(libdir + "asserts.js");
-assertThrowsInstanceOf(function () { Map([undefined]); }, TypeError);
-assertThrowsInstanceOf(function () { Map([null]); }, TypeError);
-assertThrowsInstanceOf(function () { Map([[0, 0], [1, 1], , [3, 3]]); }, TypeError);
-assertThrowsInstanceOf(function () { Map([[0, 0], [1, 1], ,]); }, TypeError);
+assertThrowsInstanceOf(function () { new Map([undefined]); }, TypeError);
+assertThrowsInstanceOf(function () { new Map([null]); }, TypeError);
+assertThrowsInstanceOf(function () { new Map([[0, 0], [1, 1], , [3, 3]]); }, TypeError);
+assertThrowsInstanceOf(function () { new Map([[0, 0], [1, 1], ,]); }, TypeError);
 
-// Map(iterable) throws if iterable doesn't have array-like objects
+// new Map(iterable) throws if iterable doesn't have array-like objects
 
-assertThrowsInstanceOf(function () { Map([1, 2, 3]); }, TypeError);
+assertThrowsInstanceOf(function () { new Map([1, 2, 3]); }, TypeError);
 assertThrowsInstanceOf(function () {
 	let s = new Set([1, 2, "abc"]);
 	new Map(s);
 }, TypeError);
--- a/js/src/jit-test/tests/collections/Map-constructor-duplicates.js
+++ b/js/src/jit-test/tests/collections/Map-constructor-duplicates.js
@@ -1,8 +1,8 @@
 // When the argument to Map contains a key multiple times, the last value is retained.
 
 var arg = [["zero", 7], ["one", 1], ["two", 4], ["zero", 8], ["two", 2], ["zero", 0]];
-var m = Map(arg);
+var m = new Map(arg);
 assertEq(m.get("zero"), 0);
 assertEq(m.get("one"), 1);
 assertEq(m.get("two"), 2);
 assertEq(m.size, 3);
--- a/js/src/jit-test/tests/collections/Map-constructor-generator-1.js
+++ b/js/src/jit-test/tests/collections/Map-constructor-generator-1.js
@@ -5,15 +5,15 @@ function data(n) {
     var s = '';
     for (var i = 0; i < n; i++) {
         yield [s, i];
         s += '.';
     }
     done = true;
 }
 
-var m = Map(data(50));
+var m = new Map(data(50));
 assertEq(done, true);  // the constructor consumes the argument
 assertEq(m.size, 50);
 assertEq(m.get(""), 0);
 assertEq(m.get("....."), 5);
 assertEq(m.get(Array(49+1).join(".")), 49);
 assertEq(m.has(undefined), false);
--- a/js/src/jit-test/tests/collections/Map-constructor-generator-2.js
+++ b/js/src/jit-test/tests/collections/Map-constructor-generator-2.js
@@ -1,8 +1,8 @@
 // The argument to Map can be a generator-expression.
 
 var arr = [1, 2, "green", "red"];
-var m = Map([v, v] for (v of arr));
+var m = new Map([v, v] for (v of arr));
 assertEq(m.size, 4);
 
 for (var i = 0; i < 4; i++)
     assertEq(m.get(arr[i]), arr[i]);
--- a/js/src/jit-test/tests/collections/Map-constructor-generator-3.js
+++ b/js/src/jit-test/tests/collections/Map-constructor-generator-3.js
@@ -1,8 +1,10 @@
 // The argument to Map may be a generator-iterator that produces no values.
 
-assertEq(Map(x for (x of [])).size, 0);
+var m = new Map(x for (x of []));
+assertEq(m.size, 0);
 
 function none() {
     if (0) yield 0;
 }
-assertEq(Map(none()).size, 0);
+m = new Map(none());
+assertEq(m.size, 0);
--- a/js/src/jit-test/tests/collections/Map-constructor-generator-exception.js
+++ b/js/src/jit-test/tests/collections/Map-constructor-generator-exception.js
@@ -4,9 +4,9 @@ load(libdir + "asserts.js");
 
 function data2() {
     yield [{}, "XR22/Z"];
     yield [{}, "23D-BN"];
     throw "oops";
 }
 
 var it = data2();
-assertThrowsValue(function () { Map(it); }, "oops");
+assertThrowsValue(function () { new Map(it); }, "oops");
--- a/js/src/jit-test/tests/collections/Map-delete-size.js
+++ b/js/src/jit-test/tests/collections/Map-delete-size.js
@@ -1,11 +1,11 @@
 // map.delete(k) decrements the map size iff an entry was actually removed.
 
-var m = Map();
+var m = new Map();
 m.delete(3);
 assertEq(m.size, 0);
 m.set({}, 'ok');
 m.set(Math, 'ok');
 assertEq(m.size, 2);
 m.delete({});
 assertEq(m.size, 2);
 m.delete(Math);
--- a/js/src/jit-test/tests/collections/Map-iterator-1.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-1.js
@@ -1,11 +1,11 @@
 // for-of can be used to iterate over a Map twice.
 
-var map = Map([['a', 0], ['b', 1], ['c', 2]]);
+var map = new Map([['a', 0], ['b', 1], ['c', 2]]);
 var log = '';
 
 for (let i = 0; i < 2; i++) {
     for (let [k, v] of map)
         log += k + v;
     log += ';'
 }
 assertEq(log, 'a0b1c2;a0b1c2;');
--- a/js/src/jit-test/tests/collections/Map-iterator-2.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-2.js
@@ -1,11 +1,11 @@
 // Nested for-of loops can iterate over a Map.
 
-var map = Map([['a', 0], ['b', 1]]);
+var map = new Map([['a', 0], ['b', 1]]);
 var log = '';
 for (let [k0, v0] of map) {
     log += k0 + v0 + ':'
     for (let [k1, v1] of map)
         log += k1 + v1;
     log += ';'
 };
 assertEq(log, 'a0:a0b1;b1:a0b1;');
--- a/js/src/jit-test/tests/collections/Map-iterator-add-1.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-add-1.js
@@ -1,11 +1,11 @@
 // map.iterator() is live: entries added during iteration are visited.
 
-var map = Map();
+var map = new Map();
 function force(k) {
     if (!map.has(k) && k >= 0)
         map.set(k, k - 1);
 }
 force(5);
 var log = '';
 for (let [k, v] of map) {
     log += k + ';';
--- a/js/src/jit-test/tests/collections/Map-iterator-add-2.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-add-2.js
@@ -1,10 +1,10 @@
 // A Map iterator does not iterate over new entries added after it throws StopIteration.
 
 load(libdir + "iteration.js");
 
-var map = Map();
+var map = new Map();
 var iter0 = map[Symbol.iterator](), iter1 = map[Symbol.iterator]();
 assertIteratorDone(iter0, undefined);  // closes iter0
 map.set(1, 2);
 assertIteratorDone(iter0, undefined);  // already closed
 assertIteratorNext(iter1, [1, 2]);     // was not yet closed
--- a/js/src/jit-test/tests/collections/Map-iterator-add-remove.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-add-remove.js
@@ -1,11 +1,11 @@
 // Removing and re-adding entries while an iterator is live causes the iterator to visit them again.
 
-var map = Map([['a', 1]]);
+var map = new Map([['a', 1]]);
 var n = 5;
 for (let [k, v] of map) {
     assertEq(k, 'a');
     assertEq(v, 1);
     if (n === 0)
         break;
     map.delete('a');
     map.set('a', 1);
--- a/js/src/jit-test/tests/collections/Map-iterator-order.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-order.js
@@ -1,13 +1,13 @@
 // Map iterators produces entries in the order they were inserted.
 
 load(libdir + "eqArrayHelper.js");
 
-var map = Map();
+var map = new Map();
 for (var i = 7; i !== 1; i = i * 7 % 1117)
     map.set("" + i, i);
 assertEq(map.size, 557);
 
 i = 7;
 for (var pair of map) {
     assertEqArray(pair, ["" + i, i]);
     i = i * 7 % 1117;
--- a/js/src/jit-test/tests/collections/Map-iterator-pairs-1.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-pairs-1.js
@@ -1,14 +1,14 @@
 // mapiter.next() returns an actual array.
 
 load(libdir + "iteration.js");
 
 var key = {};
-var map = Map([[key, 'value']]);
+var map = new Map([[key, 'value']]);
 var entry = map[Symbol.iterator]().next().value;
 assertEq(Array.isArray(entry), true);
 assertEq(Object.getPrototypeOf(entry), Array.prototype);
 assertEq(Object.isExtensible(entry), true);
 
 assertEq(entry.length, 2);
 var names = Object.getOwnPropertyNames(entry).sort();
 assertEq(names.length, 3);
--- a/js/src/jit-test/tests/collections/Map-iterator-pairs-2.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-pairs-2.js
@@ -1,13 +1,13 @@
 // mapiter.next() returns a fresh array each time.
 
 load(libdir + "iteration.js");
 
-var map = Map([['a', 1], ['b', 2]]);
+var map = new Map([['a', 1], ['b', 2]]);
 var iter = map[Symbol.iterator]();
 var a = iter.next(), b = iter.next();
 assertIteratorResult(a, ['a', 1], false);
 assertIteratorResult(b, ['b', 2], false);
 assertEq(a.value !== b.value, true);
 var a1 = map[Symbol.iterator]();
 assertIteratorNext(a1, ['a', 1]);
 assertEq(a.value !== a1.value, true);
--- a/js/src/jit-test/tests/collections/Map-iterator-pairs-3.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-pairs-3.js
@@ -1,13 +1,13 @@
 // Modifying an array returned by mapiter.next() does not modify the Map.
 
 load(libdir + "iteration.js");
 
-var map = Map([['a', 1]]);
+var map = new Map([['a', 1]]);
 var res = map[Symbol.iterator]().next();
 assertIteratorResult(res, ['a', 1], false);
 res.value[0] = 'b';
 res.value[1] = 2;
 assertIteratorResult(res, ['b', 2], false);
 assertEq(map.get('a'), 1);
 assertEq(map.has('b'), false);
 assertEq(map.size, 1);
--- a/js/src/jit-test/tests/collections/Map-iterator-proxies-1.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-proxies-1.js
@@ -1,8 +1,8 @@
 // for-of works on a cross-compartment wrapper of a Map.
 
 var g = newGlobal();
-var mw = g.eval("Map([['a', 1], ['b', 2]])");
+var mw = g.eval("new Map([['a', 1], ['b', 2]])");
 var log = '';
 for (let [k, v] of mw)
     log += k + v;
 assertEq(log, "a1b2");
--- a/js/src/jit-test/tests/collections/Map-iterator-proxies-2.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-proxies-2.js
@@ -4,18 +4,18 @@ load(libdir + "asserts.js");
 load(libdir + "eqArrayHelper.js");
 load(libdir + "iteration.js");
 
 var g = newGlobal();
 
 var iterator_fn = Map.prototype[Symbol.iterator];
 assertThrowsInstanceOf(function () { iterator_fn.call({}); }, TypeError);
 assertThrowsInstanceOf(function () { iterator_fn.call(Set()); }, TypeError);
-var mapw = g.eval("Map([['x', 1], ['y', 2]])");
+var mapw = g.eval("new Map([['x', 1], ['y', 2]])");
 assertEqArray(iterator_fn.call(mapw).next().value, ["x", 1]);
 
-var next_fn = Map()[Symbol.iterator]().next;
+var next_fn = (new Map())[Symbol.iterator]().next;
 assertThrowsInstanceOf(function () { next_fn.call({}); }, TypeError);
 assertThrowsInstanceOf(function () { next_fn.call(Set()[Symbol.iterator]()); }, TypeError);
 var iterw = mapw[Symbol.iterator]();
 assertEqArray(next_fn.call(iterw).value, ["x", 1]);
 assertEqArray(next_fn.call(iterw).value, ["y", 2]);
 assertEq(next_fn.call(iterw).done, true);
--- a/js/src/jit-test/tests/collections/Map-iterator-remove-1.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-remove-1.js
@@ -1,13 +1,13 @@
 // A map iterator can cope with removing the current entry.
 
 function test(pairs) {
     print(uneval(pairs));
-    var map = Map(pairs);
+    var map = new Map(pairs);
     
     var all_keys = '';
     var false_keys = '';
     for (let [k, v] of map) {
         all_keys += k;
         if (!v)
             false_keys += k;
     }
--- a/js/src/jit-test/tests/collections/Map-iterator-remove-2.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-remove-2.js
@@ -1,13 +1,13 @@
 // A map iterator can cope with removing the next entry.
 
 load(libdir + "iteration.js");
 
-var map = Map([['a', 0], ['b', 1], ['c', 2], ['d', 3]]);
+var map = new Map([['a', 0], ['b', 1], ['c', 2], ['d', 3]]);
 var iter = map[Symbol.iterator]();
 var log = '';
 for (let [k, v] of iter) {
     log += k + v;
     if (k === 'b')
         map.delete('c');
 }
 assertEq(log, 'a0b1d3');
--- a/js/src/jit-test/tests/collections/Map-iterator-remove-3.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-remove-3.js
@@ -1,13 +1,13 @@
 // A map iterator can cope with removing the next entry, then the current entry.
 
 load(libdir + "asserts.js");
 load(libdir + "iteration.js");
 
-var map = Map([['a', 0], ['b', 1], ['c', 2], ['d', 3]]);
+var map = new Map([['a', 0], ['b', 1], ['c', 2], ['d', 3]]);
 var iter = map[Symbol.iterator]();
 assertIteratorNext(iter, ['a', 0]);
 assertIteratorNext(iter, ['b', 1]);
 map.delete('c');
 map.delete('b');
 assertIteratorNext(iter, ['d', 3]);
 assertIteratorDone(iter, undefined);
--- a/js/src/jit-test/tests/collections/Map-iterator-remove-4.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-remove-4.js
@@ -1,14 +1,14 @@
 // Multiple live iterators on the same Map can cope with removing entries.
 
 load(libdir + "iteration.js");
 
 // Make a map.
-var map = Map();
+var map = new Map();
 var SIZE = 7;
 for (var j = 0; j < SIZE; j++)
     map.set(j, j);
 
 // Make lots of iterators pointing to entry 2 of the map.
 var NITERS = 5;
 var iters = [];
 for (var i = 0; i < NITERS; i++) {
--- a/js/src/jit-test/tests/collections/Map-iterator-remove-5.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-remove-5.js
@@ -1,12 +1,12 @@
 // Removing a Map entry already visited by an iterator does not cause any
 // entries to be skipped.
 
-var map = Map();
+var map = new Map();
 for (var i = 0; i < 20; i++)
     map.set(String.fromCharCode('A'.charCodeAt(0) + i), i);
 
 var log = '';
 for (var [k, v] of map) {
     log += k;
     if (v % 5 === 4) {
         // Delete all entries preceding this one.
--- a/js/src/jit-test/tests/collections/Map-iterator-remove-6.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-remove-6.js
@@ -1,15 +1,15 @@
 // Removing many Map entries does not cause a live iterator to skip any of the
 // entries that were not removed. (Compacting a Map must not be observable to
 // script.)
 
 load(libdir + "iteration.js");
 
-var map = Map();
+var map = new Map();
 for (var i = 0; i < 32; i++)
     map.set(i, i);
 var iter = map[Symbol.iterator]();
 assertIteratorNext(iter, [0, 0]);
 for (var i = 0; i < 30; i++)
     map.delete(i);
 assertEq(map.size, 2);
 for (var i = 32; i < 100; i++)
--- a/js/src/jit-test/tests/collections/Map-iterators-3.js
+++ b/js/src/jit-test/tests/collections/Map-iterators-3.js
@@ -1,10 +1,10 @@
 // A closed Map iterator does not visit new entries added after a clear().
 
 load(libdir + "iteration.js");
 
-var m = Map();
+var m = new Map();
 var it = m[Symbol.iterator]();
 assertIteratorDone(it, undefined);  // close the iterator
 m.clear();
 m.set("a", 1);
 assertIteratorDone(it, undefined);  // iterator still closed
--- a/js/src/jit-test/tests/collections/Map-set-size.js
+++ b/js/src/jit-test/tests/collections/Map-set-size.js
@@ -1,11 +1,11 @@
 // map.set(k, v) increments the map size iff map didn't already have an entry for k.
 
-var m = Map();
+var m = new Map();
 m.set('a', 0);
 assertEq(m.size, 1);
 m.set('a', 0);
 assertEq(m.size, 1);
 m.set('a', undefined);
 assertEq(m.size, 1);
 
 m.set('b', 2);
--- a/js/src/jit-test/tests/collections/Map-size.js
+++ b/js/src/jit-test/tests/collections/Map-size.js
@@ -1,6 +1,6 @@
 // Each Map has its own size.
 
-var m1 = Map(), m2 = Map();
+var m1 = new Map(), m2 = new Map();
 m1.set("x", 3);
 assertEq(m1.size, 1);
 assertEq(m2.size, 0);
--- a/js/src/jit-test/tests/collections/Map-surfaces-1.js
+++ b/js/src/jit-test/tests/collections/Map-surfaces-1.js
@@ -9,18 +9,17 @@ assertEq(desc.writable, true);
 
 assertEq(typeof Map, 'function');
 assertEq(Object.keys(Map).length, 0);
 assertEq(Map.length, 1);
 assertEq(Map.name, "Map");
 
 assertEq(Object.getPrototypeOf(Map.prototype), Object.prototype);
 assertEq(Object.prototype.toString.call(Map.prototype), "[object Map]");
-assertEq(Object.prototype.toString.call(new Map), "[object Map]");
-assertEq(Object.prototype.toString.call(Map()), "[object Map]");
+assertEq(Object.prototype.toString.call(new Map()), "[object Map]");
 assertEq(Object.keys(Map.prototype).join(), "");
 assertEq(Map.prototype.constructor, Map);
 
 function checkMethod(name, arity) { 
     var desc = Object.getOwnPropertyDescriptor(Map.prototype, name);
     assertEq(desc.enumerable, false);
     assertEq(desc.configurable, true);
     assertEq(desc.writable, true);
--- a/js/src/jit-test/tests/collections/Map-values-1.js
+++ b/js/src/jit-test/tests/collections/Map-values-1.js
@@ -1,11 +1,11 @@
 // map.keys(), .values(), and .entries() on an empty map produce empty iterators.
 
-var m = Map();
+var m = new Map();
 var ki = m.keys(), vi = m.values(), ei = m.entries();
 var p = Object.getPrototypeOf(ki)
 assertEq(Object.getPrototypeOf(vi), p);
 assertEq(Object.getPrototypeOf(ei), p);
 
 for (let k of ki)
     throw "FAIL";
 for (let v of vi)
--- a/js/src/jit-test/tests/collections/Map-values-2.js
+++ b/js/src/jit-test/tests/collections/Map-values-2.js
@@ -1,15 +1,15 @@
 // map.keys() and map.values() return iterators over the key or the value,
 // respectively, of each key-value pair in the map.
 
 load(libdir + "iteration.js");
 
 var data = [["one", 1], ["two", 2], ["three", 3], ["four", 4]];
-var m = Map(data);
+var m = new Map(data);
 
 var ki = m.keys();
 assertIteratorNext(ki, "one");
 assertIteratorNext(ki, "two");
 assertIteratorNext(ki, "three");
 assertIteratorNext(ki, "four");
 assertIteratorDone(ki, undefined);
 
--- a/js/src/jit-test/tests/collections/Set-iterator-proxies-2.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-proxies-2.js
@@ -2,19 +2,19 @@
 
 load(libdir + "asserts.js");
 load(libdir + "iteration.js");
 
 var g = newGlobal();
 
 var iterator_fn = Set.prototype[Symbol.iterator];
 assertThrowsInstanceOf(function () { iterator_fn.call({}); }, TypeError);
-assertThrowsInstanceOf(function () { iterator_fn.call(Map()); }, TypeError);
+assertThrowsInstanceOf(function () { iterator_fn.call(new Map()); }, TypeError);
 var setw = g.eval("Set(['x', 'y'])");
 assertIteratorNext(iterator_fn.call(setw), "x");
 
 var next_fn = Set()[Symbol.iterator]().next;
 assertThrowsInstanceOf(function () { next_fn.call({}); }, TypeError);
-assertThrowsInstanceOf(function () { next_fn.call(Map()[Symbol.iterator]()); }, TypeError);
+assertThrowsInstanceOf(function () { next_fn.call((new Map())[Symbol.iterator]()); }, TypeError);
 var iterw = setw[Symbol.iterator]();
 assertIteratorResult(next_fn.call(iterw), "x", false);
 assertIteratorResult(next_fn.call(iterw), "y", false);
 assertIteratorResult(next_fn.call(iterw), undefined, true);
--- a/js/src/jit-test/tests/collections/constructor-errors.js
+++ b/js/src/jit-test/tests/collections/constructor-errors.js
@@ -13,10 +13,10 @@ var misc = [
     {iterator: function () { return undefined; }},
     {iterator: function () { return null; }},
     {iterator: function () { return true; }},
     {iterator: function () { return 17; }},
 ];
 
 for (var v of misc) {
     assertThrowsInstanceOf(function () { Set(v); }, TypeError);
-    assertThrowsInstanceOf(function () { Map(v); }, TypeError);
+    assertThrowsInstanceOf(function () { new Map(v); }, TypeError);
 }
\ No newline at end of file
--- a/js/src/jit-test/tests/collections/iterator-gc.js
+++ b/js/src/jit-test/tests/collections/iterator-gc.js
@@ -6,11 +6,11 @@ load(libdir + "referencesVia.js");
 var key = {};
 
 function test(obj, edgeName) {
     var iter = obj[Symbol.iterator]();
     referencesVia(iter, "**UNKNOWN SLOT 0**", obj);
     referencesVia(obj, edgeName, key);
 }
 
-test([key],                 "element[0]");
-test(Map([[key, 'value']]), "key");
-test(Set([key]),            "key");
+test([key],                     "element[0]");
+test(new Map([[key, 'value']]), "key");
+test(Set([key]),                "key");
--- a/js/src/jit-test/tests/collections/iterator-proto-1.js
+++ b/js/src/jit-test/tests/collections/iterator-proto-1.js
@@ -6,10 +6,10 @@ load(libdir + "iteration.js");
 function test(obj0, obj1) {
     var iter0 = obj0[Symbol.iterator](), iter1 = obj1[Symbol.iterator]();
     var proto = Object.getPrototypeOf(iter0);
     assertEq(Object.getPrototypeOf(iter1), proto);
     assertEq(Object.getPrototypeOf(proto), Iterator.prototype);
 }
 
 test([], [1]);
-test(Map(), Map([[1, 1]]));
+test(new Map(), new Map([[1, 1]]));
 test(Set(), Set([1]));
--- a/js/src/jit-test/tests/collections/iterator-proto-2.js
+++ b/js/src/jit-test/tests/collections/iterator-proto-2.js
@@ -1,13 +1,13 @@
 // Iterators of different collection types have different prototypes.
 
 load(libdir + "iteration.js");
 
 var aproto = Object.getPrototypeOf(Array()[Symbol.iterator]());
-var mproto = Object.getPrototypeOf(Map()[Symbol.iterator]());
+var mproto = Object.getPrototypeOf((new Map())[Symbol.iterator]());
 var sproto = Object.getPrototypeOf(Set()[Symbol.iterator]());
 assertEq(aproto !== mproto, true);
 assertEq(aproto !== sproto, true);
 assertEq(mproto !== sproto, true);
 assertEq(aproto.next !== mproto.next, true);
 assertEq(aproto.next !== sproto.next, true);
 assertEq(mproto.next !== sproto.next, true);
--- a/js/src/jit-test/tests/collections/iterator-proto-surfaces.js
+++ b/js/src/jit-test/tests/collections/iterator-proto-surfaces.js
@@ -1,15 +1,15 @@
 // Iterator prototype surfaces.
 
 load(libdir + "asserts.js");
 load(libdir + "iteration.js");
 
 function test(constructor) {
-    var proto = Object.getPrototypeOf(constructor()[Symbol.iterator]());
+    var proto = Object.getPrototypeOf(new constructor()[Symbol.iterator]());
     var names = Object.getOwnPropertyNames(proto);
     names.sort();
     assertDeepEq(names, ['next']);
     assertEq(proto.hasOwnProperty(Symbol.iterator), true);
 
     var desc = Object.getOwnPropertyDescriptor(proto, 'next');
     assertEq(desc.configurable, true);
     assertEq(desc.enumerable, false);
--- a/js/src/jit-test/tests/structured-clone/Map-Set-cross-compartment.js
+++ b/js/src/jit-test/tests/structured-clone/Map-Set-cross-compartment.js
@@ -1,8 +1,8 @@
 /*
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/licenses/publicdomain/
  */
 
 // Don't crash
 serialize(evalcx("Set(['x', 'y'])"));
-serialize(evalcx("Map([['x', 1]])"));
+serialize(evalcx("new Map([['x', 1]])"));
--- a/js/src/tests/ecma_6/shell.js
+++ b/js/src/tests/ecma_6/shell.js
@@ -145,18 +145,18 @@ if (typeof assertDeepEq === 'undefined')
                         if (Object_hasOwnProperty(db, "value"))
                             throw Error_("got accessor property, expected data property" + pmsg);
                         check(da.get, db.get, at(pmsg, ".[[Get]]"));
                         check(da.set, db.set, at(pmsg, ".[[Set]]"));
                     }
                 }
             };
 
-            var ab = Map_();
-            var bpath = Map_();
+            var ab = new Map_();
+            var bpath = new Map_();
 
             function check(a, b, path) {
                 if (typeof a === "symbol") {
                     // Symbols are primitives, but they have identity.
                     // Symbol("x") !== Symbol("x") but
                     // assertDeepEq(Symbol("x"), Symbol("x")) should pass.
                     if (typeof b !== "symbol") {
                         throw Error_("got " + uneval_(a) + ", expected " + uneval_(b) + " " + path);