Backed out changeset 6ec3a764a8a5 (bug 1165053)
authorTooru Fujisawa <arai_a@mac.com>
Mon, 28 Mar 2016 06:49:58 +0900
changeset 290683 6be7ee58f77a89127d2b7a810c9a118ae947fe8f
parent 290682 2224fda64ca50e5a3d1852c4715e6d7858992747
child 290684 c1072c3d9684ffc793a6f81851ad0a6ea8691cb7
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 out6ec3a764a8a50ae594fc35f7f17aef550efbce34
Backed out changeset 6ec3a764a8a5 (bug 1165053)
js/src/builtin/TypedArray.js
js/src/builtin/Utilities.js
js/src/tests/ecma_6/Symbol/species.js
js/src/vm/ArrayBufferObject.cpp
js/src/vm/ArrayBufferObject.h
js/src/vm/TypedArrayObject.cpp
js/src/vm/TypedArrayObject.h
--- a/js/src/builtin/TypedArray.js
+++ b/js/src/builtin/TypedArray.js
@@ -1303,22 +1303,16 @@ function TypedArrayStaticOf(/*...items*/
     // Steps 6-7.
     for (var k = 0; k < len; k++)
         newObj[k] = items[k]
 
     // Step 8.
     return newObj;
 }
 
-// ES 2016 draft Mar 25, 2016 22.2.2.4.
-function TypedArraySpecies() {
-    // Step 1.
-    return this;
-}
-
 // ES 2016 draft Mar 25, 2016 24.1.4.3.
 function ArrayBufferSlice(start, end) {
     // Step 1.
     var O = this;
 
     // Steps 2-3,
     // This function is not generic.
     if (!IsObject(O) || !IsArrayBuffer(O)) {
@@ -1398,14 +1392,8 @@ function IsDetachedBufferThis() {
   return IsDetachedBuffer(this);
 }
 
 function ArrayBufferStaticSlice(buf, start, end) {
     if (arguments.length < 1)
         ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'ArrayBuffer.slice');
     return callFunction(ArrayBufferSlice, buf, start, end);
 }
-
-// ES 2016 draft Mar 25, 2016 24.1.3.3.
-function ArrayBufferSpecies() {
-    // Step 1.
-    return this;
-}
--- a/js/src/builtin/Utilities.js
+++ b/js/src/builtin/Utilities.js
@@ -162,44 +162,44 @@ function GetBuiltinConstructor(builtinNa
     assert(ctor, `No builtin with name "${builtinName}" found`);
     return ctor;
 }
 
 function GetBuiltinPrototype(builtinName) {
     return (_builtinCtorsCache[builtinName] || GetBuiltinConstructor(builtinName)).prototype;
 }
 
-// ES 2016 draft Mar 25, 2016 7.3.20.
+// ES6 draft 20150317 7.3.20.
 function SpeciesConstructor(obj, defaultConstructor) {
     // Step 1.
     assert(IsObject(obj), "not passed an object");
 
-    // Step 2.
+    // Steps 2-3.
     var ctor = obj.constructor;
 
-    // Step 3.
+    // Step 4.
     if (ctor === undefined)
         return defaultConstructor;
 
-    // Step 4.
+    // Step 5.
     if (!IsObject(ctor))
         ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, "object's 'constructor' property");
 
-    // Steps 5.
+    // Steps 6-7.
     var s = ctor[std_species];
 
-    // Step 6.
+    // Step 8.
     if (s === undefined || s === null)
         return defaultConstructor;
 
-    // Step 7.
+    // Step 9.
     if (IsConstructor(s))
         return s;
 
-    // Step 8.
+    // Step 10.
     ThrowTypeError(JSMSG_NOT_CONSTRUCTOR, "@@species property of object's constructor");
 }
 
 function GetTypeError(msg) {
     try {
         FUN_APPLY(ThrowTypeError, undefined, arguments);
     } catch (e) {
         return e;
--- a/js/src/tests/ecma_6/Symbol/species.js
+++ b/js/src/tests/ecma_6/Symbol/species.js
@@ -1,26 +1,18 @@
 var BUGNUMBER = 1131043;
 var summary = "Implement @@species getter for builtin types";
 
 print(BUGNUMBER + ": " + summary);
 
-var TypedArray = Object.getPrototypeOf(Int8Array);
-
-for (var C of [Map, Set,
-               Int8Array, Uint8Array, Uint8ClampedArray,
-               Int16Array, Uint16Array, Int32Array, Uint32Array,
-               Float32Array, Float64Array,
-               ArrayBuffer]) {
+for (var C of [Map, Set]) {
   assertEq(C[Symbol.species], C);
 }
 
-for (C of [Map, Set,
-           TypedArray,
-           ArrayBuffer]) {
+for (C of [Map, Set]) {
   var desc = Object.getOwnPropertyDescriptor(C, Symbol.species);
   assertDeepEq(Object.keys(desc).sort(), ["configurable", "enumerable", "get", "set"]);
   assertEq(desc.set, undefined);
   assertEq(desc.enumerable, false);
   assertEq(desc.configurable, true);
   assertEq(desc.get.apply(null), null);
   assertEq(desc.get.apply(undefined), undefined);
   assertEq(desc.get.apply(42), 42);
--- a/js/src/vm/ArrayBufferObject.cpp
+++ b/js/src/vm/ArrayBufferObject.cpp
@@ -128,21 +128,16 @@ const JSFunctionSpec ArrayBufferObject::
 };
 
 const JSFunctionSpec ArrayBufferObject::jsstaticfuncs[] = {
     JS_FN("isView", ArrayBufferObject::fun_isView, 1, 0),
     JS_SELF_HOSTED_FN("slice", "ArrayBufferStaticSlice", 3,0),
     JS_FS_END
 };
 
-const JSPropertySpec ArrayBufferObject::jsstaticprops[] = {
-    JS_SELF_HOSTED_SYM_GET(species, "ArrayBufferSpecies", 0),
-    JS_PS_END
-};
-
 bool
 js::IsArrayBuffer(HandleValue v)
 {
     return v.isObject() && v.toObject().is<ArrayBufferObject>();
 }
 
 bool
 js::IsArrayBuffer(HandleObject obj)
@@ -1443,17 +1438,14 @@ js::InitArrayBufferClass(JSContext* cx, 
 
     if (!NativeDefineProperty(cx, arrayBufferProto, byteLengthId, UndefinedHandleValue,
                               JS_DATA_TO_FUNC_PTR(GetterOp, getter), nullptr, attrs))
         return nullptr;
 
     if (!JS_DefineFunctions(cx, ctor, ArrayBufferObject::jsstaticfuncs))
         return nullptr;
 
-    if (!JS_DefineProperties(cx, ctor, ArrayBufferObject::jsstaticprops))
-        return nullptr;
-
     if (!JS_DefineFunctions(cx, arrayBufferProto, ArrayBufferObject::jsfuncs))
         return nullptr;
 
     return arrayBufferProto;
 }
 
--- a/js/src/vm/ArrayBufferObject.h
+++ b/js/src/vm/ArrayBufferObject.h
@@ -193,29 +193,26 @@ class ArrayBufferObject : public ArrayBu
         explicit operator bool() const { return data_ != nullptr; }
     };
 
     static const Class class_;
 
     static const Class protoClass;
     static const JSFunctionSpec jsfuncs[];
     static const JSFunctionSpec jsstaticfuncs[];
-    static const JSPropertySpec jsstaticprops[];
 
     static bool byteLengthGetter(JSContext* cx, unsigned argc, Value* vp);
 
     static bool fun_slice(JSContext* cx, unsigned argc, Value* vp);
 
     static bool fun_isView(JSContext* cx, unsigned argc, Value* vp);
 #ifdef NIGHTLY_BUILD
     static bool fun_transfer(JSContext* cx, unsigned argc, Value* vp);
 #endif
 
-    static bool fun_species(JSContext* cx, unsigned argc, Value* vp);
-
     static bool class_constructor(JSContext* cx, unsigned argc, Value* vp);
 
     static ArrayBufferObject* create(JSContext* cx, uint32_t nbytes,
                                      BufferContents contents,
                                      OwnsState ownsState = OwnsData,
                                      HandleObject proto = nullptr,
                                      NewObjectKind newKind = GenericObject);
     static ArrayBufferObject* create(JSContext* cx, uint32_t nbytes,
--- a/js/src/vm/TypedArrayObject.cpp
+++ b/js/src/vm/TypedArrayObject.cpp
@@ -856,22 +856,16 @@ TypedArrayObject::protoFunctions[] = {
 
 /* static */ const JSFunctionSpec
 TypedArrayObject::staticFunctions[] = {
     JS_SELF_HOSTED_FN("from", "TypedArrayStaticFrom", 3, 0),
     JS_SELF_HOSTED_FN("of", "TypedArrayStaticOf", 0, 0),
     JS_FS_END
 };
 
-/* static */ const JSPropertySpec
-TypedArrayObject::staticProperties[] = {
-    JS_SELF_HOSTED_SYM_GET(species, "TypedArraySpecies", 0),
-    JS_PS_END
-};
-
 /* static */ const Class
 TypedArrayObject::sharedTypedArrayPrototypeClass = {
     // Actually ({}).toString.call(%TypedArray%.prototype) should throw,
     // because %TypedArray%.prototype lacks the the typed array internal
     // slots.  (It's not clear this is desirable -- particularly applied to
     // the actual typed array prototypes, see below -- but it's what ES6
     // draft 20140824 requires.)  But this is about as much as we can do
     // until we implement @@toStringTag.
@@ -888,17 +882,17 @@ TypedArrayObject::sharedTypedArrayProtot
     nullptr,                /* call */
     nullptr,                /* hasInstance */
     nullptr,                /* construct */
     nullptr,                /* trace */
     {
         GenericCreateConstructor<TypedArrayConstructor, 3, gc::AllocKind::FUNCTION>,
         GenericCreatePrototype,
         TypedArrayObject::staticFunctions,
-        TypedArrayObject::staticProperties,
+        nullptr,
         TypedArrayObject::protoFunctions,
         TypedArrayObject::protoAccessors,
         nullptr,
         ClassSpec::DontDefineConstructor
     }
 };
 
 template<typename T>
--- a/js/src/vm/TypedArrayObject.h
+++ b/js/src/vm/TypedArrayObject.h
@@ -251,17 +251,16 @@ class TypedArrayObject : public NativeOb
     {
         CallArgs args = CallArgsFromVp(argc, vp);
         return CallNonGenericMethod<is, GetterImpl<ValueGetter>>(cx, args);
     }
 
     static const JSFunctionSpec protoFunctions[];
     static const JSPropertySpec protoAccessors[];
     static const JSFunctionSpec staticFunctions[];
-    static const JSPropertySpec staticProperties[];
 
     /* Accessors and functions */
 
     static bool is(HandleValue v);
 
     static bool set(JSContext* cx, unsigned argc, Value* vp);
 };