Skip to content

Commit 77ad7fe

Browse files
author
Yulia Startsev
committed
Normative: Remove Species check for TypedArrays ArrayBuffers and SharedArrayBuffers
1 parent 6b4217b commit 77ad7fe

File tree

1 file changed

+13
-28
lines changed

1 file changed

+13
-28
lines changed

spec.html

+13-28
Original file line numberDiff line numberDiff line change
@@ -6572,6 +6572,12 @@ <h1>
65726572
1. If IsConstructor(_S_) is *true*, return _S_.
65736573
1. Throw a *TypeError* exception.
65746574
</emu-alg>
6575+
<emu-note>
6576+
<p>Species constructor is only available for Array, RegExp and Promise built-in classes. It
6577+
will not be provided to any other built-in classes. Species are an expensive and complex
6578+
operation that did not end up being used by the community, resulting in the feature being
6579+
deprecated.</p>
6580+
</emu-note>
65756581
</emu-clause>
65766582

65776583
<emu-clause id="sec-enumerableownproperties" type="abstract operation" oldids="sec-enumerableownpropertynames">
@@ -40793,7 +40799,7 @@ <h1>%TypedArray%.prototype.filter ( _callback_ [ , _thisArg_ ] )</h1>
4079340799
1. Append _kValue_ to _kept_.
4079440800
1. Set _captured_ to _captured_ + 1.
4079540801
1. Set _k_ to _k_ + 1.
40796-
1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_captured_) »).
40802+
1. Let _A_ be ? TypedArrayCreateSameType(_O_, « 𝔽(_captured_) »).
4079740803
1. Let _n_ be 0.
4079840804
1. For each element _e_ of _kept_, do
4079940805
1. Perform ! Set(_A_, ! ToString(𝔽(_n_)), _e_, *true*).
@@ -41019,7 +41025,7 @@ <h1>%TypedArray%.prototype.map ( _callback_ [ , _thisArg_ ] )</h1>
4101941025
1. Let _taRecord_ be ? ValidateTypedArray(_O_, ~seq-cst~).
4102041026
1. Let _len_ be TypedArrayLength(_taRecord_).
4102141027
1. If IsCallable(_callback_) is *false*, throw a *TypeError* exception.
41022-
1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_len_) »).
41028+
1. Let _A_ be ? TypedArrayCreateSameType(_O_, « 𝔽(_len_) »).
4102341029
1. Let _k_ be 0.
4102441030
1. Repeat, while _k_ &lt; _len_,
4102541031
1. Let _Pk_ be ! ToString(𝔽(_k_)).
@@ -41235,7 +41241,7 @@ <h1>%TypedArray%.prototype.slice ( _start_, _end_ )</h1>
4123541241
1. Else if _relativeEnd_ &lt; 0, let _endIndex_ be max(_srcArrayLength_ + _relativeEnd_, 0).
4123641242
1. Else, let _endIndex_ be min(_relativeEnd_, _srcArrayLength_).
4123741243
1. Let _countBytes_ be max(_endIndex_ - _startIndex_, 0).
41238-
1. Let _A_ be ? TypedArraySpeciesCreate(_O_, « 𝔽(_countBytes_) »).
41244+
1. Let _A_ be ? TypedArrayCreateSameType(_O_, « 𝔽(_countBytes_) »).
4123941245
1. If _countBytes_ > 0, then
4124041246
1. Set _taRecord_ to MakeTypedArrayWithBufferWitnessRecord(_O_, ~seq-cst~).
4124141247
1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, throw a *TypeError* exception.
@@ -41347,7 +41353,7 @@ <h1>%TypedArray%.prototype.subarray ( _start_, _end_ )</h1>
4134741353
1. Else, let _endIndex_ be min(_relativeEnd_, _srcLength_).
4134841354
1. Let _newLength_ be max(_endIndex_ - _startIndex_, 0).
4134941355
1. Let _argumentsList_ be « _buffer_, 𝔽(_beginByteOffset_), 𝔽(_newLength_) ».
41350-
1. Return ? TypedArraySpeciesCreate(_O_, _argumentsList_).
41356+
1. Return ? TypedArrayCreateSameType(_O_, _argumentsList_).
4135141357
</emu-alg>
4135241358
<p>This method is not generic. The *this* value must be an object with a [[TypedArrayName]] internal slot.</p>
4135341359
</emu-clause>
@@ -41465,27 +41471,6 @@ <h1>get %TypedArray%.prototype [ %Symbol.toStringTag% ]</h1>
4146541471
<emu-clause id="sec-abstract-operations-for-typedarray-objects">
4146641472
<h1>Abstract Operations for TypedArray Objects</h1>
4146741473

