ECMA-262 (12th Edition) ECMAScript 2021 Language Specification - page 35

 

  Главная      Manuals     ECMA-262 (12th Edition) ECMAScript 2021 Language Specification

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     33      34      35      36     ..

 

 

 

ECMA-262 (12th Edition) ECMAScript 2021 Language Specification - page 35

 

 

6.  Let 

offset

 be 

O

.[[ByteOffset]].

7.  Return 

offset

).

The initial value of 

%TypedArray%

.prototype.constructor

.prototype.constructor

 is the 

%TypedArray%

 intrinsic object.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.copyWithin

.prototype.copyWithin

 are the same as for

Array.prototype.copyWithin

Array.prototype.copyWithin

 as defined in 

23.1.3.3

.

The following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  Let 

relativeTarget

 be ? 

ToIntegerOrInfinity

(

target

).

5.  If 

relativeTarget

 is -

, let 

to

 be 0.

6.  Else if 

relativeTarget

 < 0, let 

to

 be 

max

(

len

 + 

relativeTarget

, 0).

7.  Else, let 

to

 be 

min

(

relativeTarget

len

).

8.  Let 

relativeStart

 be ? 

ToIntegerOrInfinity

(

start

).

9.  If 

relativeStart

 is -

, let 

from

 be 0.

10.  Else if 

relativeStart

 < 0, let 

from

 be 

max

(

len

 + 

relativeStart

, 0).

11.  Else, let 

from

 be 

min

(

relativeStart

len

).

12.  If 

end

 is 

undefined

, let 

relativeEnd

 be 

len

; else let 

relativeEnd

 be ? 

ToIntegerOrInfinity

(

end

).

13.  If 

relativeEnd

 is -

, let 

final

 be 0.

14.  Else if 

relativeEnd

 < 0, let 

final

 be 

max

(

len

 + 

relativeEnd

, 0).

15.  Else, let 

final

 be 

min

(

relativeEnd

len

).

16.  Let 

count

 be 

min

(

final

 - 

from

len

 - 

to

).

17.  If 

count

 > 0, then

a.  NOTE: The copying must be performed in a manner that preserves the bit-level encoding of the source

data.

b.  Let 

buffer

 be 

O

.[[ViewedArrayBuffer]].

c.  If 

IsDetachedBuffer

(

buffer

) is 

true

, throw a 

TypeError

 exception.

d.  Let 

typedArrayName

 be the String value of 

O

.[[TypedArrayName]].

e.  Let 

elementSize

 be the Element Size value specified in 

Table 60

 for 

typedArrayName

.

f.  Let 

byteOffset

 be 

O

.[[ByteOffset]].

g.  Let 

toByteIndex

 be 

to

 

×

 

elementSize

 + 

byteOffset

.

h.  Let 

fromByteIndex

 be 

from

 

×

 

elementSize

 + 

byteOffset

.

i.  Let 

countBytes

 be 

count

 

×

 

elementSize

.

j.  If 

fromByteIndex

 < 

toByteIndex

 and 

toByteIndex

 < 

fromByteIndex

 + 

countBytes

, then

i.  Let 

direction

 be -1.

ii.  Set 

fromByteIndex

 to 

fromByteIndex

 + 

countBytes

 - 1.

iii.  Set 

toByteIndex

 to 

toByteIndex

 + 

countBytes

 - 1.

k.  Else,

i.  Let 

direction

 be 1.

l.  Repeat, while 

countBytes

 > 0,

23.2.3.4  %TypedArray%.prototype.constructor

23.2.3.5  %TypedArray%.prototype.copyWithin ( 

target

start

 [ , 

end

 ] )

669

i.  Let 

value

 be 

GetValueFromBuffer

(

buffer

fromByteIndex

Uint8

true

Unordered

).

ii.  Perform 

SetValueInBuffer

(

buffer

toByteIndex

Uint8

value

true

Unordered

).

iii.  Set 

fromByteIndex

 to 

fromByteIndex

 + 

direction

.

iv.  Set 

toByteIndex

 to 

toByteIndex

 + 

direction

.

v.  Set 

countBytes

 to 

countBytes

 - 1.

18.  Return 

O

.

The following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Return 

CreateArrayIterator

(

O

key+value

).

The interpretation and use of the arguments of 

%TypedArray%

.prototype.every

.prototype.every

 are the same as for

Array.prototype.every

Array.prototype.every

 as defined in 

23.1.3.5

.

When the 

every

every

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

IsCallable

(

callbackfn

) is 

false

, throw a 

TypeError

 exception.

5.  Let 

k

 be 0.

6.  Repeat, while 

k

 < 

len

,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Let 

kValue

 be ! 

Get

(

O

Pk

).

c.  Let 

testResult

 be ! 

ToBoolean

(? 

Call

(

callbackfn

thisArg

, « 

kValue

k

), 

O

 »)).

d.  If 

testResult

 is 

false

, return 

false

.

e.  Set 

k

 to 

k

 + 1.

7.  Return 

true

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.fill

.prototype.fill

 are the same as for

Array.prototype.fill

Array.prototype.fill

 as defined in 

23.1.3.6

.

The following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

O

.[[ContentType]] is 

BigInt

, set 

value

 to ? 

ToBigInt

(

value

).

5.  Otherwise, set 

value

 to ? 

ToNumber

(

value

).

6.  Let 

relativeStart

 be ? 

ToIntegerOrInfinity

(

start

).

23.2.3.6  %TypedArray%.prototype.entries ( )

23.2.3.7  %TypedArray%.prototype.every ( 

callbackfn

 [ , 

thisArg

 ] )

