@@ -204,7 +204,9 @@ ecma_builtin_typedarray_prototype_map (ecma_value_t this_arg, /**< this object *
204
204
ecma_object_t * func_object_p = ecma_get_object_from_value (cb_func_val );
205
205
206
206
// TODO: 22.2.3.18, 7-8.
207
- ecma_value_t new_typedarray = ecma_op_create_typedarray_with_type_and_length (src_info_p -> id , src_info_p -> length );
207
+ ecma_value_t len = ecma_make_number_value (src_info_p -> length );
208
+ ecma_value_t new_typedarray = ecma_typedarray_species_create (this_arg , & len , 1 );
209
+ ecma_free_value (len );
208
210
209
211
if (ECMA_IS_VALUE_ERROR (new_typedarray ))
210
212
{
@@ -427,7 +429,9 @@ ecma_builtin_typedarray_prototype_filter (ecma_value_t this_arg, /**< this objec
427
429
428
430
uint32_t pass_num = (uint32_t ) ((pass_value_p - pass_value_list_p ) >> info_p -> shift );
429
431
430
- ret_value = ecma_op_create_typedarray_with_type_and_length (info_p -> id , pass_num );
432
+ ecma_value_t collected = ecma_make_number_value (pass_num );
433
+ ret_value = ecma_typedarray_species_create (this_arg , & collected , 1 );
434
+ ecma_free_value (collected );
431
435
432
436
if (!ECMA_IS_VALUE_ERROR (ret_value ))
433
437
{
@@ -868,7 +872,8 @@ ecma_builtin_typedarray_prototype_join (ecma_object_t *obj_p, /**< this object *
868
872
* Returned value must be freed with ecma_free_value.
869
873
*/
870
874
static ecma_value_t
871
- ecma_builtin_typedarray_prototype_subarray (ecma_typedarray_info_t * info_p , /**< object info */
875
+ ecma_builtin_typedarray_prototype_subarray (ecma_value_t this_arg , /**< this object */
876
+ ecma_typedarray_info_t * info_p , /**< object info */
872
877
ecma_value_t begin , /**< begin */
873
878
ecma_value_t end ) /**< end */
874
879
{
@@ -918,7 +923,7 @@ ecma_builtin_typedarray_prototype_subarray (ecma_typedarray_info_t *info_p, /**<
918
923
ecma_make_uint32_value (subarray_length )
919
924
};
920
925
921
- ret_value = ecma_typedarray_helper_dispatch_construct ( arguments_p , 3 , info_p -> id );
926
+ ret_value = ecma_typedarray_species_create ( this_arg , arguments_p , 3 );
922
927
923
928
ecma_free_value (arguments_p [1 ]);
924
929
ecma_free_value (arguments_p [2 ]);
@@ -1489,7 +1494,8 @@ ecma_builtin_typedarray_prototype_copy_within (ecma_value_t this_arg, /**< this
1489
1494
* Returned value must be freed with ecma_free_value.
1490
1495
*/
1491
1496
static ecma_value_t
1492
- ecma_builtin_typedarray_prototype_slice (ecma_typedarray_info_t * info_p , /**< object info */
1497
+ ecma_builtin_typedarray_prototype_slice (ecma_value_t this_arg , /**< this argument */
1498
+ ecma_typedarray_info_t * info_p , /**< object info */
1493
1499
const ecma_value_t args [], /**< arguments list */
1494
1500
uint32_t args_number ) /**< number of arguments */
1495
1501
{
@@ -1518,8 +1524,10 @@ ecma_builtin_typedarray_prototype_slice (ecma_typedarray_info_t *info_p, /**< ob
1518
1524
int32_t distance = (int32_t ) (relative_end - relative_start );
1519
1525
uint32_t count = distance > 0 ? (uint32_t ) distance : 0 ;
1520
1526
1527
+ ecma_value_t len = ecma_make_number_value (count );
1521
1528
// TODO: 22.2.3.23, 12-13.
1522
- ecma_value_t new_typedarray = ecma_op_create_typedarray_with_type_and_length (info_p -> id , count );
1529
+ ecma_value_t new_typedarray = ecma_typedarray_species_create (this_arg , & len , 1 );
1530
+ ecma_free_value (len );
1523
1531
1524
1532
if (ECMA_IS_VALUE_ERROR (new_typedarray ))
1525
1533
{
@@ -1763,7 +1771,6 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
1763
1771
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FILTER :
1764
1772
{
1765
1773
return ecma_builtin_typedarray_prototype_filter (this_arg , & info , arguments_list_p [0 ], arguments_list_p [1 ]);
1766
-
1767
1774
}
1768
1775
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REVERSE :
1769
1776
{
@@ -1775,7 +1782,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
1775
1782
}
1776
1783
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SUBARRAY :
1777
1784
{
1778
- return ecma_builtin_typedarray_prototype_subarray (& info , arguments_list_p [0 ], arguments_list_p [1 ]);
1785
+ return ecma_builtin_typedarray_prototype_subarray (this_arg , & info , arguments_list_p [0 ], arguments_list_p [1 ]);
1779
1786
}
1780
1787
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FILL :
1781
1788
{
@@ -1819,7 +1826,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
1819
1826
}
1820
1827
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SLICE :
1821
1828
{
1822
- return ecma_builtin_typedarray_prototype_slice (& info , arguments_list_p , arguments_number );
1829
+ return ecma_builtin_typedarray_prototype_slice (this_arg , & info , arguments_list_p , arguments_number );
1823
1830
}
1824
1831
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_LOCALE_STRING :
1825
1832
{
0 commit comments