Bug 1309701 - Improve the TypedArray constructor for shared memory to support more tests. r=evilpie
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 14 Oct 2016 06:42:48 -0700
changeset 318117 f6161756e151b6c31bba80c84223d8748fa4fc95
parent 318116 c14157737409a119ef1f256fb1cf5aff0df2c465
child 318118 c3477c91656b57e3f983e1708e261afe8a2d6c8f
push id30830
push usercbook@mozilla.com
push dateMon, 17 Oct 2016 09:19:24 +0000
treeherdermozilla-central@94b0fddf96b4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs1309701
milestone52.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 1309701 - Improve the TypedArray constructor for shared memory to support more tests. r=evilpie
js/src/tests/ecma_6/TypedArray/Tconstructor-fromTypedArray-byteLength.js
js/src/tests/ecma_6/TypedArray/constructor-ArrayBuffer-species-wrap.js
js/src/tests/ecma_6/TypedArray/constructor-ArrayBuffer-species.js
js/src/tests/ecma_6/TypedArray/constructor-non-detached.js
js/src/tests/ecma_6/TypedArray/constructor-not-callable.js
js/src/tests/ecma_6/TypedArray/element-setting-converts-using-ToNumber.js
js/src/tests/ecma_6/TypedArray/entries.js
js/src/tests/ecma_6/TypedArray/every-and-some.js
js/src/tests/ecma_6/TypedArray/fill.js
js/src/tests/ecma_6/TypedArray/find-and-findIndex.js
js/src/tests/ecma_6/TypedArray/forEach.js
js/src/tests/ecma_6/TypedArray/from_basics.js
js/src/tests/ecma_6/TypedArray/from_constructor.js
js/src/tests/ecma_6/TypedArray/from_errors.js
js/src/tests/ecma_6/TypedArray/from_iterable.js
js/src/tests/ecma_6/TypedArray/from_mapping.js
js/src/tests/ecma_6/TypedArray/from_proxy.js
js/src/tests/ecma_6/TypedArray/from_realms.js
js/src/tests/ecma_6/TypedArray/from_surfaces.js
js/src/tests/ecma_6/TypedArray/from_this.js
js/src/tests/ecma_6/TypedArray/has-property-op.js
js/src/tests/ecma_6/TypedArray/includes.js
js/src/tests/ecma_6/TypedArray/indexOf-and-lastIndexOf.js
js/src/tests/ecma_6/TypedArray/join.js
js/src/tests/ecma_6/TypedArray/keys.js
js/src/tests/ecma_6/TypedArray/map-and-filter.js
js/src/tests/ecma_6/TypedArray/object-defineproperty.js
js/src/tests/ecma_6/TypedArray/of.js
js/src/tests/ecma_6/TypedArray/prototype-constructor-identity.js
js/src/tests/ecma_6/TypedArray/reduce-and-reduceRight.js
js/src/tests/ecma_6/TypedArray/reverse.js
js/src/tests/ecma_6/TypedArray/set.js
js/src/tests/ecma_6/TypedArray/shell.js
js/src/tests/ecma_6/TypedArray/slice-species.js
js/src/tests/ecma_6/TypedArray/slice.js
js/src/tests/ecma_6/TypedArray/sort_basics.js
js/src/tests/ecma_6/TypedArray/sort_errors.js
js/src/tests/ecma_6/TypedArray/sort_globals.js
js/src/tests/ecma_6/TypedArray/sort_small.js
js/src/tests/ecma_6/TypedArray/sorting_buffer_access.js
js/src/tests/ecma_6/TypedArray/toLocaleString-detached.js
js/src/tests/ecma_6/TypedArray/toLocaleString-nointl.js
js/src/tests/ecma_6/TypedArray/toLocaleString.js
js/src/tests/ecma_6/TypedArray/toString.js
js/src/tests/ecma_6/TypedArray/values.js
js/src/tests/ecma_6/shell.js
--- a/js/src/tests/ecma_6/TypedArray/Tconstructor-fromTypedArray-byteLength.js
+++ b/js/src/tests/ecma_6/TypedArray/Tconstructor-fromTypedArray-byteLength.js
@@ -1,38 +1,14 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array
-];
-
-const sharedConstructors = [];
-
-if (typeof SharedArrayBuffer != "undefined")
-    sharedConstructors.push(sharedConstructor(Int8Array),
-                            sharedConstructor(Uint8Array),
-                            sharedConstructor(Int16Array),
-                            sharedConstructor(Uint16Array),
-                            sharedConstructor(Int32Array),
-                            sharedConstructor(Uint32Array),
-                            sharedConstructor(Float32Array),
-                            sharedConstructor(Float64Array));
-
 var g = newGlobal();
 
 var arr = [1, 2, 3];