23.2.3.8  %TypedArray%.prototype.fill ( 

value

 [ , 

start

 [ , 

end

 ] ] )

670

7.  If 

relativeStart

 is -

, let 

k

 be 0.

8.  Else if 

relativeStart

 < 0, let 

k

 be 

max

(

len

 + 

relativeStart

, 0).

9.  Else, let 

k

 be 

min

(

relativeStart

len

).

10.  If 

end

 is 

undefined

, let 

relativeEnd

 be 

len

; else let 

relativeEnd

 be ? 

ToIntegerOrInfinity

(

end

).

11.  If 

relativeEnd

 is -

, let 

final

 be 0.

12.  Else if 

relativeEnd

 < 0, let 

final

 be 

max

(

len

 + 

relativeEnd

, 0).

13.  Else, let 

final

 be 

min

(

relativeEnd

len

).

14.  If 

IsDetachedBuffer

(

O

.[[ViewedArrayBuffer]]) is 

true

, throw a 

TypeError

 exception.

15.  Repeat, while 

k

 < 

final

,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Perform ! 

Set

(

O

Pk

value

true

).

c.  Set 

k

 to 

k

 + 1.

16.  Return 

O

.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.filter

.prototype.filter

 are the same as for

Array.prototype.filter

Array.prototype.filter

 as defined in 

23.1.3.7

.

When the 

filter

filter

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

IsCallable

(

callbackfn

) is 

false

, throw a 

TypeError

 exception.

5.  Let 

kept

 be a new empty 

List

.

6.  Let 

k

 be 0.

7.  Let 

captured

 be 0.

8.  Repeat, while 

k

 < 

len

,

a.  Let 

Pk

 be ! 

ToString

(

k

)).

b.  Let 

kValue

 be ! 

Get

(

O

Pk

).

c.  Let 

selected

 be ! 

ToBoolean

(? 

Call

(

callbackfn

thisArg

, « 

kValue

(

k

), 

O

 »)).

d.  If 

selected

 is 

true

, then

i.  Append 

kValue

 to the end of 

kept

.

ii.  Set 

captured

 to 

captured

 + 1.

e.  Set 

k

 to 

k

 + 1.

9.  Let 

A

 be ? 

TypedArraySpeciesCreate

(

O

captured

) »).

10.  Let 

n

 be 0.

11.  For each element 

e

 of 

kept

, do

a.  Perform ! 

Set

(

A

, ! 

ToString

(

(

n

)), 

e

true

).

b.  Set 

n

 to 

n

 + 1.

12.  Return 

A

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.find

.prototype.find

 are the same as for

Array.prototype.find

Array.prototype.find

 as defined in 

23.1.3.8

.

23.2.3.9  %TypedArray%.prototype.filter ( 

callbackfn

 [ , 

thisArg

 ] )

23.2.3.10  %TypedArray%.prototype.find ( 

predicate

 [ , 

thisArg

 ] )

671

When the 

find

find

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

IsCallable

(

predicate

) is 

false

, throw a 

TypeError

 exception.

5.  Let 

k

 be 0.

6.  Repeat, while 

k

 < 

len

,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Let 

kValue

 be ! 

Get

(

O

Pk

).

c.  Let 

testResult

 be ! 

ToBoolean

(? 

Call

(

predicate

thisArg

, « 

kValue

k

), 

O

 »)).

d.  If 

testResult

 is 

true

, return 

kValue

.

e.  Set 

k

 to 

k

 + 1.

7.  Return 

undefined

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.findIndex

.prototype.findIndex

 are the same as for

Array.prototype.findIndex

Array.prototype.findIndex

 as defined in 

23.1.3.9

.

When the 

findIndex

findIndex

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

IsCallable

(

predicate

) is 

false

, throw a 

TypeError

 exception.

5.  Let 

k

 be 0.

6.  Repeat, while 

k

 < 

len

,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Let 

kValue

 be ! 

Get

(

O

Pk

).

c.  Let 

testResult

 be ! 

ToBoolean

(? 

Call

(

predicate

thisArg

, « 

kValue

k

), 

O

 »)).

d.  If 

testResult

 is 

true

, return 

(

k

).

e.  Set 

k

 to 

k

 + 1.

7.  Return 

-1

𝔽

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.forEach

.prototype.forEach

 are the same as for

Array.prototype.forEach

Array.prototype.forEach

 as defined in 

23.1.3.12

.

When the 

forEach

forEach

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

IsCallable

(

callbackfn

) is 

false

, throw a 

TypeError

 exception.

23.2.3.11  %TypedArray%.prototype.findIndex ( 

predicate

 [ , 

thisArg

 ] )

23.2.3.12  %TypedArray%.prototype.forEach ( 

callbackfn

 [ , 

thisArg

 ] )

672

5.  Let 

k

 be 0.

6.  Repeat, while 

k

 < 

len

,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Let 

kValue

 be ! 

Get

(

O

Pk

).

c.  Perform ? 

Call

(

callbackfn

thisArg

, « 

kValue

k

), 

O

 »).

d.  Set 

k

 to 

k

 + 1.

7.  Return 

undefined

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.includes

.prototype.includes

 are the same as for

Array.prototype.includes

Array.prototype.includes

 as defined in 

23.1.3.13

.

When the 

includes

includes

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

len

 is 0, return 

false

.

5.  Let 

n

 be ? 

ToIntegerOrInfinity

(

fromIndex

).

6. 

Assert

: If 

fromIndex

 is 

undefined

, then 

n

 is 0.

7.  If 

n

 is +

, return 

false

.

8.  Else if 

n

 is -

, set 

n

 to 0.

9.  If 

n

 

 0, then

