Bug 1108930 - Part 2: Call Set with new. r=evilpie
authorTooru Fujisawa <arai_a@mac.com>
Thu, 05 Feb 2015 00:59:14 +0900
changeset 227454 754f851ff0c87a8788339684b4cb3983a7bd0297
parent 227453 a24ebc65b9650846d92ff65cd9a1b4e3ac8ea1dc
child 227455 e0d0cca6c17e08f6e2ec5e9e6abf0fbebe5ad51d
push id55126
push userarai_a@mac.com
push dateWed, 04 Feb 2015 16:00:49 +0000
treeherdermozilla-inbound@2c896a4f15ae [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 2: Call Set with new. r=evilpie
js/src/jit-test/lib/census.js
js/src/jit-test/tests/auto-regress/bug771027.js
js/src/jit-test/tests/basic/bug797496.js
js/src/jit-test/tests/basic/spread-array.js
js/src/jit-test/tests/basic/spread-call-eval.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-iterator-proxies-2.js
js/src/jit-test/tests/collections/Set-add-size.js
js/src/jit-test/tests/collections/Set-clear-1.js
js/src/jit-test/tests/collections/Set-clear-2.js
js/src/jit-test/tests/collections/Set-clear-3.js
js/src/jit-test/tests/collections/Set-clear-4.js
js/src/jit-test/tests/collections/Set-clear-5.js
js/src/jit-test/tests/collections/Set-clear-6.js
js/src/jit-test/tests/collections/Set-clear-gc.js
js/src/jit-test/tests/collections/Set-clear-iterators-1.js
js/src/jit-test/tests/collections/Set-clear-iterators-2.js
js/src/jit-test/tests/collections/Set-clear-iterators-3.js
js/src/jit-test/tests/collections/Set-constructor-1.js
js/src/jit-test/tests/collections/Set-constructor-2.js
js/src/jit-test/tests/collections/Set-constructor-3.js
js/src/jit-test/tests/collections/Set-constructor-generator-1.js
js/src/jit-test/tests/collections/Set-constructor-generator-2.js
js/src/jit-test/tests/collections/Set-delete-size.js
js/src/jit-test/tests/collections/Set-iterator-1.js
js/src/jit-test/tests/collections/Set-iterator-2.js
js/src/jit-test/tests/collections/Set-iterator-3.js
js/src/jit-test/tests/collections/Set-iterator-add-1.js
js/src/jit-test/tests/collections/Set-iterator-add-2.js
js/src/jit-test/tests/collections/Set-iterator-add-remove.js
js/src/jit-test/tests/collections/Set-iterator-gc-1.js
js/src/jit-test/tests/collections/Set-iterator-gc-2.js
js/src/jit-test/tests/collections/Set-iterator-gc-3.js
js/src/jit-test/tests/collections/Set-iterator-order.js
js/src/jit-test/tests/collections/Set-iterator-proxies-1.js
js/src/jit-test/tests/collections/Set-iterator-proxies-2.js
js/src/jit-test/tests/collections/Set-iterator-remove-1.js
js/src/jit-test/tests/collections/Set-iterator-remove-2.js
js/src/jit-test/tests/collections/Set-iterator-remove-3.js
js/src/jit-test/tests/collections/Set-iterator-remove-4.js
js/src/jit-test/tests/collections/Set-iterator-remove-5.js
js/src/jit-test/tests/collections/Set-iterator-remove-6.js
js/src/jit-test/tests/collections/Set-size.js
js/src/jit-test/tests/collections/Set-surfaces-1.js
js/src/jit-test/tests/collections/Set-values-1.js
js/src/jit-test/tests/collections/Set-values-2.js
js/src/jit-test/tests/collections/WeakSet-constructor.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/gc/bug-880816.js
js/src/jit-test/tests/generators/bug908920.js
js/src/jit-test/tests/structured-clone/Map-Set-cross-compartment.js
--- a/js/src/jit-test/lib/census.js
+++ b/js/src/jit-test/lib/census.js
@@ -77,17 +77,17 @@ const Census = {};
   //   |prop| which is present in the basis with value |value|.
   //
   // - extra(prop): Called when the subject has a property named |prop|, but the
   //   basis has no such property. This should return a walker that can check
   //   the subject's value.
   function makeBasisChecker({compare, missing, extra}) {
     return function makeWalker(basis) {
       if (typeof basis === 'object') {
-        var unvisited = Set(Object.getOwnPropertyNames(basis));
+        var unvisited = new Set(Object.getOwnPropertyNames(basis));
         return {
           enter: prop => {
             unvisited.delete(prop);
             if (prop in basis) {
               return makeWalker(basis[prop]);
             } else {
               return extra(prop);
             }
--- a/js/src/jit-test/tests/auto-regress/bug771027.js
+++ b/js/src/jit-test/tests/auto-regress/bug771027.js
@@ -1,8 +1,9 @@
 // |jit-test| error:TypeError
 
 // Binary: cache/js-dbg-32-b6aa44d8f11f-linux
 // Flags:
 //
 
 Array.prototype.iterator = (function() { { while(0) function Uint8ClampedArray() {  } } });
-assertEq(Set(["testing", "testing", 123]).size(), 2);
+var s = new Set(["testing", "testing", 123]);
+assertEq(s.size(), 2);
--- a/js/src/jit-test/tests/basic/bug797496.js
+++ b/js/src/jit-test/tests/basic/bug797496.js
@@ -1,8 +1,8 @@
 // |jit-test| error: TypeError
-var set = Set(['a']);
+var set = new Set(['a']);
 var n = 5;
 for (let v of set) {
     if (n === 0)
         break;
-    let g = set(Set(0xffffffff, n), 1);
+    let g = set(new Set(0xffffffff, n), 1);
 }
--- a/js/src/jit-test/tests/basic/spread-array.js
+++ b/js/src/jit-test/tests/basic/spread-array.js
@@ -14,17 +14,17 @@ assertEqArray([,,...[1, 2, 3],,,,], [,,1
 assertEqArray([...[1, 2, 3],,,,...[]], [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([...new Set([1, 2, 3])], [1, 2, 3]);
 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 };
--- a/js/src/jit-test/tests/basic/spread-call-eval.js
+++ b/js/src/jit-test/tests/basic/spread-call-eval.js
@@ -20,17 +20,17 @@ let line0 = Error().lineNumber;
 try {             // line0 + 1
   eval(...["("]); // line0 + 2
 } catch (e) {
   assertEq(e.lineNumber, 1);
 }
 
 // other iterable objects
 assertEq(eval(...["a + b"][Symbol.iterator]()), 11);
-assertEq(eval(...Set(["a + b"])), 11);
+assertEq(eval(...new Set(["a + b"])), 11);
 let itr = {};
 itr[Symbol.iterator] = function() {
     return {
         i: 0,
         next: function() {
             this.i++;
             if (this.i == 1)
                 return { value: "a + b", done: false };
--- a/js/src/jit-test/tests/basic/spread-call-funapply.js
+++ b/js/src/jit-test/tests/basic/spread-call-funapply.js
@@ -4,17 +4,17 @@ load(libdir + "iteration.js");
 
 function checkCommon(f) {
   assertEqArray(f.apply(null, ...[[1, 2, 3]]), [1, 2, 3]);
   assertEqArray(f.apply(...[null], [1, 2, 3]), [1, 2, 3]);
   assertEqArray(f.apply(...[null], ...[[1, 2, 3]]), [1, 2, 3]);
   assertEqArray(f.apply(...[null, [1, 2, 3]]), [1, 2, 3]);
 
   // other iterable objects
-  assertEqArray(f.apply(...Set([null, [1, 2, 3]])), [1, 2, 3]);
+  assertEqArray(f.apply(...new Set([null, [1, 2, 3]])), [1, 2, 3]);
   assertEqArray(f.apply(...[null, [1, 2, 3]][Symbol.iterator]()), [1, 2, 3]);
   let itr = {};
   itr[Symbol.iterator] = function() {
       return {
           i: 0,
           next: function() {
               this.i++;
               if (this.i == 1)
--- a/js/src/jit-test/tests/basic/spread-call-length.js
+++ b/js/src/jit-test/tests/basic/spread-call-length.js
@@ -17,17 +17,17 @@ function checkLength(f, makeFn) {
   assertEq(makeFn("1, ...[2, 3, 4], 5")(f), 5);
 
   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, new Set([1, 2, 3])), 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 };
--- a/js/src/jit-test/tests/basic/spread-call.js
+++ b/js/src/jit-test/tests/basic/spread-call.js
@@ -12,17 +12,17 @@ function checkCommon(f, makeFn) {
   assertEqArray(makeFn("1, ...[2], ...[3]")(f), [1, 2, 3]);
   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, new Set([1, 2, 3])), [1, 2, 3]);
   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 };
--- a/js/src/jit-test/tests/collections/Map-iterator-proxies-2.js
+++ b/js/src/jit-test/tests/collections/Map-iterator-proxies-2.js
@@ -3,19 +3,19 @@
 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);
+assertThrowsInstanceOf(function () { iterator_fn.call(new Set()); }, TypeError);
 var mapw = g.eval("new Map([['x', 1], ['y', 2]])");
 assertEqArray(iterator_fn.call(mapw).next().value, ["x", 1]);
 
 var next_fn = (new Map())[Symbol.iterator]().next;
 assertThrowsInstanceOf(function () { next_fn.call({}); }, TypeError);
-assertThrowsInstanceOf(function () { next_fn.call(Set()[Symbol.iterator]()); }, TypeError);
+assertThrowsInstanceOf(function () { next_fn.call((new 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/Set-add-size.js
+++ b/js/src/jit-test/tests/collections/Set-add-size.js
@@ -1,11 +1,11 @@
 // set.add(v) increments set.size iff the set did not already contain v.
 
-var s = Set();
+var s = new Set();
 for (var i = 0; i < 10; i++) {
     assertEq(s.size, i);
     s.add(i);
 }
 for (var i = 0; i < 10; i++) {
     assertEq(s.size, 10);
     s.add(i);
 }
--- a/js/src/jit-test/tests/collections/Set-clear-1.js
+++ b/js/src/jit-test/tests/collections/Set-clear-1.js
@@ -1,8 +1,8 @@
 // Clearing an empty Set has no effect.
 
-var s = Set();
+var s = new Set();
 for (var i = 0; i < 2; i++) {
     s.clear();
     assertEq(s.size, 0);
     assertEq(s.has(undefined), false);
 }
--- a/js/src/jit-test/tests/collections/Set-clear-2.js
+++ b/js/src/jit-test/tests/collections/Set-clear-2.js
@@ -1,11 +1,11 @@
 // Clearing a Set removes its elements; the Set remains usable afterwards.
 
-var s = Set(["x", "y", "z", "z", "y"]);
+var s = new Set(["x", "y", "z", "z", "y"]);
 assertEq(s.size, 3);
 s.clear();
 assertEq(s.size, 0);
 assertEq(s.has("x"), false);
 assertEq(s.delete("x"), false);
 assertEq(s.has("z"), false);
 for (var v of s)
     throw "FAIL";  // shouldn't be any elements
--- a/js/src/jit-test/tests/collections/Set-clear-3.js
+++ b/js/src/jit-test/tests/collections/Set-clear-3.js
@@ -1,10 +1,10 @@
 // Clearing a Set with a nontrivial number of elements works.
 
-var s = Set();
+var s = new Set();
 for (var i = 0; i < 100; i++)
     s.add(i);
 assertEq(s.size, i);
 s.clear();
 assertEq(s.size, 0);
 s.add(12);
 assertEq(s.has(12), true);
--- a/js/src/jit-test/tests/collections/Set-clear-4.js
+++ b/js/src/jit-test/tests/collections/Set-clear-4.js
@@ -1,10 +1,10 @@
 // Clearing a Set after deleting some entries works.
 
-var s = Set(["a", "b", "c", "d"]);
+var s = new Set(["a", "b", "c", "d"]);
 for (var v of s)
     if (v !== "c")
         s.delete(v);
 s.clear();
 assertEq(s.size, 0);
 assertEq(s.has("c"), false);
 assertEq(s.has("d"), false);
--- a/js/src/jit-test/tests/collections/Set-clear-5.js
+++ b/js/src/jit-test/tests/collections/Set-clear-5.js
@@ -1,12 +1,12 @@
 // Set.clear is unaffected by deleting/monkeypatching Set.prototype.{delete,iterator}.
 
 var data = ["a", 1, {}];
-var s1 = Set(data), s2 = Set(data);
+var s1 = new Set(data), s2 = new Set(data);
 
 delete Set.prototype.delete;
 delete Set.prototype.iterator;
 s1.clear();
 assertEq(s1.size, 0);
 
 Set.prototype.delete = function () { throw "FAIL"; };
 Set.prototype.iterator = function () { throw "FAIL"; };
--- a/js/src/jit-test/tests/collections/Set-clear-6.js
+++ b/js/src/jit-test/tests/collections/Set-clear-6.js
@@ -1,6 +1,6 @@
 // Clearing a Set doesn't affect expando properties.
 
-var s = Set();
+var s = new Set();
 s.x = 3;
 s.clear();
 assertEq(s.x, 3);
--- a/js/src/jit-test/tests/collections/Set-clear-gc.js
+++ b/js/src/jit-test/tests/collections/Set-clear-gc.js
@@ -1,11 +1,11 @@
 // Clearing a Set removes any strong references to its elements.
 
 load(libdir + "referencesVia.js");
 
-var s = Set();
+var s = new Set();
 var obj = {};
 s.add(obj);
 assertEq(referencesVia(s, "key", obj), true);
 s.clear();
 if (typeof findReferences == 'function')
     assertEq(referencesVia(s, "key", obj), false);
--- a/js/src/jit-test/tests/collections/Set-clear-iterators-1.js
+++ b/js/src/jit-test/tests/collections/Set-clear-iterators-1.js
@@ -1,23 +1,23 @@
 // A Set iterator does not visit entries removed by clear().
 
 load(libdir + "iteration.js");
 
-var s = Set();
+var s = new Set();
 var it = s[Symbol.iterator]();
 s.clear();
 assertIteratorDone(it, undefined);
 
-s = Set(["a", "b", "c", "d"]);
+s = new Set(["a", "b", "c", "d"]);
 it = s[Symbol.iterator]();
 assertIteratorNext(it, "a");
 s.clear();
 assertIteratorDone(it, undefined);
 
 var log = "";
-s = Set(["a", "b", "c", "d"]);
+s = new Set(["a", "b", "c", "d"]);
 for (var v of s) {
     log += v;
     if (v == "b")
         s.clear();
 }
 assertEq(log, "ab");
--- a/js/src/jit-test/tests/collections/Set-clear-iterators-2.js
+++ b/js/src/jit-test/tests/collections/Set-clear-iterators-2.js
@@ -1,11 +1,11 @@
 // A Set iterator continues to visit entries added after a clear().
 
 load(libdir + "iteration.js");
 
-var s = Set(["a"]);
+var s = new Set(["a"]);
 var it = s[Symbol.iterator]();
 assertIteratorNext(it, "a");
 s.clear();
 s.add("b");
 assertIteratorNext(it, "b");
 assertIteratorDone(it, undefined);
--- a/js/src/jit-test/tests/collections/Set-clear-iterators-3.js
+++ b/js/src/jit-test/tests/collections/Set-clear-iterators-3.js
@@ -1,10 +1,10 @@
 // A closed Set iterator does not visit new entries added after a clear().
 
 load(libdir + "iteration.js");
 
-var s = Set();
+var s = new Set();
 var it = s[Symbol.iterator]();
 assertIteratorDone(it, undefined);  // close the iterator
 s.clear();
 s.add("a");
 assertIteratorDone(it, undefined);
--- a/js/src/jit-test/tests/collections/Set-constructor-1.js
+++ b/js/src/jit-test/tests/collections/Set-constructor-1.js
@@ -1,7 +1,8 @@
 // The Set constructor creates an empty Set by default.
 
-assertEq(Set().size, 0);
-assertEq((new Set).size, 0);
-assertEq(Set(undefined).size, 0);
-assertEq(new Set(undefined).size, 0);
-assertEq(new Set(null).size, 0);
+var s = new Set();
+assertEq(s.size, 0);
+s = new Set(undefined);
+assertEq(s.size, 0);
+s = new Set(null);
+assertEq(s.size, 0);
--- a/js/src/jit-test/tests/collections/Set-constructor-2.js
+++ b/js/src/jit-test/tests/collections/Set-constructor-2.js
@@ -1,18 +1,18 @@
 // The Set constructor can take an argument that is an array.
 
-var s = Set([]);
+var s = new Set([]);
 assertEq(s.size, 0);
 assertEq(s.has(undefined), false);
 
-s = Set(["one", "two", "three"]);
+s = new Set(["one", "two", "three"]);
 assertEq(s.size, 3);
 assertEq(s.has("one"), true);
 assertEq(s.has("eleventeen"), false);
 
 var a = [{}, {}, {}];
-s = Set(a);
+s = new Set(a);
 assertEq(s.size, 3);
 for (let obj of a)
     assertEq(s.has(obj), true);
 assertEq(s.has({}), false);
 assertEq(s.has("three"), false);
--- a/js/src/jit-test/tests/collections/Set-constructor-3.js
+++ b/js/src/jit-test/tests/collections/Set-constructor-3.js
@@ -1,11 +1,12 @@
 // The argument to Set may contain a value multiple times. Duplicates are discarded.
 
-assertEq(Set(["testing", "testing", 123]).size, 2);
+var s = new Set(["testing", "testing", 123]);
+assertEq(s.size, 2);
 
 var values = [undefined, null, false, NaN, 0, -0, 6.022e23, -Infinity, "", "xyzzy", {}, Math.sin];
 for (let v of values) {
     var a = [v, {}, {}, {}, v, {}, v, v];
-    var s = Set(a);
+    s = new Set(a);
     assertEq(s.size, 5);
     assertEq(s.has(v), true);
 }
--- a/js/src/jit-test/tests/collections/Set-constructor-generator-1.js
+++ b/js/src/jit-test/tests/collections/Set-constructor-generator-1.js
@@ -1,12 +1,12 @@
 // The argument to Set can be a generator.
 
 function hexData(n) {
     for (var i = 0; i < n; i++)
         yield i.toString(16);
 }
 
-var s = Set(hexData(256));
+var s = new Set(hexData(256));
 assertEq(s.size, 256);
 assertEq(s.has("0"), true);
 assertEq(s.has(0), false);
 assertEq(s.has("ff"), true);
--- a/js/src/jit-test/tests/collections/Set-constructor-generator-2.js
+++ b/js/src/jit-test/tests/collections/Set-constructor-generator-2.js
@@ -1,8 +1,8 @@
 // The argument to Set can be a generator-expression.
 
-var s = Set(k * k for (k of [1, 2, 3, 4]));
+var s = new Set(k * k for (k of [1, 2, 3, 4]));
 assertEq(s.size, 4);
 assertEq(s.has(1), true);
 assertEq(s.has(4), true);
 assertEq(s.has(9), true);
 assertEq(s.has(16), true);
--- a/js/src/jit-test/tests/collections/Set-delete-size.js
+++ b/js/src/jit-test/tests/collections/Set-delete-size.js
@@ -1,11 +1,11 @@
 // set.delete(v) decrements set.size iff the set contained v.
 
-var s = Set();
+var s = new Set();
 for (var i = 0; i < 10; i++)
     s.add(i);
 
 for (var i = 10; i > 0; i--) {
     assertEq(s.size, i);
     assertEq(s.delete(i), false);
     assertEq(s.size, i);
     assertEq(s.delete(i - 1), true);
--- a/js/src/jit-test/tests/collections/Set-iterator-1.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-1.js
@@ -1,11 +1,11 @@
 // for-of can be used to iterate over a Set twice.
 
-var set = Set(['a', 'b', 'c']);
+var set = new Set(['a', 'b', 'c']);
 var log = '';
 
 for (let i = 0; i < 2; i++) {
     for (let x of set)
         log += x;
     log += ';'
 }
 assertEq(log, 'abc;abc;');
--- a/js/src/jit-test/tests/collections/Set-iterator-2.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-2.js
@@ -1,11 +1,11 @@
 // Nested for-of loops can iterate over a Set.
 
-var map = Set(['a', 'b']);
+var map = new Set(['a', 'b']);
 var log = '';
 for (let x of map) {
     log += x + ':'
     for (let y of map)
         log += y;
     log += ';'
 };
 assertEq(log, 'a:ab;b:ab;');
--- a/js/src/jit-test/tests/collections/Set-iterator-3.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-3.js
@@ -1,11 +1,11 @@
 // Iterating over a set of objects yields those exact objects.
 
 var arr = [{}, {}, {}, [], /xyz/, new Date];
-var set = Set(arr);
+var set = new Set(arr);
 assertEq(set.size, arr.length);
 
 var i = 0;
 for (var x of set)
     assertEq(x, arr[i++]);
 assertEq(i, arr.length);
 
--- a/js/src/jit-test/tests/collections/Set-iterator-add-1.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-add-1.js
@@ -1,11 +1,11 @@
 // set.iterator() is live: entries added during iteration are visited.
 
-var set = Set([5]);
+var set = new Set([5]);
 var log = '';
 for (let x of set) {
     log += x + ';';
     if (x > 0)
         set.add(x - 1);
 }
 assertEq(log, '5;4;3;2;1;0;');
 assertEq(set.size, 6);
--- a/js/src/jit-test/tests/collections/Set-iterator-add-2.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-add-2.js
@@ -1,10 +1,10 @@
 // A Set iterator does not iterate over new entries added after it throws StopIteration.
 
 load(libdir + "iteration.js");
 
-var set = Set();
+var set = new Set();
 var iter0 = set[Symbol.iterator](), iter1 = set[Symbol.iterator]();
 assertIteratorDone(iter0, undefined);  // closes iter0
 set.add("x");
 assertIteratorDone(iter0, undefined);  // already closed
 assertIteratorNext(iter1, "x");  // was not yet closed
--- a/js/src/jit-test/tests/collections/Set-iterator-add-remove.js
+++ b/js/src/jit-test/tests/collections/Set-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 set = Set(['a']);
+var set = new Set(['a']);
 var n = 5;
 for (let v of set) {
     assertEq(v, 'a');
     if (n === 0)
         break;
     set.delete('a');
     set.add('a');
     n--;
--- a/js/src/jit-test/tests/collections/Set-iterator-gc-1.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-gc-1.js
@@ -1,10 +1,10 @@
 // A Set iterator keeps the data alive.
 
 load(libdir + "referencesVia.js");
 load(libdir + "iteration.js");
 
 var key = {};
-var set = Set([key]);
+var set = new Set([key]);
 var iter = set[Symbol.iterator]();
 referencesVia(iter, "**UNKNOWN SLOT 0**", set);
 referencesVia(set, "key", key);
--- a/js/src/jit-test/tests/collections/Set-iterator-gc-2.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-gc-2.js
@@ -1,8 +1,8 @@
 // GC-ing during a for-of loop doesn't crash.
 
 var i = 0;
-for (var x of Set(Object.getOwnPropertyNames(this))) {
+for (var x of new Set(Object.getOwnPropertyNames(this))) {
     gc();
     if (++i >= 20)
         break;
 }
--- a/js/src/jit-test/tests/collections/Set-iterator-gc-3.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-gc-3.js
@@ -1,20 +1,20 @@
 // GC in nested for-loops is safe.
 
 var x;
-for (x of Set([1]))
-    for (x of Set([1]))
-        for (x of Set([1]))
-            for (x of Set([1]))
-                for (x of Set([1]))
-                    for (x of Set([1]))
-                        for (x of Set([1]))
-                            for (x of Set([1]))
-                                for (x of Set([1]))
-                                    for (x of Set([1]))
-                                        for (x of Set([1]))
-                                            for (x of Set([1]))
-                                                for (x of Set([1]))
-                                                    for (x of Set([1]))
-                                                        for (x of Set([1]))
-                                                            for (x of Set([1]))
+for (x of new Set([1]))
+    for (x of new Set([1]))
+        for (x of new Set([1]))
+            for (x of new Set([1]))
+                for (x of new Set([1]))
+                    for (x of new Set([1]))
+                        for (x of new Set([1]))
+                            for (x of new Set([1]))
+                                for (x of new Set([1]))
+                                    for (x of new Set([1]))
+                                        for (x of new Set([1]))
+                                            for (x of new Set([1]))
+                                                for (x of new Set([1]))
+                                                    for (x of new Set([1]))
+                                                        for (x of new Set([1]))
+                                                            for (x of new Set([1]))
                                                                 gc();
--- a/js/src/jit-test/tests/collections/Set-iterator-order.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-order.js
@@ -1,11 +1,11 @@
 // Set iterators produces entries in the order they were inserted.
 
-var set = Set();
+var set = new Set();
 var i;
 for (i = 7; i !== 1; i = i * 7 % 1117)
     set.add(i);
 assertEq(set.size, 557);
 
 i = 7;
 for (var v of set) {
     assertEq(v, i);
--- a/js/src/jit-test/tests/collections/Set-iterator-proxies-1.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-proxies-1.js
@@ -1,8 +1,8 @@
 // for-of works on a cross-compartment wrapper of a Set.
 
 var g = newGlobal();
-var mw = g.eval("Set(['a', 'b', 1, 2])");
+var mw = g.eval("new Set(['a', 'b', 1, 2])");
 var log = '';
 for (let x of mw)
     log += x;
 assertEq(log, "ab12");
--- a/js/src/jit-test/tests/collections/Set-iterator-proxies-2.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-proxies-2.js
@@ -3,18 +3,18 @@
 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(new Map()); }, TypeError);
-var setw = g.eval("Set(['x', 'y'])");
+var setw = g.eval("new Set(['x', 'y'])");
 assertIteratorNext(iterator_fn.call(setw), "x");
 
-var next_fn = Set()[Symbol.iterator]().next;
+var next_fn = (new Set())[Symbol.iterator]().next;
 assertThrowsInstanceOf(function () { next_fn.call({}); }, 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/Set-iterator-remove-1.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-remove-1.js
@@ -1,13 +1,13 @@
 // A set iterator can cope with removing the current entry.
 
 function test(letters, toRemove) {
-    var set = Set(letters);
-    toRemove = Set(toRemove);
+    var set = new Set(letters);
+    toRemove = new Set(toRemove);
 
     var leftovers = [x for (x of set) if (!toRemove.has(x))].join("");
 
     var log = "";
     for (let x of set) {
         log += x;
         if (toRemove.has(x))
             set.delete(x);
--- a/js/src/jit-test/tests/collections/Set-iterator-remove-2.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-remove-2.js
@@ -1,13 +1,13 @@
 // A map iterator can cope with removing the next entry.
 
 load(libdir + "iteration.js");
 
-var set = Set("abcd");
+var set = new Set("abcd");
 var iter = set[Symbol.iterator]();
 var log = "";
 for (let x of iter) {
     log += x;
     if (x === "b")
         set.delete("c");
 }
 assertEq(log, "abd");
--- a/js/src/jit-test/tests/collections/Set-iterator-remove-3.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-remove-3.js
@@ -1,12 +1,12 @@
 // A set iterator can cope with removing the next entry, then the current entry.
 
 load(libdir + "iteration.js");
 
-var set = Set("abcd");
+var set = new Set("abcd");
 var iter = set[Symbol.iterator]();
 assertIteratorNext(iter, "a");
 assertIteratorNext(iter, "b");
 set.delete("c");
 set.delete("b");
 assertIteratorNext(iter, "d");
 assertIteratorDone(iter, undefined);
--- a/js/src/jit-test/tests/collections/Set-iterator-remove-4.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-remove-4.js
@@ -1,14 +1,14 @@
 // Multiple live iterators on the same Set can cope with removing entries.
 
 load(libdir + "iteration.js");
 
 // Make a set.
-var set = Set();
+var set = new Set();
 var SIZE = 7;
 for (var j = 0; j < SIZE; j++)
     set.add(j);
 
 // Make lots of iterators pointing to entry 2 of the set.
 var NITERS = 5;
 var iters = [];
 for (var i = 0; i < NITERS; i++) {
--- a/js/src/jit-test/tests/collections/Set-iterator-remove-5.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-remove-5.js
@@ -1,13 +1,13 @@
 // Removing a Set entry already visited by an iterator does not cause any
 // entries to be skipped.
 
 var str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
-var set = Set(str);
+var set = new Set(str);
 
 var log = '';
 var i = 0;
 for (var x of set) {
     log += x;
     if (i++ % 5 === 0) {
         // Delete all entries preceding this one.
         for (let y of set) {
--- a/js/src/jit-test/tests/collections/Set-iterator-remove-6.js
+++ b/js/src/jit-test/tests/collections/Set-iterator-remove-6.js
@@ -1,15 +1,15 @@
 // Removing many Set entries does not cause a live iterator to skip any of the
 // entries that were not removed. (Compacting a Set must not be observable to
 // script.)
 
 load(libdir + "iteration.js");
 
-var set = Set();
+var set = new Set();
 for (var i = 0; i < 32; i++)
     set.add(i);
 var iter = set[Symbol.iterator]();
 assertIteratorNext(iter, 0);
 for (var i = 0; i < 30; i++)
     set.delete(i);
 assertEq(set.size, 2);
 for (var i = 32; i < 100; i++)
--- a/js/src/jit-test/tests/collections/Set-size.js
+++ b/js/src/jit-test/tests/collections/Set-size.js
@@ -1,7 +1,7 @@
 // Each Set has its own size.
 
-var s1 = Set(), s2 = Set();
+var s1 = new Set(), s2 = new Set();
 for (var i = 0; i < 30; i++)
     s1.add(i);
 assertEq(s1.size, 30);
 assertEq(s2.size, 0);
--- a/js/src/jit-test/tests/collections/Set-surfaces-1.js
+++ b/js/src/jit-test/tests/collections/Set-surfaces-1.js
@@ -9,18 +9,17 @@ assertEq(desc.writable, true);
 
 assertEq(typeof Set, 'function');
 assertEq(Object.keys(Set).length, 0);
 assertEq(Set.length, 1);
 assertEq(Set.name, "Set");
 
 assertEq(Object.getPrototypeOf(Set.prototype), Object.prototype);
 assertEq(Object.prototype.toString.call(Set.prototype), "[object Set]");
-assertEq(Object.prototype.toString.call(new Set), "[object Set]");
-assertEq(Object.prototype.toString.call(Set()), "[object Set]");
+assertEq(Object.prototype.toString.call(new Set()), "[object Set]");
 assertEq(Object.keys(Set.prototype).join(), "");
 assertEq(Set.prototype.constructor, Set);
 
 function checkMethod(name, arity) { 
     var desc = Object.getOwnPropertyDescriptor(Set.prototype, name);
     assertEq(desc.enumerable, false);
     assertEq(desc.configurable, true);
     assertEq(desc.writable, true);
--- a/js/src/jit-test/tests/collections/Set-values-1.js
+++ b/js/src/jit-test/tests/collections/Set-values-1.js
@@ -1,11 +1,11 @@
 // set.keys(), .values(), and .entries() on an empty set produce empty iterators
 
-var s = Set();
+var s = new Set();
 var ki = s.keys(), vi = s.values(), ei = s.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/Set-values-2.js
+++ b/js/src/jit-test/tests/collections/Set-values-2.js
@@ -1,15 +1,15 @@
 // set.keys() and set.values() return iterators over the elements
 // and set.entries() returns an iterator that yields pairs [e, e].
 
 load(libdir + "iteration.js");
 
 var data = [1, 2, 3, 4];
-var s = Set(data);
+var s = new Set(data);
 
 var ki = s.keys();
 assertIteratorNext(ki, 1);
 assertIteratorNext(ki, 2);
 assertIteratorNext(ki, 3);
 assertIteratorNext(ki, 4);
 assertIteratorDone(ki, undefined);
 
--- a/js/src/jit-test/tests/collections/WeakSet-constructor.js
+++ b/js/src/jit-test/tests/collections/WeakSet-constructor.js
@@ -1,9 +1,9 @@
 var list = [Number, Function];
 
 var ws = new WeakSet(list);
 assertEq(ws.has(Number), true);
 assertEq(ws.has(Function), true);
 
-ws = new WeakSet(Set(list));
+ws = new WeakSet(new Set(list));
 assertEq(ws.has(Number), true);
 assertEq(ws.has(Function), true);
--- a/js/src/jit-test/tests/collections/constructor-errors.js
+++ b/js/src/jit-test/tests/collections/constructor-errors.js
@@ -12,11 +12,11 @@ var misc = [
     new Boolean(true), new Number(0),
     {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 () { new Set(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
@@ -8,9 +8,9 @@ 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(new Map([[key, 'value']]), "key");
-test(Set([key]),                "key");
+test(new 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
@@ -7,9 +7,9 @@ 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(new Map(), new Map([[1, 1]]));
-test(Set(), Set([1]));
+test(new Set(), new 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((new Map())[Symbol.iterator]());
-var sproto = Object.getPrototypeOf(Set()[Symbol.iterator]());
+var sproto = Object.getPrototypeOf((new 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/gc/bug-880816.js
+++ b/js/src/jit-test/tests/gc/bug-880816.js
@@ -4,17 +4,17 @@ lfcode.push("2");
 lfcode.push("{ function foo() {} }");
 lfcode.push("evaluate('\
 var INVALIDATE_MODES = INVALIDATE_MODE_STRINGS.map(s => ({mode: s}));\
 function range(n, m) {}\
 function seq_scan(array, f) {}\
 function assertStructuralEq(e1, e2) {}\
 for (var i = 0, l = a.length; i < l; i++) {}\
 ');");
-lfcode.push("for (var x of Set(Object.getOwnPropertyNames(this))) {}");
+lfcode.push("for (var x of new Set(Object.getOwnPropertyNames(this))) {}");
 var lfRunTypeId = -1;
 while (true) {
   var file = lfcode.shift(); if (file == undefined) { break; }
   loadFile(file)
 }
 function loadFile(lfVarx) {
     try {
         if (lfVarx.substr(-3) == ".js") {}
--- a/js/src/jit-test/tests/generators/bug908920.js
+++ b/js/src/jit-test/tests/generators/bug908920.js
@@ -1,9 +1,9 @@
 if (typeof schedulegc != 'undefined') {
     Function("\
         x = (function() { yield })();\
-        Set(x);\
+        new Set(x);\
         schedulegc(1);\
         print( /x/ );\
         for (p in x) {}\
     ")();
 }
--- 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("new Set(['x', 'y'])"));
 serialize(evalcx("new Map([['x', 1]])"));