Backed out changeset 31ce940c509c (bug 1165053)
authorTooru Fujisawa <arai_a@mac.com>
Mon, 28 Mar 2016 06:49:58 +0900
changeset 290682 2224fda64ca50e5a3d1852c4715e6d7858992747
parent 290681 6787d2ac55923e28b22beea92561d8fcbe782338
child 290683 6be7ee58f77a89127d2b7a810c9a118ae947fe8f
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1165053
milestone48.0a1
backs out31ce940c509c21d24e9d59653ee5f4bad10f1cff
Backed out changeset 31ce940c509c (bug 1165053)
js/src/tests/ecma_6/TypedArray/filter-species.js
js/src/tests/ecma_6/TypedArray/map-species.js
js/src/tests/ecma_6/TypedArray/slice-species.js
js/src/tests/ecma_6/TypedArray/slice.js
js/src/tests/ecma_6/TypedArray/subarray-species.js
deleted file mode 100644
--- a/js/src/tests/ecma_6/TypedArray/filter-species.js
+++ /dev/null
@@ -1,56 +0,0 @@
-function test(constructor, constructor2, from=[1, 2, 3, 4, 5], to=[2, 4]) {
-    var modifiedConstructor = new constructor(from);
-    modifiedConstructor.constructor = constructor2;
-    assertDeepEq(modifiedConstructor.filter(x => x % 2 == 0), new constructor2(to));
-    var modifiedSpecies = new constructor(from);
-    modifiedSpecies.constructor = { [Symbol.species]: constructor2 };
-    assertDeepEq(modifiedSpecies.filter(x => x % 2 == 0), new constructor2(to));
-}
-
-// same size, same sign
-
-test(Int8Array, Uint8Array);
-test(Int8Array, Uint8ClampedArray);
-
-test(Uint8Array, Int8Array);
-test(Uint8Array, Uint8ClampedArray);
-
-test(Uint8ClampedArray, Int8Array);
-test(Uint8ClampedArray, Uint8Array);
-
-test(Int16Array, Uint16Array);
-test(Uint16Array, Int16Array);
-
-test(Int32Array, Uint32Array);
-test(Uint32Array, Int32Array);
-
-// same size, different sign
-
-test(Int8Array, Uint8Array, [-1, -2, -3, -4, -5], [0xFE, 0xFC]);
-test(Int8Array, Uint8ClampedArray, [-1, -2, -3, -4, -5], [0, 0]);
-
-test(Uint8Array, Int8Array, [0xFF, 0xFE, 0xFD, 0xFC, 0xFB], [-2, -4]);
-test(Uint8ClampedArray, Int8Array, [0xFF, 0xFE, 0xFD, 0xFC, 0xFB], [-2, -4]);
-
-test(Int16Array, Uint16Array, [-1, -2, -3, -4, -5], [0xFFFE, 0xFFFC]);
-test(Uint16Array, Int16Array, [0xFFFF, 0xFFFE, 0xFFFD, 0xFFFC, 0xFFFB], [-2, -4]);
-
-test(Int32Array, Uint32Array, [-1, -2, -3, -4, -5], [0xFFFFFFFE, 0xFFFFFFFC]);
-test(Uint32Array, Int32Array, [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 0xFFFFFFFB], [-2, -4]);
-
-// different size
-
-test(Uint8Array, Uint16Array);
-test(Uint16Array, Uint8Array);
-
-test(Uint8Array, Uint32Array);
-test(Uint32Array, Uint8Array);
-
-test(Uint16Array, Uint32Array);
-test(Uint32Array, Uint16Array);
-
-test(Float32Array, Float64Array);
-test(Float64Array, Float32Array);
-
-if (typeof reportCompare === "function")
-    reportCompare(true, true);
deleted file mode 100644
--- a/js/src/tests/ecma_6/TypedArray/map-species.js
+++ /dev/null
@@ -1,56 +0,0 @@
-function test(constructor, constructor2, from=[1, 2, 3, 4, 5], to=[2, 4, 6, 8, 10]) {
-    var modifiedConstructor = new constructor(from);
-    modifiedConstructor.constructor = constructor2;
-    assertDeepEq(modifiedConstructor.map(x => x * 2), new constructor2(to));
-    var modifiedSpecies = new constructor(from);
-    modifiedSpecies.constructor = { [Symbol.species]: constructor2 };
-    assertDeepEq(modifiedSpecies.map(x => x * 2), new constructor2(to));
-}
-
-// same size, same sign
-
-test(Int8Array, Uint8Array);
-test(Int8Array, Uint8ClampedArray);
-
-test(Uint8Array, Int8Array);
-test(Uint8Array, Uint8ClampedArray);
-
-test(Uint8ClampedArray, Int8Array);
-test(Uint8ClampedArray, Uint8Array);
-
-test(Int16Array, Uint16Array);
-test(Uint16Array, Int16Array);
-
-test(Int32Array, Uint32Array);
-test(Uint32Array, Int32Array);
-
-// same size, different sign
-
-test(Int8Array, Uint8Array, [-1, -2, -3, -4, -5], [0xFE, 0xFC, 0xFA, 0xF8, 0xF6]);
-test(Int8Array, Uint8ClampedArray, [-1, -2, -3, -4, -5], [0, 0, 0, 0, 0]);
-
-test(Uint8Array, Int8Array, [0xFF, 0xFE, 0xFD, 0xFC, 0xFB], [-2, -4, -6, -8, -10]);
-test(Uint8ClampedArray, Int8Array, [0xFF, 0xFE, 0xFD, 0xFC, 0xFB], [-2, -4, -6, -8, -10]);
-
-test(Int16Array, Uint16Array, [-1, -2, -3, -4, -5], [0xFFFE, 0xFFFC, 0xFFFA, 0xFFF8, 0xFFF6]);
-test(Uint16Array, Int16Array, [0xFFFF, 0xFFFE, 0xFFFD, 0xFFFC, 0xFFFB], [-2, -4, -6, -8, -10]);
-
-test(Int32Array, Uint32Array, [-1, -2, -3, -4, -5], [0xFFFFFFFE, 0xFFFFFFFC, 0xFFFFFFFA, 0xFFFFFFF8, 0xFFFFFFF6]);
-test(Uint32Array, Int32Array, [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 0xFFFFFFFB], [-2, -4, -6, -8, -10]);
-
-// different size
-
-test(Uint8Array, Uint16Array);
-test(Uint16Array, Uint8Array);
-
-test(Uint8Array, Uint32Array);
-test(Uint32Array, Uint8Array);
-
-test(Uint16Array, Uint32Array);
-test(Uint32Array, Uint16Array);
-
-test(Float32Array, Float64Array);
-test(Float64Array, Float32Array);
-
-if (typeof reportCompare === "function")
-    reportCompare(true, true);
deleted file mode 100644
--- a/js/src/tests/ecma_6/TypedArray/slice-species.js
+++ /dev/null
@@ -1,61 +0,0 @@
-const constructors = [
-    Int8Array,
-    Uint8Array,
-    Uint8ClampedArray,
-    Int16Array,
-    Uint16Array,
-    Int32Array,
-    Uint32Array,
-    Float32Array,
-    Float64Array
-];
-
-for (var constructor of constructors) {
-    // 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";
-        strConstructor.slice(123);
-    }, TypeError, "Assert that we have an invalid constructor");
-
-    // If obj.constructor[@@species] is undefined or null then the default
-    // constructor is used.
-    var mathConstructor = new constructor(8);
-    mathConstructor.constructor = Math.sin;
-    assertDeepEq(mathConstructor.slice(4), new constructor(4));
-
-    var undefSpecies = new constructor(2);
-    undefSpecies.constructor = { [Symbol.species]: undefined };
-    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) {
-        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));
-    }
-
-    // If obj.constructor[@@species] is neither undefined nor null, and it's
-    // not a constructor, TypeError should be thrown.
-    assertThrowsInstanceOf(() => {
-        var strSpecies = new constructor;
-        strSpecies.constructor = { [Symbol.species]: "not a constructor" };
-        strSpecies.slice(123);
-    }, TypeError);
-}
-
-if (typeof reportCompare === "function")
-    reportCompare(true, true);
--- a/js/src/tests/ecma_6/TypedArray/slice.js
+++ b/js/src/tests/ecma_6/TypedArray/slice.js
@@ -54,13 +54,33 @@ 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");
         }
     }).slice(2);