a.  Let 

k

 be 

n

.

10.  Else,

a.  Let 

k

 be 

len

 + 

n

.

b.  If 

k

 < 0, set 

k

 to 0.

11.  Repeat, while 

k

 < 

len

,

a.  Let 

elementK

 be ! 

Get

(

O

, ! 

ToString

k

))).

b.  If 

SameValueZero

(

searchElement

elementK

) is 

true

, return 

true

.

c.  Set 

k

 to 

k

 + 1.

12.  Return 

false

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.indexOf

.prototype.indexOf

 are the same as for

Array.prototype.indexOf

Array.prototype.indexOf

 as defined in 

23.1.3.14

.

When the 

indexOf

indexOf

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

len

 is 0, return 

-1

𝔽

.

23.2.3.13  %TypedArray%.prototype.includes ( 

searchElement

 [ , 

fromIndex

 ] )

23.2.3.14  %TypedArray%.prototype.indexOf ( 

searchElement

 [ , 

fromIndex

 ] )

673

5.  Let 

n

 be ? 

ToIntegerOrInfinity

(

fromIndex

).

6. 

Assert

: If 

fromIndex

 is 

undefined

, then 

n

 is 0.

7.  If 

n

 is +

, return 

-1

𝔽

.

8.  Else if 

n

 is -

, set 

n

 to 0.

9.  If 

n

 

 0, then

a.  Let 

k

 be 

n

.

10.  Else,

a.  Let 

k

 be 

len

 + 

n

.

b.  If 

k

 < 0, set 

k

 to 0.

11.  Repeat, while 

k

 < 

len

,

a.  Let 

kPresent

 be ! 

HasProperty

(

O

, ! 

ToString

k

))).

b.  If 

kPresent

 is 

true

, then

i.  Let 

elementK

 be ! 

Get

(

O

, ! 

ToString

k

))).

ii.  Let 

same

 be the result of performing 

Strict Equality Comparison

 

searchElement

 === 

elementK

.

iii.  If 

same

 is 

true

, return 

(

k

).

c.  Set 

k

 to 

k

 + 1.

12.  Return 

-1

𝔽

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.join

.prototype.join

 are the same as for

Array.prototype.join

Array.prototype.join

 as defined in 

23.1.3.15

.

When the 

join

join

 method is called with one argument 

separator

, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

separator

 is 

undefined

, let 

sep

 be the single-element String 

","

.

5.  Else, let 

sep

 be ? 

ToString

(

separator

).

6.  Let 

R

 be the empty String.

7.  Let 

k

 be 0.

8.  Repeat, while 

k

 < 

len

,

a.  If 

k

 > 0, set 

R

 to the 

string-concatenation

 of 

R

 and 

sep

.

b.  Let 

element

 be ! 

Get

(

O

, ! 

ToString

(

(

k

))).

c.  If 

element

 is 

undefined

, let 

next

 be the empty String; otherwise, let 

next

 be ! 

ToString

(

element

).

d.  Set 

R

 to the 

string-concatenation

 of 

R

 and 

next

.

e.  Set 

k

 to 

k

 + 1.

9.  Return 

R

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The following steps are taken:

1.  Let 

O

 be the 

this

 value.

23.2.3.15  %TypedArray%.prototype.join ( 

separator

 )

23.2.3.16  %TypedArray%.prototype.keys ( )

674

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Return 

CreateArrayIterator

(

O

key

).

The interpretation and use of the arguments of 

%TypedArray%

.prototype.lastIndexOf

.prototype.lastIndexOf

 are the same as for

Array.prototype.lastIndexOf

Array.prototype.lastIndexOf

 as defined in 

23.1.3.17

.

When the 

lastIndexOf

lastIndexOf

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

len

 is 0, return 

-1

𝔽

.

5.  If 

fromIndex

 is present, let 

n

 be ? 

ToIntegerOrInfinity

(

fromIndex

); else let 

n

 be 

len

 - 1.

6.  If 

n

 is -

, return 

-1

𝔽

.

7.  If 

n

 

 0, then

a.  Let 

k

 be 

min

(

n

len

 - 1).

8.  Else,

a.  Let 

k

 be 

len

 + 

n

.

9.  Repeat, while 

k

 

 0,

a.  Let 

kPresent

 be ! 

HasProperty

(

O

, ! 

ToString

k

))).

b.  If 

kPresent

 is 

true

, then

i.  Let 

elementK

 be ! 

Get

(

O

, ! 

ToString

k

))).

ii.  Let 

same

 be the result of performing 

Strict Equality Comparison

 

searchElement

 === 

elementK

.

iii.  If 

same

 is 

true

, return 

(

k

).

c.  Set 

k

 to 

k

 - 1.

10.  Return 

-1

𝔽

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

%TypedArray%

.prototype.length

.prototype.length

 is an 

accessor property

 whose set accessor function is 

undefined

. Its get

accessor function performs the following steps:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

RequireInternalSlot

(

O

, [[TypedArrayName]]).

3. 

Assert

O

 has [[ViewedArrayBuffer]] and [[ArrayLength]] internal slots.

4.  Let 

buffer

 be 

O

.[[ViewedArrayBuffer]].

5.  If 

IsDetachedBuffer

(

buffer

) is 

true

, return 

+0

𝔽

.

6.  Let 

length

 be 

O

.[[ArrayLength]].

7.  Return 

length

).

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.map

.prototype.map

 are the same as for

23.2.3.17  %TypedArray%.prototype.lastIndexOf ( 

searchElement

 [ , 

fromIndex

 ] )

23.2.3.18  get %TypedArray%.prototype.length

