Bug 1117350 - Part 1: Rename "TypedArray" to "TypedObjectArray" for self-hosted methods of typed object arrays. r=till
authorziyunfei <446240525@qq.com>
Sun, 04 Jan 2015 06:32:00 -0500
changeset 222766 f09142ac24fc
parent 222765 08c680b949e2
child 222767 3b29b9cdedfc
push id28073
push userkwierso@gmail.com
push dateFri, 09 Jan 2015 01:08:23 +0000
treeherdermozilla-central@b3f84cf78dc2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1117350
milestone37.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 1117350 - Part 1: Rename "TypedArray" to "TypedObjectArray" for self-hosted methods of typed object arrays. r=till
js/src/builtin/TypedObject.cpp
js/src/builtin/TypedObject.js
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -512,25 +512,25 @@ const JSFunctionSpec ArrayMetaTypeDescr:
 };
 
 const JSPropertySpec ArrayMetaTypeDescr::typedObjectProperties[] = {
     JS_PS_END
 };
 
 const JSFunctionSpec ArrayMetaTypeDescr::typedObjectMethods[] = {
     {"forEach", {nullptr, nullptr}, 1, 0, "ArrayForEach"},
-    {"redimension", {nullptr, nullptr}, 1, 0, "TypedArrayRedimension"},
-    JS_SELF_HOSTED_FN("map",        "TypedArrayMap",        2, 0),
-    JS_SELF_HOSTED_FN("mapPar",     "TypedArrayMapPar",     2, 0),
-    JS_SELF_HOSTED_FN("reduce",     "TypedArrayReduce",     2, 0),
-    JS_SELF_HOSTED_FN("reducePar",  "TypedArrayReducePar",  2, 0),
-    JS_SELF_HOSTED_FN("scatter",    "TypedArrayScatter",    4, 0),
-    JS_SELF_HOSTED_FN("scatterPar", "TypedArrayScatterPar", 4, 0),
-    JS_SELF_HOSTED_FN("filter",     "TypedArrayFilter",     1, 0),
-    JS_SELF_HOSTED_FN("filterPar",  "TypedArrayFilterPar",  1, 0),
+    {"redimension", {nullptr, nullptr}, 1, 0, "TypedObjectArrayRedimension"},
+    JS_SELF_HOSTED_FN("map",        "TypedObjectArrayMap",        2, 0),
+    JS_SELF_HOSTED_FN("mapPar",     "TypedObjectArrayMapPar",     2, 0),
+    JS_SELF_HOSTED_FN("reduce",     "TypedObjectArrayReduce",     2, 0),
+    JS_SELF_HOSTED_FN("reducePar",  "TypedObjectArrayReducePar",  2, 0),
+    JS_SELF_HOSTED_FN("scatter",    "TypedObjectArrayScatter",    4, 0),
+    JS_SELF_HOSTED_FN("scatterPar", "TypedObjectArrayScatterPar", 4, 0),
+    JS_SELF_HOSTED_FN("filter",     "TypedObjectArrayFilter",     1, 0),
+    JS_SELF_HOSTED_FN("filterPar",  "TypedObjectArrayFilterPar",  1, 0),
     JS_FS_END
 };
 
 bool
 js::CreateUserSizeAndAlignmentProperties(JSContext *cx, HandleTypeDescr descr)
 {
     // If data is transparent, also store the public slots.
     if (descr->transparent()) {
--- a/js/src/builtin/TypedObject.js
+++ b/js/src/builtin/TypedObject.js
@@ -375,17 +375,17 @@ function Reify(sourceDescr,
 function TypeDescrEquivalent(otherDescr) {
   if (!IsObject(this) || !ObjectIsTypeDescr(this))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
   if (!IsObject(otherDescr) || !ObjectIsTypeDescr(otherDescr))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
   return DescrsEquiv(this, otherDescr);
 }
 
-// TypedArray.redimension(newArrayType)
+// TypedObjectArray.redimension(newArrayType)
 //
 // Method that "repackages" the data from this array into a new typed
 // object whose type is `newArrayType`. Once you strip away all the
 // outer array dimensions, the type of `this` array and `newArrayType`
 // must share the same innermost element type. Moreover, those
 // stripped away dimensions must amount to the same total number of
 // elements.
 //
@@ -395,17 +395,17 @@ function TypeDescrEquivalent(otherDescr)
 //     U[2][16]
 //     U[2][2][8]
 // Because they all share the same total number (32) of equivalent elements.
 // But it would be illegal to convert `T[32]` to `U[31]` or `U[2][17]`, since
 // the number of elements differs. And it's just plain incompatible to convert
 // if the base element types are not equivalent.
 //
 // Warning: user exposed!
-function TypedArrayRedimension(newArrayType) {
+function TypedObjectArrayRedimension(newArrayType) {
   if (!IsObject(this) || !ObjectIsTypedObject(this))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
 
   if (!IsObject(newArrayType) || !ObjectIsTypeDescr(newArrayType))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
 
   // Peel away the outermost array layers from the type of `this` to find
   // the core element type. In the process, count the number of elements.
@@ -626,68 +626,68 @@ function TypedObjectArrayTypeFrom(a, b, 
     else if (explicitDepth)
       ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
     else
       ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
   }
 }
 
 // Warning: user exposed!
-function TypedArrayMap(a, b) {
+function TypedObjectArrayMap(a, b) {
   if (!IsObject(this) || !ObjectIsTypedObject(this))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
   var thisType = TypedObjectTypeDescr(this);
   if (!TypeDescrIsArrayType(thisType))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
 
   // Arguments: [depth], func
   if (typeof a === "number" && typeof b === "function")
     return MapTypedSeqImpl(this, a, thisType, b);
   else if (typeof a === "function")
     return MapTypedSeqImpl(this, 1, thisType, a);
   ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
 }
 
 // Warning: user exposed!
-function TypedArrayMapPar(a, b) {
+function TypedObjectArrayMapPar(a, b) {
   // Arguments: [depth], func
 
   // Defer to the sequential variant for error cases or
   // when not working with typed objects.
   if (!IsObject(this) || !ObjectIsTypedObject(this))
-    return callFunction(TypedArrayMap, this, a, b);
+    return callFunction(TypedObjectArrayMap, this, a, b);
   var thisType = TypedObjectTypeDescr(this);
   if (!TypeDescrIsArrayType(thisType))
-    return callFunction(TypedArrayMap, this, a, b);
+    return callFunction(TypedObjectArrayMap, this, a, b);
 
   if (typeof a === "number" && IsCallable(b))
     return MapTypedParImpl(this, a, thisType, b);
   else if (IsCallable(a))
     return MapTypedParImpl(this, 1, thisType, a);
-  return callFunction(TypedArrayMap, this, a, b);
+  return callFunction(TypedObjectArrayMap, this, a, b);
 }
 
 // Warning: user exposed!
-function TypedArrayReduce(a, b) {
+function TypedObjectArrayReduce(a, b) {
   // Arguments: func, [initial]
   if (!IsObject(this) || !ObjectIsTypedObject(this))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
   var thisType = TypedObjectTypeDescr(this);
   if (!TypeDescrIsArrayType(thisType))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
 
   if (a !== undefined && typeof a !== "function")
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
 
   var outputType = thisType.elementType;
   return ReduceTypedSeqImpl(this, outputType, a, b);
 }
 
 // Warning: user exposed!
-function TypedArrayScatter(a, b, c, d) {
+function TypedObjectArrayScatter(a, b, c, d) {
   // Arguments: outputArrayType, indices, defaultValue, conflictFunction
   if (!IsObject(this) || !ObjectIsTypedObject(this))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
   var thisType = TypedObjectTypeDescr(this);
   if (!TypeDescrIsArrayType(thisType))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
 
   if (!IsObject(a) || !ObjectIsTypeDescr(a) || !TypeDescrIsArrayType(a))
@@ -695,17 +695,17 @@ function TypedArrayScatter(a, b, c, d) {
 
   if (d !== undefined && typeof d !== "function")
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
 
   return ScatterTypedSeqImpl(this, a, b, c, d);
 }
 
 // Warning: user exposed!
-function TypedArrayFilter(func) {
+function TypedObjectArrayFilter(func) {
   // Arguments: predicate
   if (!IsObject(this) || !ObjectIsTypedObject(this))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
   var thisType = TypedObjectTypeDescr(this);
   if (!TypeDescrIsArrayType(thisType))
     ThrowError(JSMSG_TYPEDOBJECT_BAD_ARGS);
 
   if (typeof func !== "function")
@@ -736,28 +736,28 @@ function TypedObjectArrayTypeFromPar(a,b
   if (typeof b === "number" && IsCallable(c))
     return MapTypedParImpl(a, b, this, c);
   if (IsCallable(b))
     return MapTypedParImpl(a, 1, this, b);
   return callFunction(TypedObjectArrayTypeFrom, this, a, b, c);
 }
 
 // Warning: user exposed!
-function TypedArrayReducePar(a, b) {
-  return callFunction(TypedArrayReduce, this, a, b);
+function TypedObjectArrayReducePar(a, b) {
+  return callFunction(TypedObjectArrayReduce, this, a, b);
 }
 
 // Warning: user exposed!
-function TypedArrayScatterPar(a, b, c, d) {
-  return callFunction(TypedArrayScatter, this, a, b, c, d);
+function TypedObjectArrayScatterPar(a, b, c, d) {
+  return callFunction(TypedObjectArrayScatter, this, a, b, c, d);
 }
 
 // Warning: user exposed!
-function TypedArrayFilterPar(func) {
-  return callFunction(TypedArrayFilter, this, func);
+function TypedObjectArrayFilterPar(func) {
+  return callFunction(TypedObjectArrayFilter, this, func);
 }
 
 // should eventually become macros
 function NUM_BYTES(bits) {
   return (bits + 7) >> 3;
 }
 function SET_BIT(data, index) {
   var word = index >> 3;