41468-
<emu-clause id="typedarray-species-create" type="abstract operation">
41469-
<h1>
41470-
TypedArraySpeciesCreate (
41471-
_exemplar_: a TypedArray,
41472-
_argumentList_: a List of ECMAScript language values,
41473-
): either a normal completion containing a TypedArray or a throw completion
41474-
</h1>
41475-
<dl class="header">
41476-
<dt>description</dt>
41477-
<dd>It is used to specify the creation of a new TypedArray using a constructor function that is derived from _exemplar_. Unlike ArraySpeciesCreate, which can create non-Array objects through the use of %Symbol.species%, this operation enforces that the constructor function creates an actual TypedArray.</dd>
41478-
</dl>
41479-
<emu-alg>
41480-
1. Let _defaultConstructor_ be the intrinsic object associated with the constructor name _exemplar_.[[TypedArrayName]] in <emu-xref href="#table-the-typedarray-constructors"></emu-xref>.
41481-
1. Let _constructor_ be ? SpeciesConstructor(_exemplar_, _defaultConstructor_).
41482-
1. Let _result_ be ? TypedArrayCreateFromConstructor(_constructor_, _argumentList_).
41483-
1. Assert: _result_ has [[TypedArrayName]] and [[ContentType]] internal slots.
41484-
1. If _result_.[[ContentType]] is not _exemplar_.[[ContentType]], throw a *TypeError* exception.
41485-
1. Return _result_.
41486-
</emu-alg>
41487-
</emu-clause>
41488-
4148941474
<emu-clause id="sec-typedarraycreatefromconstructor" oldids="typedarray-create" type="abstract operation">
4149041475
<h1>
4149141476
TypedArrayCreateFromConstructor (
@@ -41517,7 +41502,7 @@ <h1>
4151741502
</h1>
4151841503
<dl class="header">
4151941504
<dt>description</dt>
41520-
<dd>It is used to specify the creation of a new TypedArray using a constructor function that is derived from _exemplar_. Unlike TypedArraySpeciesCreate, which can construct custom TypedArray subclasses through the use of %Symbol.species%, this operation always uses one of the built-in TypedArray constructors.</dd>
41505+
<dd>It is used to specify the creation of a new TypedArray using a constructor function that is derived from _exemplar_. This operation always uses one of the built-in TypedArray constructors.</dd>
4152141506
</dl>
4152241507
<emu-alg>
4152341508
1. Let _constructor_ be the intrinsic object associated with the constructor name _exemplar_.[[TypedArrayName]] in <emu-xref href="#table-the-typedarray-constructors"></emu-xref>.
@@ -43807,7 +43792,7 @@ <h1>ArrayBuffer.prototype.slice ( _start_, _end_ )</h1>
4380743792
1. Else if _relativeEnd_ &lt; 0, let _final_ be max(_len_ + _relativeEnd_, 0).
4380843793
1. Else, let _final_ be min(_relativeEnd_, _len_).
4380943794
1. Let _newLen_ be max(_final_ - _first_, 0).
43810-
1. Let _ctor_ be ? SpeciesConstructor(_O_, %ArrayBuffer%).
43795+
1. Let _ctor_ be %ArrayBuffer%.
4381143796
1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »).
4381243797
1. Perform ? RequireInternalSlot(_new_, [[ArrayBufferData]]).
4381343798
1. If IsSharedArrayBuffer(_new_) is *true*, throw a *TypeError* exception.
@@ -44125,7 +44110,7 @@ <h1>SharedArrayBuffer.prototype.slice ( _start_, _end_ )</h1>
4412544110
1. Else if _relativeEnd_ &lt; 0, let _final_ be max(_len_ + _relativeEnd_, 0).
4412644111
1. Else, let _final_ be min(_relativeEnd_, _len_).
4412744112
1. Let _newLen_ be max(_final_ - _first_, 0).
44128-
1. Let _ctor_ be ? SpeciesConstructor(_O_, %SharedArrayBuffer%).
44113+
1. Let _ctor_ be %SharedArrayBuffer%.
4412944114
1. Let _new_ be ? Construct(_ctor_, « 𝔽(_newLen_) »).
4413044115
1. Perform ? RequireInternalSlot(_new_, [[ArrayBufferData]]).
4413144116
1. If IsSharedArrayBuffer(_new_) is *false*, throw a *TypeError* exception.

0 commit comments

Comments
 (0)