23.2.3.19  %TypedArray%.prototype.map ( 

callbackfn

 [ , 

thisArg

 ] )

675

Array.prototype.map

Array.prototype.map

 as defined in 

23.1.3.18

.

When the 

map

map

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

IsCallable

(

callbackfn

) is 

false

, throw a 

TypeError

 exception.

5.  Let 

A

 be ? 

TypedArraySpeciesCreate

(

O

len

) »).

6.  Let 

k

 be 0.

7.  Repeat, while 

k

 < 

len

,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Let 

kValue

 be ! 

Get

(

O

Pk

).

c.  Let 

mappedValue

 be ? 

Call

(

callbackfn

thisArg

, « 

kValue

k

), 

O

 »).

d.  Perform ? 

Set

(

A

Pk

mappedValue

true

).

e.  Set 

k

 to 

k

 + 1.

8.  Return 

A

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.reduce

.prototype.reduce

 are the same as for

Array.prototype.reduce

Array.prototype.reduce

 as defined in 

23.1.3.21

.

When the 

reduce

reduce

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

IsCallable

(

callbackfn

) is 

false

, throw a 

TypeError

 exception.

5.  If 

len

 = 0 and 

initialValue

 is not present, throw a 

TypeError

 exception.

6.  Let 

k

 be 0.

7.  Let 

accumulator

 be 

undefined

.

8.  If 

initialValue

 is present, then

a.  Set 

accumulator

 to 

initialValue

.

9.  Else,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Set 

accumulator

 to ! 

Get

(

O

Pk

).

c.  Set 

k

 to 

k

 + 1.

10.  Repeat, while 

k

 < 

len

,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Let 

kValue

 be ! 

Get

(

O

Pk

).

c.  Set 

accumulator

 to ? 

Call

(

callbackfn

undefined

, « 

accumulator

kValue

k

), 

O

 »).

d.  Set 

k

 to 

k

 + 1.

11.  Return 

accumulator

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

23.2.3.20  %TypedArray%.prototype.reduce ( 

callbackfn

 [ , 

initialValue

 ] )

676

The interpretation and use of the arguments of 

%TypedArray%

.prototype.reduceRight

.prototype.reduceRight

 are the same as for

Array.prototype.reduceRight

Array.prototype.reduceRight

 as defined in 

23.1.3.22

.

When the 

reduceRight

reduceRight

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

IsCallable

(

callbackfn

) is 

false

, throw a 

TypeError

 exception.

5.  If 

len

 is 0 and 

initialValue

 is not present, throw a 

TypeError

 exception.

6.  Let 

k

 be 

len

 - 1.

7.  Let 

accumulator

 be 

undefined

.

8.  If 

initialValue

 is present, then

a.  Set 

accumulator

 to 

initialValue

.

9.  Else,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Set 

accumulator

 to ! 

Get

(

O

Pk

).

c.  Set 

k

 to 

k

 - 1.

10.  Repeat, while 

k

 

 0,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Let 

kValue

 be ! 

Get

(

O

Pk

).

c.  Set 

accumulator

 to ? 

Call

(

callbackfn

undefined

, « 

accumulator

kValue

k

), 

O

 »).

d.  Set 

k

 to 

k

 - 1.

11.  Return 

accumulator

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.reverse

.prototype.reverse

 are the same as for

Array.prototype.reverse

Array.prototype.reverse

 as defined in 

23.1.3.23

.

When the 

reverse

reverse

 method is called, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  Let 

middle

 be 

floor

(

len

 / 2).

5.  Let 

lower

 be 0.

6.  Repeat, while 

lower

 

 

middle

,

a.  Let 

upper

 be 

len

 - 

lower

 - 1.

b.  Let 

upperP

 be ! 

ToString

(

upper

)).

c.  Let 

lowerP

 be ! 

ToString

(

(

lower

)).

d.  Let 

lowerValue

 be ! 

Get

(

O

lowerP

).

e.  Let 

upperValue

 be ! 

Get

(

O

upperP

).

f.  Perform ! 

Set

(

O

lowerP

upperValue

true

).

g.  Perform ! 

Set

(

O

upperP

lowerValue

true

).

h.  Set 

lower

 to 

lower

 + 1.

23.2.3.21  %TypedArray%.prototype.reduceRight ( 

callbackfn

 [ , 

initialValue

 ] )

23.2.3.22  %TypedArray%.prototype.reverse ( )

677

7.  Return 

O

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

%TypedArray%

.prototype.set

.prototype.set

 is a function whose behaviour differs based upon the type of its first argument.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

Sets multiple values in this 

TypedArray

, reading the values from 

source

. The optional 

offset

 value indicates the first

element index in this 

TypedArray

 where values are written. If omitted, it is assumed to be 0.

1.  Let 

target

 be the 

this

 value.

2.  Perform ? 

RequireInternalSlot

(

target

, [[TypedArrayName]]).

3. 

Assert

target

 has a [[ViewedArrayBuffer]] internal slot.

4.  Let 

targetOffset

 be ? 

ToIntegerOrInfinity

(

offset

).

5.  If 

targetOffset

 < 0, throw a 

RangeError

 exception.

6.  If 

source

 is an Object that has a [[TypedArrayName]] internal slot, then

a.  Perform ? 

SetTypedArrayFromTypedArray

(

target

targetOffset

source

).

7.  Else,

a.  Perform ? 

SetTypedArrayFromArrayLike

(

target

targetOffset

source

).

8.  Return 

undefined

.

The abstract operation SetTypedArrayFromTypedArray takes arguments 

target

 (a TypedArray object), 

targetOffset

 (a

non-negative 

integer

 or +

), and 

