@@ -204,7 +204,9 @@ ecma_builtin_typedarray_prototype_map (ecma_value_t this_arg, /**< this object *
204204 ecma_object_t * func_object_p = ecma_get_object_from_value (cb_func_val );
205205
206206 // 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 );
208210
209211 if (ECMA_IS_VALUE_ERROR (new_typedarray ))
210212 {
@@ -427,7 +429,9 @@ ecma_builtin_typedarray_prototype_filter (ecma_value_t this_arg, /**< this objec
427429
428430 uint32_t pass_num = (uint32_t ) ((pass_value_p - pass_value_list_p ) >> info_p -> shift );
429431
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 );
431435
432436 if (!ECMA_IS_VALUE_ERROR (ret_value ))
433437 {
@@ -868,7 +872,8 @@ ecma_builtin_typedarray_prototype_join (ecma_object_t *obj_p, /**< this object *
868872 * Returned value must be freed with ecma_free_value.
869873 */
870874static 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 */
872877 ecma_value_t begin , /**< begin */
873878 ecma_value_t end ) /**< end */
874879{
@@ -918,7 +923,7 @@ ecma_builtin_typedarray_prototype_subarray (ecma_typedarray_info_t *info_p, /**<
918923 ecma_make_uint32_value (subarray_length )
919924 };
920925
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 );
922927
923928 ecma_free_value (arguments_p [1 ]);
924929 ecma_free_value (arguments_p [2 ]);
@@ -1489,7 +1494,8 @@ ecma_builtin_typedarray_prototype_copy_within (ecma_value_t this_arg, /**< this
14891494 * Returned value must be freed with ecma_free_value.
14901495 */
14911496static 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 */
14931499 const ecma_value_t args [], /**< arguments list */
14941500 uint32_t args_number ) /**< number of arguments */
14951501{
@@ -1518,8 +1524,10 @@ ecma_builtin_typedarray_prototype_slice (ecma_typedarray_info_t *info_p, /**< ob
15181524 int32_t distance = (int32_t ) (relative_end - relative_start );
15191525 uint32_t count = distance > 0 ? (uint32_t ) distance : 0 ;
15201526
1527+ ecma_value_t len = ecma_make_number_value (count );
15211528 // 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 );
15231531
15241532 if (ECMA_IS_VALUE_ERROR (new_typedarray ))
15251533 {
@@ -1763,7 +1771,6 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
17631771 case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FILTER :
17641772 {
17651773 return ecma_builtin_typedarray_prototype_filter (this_arg , & info , arguments_list_p [0 ], arguments_list_p [1 ]);
1766-
17671774 }
17681775 case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REVERSE :
17691776 {
@@ -1775,7 +1782,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
17751782 }
17761783 case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SUBARRAY :
17771784 {
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 ]);
17791786 }
17801787 case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FILL :
17811788 {
@@ -1819,7 +1826,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
18191826 }
18201827 case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SLICE :
18211828 {
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 );
18231830 }
18241831 case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_LOCALE_STRING :
18251832 {
0 commit comments