Backed out changesets 808970eca6d5 and 84c8b33619e0 due to continued orange. a=bustage
authorJonas Sicking <jonas@sicking.cc>
Tue, 01 Feb 2011 16:45:54 -0800
changeset 61762 298c555d0c6e0151db9ce00c15a5d766ab044d67
parent 61761 808970eca6d5530ee7d0e83288e29b53de8845b1
child 61763 7c00a00d8b8f87d6463c0bdff149fa3884722b15
push id18476
push usersicking@mozilla.com
push dateWed, 02 Feb 2011 00:49:47 +0000
treeherdermozilla-central@298c555d0c6e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
milestone2.0b11pre
backs out808970eca6d5530ee7d0e83288e29b53de8845b1
84c8b33619e0f950e4f024f1fd3824891f0396e8
first release with
nightly win64
298c555d0c6e / 4.0b11pre / 20110201172615 / files
nightly linux32
nightly linux64
nightly mac
nightly win32
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly win64
Backed out changesets 808970eca6d5 and 84c8b33619e0 due to continued orange. a=bustage
content/canvas/test/webgl/conformance/array-unit-tests.html
js/src/jstypedarray.cpp
js/src/tests/js1_8_5/extensions/typedarray.js
--- a/content/canvas/test/webgl/conformance/array-unit-tests.html
+++ b/content/canvas/test/webgl/conformance/array-unit-tests.html
@@ -313,42 +313,42 @@ function negativeTestSetFromArray(type, 
     fail(e);
   }
 }
 
 function testSlice(type, name) {
   running('test ' + name + ' Slice');
   try {
     var array = new type([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
-    var slice = array.subset(0, 5);
+    var slice = array.slice(0, 5);
     assertEq('slice.length', 5, slice.length);
     for (var i = 0; i < 5; i++) {
       assertEq('Element ' + i, i, slice[i]);
     }
-    slice = array.subset(4, 10);
+    slice = array.slice(4, 10);
     assertEq('slice.length', 6, slice.length);
     for (var i = 0; i < 6; i++) {
       assertEq('Element ' + i, 4 + i, slice[i]);
     }
     pass();
   } catch (e) {
     fail(e);
   }
 }
 
 function negativeTestSlice(type, name) {
   running('negativeTest ' + name + ' Slice');
   try {
     var array = new type([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
-    slice = array.subset(5, 11);
+    slice = array.slice(5, 11);
     if (slice.length != 5) {
       fail();
       return;
     }
-    slice = array.subset(10, 10);
+    slice = array.slice(10, 10);
     if (slice.length != 0) {
       fail();
       return;
     }
     pass();
   } catch (e) {
     fail(e);
   }
@@ -482,23 +482,23 @@ function testSlicingWithOutOfRangeValues
         var buffer = new ArrayBuffer(32);
         array = new type(buffer);
         typeSize = sz;
         shouldBe("array.length", "32 / typeSize");
         try {
             shouldBe("array.slice(4, 0x3FFFFFFF).length", "(32 / typeSize) - 4");
             shouldBe("array.slice(4, -2147483648).length", "0");
             // Test slice() against overflows.
-            array = array.subset(2);
+            array = array.slice(2);
             if (sz > 1) {
                 // Full byte offset is +1 larger than the maximum unsigned long int.
-                // Make sure subset() still handles it correctly.  Otherwise overflow would happen and
+                // Make sure slice() still handles it correctly.  Otherwise overflow would happen and
                 // offset would be 0, and array.length array.length would incorrectly be 1.
                 var start = 4294967296 / sz - 2;
-                array = array.subset(start, start + 1);
+                array = array.slice(start, start + 1);
                 shouldBe("array.length", "0");
             }
         } catch (e) {
             testFailed("Slicing of " + name + " threw exception");
         }
     } catch (e) {
         testFailed("Exception: " + e);
     }
@@ -507,20 +507,20 @@ function testSlicingWithOutOfRangeValues
 function testSlicingWithDefaultValues(type, name, sz) {
     debug("Testing slicing with default inputs of " + name);
     try {
         var buffer = new ArrayBuffer(32);
         array = new type(buffer);
         typeSize = sz;
         shouldBe("array.length", "32 / typeSize");
         try {
-            shouldBe("array.subset(0).length", "(32 / typeSize)");
-            shouldBe("array.subset(2).length", "(32 / typeSize) - 2");
-            shouldBe("array.subset(-2).length", "2");
-            shouldBe("array.subset(-2147483648).length", "(32 / typeSize)");
+            shouldBe("array.slice(0).length", "(32 / typeSize)");
+            shouldBe("array.slice(2).length", "(32 / typeSize) - 2");
+            shouldBe("array.slice(-2).length", "2");
+            shouldBe("array.slice(-2147483648).length", "(32 / typeSize)");
         } catch (e) {
             testFailed("Slicing of " + name + " threw exception");
         }
     } catch (e) {
         testFailed("Exception: " + e);
     }
 }
 
--- a/js/src/jstypedarray.cpp
+++ b/js/src/jstypedarray.cpp
@@ -815,32 +815,32 @@ class TypedArrayTemplate
     static void
     class_finalize(JSContext *cx, JSObject *obj)
     {
         ThisTypeArray *tarray = ThisTypeArray::fromJSObject(obj);
         if (tarray)
             cx->destroy<ThisTypeArray>(tarray);
     }
 
-    /* subarray(start[, end]) */
+    /* slice(start[, end]) */
     static JSBool
-    fun_subarray(JSContext *cx, uintN argc, Value *vp)
+    fun_slice(JSContext *cx, uintN argc, Value *vp)
     {
         JSObject *obj = ToObject(cx, &vp[1]);
         if (!obj)
             return false;
 
         if (!InstanceOf(cx, obj, ThisTypeArray::fastClass(), vp + 2))
             return false;
 
         if (obj->getClass() != fastClass()) {
-            // someone tried to apply this subarray() to the wrong class
+            // someone tried to apply this slice() to the wrong class
             JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
                                  JSMSG_INCOMPATIBLE_METHOD,
-                                 fastClass()->name, "subarray", obj->getClass()->name);
+                                 fastClass()->name, "slice", obj->getClass()->name);
             return false;
         }
 
         ThisTypeArray *tarray = ThisTypeArray::fromJSObject(obj);
         if (!tarray)
             return true;
 
         // these are the default values
@@ -870,17 +870,17 @@ class TypedArrayTemplate
                     end = length;
                 }
             }
         }
 
         if (begin > end)
             begin = end;
 