source

 (a TypedArray object). It sets multiple values in 

target

, starting at index

targetOffset

, reading the values from 

source

. It performs the following steps when called:

1. 

Assert

source

 is an Object that has a [[TypedArrayName]] internal slot.

2.  Let 

targetBuffer

 be 

target

.[[ViewedArrayBuffer]].

3.  If 

IsDetachedBuffer

(

targetBuffer

) is 

true

, throw a 

TypeError

 exception.

4.  Let 

targetLength

 be 

target

.[[ArrayLength]].

5.  Let 

srcBuffer

 be 

source

.[[ViewedArrayBuffer]].

6.  If 

IsDetachedBuffer

(

srcBuffer

) is 

true

, throw a 

TypeError

 exception.

7.  Let 

targetName

 be the String value of 

target

.[[TypedArrayName]].

8.  Let 

targetType

 be the Element Type value in 

Table 60

 for 

targetName

.

9.  Let 

targetElementSize

 be the Element Size value specified in 

Table 60

 for 

targetName

.

10.  Let 

targetByteOffset

 be 

target

.[[ByteOffset]].

11.  Let 

srcName

 be the String value of 

source

.[[TypedArrayName]].

12.  Let 

srcType

 be the Element Type value in 

Table 60

 for 

srcName

.

13.  Let 

srcElementSize

 be the Element Size value specified in 

Table 60

 for 

srcName

.

14.  Let 

srcLength

 be 

source

.[[ArrayLength]].

15.  Let 

srcByteOffset

 be 

source

.[[ByteOffset]].

16.  If 

targetOffset

 is +

, throw a 

RangeError

 exception.

17.  If 

srcLength

 + 

targetOffset

 > 

targetLength

, throw a 

RangeError

 exception.

18.  If 

target

.[[ContentType]] 

 

source

.[[ContentType]], throw a 

TypeError

 exception.

19.  If both 

IsSharedArrayBuffer

(

srcBuffer

) and 

IsSharedArrayBuffer

(

targetBuffer

) are 

true

, then

a.  If 

srcBuffer

.[[ArrayBufferData]] and 

targetBuffer

.[[ArrayBufferData]] are the same 

Shared Data Block

23.2.3.23  %TypedArray%.prototype.set ( 

source

 [ , 

offset

 ] )

23.2.3.23.1  SetTypedArrayFromTypedArray ( 

target

targetOffset

source

 )

678

values, let 

same

 be 

true

; else let 

same

 be 

false

.

20.  Else, let 

same

 be 

SameValue

(

srcBuffer

targetBuffer

).

21.  If 

same

 is 

true

, then

a.  Let 

srcByteLength

 be 

source

.[[ByteLength]].

b.  Set 

srcBuffer

 to ? 

CloneArrayBuffer

(

srcBuffer

srcByteOffset

srcByteLength

%ArrayBuffer%

).

c.  NOTE: 

%ArrayBuffer%

 is used to clone 

srcBuffer

 because is it known to not have any observable side-

effects.

d.  Let 

srcByteIndex

 be 0.

22.  Else, let 

srcByteIndex

 be 

srcByteOffset

.

23.  Let 

targetByteIndex

 be 

targetOffset

 

×

 

targetElementSize

 + 

targetByteOffset

.

24.  Let 

limit

 be 

targetByteIndex

 + 

targetElementSize

 

×

 

srcLength

.

25.  If 

srcType

 is the same as 

targetType

, then

a.  NOTE: If 

srcType

 and 

targetType

 are the same, the transfer must be performed in a manner that preserves

the bit-level encoding of the source data.

b.  Repeat, while 

targetByteIndex

 < 

limit

,

i.  Let 

value

 be 

GetValueFromBuffer

(

srcBuffer

srcByteIndex

Uint8

true

Unordered

).

ii.  Perform 

SetValueInBuffer

(

targetBuffer

targetByteIndex

Uint8

value

true

Unordered

).

iii.  Set 

srcByteIndex

 to 

srcByteIndex

 + 1.

iv.  Set 

targetByteIndex

 to 

targetByteIndex

 + 1.

26.  Else,

a.  Repeat, while 

targetByteIndex

 < 

limit

,

i.  Let 

value

 be 

GetValueFromBuffer

(

srcBuffer

srcByteIndex

srcType

true

Unordered

).

ii.  Perform 

SetValueInBuffer

(

targetBuffer

targetByteIndex

targetType

value

true

Unordered

).

iii.  Set 

srcByteIndex

 to 

srcByteIndex

 + 

srcElementSize

.

iv.  Set 

targetByteIndex

 to 

targetByteIndex

 + 

targetElementSize

.

The abstract operation SetTypedArrayFromArrayLike takes arguments 

target

 (a TypedArray object), 

targetOffset

 (a

non-negative 

integer

 or +

), and 

source

 (an ECMAScript value other than a TypedArray object). It sets multiple values

in 

target

, starting at index 

targetOffset

, reading the values from 

source

. It performs the following steps when called:

1. 

Assert

source

 is any 

ECMAScript language value

 other than an Object with a [[TypedArrayName]] internal

slot.

2.  Let 

targetBuffer

 be 

target

.[[ViewedArrayBuffer]].

3.  If 

IsDetachedBuffer

(

targetBuffer

) is 

true

, throw a 

TypeError

 exception.

4.  Let 

targetLength

 be 

target

.[[ArrayLength]].

5.  Let 

targetName

 be the String value of 

target

.[[TypedArrayName]].

6.  Let 

targetElementSize

 be the Element Size value specified in 

Table 60

 for 

targetName

.

7.  Let 

targetType

 be the Element Type value in 