-for (var constructor of constructors.concat(sharedConstructors)) {
+for (var constructor of anyTypedArrayConstructors) {
     var tarr = new constructor(arr);
-    for (var constructor2 of constructors) {
+    for (var constructor2 of anyTypedArrayConstructors) {
         var copied = new constructor2(tarr);
         assertEq(copied.buffer.byteLength, arr.length * constructor2.BYTES_PER_ELEMENT);
 
         g.tarr = tarr;
         copied = g.eval(`new ${constructor2.name}(tarr);`);
         assertEq(copied.buffer.byteLength, arr.length * constructor2.BYTES_PER_ELEMENT);
     }
 }
--- a/js/src/tests/ecma_6/TypedArray/constructor-ArrayBuffer-species-wrap.js
+++ b/js/src/tests/ecma_6/TypedArray/constructor-ArrayBuffer-species-wrap.js
@@ -1,46 +1,34 @@
 // |reftest| skip-if(!xulRuntime.shell)
 
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array
-];
-
 let g = newGlobal();
 
 // Both TypedArray and ArrayBuffer from different global.
-for (let ctor of constructors) {
+for (let ctor of typedArrayConstructors) {
   let a = g.eval(`new ${ctor.name}([1, 2, 3, 4, 5]);`);
-  for (let ctor2 of constructors) {
+  for (let ctor2 of typedArrayConstructors) {
     let b = new ctor2(a);
     assertEq(Object.getPrototypeOf(b).constructor, ctor2);
     assertEq(Object.getPrototypeOf(b.buffer).constructor, g.ArrayBuffer);
   }
 }
 
 // Only ArrayBuffer from different global.
 let called = false;
 let origSpecies = Object.getOwnPropertyDescriptor(ArrayBuffer, Symbol.species);
 let modSpecies = {
   get() {
     called = true;
     return g.ArrayBuffer;
   }
 };
-for (let ctor of constructors) {
+for (let ctor of typedArrayConstructors) {
   let a = new ctor([1, 2, 3, 4, 5]);
-  for (let ctor2 of constructors) {
+  for (let ctor2 of typedArrayConstructors) {
     called = false;
     Object.defineProperty(ArrayBuffer, Symbol.species, modSpecies);
     let b = new ctor2(a);
     Object.defineProperty(ArrayBuffer, Symbol.species, origSpecies);
     assertEq(called, true);
     assertEq(Object.getPrototypeOf(b).constructor, ctor2);
     assertEq(Object.getPrototypeOf(b.buffer).constructor, g.ArrayBuffer);
   }
@@ -53,19 +41,19 @@ var called = false;
 var origSpecies = Object.getOwnPropertyDescriptor(ArrayBuffer, Symbol.species);
 var modSpecies = {
   get() {
     called = true;
     return otherArrayBuffer;
   }
 };
 `);
-for (let ctor of constructors) {
+for (let ctor of typedArrayConstructors) {
   let a = g.eval(`new ${ctor.name}([1, 2, 3, 4, 5]);`);
-  for (let ctor2 of constructors) {
+  for (let ctor2 of typedArrayConstructors) {
     g.called = false;
     g.eval(`Object.defineProperty(ArrayBuffer, Symbol.species, modSpecies);`);
     let b = new ctor2(a);
     g.eval(`Object.defineProperty(ArrayBuffer, Symbol.species, origSpecies);`);
     assertEq(g.called, true);
     assertEq(Object.getPrototypeOf(b).constructor, ctor2);
     assertEq(Object.getPrototypeOf(b.buffer).constructor, ArrayBuffer);
   }
--- a/js/src/tests/ecma_6/TypedArray/constructor-ArrayBuffer-species.js
+++ b/js/src/tests/ecma_6/TypedArray/constructor-ArrayBuffer-species.js
@@ -1,22 +1,10 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array
-];
-
 let logs = [];
-for (let ctor of constructors) {
+for (let ctor of typedArrayConstructors) {
   let arr = new ctor([1, 2, 3, 4, 5, 6, 7, 8]);
 
   let ctorObj = {};
 
   let proxyProto = new Proxy({}, {
     get(that, name) {
       logs.push("get proto." + String(name));
       if (name == "constructor")
@@ -39,17 +27,17 @@ for (let ctor of constructors) {
           }
           throw new Error("unexpected prop access");
         }
       });
       return C;
     }
   };
 
-  for (let ctor2 of constructors) {
+  for (let ctor2 of typedArrayConstructors) {
     logs.length = 0;
     let arr2 = new ctor2(arr);
     assertDeepEq(logs, ["get @@species", "get ctor.prototype"]);
 
     logs.length = 0;
     assertEq(Object.getPrototypeOf(arr2.buffer), proxyProto);
     assertDeepEq(logs, []);
 
--- a/js/src/tests/ecma_6/TypedArray/constructor-non-detached.js
+++ b/js/src/tests/ecma_6/TypedArray/constructor-non-detached.js
@@ -1,23 +1,11 @@
 // |reftest| skip-if(!xulRuntime.shell) -- needs detachArrayBuffer
 
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array
-];
-
-for (var constructor of constructors) {
+for (var constructor of typedArrayConstructors) {
     var buf = new constructor();
     detachArrayBuffer(buf.buffer);
     assertThrowsInstanceOf(() => new constructor(buf), TypeError);
 
     var buffer = new ArrayBuffer();
     detachArrayBuffer(buffer);
     assertThrowsInstanceOf(() => new constructor(buffer), TypeError);
 }
--- a/js/src/tests/ecma_6/TypedArray/constructor-not-callable.js
+++ b/js/src/tests/ecma_6/TypedArray/constructor-not-callable.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertThrowsInstanceOf(() => constructor(), TypeError);
     assertThrowsInstanceOf(() => constructor(1), TypeError);
     assertThrowsInstanceOf(() => constructor.call(null), TypeError);
     assertThrowsInstanceOf(() => constructor.apply(null, []), TypeError);
     assertThrowsInstanceOf(() => Reflect.apply(constructor, null, []), TypeError);
 }
 
 if (typeof reportCompare === "function")
--- a/js/src/tests/ecma_6/TypedArray/element-setting-converts-using-ToNumber.js
+++ b/js/src/tests/ecma_6/TypedArray/element-setting-converts-using-ToNumber.js
@@ -11,21 +11,17 @@ var summary =
   "followed by an element-type-specific truncation function";
 
 print(BUGNUMBER + ": " + summary);
 
 /**************
  * BEGIN TEST *
  **************/
 
-var ctors = [Int8Array, Uint8Array, Uint8ClampedArray,
-             Int16Array, Uint16Array,
-             Int32Array, Uint32Array,
-             Float32Array, Float64Array];
-ctors.forEach(function(TypedArray) {
+anyTypedArrayConstructors.forEach(function(TypedArray) {
   var ta = new TypedArray(1);
   assertEq(ta[0], 0);
 
   var count = 0;
   function setToObject()
   {
     for (var i = 0; i < 1e4; i++)
     {
--- a/js/src/tests/ecma_6/TypedArray/entries.js
+++ b/js/src/tests/ecma_6/TypedArray/entries.js
@@ -1,47 +1,26 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.entries.length, 0);
     assertEq(constructor.prototype.entries.name, "entries");
 
     assertDeepEq([...new constructor(0).entries()], []);
     assertDeepEq([...new constructor(1).entries()], [[0, 0]]);
     assertDeepEq([...new constructor(2).entries()], [[0, 0], [1, 0]]);
     assertDeepEq([...new constructor([15]).entries()], [[0, 15]]);
 
     var arr = new constructor([1, 2, 3]);
     var iterator = arr.entries();
     assertDeepEq(iterator.next(), {value: [0, 1], done: false});
     assertDeepEq(iterator.next(), {value: [1, 2], done: false});
     assertDeepEq(iterator.next(), {value: [2, 3], done: false});
     assertDeepEq(iterator.next(), {value: undefined, done: true});
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var otherGlobal = newGlobal();
         var entries = otherGlobal[constructor.name].prototype.entries;
         assertDeepEq([...entries.call(new constructor(2))],
                      [new otherGlobal.Array(0, 0), new otherGlobal.Array(1, 0)]);
         arr = new (newGlobal()[constructor.name])(2);
         assertEq([...constructor.prototype.entries.call(arr)].toString(), "0,0,1,0");
     }
 
--- a/js/src/tests/ecma_6/TypedArray/every-and-some.js
+++ b/js/src/tests/ecma_6/TypedArray/every-and-some.js
@@ -1,31 +1,10 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
 // Tests for TypedArray#every.
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.every.length, 1);
 
     // Basic tests.
     assertEq(new constructor([1, 3, 5]).every(v => v % 2), true);
     assertEq(new constructor([1, 3, 5]).every(v => v > 2), false);
     assertEq(new constructor(10).every(v => v === 0), true);
     assertEq(new constructor().every(v => v > 1), true);
 
@@ -107,17 +86,17 @@ for (var constructor of constructors) {
     })
 
     // Callback is a generator.
     arr.every(function*(){
         throw "This line will not be executed";
     });
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var every = newGlobal()[constructor.name].prototype.every;
         var sum = 0;
         assertEq(every.call(new constructor([1, 2, 3]), v => sum += v), true);
         assertEq(sum, 6);
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
@@ -131,21 +110,22 @@ for (var constructor of constructors) {
     // Test that the length getter is never called.
     assertEq(Object.defineProperty(new constructor([1, 2, 3]), "length", {
         get() {
             throw new Error("length accessor called");
         }
     }).every(() => true), true);
 }
 
-assertEq(new Float32Array([undefined, , NaN]).every(v => Object.is(v, NaN)), true);
-assertEq(new Float64Array([undefined, , NaN]).every(v => Object.is(v, NaN)), true);
+for (let constructor of anyTypedArrayConstructors.filter(isFloatConstructor)) {
+    assertEq(new constructor([undefined, , NaN]).every(v => Object.is(v, NaN)), true);
+}
 
 // Tests for TypedArray#some.
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.some.length, 1);
 
     // Basic tests.
     assertEq(new constructor([1, 2, 3]).some(v => v % 2), true);
     assertEq(new constructor([0, 2, 4]).some(v => v % 2), false);
     assertEq(new constructor([1, 3, 5]).some(v => v > 2), true);
     assertEq(new constructor([1, 3, 5]).some(v => v < 0), false);
     assertEq(new constructor(10).some(v => v !== 0), false);
@@ -229,17 +209,17 @@ for (var constructor of constructors) {
     })
 
     // Callback is a generator.
     arr.some(function*(){
         throw "This line will not be executed";
     });
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var some = newGlobal()[constructor.name].prototype.some;
         var sum = 0;
         assertEq(some.call(new constructor([1, 2, 3]), v => {
             sum += v;
             return false;
         }), false);
         assertEq(sum, 6);
     }
@@ -256,13 +236,14 @@ for (var constructor of constructors) {
     // Test that the length getter is never called.
     assertEq(Object.defineProperty(new constructor([1, 2, 3]), "length", {
         get() {
             throw new Error("length accessor called");
         }
     }).some(() => false), false);
 }
 
-assertEq(new Float32Array([undefined, , NaN]).some(v => v === v), false);
-assertEq(new Float64Array([undefined, , NaN]).some(v => v === v), false);
+for (let constructor of anyTypedArrayConstructors.filter(isFloatConstructor)) {
+    assertEq(new constructor([undefined, , NaN]).some(v => v === v), false);
+}
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/fill.js
+++ b/js/src/tests/ecma_6/TypedArray/fill.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertDeepEq(constructor.prototype.fill.length, 1);
 
     assertDeepEq(new constructor([]).fill(1), new constructor([]));
     assertDeepEq(new constructor([1,1,1]).fill(2), new constructor([2,2,2]));
     assertDeepEq(new constructor([1,1,1]).fill(2, 1), new constructor([1,2,2]));
     assertDeepEq(new constructor([1,1,1]).fill(2, 1, 2), new constructor([1,2,1]));
     assertDeepEq(new constructor([1,1,1]).fill(2, -2), new constructor([1,2,2]));
     assertDeepEq(new constructor([1,1,1]).fill(2, -2, -1), new constructor([1,2,1]));
@@ -51,17 +30,17 @@ for (var constructor of constructors) {
     assertDeepEq(new constructor([1,1,1]).fill(2, "0"), new constructor([2,2,2]));
     assertDeepEq(new constructor([1,1,1]).fill(2, "1"), new constructor([1,2,2]));
     assertDeepEq(new constructor([1,1,1]).fill(2, "-2"), new constructor([1,2,2]));
     assertDeepEq(new constructor([1,1,1]).fill(2, "-2", "-1"), new constructor([1,2,1]));
     assertDeepEq(new constructor([1,1,1]).fill(2, {valueOf: ()=>1}), new constructor([1,2,2]));
     assertDeepEq(new constructor([1,1,1]).fill(2, 0, {valueOf: ()=>1}), new constructor([2,1,1]));
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var fill = newGlobal()[constructor.name].prototype.fill;
         assertDeepEq(fill.call(new constructor([3, 2, 1]), 2), new constructor([2, 2, 2]));
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
                             new Proxy(new constructor(), {})];
     invalidReceivers.forEach(invalidReceiver => {
@@ -73,13 +52,14 @@ for (var constructor of constructors) {
     // Test that the length getter is never called.
     Object.defineProperty(new constructor([1, 2, 3]), "length", {
         get() {
             throw new Error("length accessor called");
         }
     }).fill(1);
 }
 
-assertDeepEq(new Float32Array([0, 0]).fill(NaN), new Float32Array([NaN, NaN]));
-assertDeepEq(new Float64Array([0, 0]).fill(NaN), new Float64Array([NaN, NaN]));
+for (let constructor of anyTypedArrayConstructors.filter(isFloatConstructor)) {
+    assertDeepEq(new constructor([0, 0]).fill(NaN), new constructor([NaN, NaN]));
+}
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/find-and-findIndex.js
+++ b/js/src/tests/ecma_6/TypedArray/find-and-findIndex.js
@@ -2,40 +2,19 @@
  * Any copyright is dedicated to the Public Domain.
  * https://creativecommons.org/publicdomain/zero/1.0/
  */
 
 var BUGNUMBER = 1078975;
 var summary = "Implement %TypedArray%.prototype.{find, findIndex}";
 print(BUGNUMBER + ": " + summary);
 
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
 const methods = ["find", "findIndex"];
 
-constructors.forEach(constructor => {
+anyTypedArrayConstructors.forEach(constructor => {
     methods.forEach(method => {
         var arr = new constructor([0, 1, 2, 3, 4, 5]);
         // test that this.length is never called
         Object.defineProperty(arr, "length", {
             get() {
                 throw new Error("length accessor called");
             }
         });
@@ -51,17 +30,17 @@ constructors.forEach(constructor => {
             assertThrowsInstanceOf(() => arr[method].call(thisArg, () => true), TypeError)
         );
 
         assertThrowsInstanceOf(() => arr[method](), TypeError);
         assertThrowsInstanceOf(() => arr[method](1), TypeError);
     });
 });
 
-[Float32Array, Float64Array].forEach(constructor => {
+anyTypedArrayConstructors.filter(isFloatConstructor).forEach(constructor => {
     var arr = new constructor([-0, 0, 1, 5, NaN, 6]);
     assertEq(arr.find(v => Number.isNaN(v)), NaN);
     assertEq(arr.findIndex(v => Number.isNaN(v)), 4);
 
     assertEq(arr.find(v => Object.is(v, 0)), 0);
     assertEq(arr.findIndex(v => Object.is(v, 0)), 1);
 
     assertEq(arr.find(v => Object.is(v, -0)), -0);
--- a/js/src/tests/ecma_6/TypedArray/forEach.js
+++ b/js/src/tests/ecma_6/TypedArray/forEach.js
@@ -1,31 +1,10 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
 // Tests for TypedArray#forEach
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.forEach.length, 1);
 
     var arr = new constructor([1, 2, 3, 4, 5]);
     // Tests for `thisArg` argument.
     function assertThisArg(thisArg, thisValue) {
         // In sloppy mode, `this` could be global object or a wrapper of `thisArg`.
         arr.forEach(function() {
             assertDeepEq(this, thisValue);
@@ -86,28 +65,28 @@ for (var constructor of constructors) {
     })
 
     // Callback is a generator.
     arr.forEach(function*(){
         throw "This line will not be executed";
     });
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var forEach = newGlobal()[constructor.name].prototype.forEach;
         var sum = 0;
         forEach.call(new constructor([1, 2, 3]), v => {
             sum += v;
         });
         assertEq(sum, 6);
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
-			    new Proxy(new constructor(), {})];
+                            new Proxy(new constructor(), {})];
     invalidReceivers.forEach(invalidReceiver => {
         assertThrowsInstanceOf(() => {
             constructor.prototype.forEach.call(invalidReceiver, () => true);
         }, TypeError, "Assert that some fails if this value is not a TypedArray");
     });
 }
 
 if (typeof reportCompare === "function")
--- a/js/src/tests/ecma_6/TypedArray/from_basics.js
+++ b/js/src/tests/ecma_6/TypedArray/from_basics.js
@@ -1,48 +1,27 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     // 'from' method is identical for all typed array constructors.
-    assertEq(constructors[0].from === constructor.from, true);
+    assertEq(anyTypedArrayConstructors[0].from === constructor.from, true);
 
     // %TypedArray%.from copies arrays.
     var src = new constructor([1, 2, 3]), copy = constructor.from(src);
     assertEq(copy === src, false);
-    assertEq(isSharedConstructor(constructor) || copy instanceof constructor, true);
+    assertEq(copy instanceof constructor, true);
     assertDeepEq(copy, src);
 
     // Non-element properties are not copied.
     var a = new constructor([0, 1]);
     a.name = "lisa";
     assertDeepEq(constructor.from(a), new constructor([0, 1]));
 
     // %TypedArray%.from can copy non-iterable objects, if they're array-like.
     src = {0: 0, 1: 1, length: 2};
     copy = constructor.from(src);
-    assertEq(isSharedConstructor(constructor) || copy instanceof constructor, true);
+    assertEq(copy instanceof constructor, true);
     assertDeepEq(copy, new constructor([0, 1]));
 
     // Properties past the .length are not copied.
     src = {0: "0", 1: "1", 2: "two", 9: "nine", name: "lisa", length: 2};
     assertDeepEq(constructor.from(src), new constructor([0, 1]));
 
     // If an object has neither an @@iterator method nor .length,
     // then it's treated as zero-length.
--- a/js/src/tests/ecma_6/TypedArray/from_constructor.js
+++ b/js/src/tests/ecma_6/TypedArray/from_constructor.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     // %TypedArray%.from can be applied to any constructor.
     // For example, the Date builtin constructor.
     // Unlike Array.from, %TypedArray%.from doesn't set the 'length' property at the end.
     var d = constructor.from.call(Date, ["A", "B"]);
     assertEq(d instanceof constructor, false);
     assertEq(Object.prototype.toString.call(d), "[object Date]");
     assertEq(Object.getPrototypeOf(d), Date.prototype);
     assertEq(d.length, undefined);
@@ -67,19 +46,16 @@ for (var constructor of constructors) {
         () => ({})  // arrow functions are not constructors
     ];
     for (var v of nonconstructors) {
         assertThrowsInstanceOf(() => {
             constructor.from.call(v, arr);
         }, TypeError);
     }
 
-    if (isSharedConstructor(constructor))
-	continue;
-
     // %TypedArray%.from does not get confused if global constructors for typed arrays
     // are replaced with another constructor.
     function NotArray() {
     }
     var RealArray = constructor;
     NotArray.from = constructor.from;
     this[constructor.name] = NotArray;
     assertEq(RealArray.from([1]) instanceof RealArray, true);
--- a/js/src/tests/ecma_6/TypedArray/from_errors.js
+++ b/js/src/tests/ecma_6/TypedArray/from_errors.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     // %TypedArray%.from throws if the argument is undefined or null.
     assertThrowsInstanceOf(() => constructor.from(), TypeError);
     assertThrowsInstanceOf(() => constructor.from(undefined), TypeError);
     assertThrowsInstanceOf(() => constructor.from(null), TypeError);
 
     // %TypedArray%.from throws if an element can't be defined on the new object.
     function ObjectWithReadOnlyElement() {
         Object.defineProperty(this, "0", {value: null});
--- a/js/src/tests/ecma_6/TypedArray/from_iterable.js
+++ b/js/src/tests/ecma_6/TypedArray/from_iterable.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     // %TypedArray%.from works on arguments objects.
     (function () {
         assertDeepEq(constructor.from(arguments), new constructor(["0", "1", undefined]));
     })("0", "1", undefined);
 
     // If an object has both .length and [@@iterator] properties, [@@iterator] is used.
     var a = ['0', '1', '2', '3', '4'];
     a[Symbol.iterator] = function* () {
--- a/js/src/tests/ecma_6/TypedArray/from_mapping.js
+++ b/js/src/tests/ecma_6/TypedArray/from_mapping.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     // If the mapfn argument to %TypedArray%.from is undefined, don't map.
     assertDeepEq(constructor.from([3, 4, 5], undefined), new constructor([3, 4, 5]));
     assertDeepEq(constructor.from([4, 5, 6], undefined, Math), new constructor([4, 5, 6]));
 
     // mapfn is called with two arguments: value and index.
     var log = [];
     function f(...args) {
         log.push(args);
@@ -53,13 +32,12 @@ for (var constructor of constructors) {
     // The mapfn is called even if the value to be mapped is undefined.
     assertDeepEq(constructor.from([0, 1, , 3], String), new constructor(["0", "1", "undefined", "3"]));
     var arraylike = {length: 4, "0": 0, "1": 1, "3": 3};
     assertDeepEq(constructor.from(arraylike, String), new constructor(["0", "1", "undefined", "3"]));
 }
 
 // %TypedArray%.from(obj, map) is not exactly the same as %TypedArray%.from(obj).map(mapFn).
 assertDeepEq(Int8Array.from([150], v => v / 2), new Int8Array([75]));
-// Uncomment the following line when we implement the .map method.
-// assertDeepEq(Int8Array.from([150]).map(v => v / 2), new Int8Array([-53]));
+assertDeepEq(Int8Array.from([150]).map(v => v / 2), new Int8Array([-53]));
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/from_proxy.js
+++ b/js/src/tests/ecma_6/TypedArray/from_proxy.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     // Two tests involving %TypedArray%.from and a Proxy.
     var log = [];
     function LoggingProxy(target) {
         log.push("target", target);
         var h = {
             defineProperty: function (t, id) {
                 log.push("define", id);
                 return true;
--- a/js/src/tests/ecma_6/TypedArray/from_realms.js
+++ b/js/src/tests/ecma_6/TypedArray/from_realms.js
@@ -1,31 +1,10 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
-    if (typeof newGlobal !== 'function' || isSharedConstructor(constructor))
+for (var constructor of anyTypedArrayConstructors) {
+    if (typeof newGlobal !== 'function')
         break;
 
     // G[constructor.name].from, where G is any global, produces an array whose prototype
     // is G[constructor.name].prototype.
     var g = newGlobal();
     var ga = g[constructor.name].from([1, 2, 3]);
     assertEq(ga instanceof g[constructor.name], true);
 
--- a/js/src/tests/ecma_6/TypedArray/from_surfaces.js
+++ b/js/src/tests/ecma_6/TypedArray/from_surfaces.js
@@ -1,35 +1,12 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     // Check superficial features of %TypeArray%.from.
     var desc = Object.getOwnPropertyDescriptor(constructor.__proto__, "from");
-    if (!isSharedConstructor(constructor)) {
-	assertEq(desc.configurable, true);
-	assertEq(desc.enumerable, false);
-	assertEq(desc.writable, true);
-    }
+    assertEq(desc.configurable, true);
+    assertEq(desc.enumerable, false);
+    assertEq(desc.writable, true);
     assertEq(constructor.from.length, 1);
     assertThrowsInstanceOf(() => new constructor.from(), TypeError);  // not a constructor
 }
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/from_this.js
+++ b/js/src/tests/ecma_6/TypedArray/from_this.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     // The third argument to %TypedArray%.from is passed as the 'this' value to the
     // mapping function.
     var hits = 0, obj = {};
     function f(x) {
         assertEq(this, obj);
         hits++;
     }
     constructor.from(["a", "b", "c"], f, obj);
--- a/js/src/tests/ecma_6/TypedArray/has-property-op.js
+++ b/js/src/tests/ecma_6/TypedArray/has-property-op.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     var obj = new constructor(5);
 
     for (var i = 0; i < obj.length; i++)
         assertEq(i in obj, true);
 
     for (var v of [20, 300, -1, 5, -10, Math.pow(2, 32) - 1, -Math.pow(2, 32)])
         assertEq(v in obj, false);
 
--- a/js/src/tests/ecma_6/TypedArray/includes.js
+++ b/js/src/tests/ecma_6/TypedArray/includes.js
@@ -1,46 +1,25 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.includes.length, 1);
 
     assertEq(new constructor([1, 2, 3]).includes(1), true);
     assertEq(new constructor([1, 2, 3]).includes(2), true);
     assertEq(new constructor([1, 2, 3]).includes(3), true);
     assertEq(new constructor([1, 2, 3]).includes(2, 1), true);
     assertEq(new constructor([1, 2, 3]).includes(2, -2), true);
     assertEq(new constructor([1, 2, 3]).includes(2, -100), true);
 
     assertEq(new constructor([1, 2, 3]).includes("2"), false);
     assertEq(new constructor([1, 2, 3]).includes(2, 2), false);
     assertEq(new constructor([1, 2, 3]).includes(2, -1), false);
     assertEq(new constructor([1, 2, 3]).includes(2, 100), false);
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var includes = newGlobal()[constructor.name].prototype.includes;
         assertEq(includes.call(new constructor([1, 2, 3]), 2), true);
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
                             new Proxy(new constructor(), {})];
     invalidReceivers.forEach(invalidReceiver => {
--- a/js/src/tests/ecma_6/TypedArray/indexOf-and-lastIndexOf.js
+++ b/js/src/tests/ecma_6/TypedArray/indexOf-and-lastIndexOf.js
@@ -1,41 +1,20 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
 // Tests for TypedArray#indexOf.
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.indexOf.length, 1);
 
     // Works with one argument.
     assertEq(new constructor([1, 2, 3, 4, 5]).indexOf(0), -1);
     assertEq(new constructor([1, 2, 3, 4, 5]).indexOf(1), 0);
     assertEq(new constructor([1, 2, 3, 4, 5]).indexOf(5), 4);
     assertEq(new constructor([1, 2, 3, 4, 5]).indexOf(6), -1);
     assertEq(new constructor([1, 2, 1, 2, 1]).indexOf(1), 0);
 
-    if (isFloatingConstructor(constructor)) {
+    if (isFloatConstructor(constructor)) {
         assertEq(new constructor([NaN, 0, -0]).indexOf(NaN), -1);
         assertEq(new constructor([NaN, 0, -0]).indexOf(0), 1);
         assertEq(new constructor([NaN, 0, -0]).indexOf(-0), 1);
     } else {
         // [NaN, 0, -0] will be coerced to [0, 0, 0]
         assertEq(new constructor([NaN, 0, -0]).indexOf(NaN), -1);
         assertEq(new constructor([NaN, 0, -0]).indexOf(0), 0);
         assertEq(new constructor([NaN, 0, -0]).indexOf(-0), 0);
@@ -61,33 +40,39 @@ for (var constructor of constructors) {
     // test that this.length is never called
     assertEq(Object.defineProperty(new constructor([0, 1, 2, 3, 5]), "length", {
         get() {
             throw new Error("length accessor called");
         }
     }).indexOf(1), 1);
 }
 
-assertEq(new Float32Array([.1, .2, .3]).indexOf(.2), -1);
-assertEq(new Float32Array([.1, .2, .3]).indexOf(Math.fround(.2)), 1);
-assertEq(new Float64Array([.1, .2, .3]).indexOf(.2), 1);
+for (let constructor of anyTypedArrayConstructors.filter(isFloatConstructor)) {
+    if (constructor.BYTES_PER_ELEMENT === 4) {
+        assertEq(new constructor([.1, .2, .3]).indexOf(.2), -1);
+        assertEq(new constructor([.1, .2, .3]).indexOf(Math.fround(.2)), 1);
+    } else {
+        assertEq(constructor.BYTES_PER_ELEMENT, 8);
+        assertEq(new constructor([.1, .2, .3]).indexOf(.2), 1);
+    }
+}
 
 // Tests for TypedArray#lastIndexOf.
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
 
     assertEq(constructor.prototype.lastIndexOf.length, 1);
 
     // Works with one arguments.
     assertEq(new constructor([1, 2, 3, 4, 5]).lastIndexOf(0), -1);
     assertEq(new constructor([1, 2, 3, 4, 5]).lastIndexOf(1), 0);
     assertEq(new constructor([1, 2, 3, 4, 5]).lastIndexOf(5), 4);
     assertEq(new constructor([1, 2, 3, 4, 5]).lastIndexOf(6), -1);
     assertEq(new constructor([1, 2, 1, 2, 1]).lastIndexOf(1), 4);
 
-    if (isFloatingConstructor(constructor)) {
+    if (isFloatConstructor(constructor)) {
         assertEq(new constructor([NaN, 0, -0]).lastIndexOf(NaN), -1);
         assertEq(new constructor([NaN, 0, -0]).lastIndexOf(0), 2);
         assertEq(new constructor([NaN, 0, -0]).lastIndexOf(-0), 2);
     } else {
         // [NaN, 0, -0] will be coerced to [0, 0, 0].
         assertEq(new constructor([NaN, 0, -0]).lastIndexOf(NaN), -1);
         assertEq(new constructor([NaN, 0, -0]).lastIndexOf(0), 2);
         assertEq(new constructor([NaN, 0, -0]).lastIndexOf(-0), 2);
@@ -113,14 +98,20 @@ for (var constructor of constructors) {
     // Test that the length getter is never called.
     assertEq(Object.defineProperty(new constructor([0, 1, 2, 3, 5]), "length", {
         get() {
             throw new Error("length accessor called");
         }
     }).lastIndexOf(1), 1);
 }
 
-assertEq(new Float32Array([.1, .2, .3]).lastIndexOf(.2), -1);
-assertEq(new Float32Array([.1, .2, .3]).lastIndexOf(Math.fround(.2)), 1);
-assertEq(new Float64Array([.1, .2, .3]).lastIndexOf(.2), 1);
+for (let constructor of anyTypedArrayConstructors.filter(isFloatConstructor)) {
+    if (constructor.BYTES_PER_ELEMENT === 4) {
+        assertEq(new constructor([.1, .2, .3]).lastIndexOf(.2), -1);
+        assertEq(new constructor([.1, .2, .3]).lastIndexOf(Math.fround(.2)), 1);
+    } else {
+        assertEq(constructor.BYTES_PER_ELEMENT, 8);
+        assertEq(new constructor([.1, .2, .3]).lastIndexOf(.2), 1);
+    }
+}
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/join.js
+++ b/js/src/tests/ecma_6/TypedArray/join.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.join.length, 1);
 
     assertEq(new constructor([1, 2, 3]).join(), "1,2,3");
     assertEq(new constructor([1, 2, 3]).join(undefined), "1,2,3");
     assertEq(new constructor([1, 2, 3]).join(null), "1null2null3");
     assertEq(new constructor([1, 2, 3]).join(""), "123");
     assertEq(new constructor([1, 2, 3]).join("+"), "1+2+3");
     assertEq(new constructor([1, 2, 3]).join(.1), "10.120.13");
@@ -34,17 +13,17 @@ for (var constructor of constructors) {
     assertEq(new constructor().join("*"), "");
     assertEq(new constructor(1).join(), "0");
     assertEq(new constructor(3).join(), "0,0,0");
 
     assertThrowsInstanceOf(() => new constructor().join({toString(){throw new TypeError}}), TypeError);
     assertThrowsInstanceOf(() => new constructor().join(Symbol()), TypeError);
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var join = newGlobal()[constructor.name].prototype.join;
         assertEq(join.call(new constructor([1, 2, 3]), "\t"), "1\t2\t3");
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
                             new Proxy(new constructor(), {})];
     invalidReceivers.forEach(invalidReceiver => {
@@ -56,13 +35,14 @@ for (var constructor of constructors) {
     // Test that the length getter is never called.
     assertEq(Object.defineProperty(new constructor([1, 2, 3]), "length", {
         get() {
             throw new Error("length accessor called");
         }
     }).join("\0"), "1\0002\0003");
 }
 
-assertDeepEq(new Float32Array([null, , NaN]).join(), "0,NaN,NaN");
-assertDeepEq(new Float64Array([null, , NaN]).join(), "0,NaN,NaN");
+for (let constructor of anyTypedArrayConstructors.filter(isFloatConstructor)) {
+    assertDeepEq(new constructor([null, , NaN]).join(), "0,NaN,NaN");
+}
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/keys.js
+++ b/js/src/tests/ecma_6/TypedArray/keys.js
@@ -1,47 +1,26 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.keys.length, 0);
     assertEq(constructor.prototype.keys.name, "keys");
 
     assertDeepEq([...new constructor(0).keys()], []);
     assertDeepEq([...new constructor(1).keys()], [0]);
     assertDeepEq([...new constructor(2).keys()], [0, 1]);
     assertDeepEq([...new constructor([15]).keys()], [0]);
 
     var arr = new constructor([1, 2, 3]);
     var iterator = arr.keys();
     assertDeepEq(iterator.next(), {value: 0, done: false});
     assertDeepEq(iterator.next(), {value: 1, done: false});
     assertDeepEq(iterator.next(), {value: 2, done: false});
     assertDeepEq(iterator.next(), {value: undefined, done: true});
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var keys = newGlobal()[constructor.name].prototype.keys;
         assertDeepEq([...keys.call(new constructor(2))], [0, 1]);
         arr = new (newGlobal()[constructor.name])(2);
         assertEq([...constructor.prototype.keys.call(arr)].toString(), "0,1");
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
--- a/js/src/tests/ecma_6/TypedArray/map-and-filter.js
+++ b/js/src/tests/ecma_6/TypedArray/map-and-filter.js
@@ -1,31 +1,10 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
 // Tests for TypedArray#map.
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.map.length, 1);
 
     // Basic tests.
     assertDeepEq(new constructor([1, 3, 5]).map(v => v * 2), new constructor([2,6,10]));
     assertDeepEq(new constructor([-1, 13, 5]).map(v => v - 2), new constructor([-3, 11, 3]));
     assertDeepEq(new constructor(10).map(v => v), new constructor(10));
     assertDeepEq(new constructor().map(v => v + 1), new constructor);
     assertDeepEq(new constructor([1,2,3]).map(v => v), new constructor([1,2,3]));
@@ -115,17 +94,17 @@ for (var constructor of constructors) {
     })
 
     // Callback is a generator.
     arr.map(function*(){
         throw "This line will not be executed";
     });
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var map = newGlobal()[constructor.name].prototype.map;
         var sum = 0;
         assertDeepEq(map.call(new constructor([1, 2, 3]), v => sum += v), new constructor([1,3,6]));
         assertEq(sum, 6);
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
@@ -140,17 +119,17 @@ for (var constructor of constructors) {
     assertDeepEq(Object.defineProperty(new constructor([1, 2, 3]), "length", {
         get() {
             throw new Error("length accessor called");
         }
     }).map((b) => b), new constructor([1,2,3]));
 }
 
 // Test For TypedArray#filter.
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.filter.length, 1)
 
     // Basic tests.
     assertDeepEq(new constructor([1,2,3]).filter(x => x == x), new constructor([1,2,3]));
     assertDeepEq(new constructor([1,2,3,4]).filter(x => x % 2 == 0), new constructor([2,4]));
     assertDeepEq(new constructor([1,2,3,4,5]).filter(x => x < 4), new constructor([1,2,3]));
     assertDeepEq(new constructor().filter(x => x * 2 == 4), new constructor());
 
@@ -239,17 +218,17 @@ for (var constructor of constructors) {
     })
 
     // Callback is a generator.
     arr.filter(function*(){
         throw "This line will not be executed";
     });
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var filter = newGlobal()[constructor.name].prototype.filter;
         var sum = 0;
         assertDeepEq(filter.call(new constructor([1, 2, 3]), v => {sum += v; return true}),
         new constructor([1,2,3]));
         assertEq(sum, 6);
     }
 
     // Throws if `this` isn't a TypedArray.
--- a/js/src/tests/ecma_6/TypedArray/object-defineproperty.js
+++ b/js/src/tests/ecma_6/TypedArray/object-defineproperty.js
@@ -48,38 +48,17 @@ assertEq(desc.writable, true);
 assertEq(desc.value, 18);
 assertEq('get' in desc, false);
 assertEq('set' in desc, false);
 
 Object.defineProperties(obj, {0: {value: 20}, 1: {value: 42}});
 assertEq(obj[0], 20);
 assertEq(obj[1], 42);
 
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-constructors.forEach(constructor => {
+anyTypedArrayConstructors.forEach(constructor => {
     var obj = new constructor(4);
     obj[0] = 100;
     obj[1] = 200;
 
     for (var v of [20, 300, -10, Math.pow(2, 32), -Math.pow(2, 32), NaN]) {
         Object.defineProperty(obj, 0, {value: v});
         obj[1] = v;
         assertEq(obj[0], obj[1]);
--- a/js/src/tests/ecma_6/TypedArray/of.js
+++ b/js/src/tests/ecma_6/TypedArray/of.js
@@ -1,46 +1,21 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.of.length, 0);
 
-    if (!isSharedConstructor(constructor)) {
-	assertDeepEq(Object.getOwnPropertyDescriptor(constructor.__proto__, "of"), {
-            value: constructor.of,
-            writable: true,
-            enumerable: false,
-            configurable: true
-	});
-    }
+    assertDeepEq(Object.getOwnPropertyDescriptor(constructor.__proto__, "of"), {
+        value: constructor.of,
+        writable: true,
+        enumerable: false,
+        configurable: true
+    });
 
     // Basic tests.
-    if (!isSharedConstructor(constructor)) {
-	assertEq(constructor.of().constructor, constructor);
-	assertEq(constructor.of() instanceof constructor, true);
-    }
+    assertEq(constructor.of().constructor, constructor);
+    assertEq(constructor.of() instanceof constructor, true);
     assertDeepEq(constructor.of(10), new constructor([10]));
     assertDeepEq(constructor.of(1, 2, 3), new constructor([1, 2, 3]));
     assertDeepEq(constructor.of("1", "2", "3"), new constructor([1, 2, 3]));
 
     // This method can be transplanted to other constructors.
     assertDeepEq(constructor.of.call(Array, 1, 2, 3), [1, 2, 3]);
 
     var hits = 0;
@@ -52,17 +27,17 @@ for (var constructor of constructors) {
     }, "a", "b", "c"), {
         0: "a",
         1: "b",
         2: "c"
     });
     assertEq(hits, 1);
 
     // Behavior across compartments.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var newC = newGlobal()[constructor.name];
         assertEq(newC.of() instanceof newC, true);
         assertEq(newC.of() instanceof constructor, false);
         assertEq(newC.of.call(constructor) instanceof constructor, true);
     }
 
     // Throws if `this` isn't a constructor.
     var invalidConstructors = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
@@ -107,13 +82,14 @@ for (var constructor of constructors) {
                 set 0(v) {
                     throw new TypeError;
                 }
             });
         }, "a");
     }, TypeError);
 }
 
-assertDeepEq(Float32Array.of(0.1, null, undefined, NaN), new Float32Array([0.1, 0, NaN, NaN]));
-assertDeepEq(Float64Array.of(0.1, null, undefined, NaN), new Float64Array([0.1, 0, NaN, NaN]));
+for (let constructor of anyTypedArrayConstructors.filter(isFloatConstructor)) {
+    assertDeepEq(constructor.of(0.1, null, undefined, NaN), new constructor([0.1, 0, NaN, NaN]));
+}
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/prototype-constructor-identity.js
+++ b/js/src/tests/ecma_6/TypedArray/prototype-constructor-identity.js
@@ -27,21 +27,17 @@ assertEq(TypedArray.prototype.constructo
          "bad %TypedArray%.prototype.constructor");
 
 // Check a few different functions we implement are here, as a sanity check.
 var typedArrayProps = Object.getOwnPropertyNames(TypedArray.prototype);
 assertEq(typedArrayProps.indexOf("copyWithin") >= 0, true);
 assertEq(typedArrayProps.indexOf("subarray") >= 0, true);
 assertEq(typedArrayProps.indexOf("set") >= 0, true);
 
-var ctors = [Int8Array, Uint8Array, Uint8ClampedArray,
-             Int16Array, Uint16Array,
-             Int32Array, Uint32Array,
-             Float32Array, Float64Array];
-ctors.forEach(function(ctor) {
+anyTypedArrayConstructors.forEach(function(ctor) {
   assertEq(Object.getPrototypeOf(ctor), TypedArray);
 
   var proto = ctor.prototype;
 
   // Inherited functions aren't present.
   var props = Object.getOwnPropertyNames(proto).sort();
   assertEq(props[0], "BYTES_PER_ELEMENT");
   assertEq(props[1], "constructor");
--- a/js/src/tests/ecma_6/TypedArray/reduce-and-reduceRight.js
+++ b/js/src/tests/ecma_6/TypedArray/reduce-and-reduceRight.js
@@ -1,31 +1,10 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
 // Tests for TypedArray#reduce.
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.reduce.length, 1);
 
     // Basic tests.
     var arr = new constructor([1, 2, 3, 4, 5]);
 
     assertEq(arr.reduce((previous, current) => previous + current), 15);
     assertEq(arr.reduce((previous, current) => current - previous), 3);
 
@@ -85,17 +64,17 @@ for (var constructor of constructors) {
     })
 
     // Callback is a generator.
     arr.reduce(function*(){
         throw "This line will not be executed";
     });
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var reduce = newGlobal()[constructor.name].prototype.reduce;
         assertEq(reduce.call(arr, (previous, current) => Math.min(previous, current)), 1);
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
                             new Proxy(new constructor(3), {})];
     invalidReceivers.forEach(invalidReceiver => {
@@ -108,17 +87,17 @@ for (var constructor of constructors) {
     assertEq(Object.defineProperty(arr, "length", {
         get() {
             throw new Error("length accessor called");
         }
     }).reduce((previous, current) => Math.max(previous, current)), 5);
 }
 
 // Tests for TypedArray#reduceRight.
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.reduceRight.length, 1);
 
     // Basic tests.
     var arr = new constructor([1, 2, 3, 4, 5]);
 
     assertEq(arr.reduceRight((previous, current) => previous + current), 15);
     assertEq(arr.reduceRight((previous, current) => current - previous), 3);
 
@@ -178,17 +157,17 @@ for (var constructor of constructors) {
     })
 
     // Callback is a generator.
     arr.reduceRight(function*(){
         throw "This line will not be executed";
     });
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var reduceRight = newGlobal()[constructor.name].prototype.reduceRight;
         assertEq(reduceRight.call(arr, (previous, current) => Math.min(previous, current)), 1);
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
                             new Proxy(new constructor(3), {})];
     invalidReceivers.forEach(invalidReceiver => {
--- a/js/src/tests/ecma_6/TypedArray/reverse.js
+++ b/js/src/tests/ecma_6/TypedArray/reverse.js
@@ -1,44 +1,23 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertDeepEq(constructor.prototype.reverse.length, 0);
 
     assertDeepEq(new constructor().reverse(), new constructor());
     assertDeepEq(new constructor(10).reverse(), new constructor(10));
     assertDeepEq(new constructor([]).reverse(), new constructor([]));
     assertDeepEq(new constructor([1]).reverse(), new constructor([1]));
     assertDeepEq(new constructor([1, 2]).reverse(), new constructor([2, 1]));
     assertDeepEq(new constructor([1, 2, 3]).reverse(), new constructor([3, 2, 1]));
     assertDeepEq(new constructor([1, 2, 3, 4]).reverse(), new constructor([4, 3, 2, 1]));
     assertDeepEq(new constructor([1, 2, 3, 4, 5]).reverse(), new constructor([5, 4, 3, 2, 1]));
     assertDeepEq(new constructor([.1, .2, .3]).reverse(), new constructor([.3, .2, .1]));
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var reverse = newGlobal()[constructor.name].prototype.reverse;
         assertDeepEq(reverse.call(new constructor([3, 2, 1])), new constructor([1, 2, 3]));
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
                             new Proxy(new constructor(), {})];
     invalidReceivers.forEach(invalidReceiver => {
--- a/js/src/tests/ecma_6/TypedArray/set.js
+++ b/js/src/tests/ecma_6/TypedArray/set.js
@@ -1,28 +1,16 @@
 const TypedArrayPrototype = Object.getPrototypeOf(Int8Array.prototype);
 
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array
-];
-
 // %TypedArrayPrototype% has an own "set" function property.
 assertEq(TypedArrayPrototype.hasOwnProperty("set"), true);
 assertEq(typeof TypedArrayPrototype.set, "function");
 
 // The concrete TypedArray prototypes do not have an own "set" property.
-assertEq(constructors.every(c => !c.hasOwnProperty("set")), true);
+assertEq(anyTypedArrayConstructors.every(c => !c.hasOwnProperty("set")), true);
 
 assertDeepEq(Object.getOwnPropertyDescriptor(TypedArrayPrototype, "set"), {
     value: TypedArrayPrototype.set,
     writable: true,
     enumerable: false,
     configurable: true,
 });
 
--- a/js/src/tests/ecma_6/TypedArray/shell.js
+++ b/js/src/tests/ecma_6/TypedArray/shell.js
@@ -1,38 +1,113 @@
-// Synthesize a constructor for a shared memory array from the
-// constructor for unshared memory.  This has "good enough" fidelity
-// for many uses.  In cases where it's not good enough, use the
-// __isShared__ flags or call isSharedConstructor for local workarounds.
+(function(global) {
+    "use strict";
+
+    const {
+        Float32Array, Float64Array, Object, Reflect, SharedArrayBuffer, WeakMap,
+        assertEq
+    } = global;
+    const {
+        apply: Reflect_apply,
+        construct: Reflect_construct,
+    } = Reflect;
+    const {
+        get: WeakMap_prototype_get,
+        has: WeakMap_prototype_has,
+    } = WeakMap.prototype;
+
+    const sharedConstructors = new WeakMap();
+
+    // Synthesize a constructor for a shared memory array from the constructor
+    // for unshared memory. This has "good enough" fidelity for many uses. In
+    // cases where it's not good enough, call isSharedConstructor for local
+    // workarounds.
+    function sharedConstructor(baseConstructor) {
+        // Create SharedTypedArray as a subclass of %TypedArray%, following the
+        // built-in %TypedArray% subclasses.
+        class SharedTypedArray extends Object.getPrototypeOf(baseConstructor) {
+            constructor(...args) {
+                var array = Reflect_construct(baseConstructor, args);
+                var {buffer, byteOffset, length} = array;
+                var sharedBuffer = new SharedArrayBuffer(buffer.byteLength);
+                var sharedArray = Reflect_construct(baseConstructor,
+                                                    [sharedBuffer, byteOffset, length],
+                                                    new.target);
+                for (var i = 0; i < length; i++)
+                    sharedArray[i] = array[i];
+                assertEq(sharedArray.buffer, sharedBuffer);
+                return sharedArray;
+            }
+        }
+
+        // 22.2.5.1 TypedArray.BYTES_PER_ELEMENT
+        Object.defineProperty(SharedTypedArray, "BYTES_PER_ELEMENT",
+                              {__proto__: null, value: baseConstructor.BYTES_PER_ELEMENT});
+
+        // 22.2.6.1 TypedArray.prototype.BYTES_PER_ELEMENT
+        Object.defineProperty(SharedTypedArray.prototype, "BYTES_PER_ELEMENT",
+                              {__proto__: null, value: baseConstructor.BYTES_PER_ELEMENT});
+
+        // Share the same name with the base constructor to avoid calling
+        // isSharedConstructor() in multiple places.
+        Object.defineProperty(SharedTypedArray, "name",
+                              {__proto__: null, value: baseConstructor.name});
+
+        sharedConstructors.set(SharedTypedArray, baseConstructor);
 
-function sharedConstructor(constructor) {
-    var c = function(...args) {
-	if (!new.target)
-	    throw new TypeError("Not callable");
-	var array = new constructor(...args);
-	var buffer = array.buffer;
-	var offset = array.byteOffset;
-	var length = array.length;
-	var sharedBuffer = new SharedArrayBuffer(buffer.byteLength);
-	var sharedArray = new constructor(sharedBuffer, offset, length);
-	for ( var i=0 ; i < length ; i++ )
-	    sharedArray[i] = array[i];
-	assertEq(sharedArray.buffer, sharedBuffer);
-	return sharedArray;
-    };
-    c.prototype = Object.create(constructor.prototype);
-    c.__isShared__ = true;
-    c.__baseConstructor__ = constructor;
-    c.from = constructor.from;
-    c.of = constructor.of;
-    return c;
-}
+        return SharedTypedArray;
+    }
+
+    /**
+     * All TypedArray constructors for unshared memory.
+     */
+    const typedArrayConstructors = Object.freeze([
+        Int8Array,
+        Uint8Array,
+        Uint8ClampedArray,
+        Int16Array,
+        Uint16Array,
+        Int32Array,
+        Uint32Array,
+        Float32Array,
+        Float64Array,
+    ]);
+
+    /**
+     * All TypedArray constructors for shared memory.
+     */
+    const sharedTypedArrayConstructors = Object.freeze(
+        typedArrayConstructors.map(sharedConstructor)
+    );
 
-function isSharedConstructor(x) {
-    return typeof x == "function" && x.__isShared__;
-}
+    /**
+     * All TypedArray constructors for unshared and shared memory.
+     */
+    const anyTypedArrayConstructors = Object.freeze([
+        ...typedArrayConstructors,
+        ...(typeof SharedArrayBuffer === "function" ? sharedTypedArrayConstructors : []),
+    ]);
+
+    /**
+     * Returns `true` if `constructor` is a TypedArray constructor for shared
+     * memory.
+     */
+    function isSharedConstructor(constructor) {
+        return Reflect_apply(WeakMap_prototype_has, sharedConstructors, [constructor]);
+    }
 
-function isFloatingConstructor(c) {
-    return c == Float32Array ||
-	c == Float64Array ||
-	(c.hasOwnProperty("__baseConstructor__") &&
-	 isFloatingConstructor(c.__baseConstructor__));
-}
+    /**
+     * Returns `true` if `constructor` is a TypedArray constructor for shared
+     * or unshared memory, with an underlying element type of either Float32 or
+     * Float64.
+     */
+    function isFloatConstructor(constructor) {
+        if (isSharedConstructor(constructor))
+            constructor = Reflect_apply(WeakMap_prototype_get, sharedConstructors, [constructor]);
+        return constructor == Float32Array || constructor == Float64Array;
+    }
+
+    global.typedArrayConstructors = typedArrayConstructors;
+    global.sharedTypedArrayConstructors = sharedTypedArrayConstructors;
+    global.anyTypedArrayConstructors = anyTypedArrayConstructors;
+    global.isSharedConstructor = isSharedConstructor;
+    global.isFloatConstructor = isFloatConstructor;
+})(this);
--- a/js/src/tests/ecma_6/TypedArray/slice-species.js
+++ b/js/src/tests/ecma_6/TypedArray/slice-species.js
@@ -1,21 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array
-];
-
-for (var constructor of constructors) {
+for (var constructor of typedArrayConstructors) {
     // Basic tests for our SpeciesConstructor implementation.
     var undefConstructor = new constructor(2);
     undefConstructor.constructor = undefined;
     assertDeepEq(undefConstructor.slice(1), new constructor(1));
 
     assertThrowsInstanceOf(() => {
         var strConstructor = new constructor;
         strConstructor.constructor = "not a constructor";
@@ -33,17 +21,17 @@ for (var constructor of constructors) {
     assertDeepEq(undefSpecies.slice(1), new constructor(1));
 
     var nullSpecies = new constructor(2);
     nullSpecies.constructor = { [Symbol.species]: null };
     assertDeepEq(nullSpecies.slice(1), new constructor(1));
 
     // If obj.constructor[@@species] is different constructor, it should be
     // used.
-    for (var constructor2 of constructors) {
+    for (var constructor2 of typedArrayConstructors) {
         var modifiedConstructor = new constructor(2);
         modifiedConstructor.constructor = constructor2;
         assertDeepEq(modifiedConstructor.slice(1), new constructor2(1));
 
         var modifiedSpecies = new constructor(2);
         modifiedSpecies.constructor = { [Symbol.species]: constructor2 };
         assertDeepEq(modifiedSpecies.slice(1), new constructor2(1));
     }
--- a/js/src/tests/ecma_6/TypedArray/slice.js
+++ b/js/src/tests/ecma_6/TypedArray/slice.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertDeepEq(constructor.prototype.slice.length, 2);
 
     assertDeepEq(new constructor().slice(0), new constructor());
     assertDeepEq(new constructor().slice(0, 4), new constructor());
     assertDeepEq(new constructor(10).slice(0, 2), new constructor(2));
 
     assertDeepEq(new constructor([1, 2]).slice(1), new constructor([2]));
     assertDeepEq(new constructor([1, 2]).slice(0), new constructor([1, 2]));
@@ -33,17 +12,17 @@ for (var constructor of constructors) {
     assertDeepEq(new constructor([.1, .2]).slice(0), new constructor([.1, .2]));
 
     assertDeepEq(new constructor([1, 2]).slice(-3), new constructor([1, 2]));
     assertDeepEq(new constructor([1, 2]).slice(0, -3), new constructor());
     assertDeepEq(new constructor([1, 2]).slice(4), new constructor());
     assertDeepEq(new constructor([1, 2]).slice(1, 5), new constructor([2]));
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var slice = newGlobal()[constructor.name].prototype.slice;
         assertDeepEq(slice.call(new constructor([3, 2, 1]), 1),
                      new constructor([2, 1]));
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
                             new Proxy(new constructor(), {})];
--- a/js/src/tests/ecma_6/TypedArray/sort_basics.js
+++ b/js/src/tests/ecma_6/TypedArray/sort_basics.js
@@ -57,25 +57,17 @@ function SortTest(dataType, dataSource) 
     typedArray.sort((x, y) => cmp(y, x));
 
     // The array should be in reverse order
     for (let i=typedArray.length - 2; i >= 0; i--)
         assertEq(gte(typedArray[i], typedArray[i + 1]), true,
                  `The array is not properly sorted! ${typedArray[i]} < ${typedArray[i + 1]}, seed: ${SEED}`)
 }
 
-function RunTests(arrayLength) {
-    SortTest(Int32Array,    genRandomArrayBuffer(arrayLength, 32, SEED));
-    SortTest(Uint32Array,   genRandomArrayBuffer(arrayLength, 32, SEED));
-    SortTest(Int16Array,    genRandomArrayBuffer(arrayLength, 16, SEED));
-    SortTest(Uint16Array,   genRandomArrayBuffer(arrayLength, 16, SEED));
-    SortTest(Int8Array,     genRandomArrayBuffer(arrayLength, 8,  SEED));
-    SortTest(Uint8Array,    genRandomArrayBuffer(arrayLength, 8,  SEED));
-    SortTest(Float32Array,  genRandomArrayBuffer(arrayLength, 32, SEED));
-    SortTest(Float64Array,  genRandomArrayBuffer(arrayLength, 64, SEED));
+for (let constructor of anyTypedArrayConstructors) {
+    for (let arrayLength of [256, 16, 0]) {
+        let source = genRandomArrayBuffer(arrayLength, constructor.BYTES_PER_ELEMENT * 8, SEED);
+        SortTest(constructor, source);
+    }
 }
 
-RunTests(256);
-RunTests(16);
-RunTests(0);
-
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/sort_errors.js
+++ b/js/src/tests/ecma_6/TypedArray/sort_errors.js
@@ -1,17 +1,17 @@
-// |reftest| skip-if(!xulRuntime.shell) -- needs detachArrayBuffer
-
 // Ensure that TypedArrays throw when attempting to sort a detached ArrayBuffer
-assertThrowsInstanceOf(() => {
-    let buffer = new ArrayBuffer(32);
-    let array  = new Int32Array(buffer);
-    detachArrayBuffer(buffer);
-    array.sort();
-}, TypeError);
+if (typeof detachArrayBuffer === "function") {
+    assertThrowsInstanceOf(() => {
+        let buffer = new ArrayBuffer(32);
+        let array  = new Int32Array(buffer);
+        detachArrayBuffer(buffer);
+        array.sort();
+    }, TypeError);
+}
 
 // Ensure that TypedArray.prototype.sort will not sort non-TypedArrays
 assertThrowsInstanceOf(() => {
     let array = [4, 3, 2, 1];
     Int32Array.prototype.sort.call(array);
 }, TypeError);
 
 assertThrowsInstanceOf(() => {
--- a/js/src/tests/ecma_6/TypedArray/sort_globals.js
+++ b/js/src/tests/ecma_6/TypedArray/sort_globals.js
@@ -1,9 +1,9 @@
 // TypedArray.prototype.sort should work across globals
 let g2 = newGlobal();
-assertDeepEq(
+assertEqArray(
     Int32Array.prototype.sort.call(new g2.Int32Array([3, 2, 1])),
     new Int32Array([1, 2, 3])
 );
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/sort_small.js
+++ b/js/src/tests/ecma_6/TypedArray/sort_small.js
@@ -1,35 +1,38 @@
-// Pre-sorted test data, it's important that these arrays remain in ascending order.
-let i32  = [-2147483648, -320000, -244000, 2147483647]
-let u32  = [0, 987632, 4294967295]
-let i16  = [-32768, -999, 1942, 32767]
-let u16  = [0, 65535, 65535]
-let i8   = [-128, 127]
-let u8   = [255]
+const testCases = {
+    // Pre-sorted test data, it's important that these arrays remain in ascending order.
+    [Int8Array.name]: [[-128, 127]],
+    [Int16Array.name]: [[-32768, -999, 1942, 32767]],
+    [Int32Array.name]: [[-2147483648, -320000, -244000, 2147483647]],
+    [Uint8Array.name]: [[255]],
+    [Uint16Array.name]: [[0, 65535, 65535]],
+    [Uint32Array.name]: [[0, 987632, 4294967295]],
+    [Uint8ClampedArray.name]: [[255]],
 
-// Test the behavior in the default comparator as described in 22.2.3.26.
-// The spec boils down to, -0s come before +0s, and NaNs always come last.
-// Float Arrays are used because all other types convert -0 and NaN to +0.
-let f32  = [-2147483647, -2147483646.99, -0, 0, 2147483646.99, NaN]
-let f64  = [-2147483646.99, -0, 0, 4147483646.99, NaN]
-let nans = [1/undefined, NaN, Number.NaN]
+    // Test the behavior in the default comparator as described in 22.2.3.26.
+    // The spec boils down to, -0s come before +0s, and NaNs always come last.
+    // Float Arrays are used because all other types convert -0 and NaN to +0.
+    [Float32Array.name]: [
+        [-2147483647, -2147483646.99, -0, 0, 2147483646.99, NaN],
+        [1/undefined, NaN, Number.NaN]
+    ],
+    [Float64Array.name]: [
+        [-2147483646.99, -0, 0, 4147483646.99, NaN],
+        [1/undefined, NaN, Number.NaN]
+    ],
+};
 
 // Sort every possible permutation of an arrays
 function sortAllPermutations(dataType, testData) {
     let reference = new dataType(testData);
     for (let permutation of Permutations(testData))
         assertDeepEq((new dataType(permutation)).sort(), reference);
 }
 
-sortAllPermutations(Int32Array,   i32);
-sortAllPermutations(Uint32Array,  u32);
-sortAllPermutations(Int16Array,   i16);
-sortAllPermutations(Uint16Array,  u16);
-sortAllPermutations(Int8Array,    i8);
-sortAllPermutations(Uint8Array,   u8);
-sortAllPermutations(Float32Array, f32);
-sortAllPermutations(Float64Array, f64);
-sortAllPermutations(Float32Array, nans);
-sortAllPermutations(Float64Array, nans);
+for (let constructor of sharedTypedArrayConstructors) {
+    for (let data of testCases[constructor.name]) {
+        sortAllPermutations(constructor, data);
+    }
+}
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/sorting_buffer_access.js
+++ b/js/src/tests/ecma_6/TypedArray/sorting_buffer_access.js
@@ -1,26 +1,15 @@
 // Ensure that when sorting arrays of size greater than 128, which
 // calls RadixSort under the hood, we don't access the 'buffer' 
 // property of the typed array directly. 
 
 
 // The buggy behavior in the RadixSort is only exposed when we use
 // float arrays, but checking everything just to be sure.
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-for (var ctor of constructors) {
+for (var ctor of anyTypedArrayConstructors) {
     var testArray = new ctor(1024);
     Object.defineProperty(testArray, "buffer", { get() { throw new Error("FAIL: Buffer accessed directly"); }  });
     testArray.sort();
 }
 
 if (typeof reportCompare === "function")
-    reportCompare(true, true);
\ No newline at end of file
+    reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/toLocaleString-detached.js
+++ b/js/src/tests/ecma_6/TypedArray/toLocaleString-detached.js
@@ -1,32 +1,20 @@
 if (typeof detachArrayBuffer === "function") {
-    const constructors = [
-        Int8Array,
-        Uint8Array,
-        Uint8ClampedArray,
-        Int16Array,
-        Uint16Array,
-        Int32Array,
-        Uint32Array,
-        Float32Array,
-        Float64Array,
-    ];
-
     const originalNumberToLocaleString = Number.prototype.toLocaleString;
 
     // Throws if array buffer is detached.
-    for (let constructor of constructors) {
+    for (let constructor of typedArrayConstructors) {
         let typedArray = new constructor(42);
         detachArrayBuffer(typedArray.buffer);
         assertThrowsInstanceOf(() => typedArray.toLocaleString(), TypeError);
     }
 
     // Throws a TypeError if detached in Number.prototype.toLocaleString.
-    for (let constructor of constructors) {
+    for (let constructor of typedArrayConstructors) {
         Number.prototype.toLocaleString = function() {
             "use strict";
             if (!detached) {
                 detachArrayBuffer(typedArray.buffer);
                 detached = true;
             }
             return this;
         };
--- a/js/src/tests/ecma_6/TypedArray/toLocaleString-nointl.js
+++ b/js/src/tests/ecma_6/TypedArray/toLocaleString-nointl.js
@@ -1,42 +1,30 @@
 if (typeof Intl !== "object") {
-    const constructors = [
-        Int8Array,
-        Uint8Array,
-        Uint8ClampedArray,
-        Int16Array,
-        Uint16Array,
-        Int32Array,
-        Uint32Array,
-        Float32Array,
-        Float64Array,
-    ];
-
     const localeSep = [,,].toLocaleString();
 
     const originalNumberToLocaleString = Number.prototype.toLocaleString;
 
     // Ensure no arguments are passed to the array elements.
-    for (let constructor of constructors) {
+    for (let constructor of anyTypedArrayConstructors) {
         Number.prototype.toLocaleString = function() {
             assertEq(arguments.length, 0);
             return "pass";
         };
 
         // Single element case.
         assertEq(new constructor(1).toLocaleString(), "pass");
 
         // More than one element.
         assertEq(new constructor(2).toLocaleString(), "pass" + localeSep + "pass");
     }
     Number.prototype.toLocaleString = originalNumberToLocaleString;
 
     // Ensure no arguments are passed to the array elements even if supplied.
-    for (let constructor of constructors) {
+    for (let constructor of anyTypedArrayConstructors) {
         Number.prototype.toLocaleString = function() {
             assertEq(arguments.length, 0);
             return "pass";
         };
         let locales = {};
         let options = {};
 
         // Single element case.
--- a/js/src/tests/ecma_6/TypedArray/toLocaleString.js
+++ b/js/src/tests/ecma_6/TypedArray/toLocaleString.js
@@ -1,31 +1,19 @@
 const TypedArrayPrototype = Object.getPrototypeOf(Int8Array.prototype);
 
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array,
-];
-
 // %TypedArrayPrototype% has an own "toLocaleString" function property.
 assertEq(TypedArrayPrototype.hasOwnProperty("toLocaleString"), true);
 assertEq(typeof TypedArrayPrototype.toLocaleString, "function");
 
 // The initial value of %TypedArrayPrototype%.toLocaleString is not Array.prototype.toLocaleString.
 assertEq(TypedArrayPrototype.toLocaleString === Array.prototype.toLocaleString, false);
 
 // The concrete TypedArray prototypes do not have an own "toLocaleString" property.
-assertEq(constructors.every(c => !c.hasOwnProperty("toLocaleString")), true);
+assertEq(anyTypedArrayConstructors.every(c => !c.hasOwnProperty("toLocaleString")), true);
 
 assertDeepEq(Object.getOwnPropertyDescriptor(TypedArrayPrototype, "toLocaleString"), {
     value: TypedArrayPrototype.toLocaleString,
     writable: true,
     enumerable: false,
     configurable: true,
 });
 
@@ -37,26 +25,26 @@ assertThrowsInstanceOf(() => TypedArrayP
 for (let invalid of [void 0, null, {}, [], function(){}, true, 0, "", Symbol()]) {
     assertThrowsInstanceOf(() => TypedArrayPrototype.toLocaleString.call(invalid), TypeError);
 }
 
 const localeOne = 1..toLocaleString(),
       localeTwo = 2..toLocaleString(),
       localeSep = [,,].toLocaleString();
 
-for (let constructor of constructors) {
+for (let constructor of anyTypedArrayConstructors) {
     assertEq(new constructor([]).toLocaleString(), "");
     assertEq(new constructor([1]).toLocaleString(), localeOne);
     assertEq(new constructor([1, 2]).toLocaleString(), localeOne + localeSep + localeTwo);
 }
 
 const originalNumberToLocaleString = Number.prototype.toLocaleString;
 
 // Calls Number.prototype.toLocaleString on each element.
-for (let constructor of constructors) {
+for (let constructor of anyTypedArrayConstructors) {
     Number.prototype.toLocaleString = function() {
         "use strict";
 
         // Ensure this-value is not boxed.
         assertEq(typeof this, "number");
 
         // Test ToString is applied.
         return {
@@ -70,17 +58,17 @@ for (let constructor of constructors) {
     };
     let typedArray = new constructor([1, 2]);
     assertEq(typedArray.toLocaleString(), "11" + localeSep + "12");
 }
 Number.prototype.toLocaleString = originalNumberToLocaleString;
 
 // Calls Number.prototype.toLocaleString from the current Realm.
 const otherGlobal = newGlobal();
-for (let constructor of constructors) {
+for (let constructor of anyTypedArrayConstructors) {
     Number.prototype.toLocaleString = function() {
         "use strict";
         called = true;
         return this;
     };
     let typedArray = new otherGlobal[constructor.name]([1]);
     let called = false;
     assertEq(TypedArrayPrototype.toLocaleString.call(typedArray), "1");
--- a/js/src/tests/ecma_6/TypedArray/toString.js
+++ b/js/src/tests/ecma_6/TypedArray/toString.js
@@ -1,48 +1,69 @@
 const TypedArrayPrototype = Object.getPrototypeOf(Int8Array.prototype);
 
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array,
-];
-
 // %TypedArrayPrototype% has an own "toString" property.
 assertEq(TypedArrayPrototype.hasOwnProperty("toString"), true);
 
 // The initial value of %TypedArrayPrototype%.toString is Array.prototype.toString.
 assertEq(TypedArrayPrototype.toString, Array.prototype.toString);
 
 // The concrete TypedArray prototypes do not have an own "toString" property.
-assertEq(constructors.every(c => !c.hasOwnProperty("toString")), true);
+assertEq(anyTypedArrayConstructors.every(c => !c.hasOwnProperty("toString")), true);
 
 assertDeepEq(Object.getOwnPropertyDescriptor(TypedArrayPrototype, "toString"), {
     value: TypedArrayPrototype.toString,
     writable: true,
     enumerable: false,
     configurable: true,
 });
 
-for (let constructor of constructors) {
+for (let constructor of anyTypedArrayConstructors) {
     assertEq(new constructor([]).toString(), "");
     assertEq(new constructor([1]).toString(), "1");
     assertEq(new constructor([1, 2]).toString(), "1,2");
 }
 
-assertEq(new Int8Array([-1, 2, -3, 4, NaN]).toString(), "-1,2,-3,4,0");
-assertEq(new Uint8Array([255, 2, 3, 4, NaN]).toString(), "255,2,3,4,0");
-assertEq(new Uint8ClampedArray([255, 256, 2, 3, 4, NaN]).toString(), "255,255,2,3,4,0");
-assertEq(new Int16Array([-1, 2, -3, 4, NaN]).toString(), "-1,2,-3,4,0");
-assertEq(new Uint16Array([-1, 2, 3, 4, NaN]).toString(), "65535,2,3,4,0");
-assertEq(new Int32Array([-1, 2, -3, 4, NaN]).toString(), "-1,2,-3,4,0");
-assertEq(new Uint32Array([-1, 2, 3, 4, NaN]).toString(), "4294967295,2,3,4,0");
-assertEq(new Float32Array([-0, 0, 0.5, -0.5, NaN, Infinity, -Infinity]).toString(), "0,0,0.5,-0.5,NaN,Infinity,-Infinity");
-assertEq(new Float64Array([-0, 0, 0.5, -0.5, NaN, Infinity, -Infinity]).toString(), "0,0,0.5,-0.5,NaN,Infinity,-Infinity");
+const testCases = {
+    [Int8Array.name]: {
+        array: [-1, 2, -3, 4, NaN],
+        expected: "-1,2,-3,4,0",
+    },
+    [Int16Array.name]: {
+        array: [-1, 2, -3, 4, NaN],
+        expected: "-1,2,-3,4,0",
+    },
+    [Int32Array.name]: {
+        array: [-1, 2, -3, 4, NaN],
+        expected: "-1,2,-3,4,0",
+    },
+    [Uint8Array.name]: {
+        array: [255, 2, 3, 4, NaN],
+        expected: "255,2,3,4,0",
+    },
+    [Uint16Array.name]: {
+        array: [-1, 2, 3, 4, NaN],
+        expected: "65535,2,3,4,0",
+    },
+    [Uint32Array.name]: {
+        array: [-1, 2, 3, 4, NaN],
+        expected: "4294967295,2,3,4,0",
+    },
+    [Uint8ClampedArray.name]: {
+        array: [255, 256, 2, 3, 4, NaN],
+        expected: "255,255,2,3,4,0",
+    },
+    [Float32Array.name]: {
+        array: [-0, 0, 0.5, -0.5, NaN, Infinity, -Infinity],
+        expected: "0,0,0.5,-0.5,NaN,Infinity,-Infinity",
+    },
+    [Float64Array.name]: {
+        array: [-0, 0, 0.5, -0.5, NaN, Infinity, -Infinity],
+        expected: "0,0,0.5,-0.5,NaN,Infinity,-Infinity",
+    },
+};
+for (let constructor of anyTypedArrayConstructors) {
+    let {array, expected} = testCases[constructor.name];
+    assertEq(new constructor(array).toString(), expected);
+}
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/values.js
+++ b/js/src/tests/ecma_6/TypedArray/values.js
@@ -1,30 +1,9 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array ];
-
-if (typeof SharedArrayBuffer != "undefined")
-    constructors.push(sharedConstructor(Int8Array),
-		      sharedConstructor(Uint8Array),
-		      sharedConstructor(Int16Array),
-		      sharedConstructor(Uint16Array),
-		      sharedConstructor(Int32Array),
-		      sharedConstructor(Uint32Array),
-		      sharedConstructor(Float32Array),
-		      sharedConstructor(Float64Array));
-
-for (var constructor of constructors) {
+for (var constructor of anyTypedArrayConstructors) {
     assertEq(constructor.prototype.values.length, 0);
     assertEq(constructor.prototype.values.name, "values");
     assertEq(constructor.prototype.values, constructor.prototype[Symbol.iterator]);
 
     assertDeepEq([...new constructor(0).values()], []);
     assertDeepEq([...new constructor(1).values()], [0]);
     assertDeepEq([...new constructor(2).values()], [0, 0]);
     assertDeepEq([...new constructor([15]).values()], [15]);
@@ -32,17 +11,17 @@ for (var constructor of constructors) {
     var arr = new constructor([1, 2, 3]);
     var iterator = arr.values();
     assertDeepEq(iterator.next(), {value: 1, done: false});
     assertDeepEq(iterator.next(), {value: 2, done: false});
     assertDeepEq(iterator.next(), {value: 3, done: false});
     assertDeepEq(iterator.next(), {value: undefined, done: true});
 
     // Called from other globals.
-    if (typeof newGlobal === "function" && !isSharedConstructor(constructor)) {
+    if (typeof newGlobal === "function") {
         var values = newGlobal()[constructor.name].prototype.values;
         assertDeepEq([...values.call(new constructor([42, 36]))], [42, 36]);
         arr = new (newGlobal()[constructor.name])([42, 36]);
         assertEq([...constructor.prototype.values.call(arr)].toString(), "42,36");
     }
 
     // Throws if `this` isn't a TypedArray.
     var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
--- a/js/src/tests/ecma_6/shell.js
+++ b/js/src/tests/ecma_6/shell.js
@@ -1,21 +1,21 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 (function(global) {
-  /** Yield every permutation of the elements in some iterable. */
+  /** Yield every permutation of the elements in some array. */
   global.Permutations = function* Permutations(items) {
       if (items.length == 0) {
           yield [];
       } else {
-          let swap;
+          items = items.slice(0);
           for (let i = 0; i < items.length; i++) {
-              swap = items[0];
+              let swap = items[0];
               items[0] = items[i];
               items[i] = swap;
               for (let e of Permutations(items.slice(1, items.length)))
                   yield [items[0]].concat(e);
           }
       }
   };
 })(this);