-        ThisTypeArray *ntarray = tarray->subarray(cx, begin, end);
+        ThisTypeArray *ntarray = tarray->slice(cx, begin, end);
         if (!ntarray) {
             // this should rarely ever happen
             JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
                                  JSMSG_TYPED_ARRAY_BAD_ARGS);
             return false;
         }
 
         // note the usage of NewObject here -- we don't want the
@@ -977,17 +977,17 @@ class TypedArrayTemplate
 
     static ThisTypeArray *
     fromJSObject(JSObject *obj)
     {
         JS_ASSERT(obj->getClass() == fastClass());
         return reinterpret_cast<ThisTypeArray*>(obj->getPrivate());
     }
 
-    // helper used by both the constructor and Subarray()
+    // helper used by both the constructor and Slice()
     static bool
     makeFastWithPrivate(JSContext *cx, JSObject *obj, ThisTypeArray *tarray)
     {
         JS_ASSERT(obj->getClass() == slowClass());
         obj->setSharedNonNativeMap();
         obj->clasp = fastClass();
         obj->setPrivate(tarray);
         
@@ -1088,17 +1088,17 @@ class TypedArrayTemplate
     setIndex(uint32 index, NativeType val)
     {
         *(static_cast<NativeType*>(data) + index) = val;
     }
 
     inline void copyIndexToValue(JSContext *cx, uint32 index, Value *vp);
 
     ThisTypeArray *
-    subarray(JSContext *cx, uint32 begin, uint32 end)
+    slice(JSContext *cx, uint32 begin, uint32 end)
     {
         if (begin > length || end > length)
             return NULL;
 
         ThisTypeArray *tarray = cx->create<ThisTypeArray>();
         if (!tarray)
             return NULL;
 
@@ -1479,17 +1479,17 @@ JSPropertySpec TypedArray::jsprops[] = {
 };
 
 /*
  * TypedArray boilerplate
  */
 
 #define IMPL_TYPED_ARRAY_STATICS(_typedArray)                                  \
 template<> JSFunctionSpec _typedArray::jsfuncs[] = {                           \
-    JS_FN("subarray", _typedArray::fun_subarray, 2, 0),                            \
+    JS_FN("slice", _typedArray::fun_slice, 2, 0),                              \
     JS_FN("set", _typedArray::fun_set, 2, 0),                                  \
     JS_FS_END                                                                  \
 }
 
 #define IMPL_TYPED_ARRAY_SLOW_CLASS(_typedArray)                               \
 {                                                                              \
     #_typedArray,                                                              \
     JSCLASS_HAS_PRIVATE | JSCLASS_HAS_CACHED_PROTO(JSProto_##_typedArray),     \
--- a/js/src/tests/js1_8_5/extensions/typedarray.js
+++ b/js/src/tests/js1_8_5/extensions/typedarray.js
@@ -159,30 +159,30 @@ function test()
     check(function() new Int8Array(buf, 0));
 
     check(function() (new Int8Array(buf, 3)).byteLength == 2);
     checkThrows(function() new Int8Array(buf, 500));
     checkThrows(function() new Int8Array(buf, 0, 50));
     checkThrows(function() new Float32Array(buf, 500));
     checkThrows(function() new Float32Array(buf, 0, 50));
 
-    var sl = a.subarray(5,10);
+    var sl = a.slice(5,10);
     check(function() sl.length == 5);
     check(function() sl.buffer == a.buffer);
     check(function() sl.byteLength == 20);
     check(function() sl.byteOffset == 20);
 
-    check(function() a.subarray(5,5).length == 0);
-    check(function() a.subarray(-5).length == 5);
-    check(function() a.subarray(-100).length == 20);
-    check(function() a.subarray(0, 2).length == 2);
-    check(function() a.subarray().length == a.length);
-    check(function() a.subarray(-7,-5).length == 2);
-    check(function() a.subarray(-5,-7).length == 0);
-    check(function() a.subarray(15).length == 5);
+    check(function() a.slice(5,5).length == 0);
+    check(function() a.slice(-5).length == 5);
+    check(function() a.slice(-100).length == 20);
+    check(function() a.slice(0, 2).length == 2);
+    check(function() a.slice().length == a.length);
+    check(function() a.slice(-7,-5).length == 2);
+    check(function() a.slice(-5,-7).length == 0);
+    check(function() a.slice(15).length == 5);
 
     a = new Uint8Array([0xaa, 0xbb, 0xcc]);
     check(function() a.length == 3);
     check(function() a.byteLength == 3);
     check(function() a[1] == 0xbb);
 
     // not sure if this is supposed to throw or to treat "foo"" as 0.
     checkThrows(function() new Int32Array([0xaa, "foo", 0xbb]), TODO);
@@ -275,50 +275,42 @@ function test()
 
     b = new Float32Array([7,8,9]);
     a.set(b, 0);
     a.set(b, 3);
     check(function()
           a[0] == 7 && a[1] == 8 && a[2] == 9 &&
           a[3] == 7 && a[4] == 8 && a[5] == 9 &&
           a[6] == 0 && a[7] == 0 && a[8] == 0);
-    a.set(a.subarray(0,3), 6);
+    a.set(a.slice(0,3), 6);
     check(function()
           a[0] == 7 && a[1] == 8 && a[2] == 9 &&
           a[3] == 7 && a[4] == 8 && a[5] == 9 &&
           a[6] == 7 && a[7] == 8 && a[8] == 9);
 
     a.set([1,2,3,4,5,6,7,8,9]);
-    a.set(a.subarray(0,6), 3);
+    a.set(a.slice(0,6), 3);
     check(function()
           a[0] == 1 && a[1] == 2 && a[2] == 3 &&
           a[3] == 1 && a[4] == 2 && a[5] == 3 &&
           a[6] == 4 && a[7] == 5 && a[8] == 6);
 
-    a.set(a.subarray(3,9), 0);
+    a.set(a.slice(3,9), 0);
     check(function()
           a[0] == 1 && a[1] == 2 && a[2] == 3 &&
           a[3] == 4 && a[4] == 5 && a[5] == 6 &&
           a[6] == 4 && a[7] == 5 && a[8] == 6);
 
-    // verify that subarray() returns a new view that
-    // references the same buffer
-    a.subarray(0,3).set(a.subarray(3,6), 0);
-    check(function()
-          a[0] == 4 && a[1] == 5 && a[2] == 6 &&
-          a[3] == 4 && a[4] == 5 && a[5] == 6 &&
-          a[6] == 4 && a[7] == 5 && a[8] == 6);
-
     a = new ArrayBuffer(0x10);
     checkThrows(function() new Uint32Array(buffer, 4, 0x3FFFFFFF));
 
     checkThrows(function() new Float32Array(null));
 
     a = new Uint8Array(0x100);
-    checkThrows(function() Uint32Array.prototype.subarray.apply(a, [0, 0x100]));
+    checkThrows(function() Uint32Array.prototype.slice.apply(a, [0, 0x100]));
 
     // The prototypes are objects that don't have a length property, so they act
     // like empty arrays.
     check(function() new Int32Array(ArrayBuffer.prototype).length == 0);
     check(function() new Int32Array(Int32Array.prototype).length == 0);
     check(function() new Int32Array(Float64Array.prototype).length == 0);
 
     // ArrayBuffer, Int32Array and Float64Array are native functions and have a .length