Table 60

 for 

targetName

.

8.  Let 

targetByteOffset

 be 

target

.[[ByteOffset]].

9.  Let 

src

 be ? 

ToObject

(

source

).

10.  Let 

srcLength

 be ? 

LengthOfArrayLike

(

src

).

11.  If 

targetOffset

 is +

, throw a 

RangeError

 exception.

12.  If 

srcLength

 + 

targetOffset

 > 

targetLength

, throw a 

RangeError

 exception.

13.  Let 

targetByteIndex

 be 

targetOffset

 

×

 

targetElementSize

 + 

targetByteOffset

.

14.  Let 

k

 be 0.

15.  Let 

limit

 be 

targetByteIndex

 + 

targetElementSize

 

×

 

srcLength

.

23.2.3.23.2  SetTypedArrayFromArrayLike ( 

target

targetOffset

source

 )

679

16.  Repeat, while 

targetByteIndex

 < 

limit

,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Let 

value

 be ? 

Get

(

src

Pk

).

c.  If 

target

.[[ContentType]] is 

BigInt

, set 

value

 to ? 

ToBigInt

(

value

).

d.  Otherwise, set 

value

 to ? 

ToNumber

(

value

).

e.  If 

IsDetachedBuffer

(

targetBuffer

) is 

true

, throw a 

TypeError

 exception.

f.  Perform 

SetValueInBuffer

(

targetBuffer

targetByteIndex

targetType

value

true

Unordered

).

g.  Set 

k

 to 

k

 + 1.

h.  Set 

targetByteIndex

 to 

targetByteIndex

 + 

targetElementSize

.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.slice

.prototype.slice

 are the same as for

Array.prototype.slice

Array.prototype.slice

 as defined in 

23.1.3.25

. The following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  Let 

relativeStart

 be ? 

ToIntegerOrInfinity

(

start

).

5.  If 

relativeStart

 is -

, let 

k

 be 0.

6.  Else if 

relativeStart

 < 0, let 

k

 be 

max

(

len

 + 

relativeStart

, 0).

7.  Else, let 

k

 be 

min

(

relativeStart

len

).

8.  If 

end

 is 

undefined

, let 

relativeEnd

 be 

len

; else let 

relativeEnd

 be ? 

ToIntegerOrInfinity

(

end

).

9.  If 

relativeEnd

 is -

, let 

final

 be 0.

10.  Else if 

relativeEnd

 < 0, let 

final

 be 

max

(

len

 + 

relativeEnd

, 0).

11.  Else, let 

final

 be 

min

(

relativeEnd

len

).

12.  Let 

count

 be 

max

(

final

 - 

k

, 0).

13.  Let 

A

 be ? 

TypedArraySpeciesCreate

(

O

count

) »).

14.  If 

count

 > 0, then

a.  If 

IsDetachedBuffer

(

O

.[[ViewedArrayBuffer]]) is 

true

, throw a 

TypeError

 exception.

b.  Let 

srcName

 be the String value of 

O

.[[TypedArrayName]].

c.  Let 

srcType

 be the Element Type value in 

Table 60

 for 

srcName

.

d.  Let 

targetName

 be the String value of 

A

.[[TypedArrayName]].

e.  Let 

targetType

 be the Element Type value in 

Table 60

 for 

targetName

.

f.  If 

srcType

 is different from 

targetType

, then

i.  Let 

n

 be 0.

ii.  Repeat, while 

k

 < 

final

,

1.  Let 

Pk

 be ! 

ToString

(

(

k

)).

2.  Let 

kValue

 be ! 

Get

(

O

Pk

).

3.  Perform ! 

Set

(

A

, ! 

ToString

(

n

)), 

kValue

true

).

4.  Set 

k

 to 

k

 + 1.

5.  Set 

n

 to 

n

 + 1.

g.  Else,

i.  Let 

srcBuffer

 be 

O

.[[ViewedArrayBuffer]].

ii.  Let 

targetBuffer

 be 

A

.[[ViewedArrayBuffer]].

iii.  Let 

elementSize

 be the Element Size value specified in 

Table 60

 for Element Type 

srcType

.

iv.  NOTE: If 

srcType

 and 

targetType

 are the same, the transfer must be performed in a manner that

preserves the bit-level encoding of the source data.

23.2.3.24  %TypedArray%.prototype.slice ( 

start

end

 )

680

v.  Let 

srcByteOffset

 be 

O

.[[ByteOffset]].

vi.  Let 

targetByteIndex

 be 

A

.[[ByteOffset]].

vii.  Let 

srcByteIndex

 be (

k

 

×

 

elementSize

) + 

srcByteOffset

.

viii.  Let 

limit

 be 

targetByteIndex

 + 

count

 

×

 

elementSize

.

ix.  Repeat, while 

targetByteIndex

 < 

limit

,

1.  Let 

value

 be 

GetValueFromBuffer

(

srcBuffer

srcByteIndex

Uint8

true

Unordered

).

2.  Perform 

SetValueInBuffer

(

targetBuffer

targetByteIndex

Uint8

value

true

Unordered

).

3.  Set 

srcByteIndex

 to 

srcByteIndex

 + 1.

4.  Set 

targetByteIndex

 to 

targetByteIndex

 + 1.

15.  Return 

A

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

The interpretation and use of the arguments of 

%TypedArray%

.prototype.some

.prototype.some

 are the same as for

Array.prototype.some

Array.prototype.some

 as defined in 

23.1.3.26

.

When the 

some

some

 method is called with one or two arguments, the following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Let 

len

 be 

O

.[[ArrayLength]].

4.  If 

IsCallable