+
+    // 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";
+        strConstructor.slice(123);
+    }, TypeError, "Assert that we have an invalid constructor");
+
+    // If obj.constructor[@@species] is undefined or null -- which it has to be
+    // if we don't implement @@species -- then the default constructor is used.
+    var mathConstructor = new constructor(8);
+    mathConstructor.constructor = Math.sin;
+    assertDeepEq(mathConstructor.slice(4), new constructor(4));
+
+    assertEq(Symbol.species in Int8Array, false,
+             "you've implemented %TypedArray%[@@species] -- add real tests here!");
 }
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
 
deleted file mode 100644
--- a/js/src/tests/ecma_6/TypedArray/subarray-species.js
+++ /dev/null
@@ -1,63 +0,0 @@
-function test(constructor, constructor2, from=[1, 2, 3, 4, 5], to=[3, 4], begin=2, end=4) {
-    var modifiedConstructor = new constructor(from);
-    modifiedConstructor.constructor = constructor2;
-    assertDeepEq(modifiedConstructor.subarray(begin, end), new constructor2(to));
-    var modifiedSpecies = new constructor(from);
-    modifiedSpecies.constructor = { [Symbol.species]: constructor2 };
-    assertDeepEq(modifiedSpecies.subarray(begin, end), new constructor2(to));
-}
-
-// same size, same sign
-
-test(Int8Array, Uint8Array);
-test(Int8Array, Uint8ClampedArray);
-
-test(Uint8Array, Int8Array);
-test(Uint8Array, Uint8ClampedArray);
-
-test(Uint8ClampedArray, Int8Array);
-test(Uint8ClampedArray, Uint8Array);
-
-test(Int16Array, Uint16Array);
-test(Uint16Array, Int16Array);
-
-test(Int32Array, Uint32Array);
-test(Uint32Array, Int32Array);
-
-// same size, different sign
-
-test(Int8Array, Uint8Array, [-1, -2, -3, -4, -5], [0xFD, 0xFC]);
-test(Int8Array, Uint8ClampedArray, [-1, -2, -3, -4, -5], [0xFD, 0xFC]);
-
-test(Uint8Array, Int8Array, [0xFF, 0xFE, 0xFD, 0xFC, 0xFB], [-3, -4]);
-test(Uint8ClampedArray, Int8Array, [0xFF, 0xFE, 0xFD, 0xFC, 0xFB], [-3, -4]);
-
-test(Int16Array, Uint16Array, [-1, -2, -3, -4, -5], [0xFFFD, 0xFFFC]);
-test(Uint16Array, Int16Array, [0xFFFF, 0xFFFE, 0xFFFD, 0xFFFC, 0xFFFB], [-3, -4]);
-
-test(Int32Array, Uint32Array, [-1, -2, -3, -4, -5], [0xFFFFFFFD, 0xFFFFFFFC]);
-test(Uint32Array, Int32Array, [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 0xFFFFFFFB], [-3, -4]);
-
-// different size
-
-// To avoid handling endian, use ArrayBuffer as an argument.
-var a = new Int8Array([0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
-                       0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01,
-                       0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
-                       0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x0F]);
-
-test(Uint8Array, Uint16Array, a.buffer, a.slice(2, 6).buffer);
-test(Uint16Array, Uint8Array, a.buffer, a.slice(4, 6).buffer);
-
-test(Uint8Array, Uint32Array, a.buffer, a.slice(4, 12).buffer, 4, 6);
-test(Uint32Array, Uint8Array, a.buffer, a.slice(8, 10).buffer);
-
-test(Uint16Array, Uint32Array, a.buffer, a.slice(4, 12).buffer);
-test(Uint32Array, Uint16Array, a.buffer, a.slice(8, 12).buffer);
-
-test(Float32Array, Float64Array, a.buffer, a.slice(8, 24).buffer);
-test(Float64Array, Float32Array, a.buffer, a.slice(16, 24).buffer);
-
-if (typeof reportCompare === "function")
-    reportCompare(true, true);
-