(

callbackfn

) is 

false

, throw a 

TypeError

 exception.

5.  Let 

k

 be 0.

6.  Repeat, while 

k

 < 

len

,

a.  Let 

Pk

 be ! 

ToString

(

(

k

)).

b.  Let 

kValue

 be ! 

Get

(

O

Pk

).

c.  Let 

testResult

 be ! 

ToBoolean

(? 

Call

(

callbackfn

thisArg

, « 

kValue

k

), 

O

 »)).

d.  If 

testResult

 is 

true

, return 

true

.

e.  Set 

k

 to 

k

 + 1.

7.  Return 

false

.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

%TypedArray%

.prototype.sort

.prototype.sort

 is a distinct function that, except as described below, implements the same

requirements as those of 

Array.prototype.sort

Array.prototype.sort

 as defined in 

23.1.3.27

. The implementation of the

%TypedArray%

.prototype.sort

.prototype.sort

 specification may be optimized with the knowledge that the 

this

 value is an

object that has a fixed length and whose 

integer-indexed

 properties are not sparse.

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

Upon entry, the following steps are performed to initialize evaluation of the 

sort

sort

 function. These steps are used

instead of steps 

1

3

 in 

23.1.3.27

:

1.  If 

comparefn

 is not 

undefined

 and 

IsCallable

(

comparefn

) is 

false

, throw a 

TypeError

 exception.

2.  Let 

obj

 be the 

this

 value.

3.  Let 

buffer

 be ? 

ValidateTypedArray

(

obj

).

23.2.3.25  %TypedArray%.prototype.some ( 

callbackfn

 [ , 

thisArg

 ] )

23.2.3.26  %TypedArray%.prototype.sort ( 

comparefn

 )

681

4.  Let 

len

 be 

obj

.[[ArrayLength]].

The following version of 

SortCompare

 is used by 

%TypedArray%

.prototype.sort

.prototype.sort

. It performs a numeric

comparison rather than the string comparison used in 

23.1.3.27

.

The abstract operation TypedArraySortCompare takes arguments 

x

 and 

y

. It also has access to the 

comparefn

 and 

buffer

values of the current invocation of the 

sort

sort

 method. It performs the following steps when called:

1. 

Assert

: Both 

Type

(

x

) and 

Type

(

y

) are Number or both are BigInt.

2.  If 

comparefn

 is not 

undefined

, then

a.  Let 

v

 be ? 

ToNumber

(? 

Call

(

comparefn

undefined

, « 

x

y

 »)).

b.  If 

IsDetachedBuffer

(

buffer

) is 

true

, throw a 

TypeError

 exception.

c.  If 

v

 is 

NaN

, return 

+0

𝔽

.

d.  Return 

v

.

3.  If 

x

 and 

y

 are both 

NaN

, return 

+0

𝔽

.

4.  If 

x

 is 

NaN

, return 

1

𝔽

.

5.  If 

y

 is 

NaN

, return 

-1

𝔽

.

6.  If 

x

 < 

y

, return 

-1

𝔽

.

7.  If 

x

 > 

y

, return 

1

𝔽

.

8.  If 

x

 is 

-0

𝔽

 and 

y

 is 

+0

𝔽

, return 

-1

𝔽

.

9.  If 

x

 is 

+0

𝔽

 and 

y

 is 

-0

𝔽

, return 

1

𝔽

.

10.  Return 

+0

𝔽

.

NOTE

Returns a new 

TypedArray

 object whose element type is the same as this 

TypedArray

 and whose ArrayBuffer is the

same as the ArrayBuffer of this 

TypedArray

, referencing the elements at 

begin

, inclusive, up to 

end

, exclusive. If either

begin

 or 

end

 is negative, it refers to an index from the end of the array, as opposed to from the beginning.

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

RequireInternalSlot

(

O

, [[TypedArrayName]]).

3. 

Assert

O

 has a [[ViewedArrayBuffer]] internal slot.

4.  Let 

buffer

 be 

O

.[[ViewedArrayBuffer]].

5.  Let 

srcLength

 be 

O

.[[ArrayLength]].

6.  Let 

relativeBegin

 be ? 

ToIntegerOrInfinity

(

begin

).

7.  If 

relativeBegin

 is -

, let 

beginIndex

 be 0.

8.  Else if 

relativeBegin

 < 0, let 

beginIndex

 be 

max

(

srcLength

 + 

relativeBegin

, 0).

9.  Else, let 

beginIndex

 be 

min

(

relativeBegin

srcLength

).

10.  If 

end

 is 

undefined

, let 

relativeEnd

 be 

srcLength

; else let 

relativeEnd

 be ? 

ToIntegerOrInfinity

(

end

).

11.  If 

relativeEnd

 is -

, let 

endIndex

 be 0.

12.  Else if 

relativeEnd

 < 0, let 

endIndex

 be 

max

(

srcLength

 + 

relativeEnd

, 0).

13.  Else, let 

endIndex

 be 

min

(

relativeEnd

srcLength

).

14.  Let 

newLength

 be 

max

(

endIndex

 - 

beginIndex

, 0).

15.  Let 

constructorName

 be the String value of 

O

.[[TypedArrayName]].

Because 

NaN

 always compares greater than any other value, 

NaN

 property values always sort to

the end of the result when 

comparefn

 is not provided.

23.2.3.27  %TypedArray%.prototype.subarray ( 

begin

end

 )

682

16.  Let 

elementSize

 be the Element Size value specified in 

Table 60

 for 

constructorName

.

17.  Let 

srcByteOffset

 be 

O

.[[ByteOffset]].

18.  Let 

beginByteOffset

 be 

srcByteOffset

 + 

beginIndex

 

×

 

elementSize

.

19.  Let 

argumentsList

 be « 

buffer

(

beginByteOffset

(

newLength

) ».

20.  Return ? 

TypedArraySpeciesCreate

(

O

argumentsList

).

This function is not generic. The 

this

 value must be an object with a [[TypedArrayName]] internal slot.

%TypedArray%

.prototype.toLocaleString

.prototype.toLocaleString

 is a distinct function that implements the same algorithm as

Array.prototype.toLocaleString

Array.prototype.toLocaleString

 as defined in 

23.1.3.29

 except that the 

this

 value's [[ArrayLength]]

internal slot is accessed in place of performing a [[Get]] of 

"length"

. The implementation of the algorithm may be

optimized with the knowledge that the 

this

 value is an object that has a fixed length and whose 

integer-indexed

properties are not sparse. However, such optimization must not introduce any observable changes in the specified
behaviour of the algorithm.

This function is not generic. 

ValidateTypedArray

 is applied to the 

this

 value prior to evaluating the algorithm. If its

result is an 

abrupt completion

 that exception is thrown instead of evaluating the algorithm.

NOTE

The initial value of the 

%TypedArray%

.prototype.toString

.prototype.toString

 

data property

 is the same built-in 

function object

as the 

Array.prototype.toString

Array.prototype.toString

 method defined in 

23.1.3.30

.

The following steps are taken:

1.  Let 

O

 be the 

this

 value.

2.  Perform ? 

ValidateTypedArray

(

O

).

3.  Return 

CreateArrayIterator

(

O

value

).

The initial value of the 

@@iterator

 property is the same 

function object

 as the initial value of the

%TypedArray%

.prototype.values

.prototype.values

 property.

%TypedArray%

.prototype[@@toStringTag]

.prototype[@@toStringTag]

 is an 

accessor property

 whose set accessor function is

undefined

. Its get accessor function performs the following steps:

1.  Let 

O

 be the 

this

 value.

If the ECMAScript implementation includes the ECMA-402 Internationalization API this function
is based upon the algorithm for 

Array.prototype.toLocaleString

Array.prototype.toLocaleString

 that is in the

ECMA-402 specification.

23.2.3.28  %TypedArray%.prototype.toLocaleString ( [ 

reserved1

 [ , 

reserved2

 ] ] )

23.2.3.29  %TypedArray%.prototype.toString ( )

23.2.3.30  %TypedArray%.prototype.values ( )

23.2.3.31  %TypedArray%.prototype [ @@iterator ] ( )

23.2.3.32  get %TypedArray%.prototype [ @@toStringTag ]

683

2.  If 

Type

(

O

) is not Object, return 

undefined

.

3.  If 

O

 does not have a [[TypedArrayName]] internal slot, return 

undefined

.

4.  Let 

name

 be 

O

.[[TypedArrayName]].

5. 

Assert

Type

(

name

) is String.

6.  Return 

name

.

This property has the attributes { [[Enumerable]]: 

false

, [[Configurable]]: 

true

 }.

The initial value of the 

"name"

 property of this function is 

"get [Symbol.toStringTag]"

.

The abstract operation TypedArraySpeciesCreate takes arguments 

exemplar

 and 

argumentList

. It is used to specify the

creation of a new TypedArray object using a 

constructor

 function that is derived from 

exemplar

. It performs the

following steps when called:

1. 

Assert

exemplar

 is an Object that has [[TypedArrayName]] and [[ContentType]] internal slots.

2.  Let 

defaultConstructor

 be the intrinsic object listed in column one of 

Table 60

 for 

exemplar

.[[TypedArrayName]].

3.  Let 

constructor

 be ? 

SpeciesConstructor

(

exemplar

defaultConstructor

).

4.  Let 

result

 be ? 

TypedArrayCreate

(

constructor

argumentList

).

5. 

Assert

result

 has [[TypedArrayName]] and [[ContentType]] internal slots.

6.  If 

result

.[[ContentType]] 

 

exemplar

.[[ContentType]], throw a 

TypeError

 exception.

7.  Return 

result

.

The abstract operation TypedArrayCreate takes arguments 

constructor

 and 

argumentList

. It is used to specify the

creation of a new TypedArray object using a 

constructor

 function. It performs the following steps when called:

1.  Let 

newTypedArray

 be ? 

Construct

(

constructor

argumentList

).

2.  Perform ? 

ValidateTypedArray

(

newTypedArray

).

3.  If 

argumentList

 is a 

List

 of a single Number, then

a.  If 

newTypedArray

.[[ArrayLength]] < 

(

argumentList

[0]), throw a 

TypeError

 exception.

4.  Return 

newTypedArray

.

The abstract operation ValidateTypedArray takes argument 

O

. It performs the following steps when called:

1.  Perform ? 

RequireInternalSlot

(

O

, [[TypedArrayName]]).

2. 

Assert

O

 has a [[ViewedArrayBuffer]] internal slot.

3.  Let 

buffer

 be 

O

.[[ViewedArrayBuffer]].

4.  If 

IsDetachedBuffer

(

buffer

) is 

true

, throw a 

TypeError

 exception.

5.  Return 

buffer

.

23.2.4  Abstract Operations for TypedArray Objects

23.2.4.1  TypedArraySpeciesCreate ( 

exemplar

argumentList

 )

23.2.4.2  TypedArrayCreate ( 

constructor

argumentList

 )

23.2.4.3  ValidateTypedArray ( 

O

 )

23.2.5  The 

TypedArray

 Constructors

684

 

 

 

 

 

 

 

Content      ..     33      34      35      36     ..