mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Update TypedArray internals methods (#4653)
releated test262 test-cases has been removed from the skip list. JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
This commit is contained in:
parent
823a8b128d
commit
a58884c169
@ -816,81 +816,51 @@ ecma_builtin_typedarray_prototype_join (ecma_object_t *obj_p, /**< this object *
|
||||
ecma_value_t separator_arg) /**< separator argument */
|
||||
{
|
||||
/* 2. */
|
||||
ecma_value_t length_value = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_LENGTH);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (length_value))
|
||||
{
|
||||
return length_value;
|
||||
}
|
||||
|
||||
ecma_number_t length_number;
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (length_value, &length_number)))
|
||||
{
|
||||
ecma_free_value (length_value);
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
uint32_t length = ecma_typedarray_get_length (obj_p);
|
||||
ecma_string_t *separator_string_p = ecma_op_typedarray_get_separator_string (separator_arg);
|
||||
|
||||
ecma_value_t ret_value = ECMA_VALUE_ERROR;
|
||||
|
||||
/* 3. */
|
||||
uint32_t length = ecma_number_to_uint32 (length_number);
|
||||
|
||||
if (length == 0)
|
||||
if (JERRY_UNLIKELY (separator_string_p == NULL))
|
||||
{
|
||||
/* 6. */
|
||||
ecma_free_value (length_value);
|
||||
return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
|
||||
return ret_value;
|
||||
}
|
||||
else
|
||||
|
||||
/* 7-8. */
|
||||
ecma_string_t *first_string_p = ecma_op_typedarray_get_to_string_at_index (obj_p, 0);
|
||||
|
||||
if (JERRY_UNLIKELY (first_string_p == NULL))
|
||||
{
|
||||
ecma_string_t *separator_string_p = ecma_op_typedarray_get_separator_string (separator_arg);
|
||||
|
||||
if (JERRY_UNLIKELY (separator_string_p == NULL))
|
||||
{
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* 7-8. */
|
||||
ecma_string_t *first_string_p = ecma_op_typedarray_get_to_string_at_index (obj_p, 0);
|
||||
|
||||
if (JERRY_UNLIKELY (first_string_p == NULL))
|
||||
{
|
||||
ecma_deref_ecma_string (separator_string_p);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (first_string_p);
|
||||
|
||||
ecma_deref_ecma_string (first_string_p);
|
||||
|
||||
/* 9-10. */
|
||||
for (uint32_t k = 1; k < length; k++)
|
||||
{
|
||||
/* 10.a */
|
||||
ecma_stringbuilder_append (&builder, separator_string_p);
|
||||
|
||||
/* 10.d */
|
||||
ecma_string_t *next_string_p = ecma_op_typedarray_get_to_string_at_index (obj_p, k);
|
||||
|
||||
if (JERRY_UNLIKELY (next_string_p == NULL))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
ecma_deref_ecma_string (separator_string_p);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ecma_stringbuilder_append (&builder, next_string_p);
|
||||
|
||||
ecma_deref_ecma_string (next_string_p);
|
||||
}
|
||||
|
||||
ecma_deref_ecma_string (separator_string_p);
|
||||
ret_value = ecma_make_string_value (ecma_stringbuilder_finalize (&builder));
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
ecma_free_value (length_value);
|
||||
ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (first_string_p);
|
||||
|
||||
ecma_deref_ecma_string (first_string_p);
|
||||
|
||||
/* 9-10. */
|
||||
for (uint32_t k = 1; k < length; k++)
|
||||
{
|
||||
/* 10.a */
|
||||
ecma_stringbuilder_append (&builder, separator_string_p);
|
||||
|
||||
/* 10.d */
|
||||
ecma_string_t *next_string_p = ecma_op_typedarray_get_to_string_at_index (obj_p, k);
|
||||
|
||||
if (JERRY_UNLIKELY (next_string_p == NULL))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
ecma_deref_ecma_string (separator_string_p);
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
ecma_stringbuilder_append (&builder, next_string_p);
|
||||
|
||||
ecma_deref_ecma_string (next_string_p);
|
||||
}
|
||||
|
||||
ecma_deref_ecma_string (separator_string_p);
|
||||
ret_value = ecma_make_string_value (ecma_stringbuilder_finalize (&builder));
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_typedarray_prototype_join */
|
||||
@ -1108,7 +1078,7 @@ ecma_builtin_typedarray_prototype_sort_compare_helper (ecma_value_t lhs, /**< le
|
||||
{
|
||||
result = ECMA_NUMBER_MINUS_ONE;
|
||||
}
|
||||
else if (lhs_value > rhs_value)
|
||||
else if (lhs_value > rhs_value || (ecma_number_is_zero (rhs_value) && ecma_number_is_negative (rhs_value)))
|
||||
{
|
||||
result = ECMA_NUMBER_ONE;
|
||||
}
|
||||
@ -1631,7 +1601,8 @@ static ecma_value_t
|
||||
ecma_builtin_typedarray_prototype_to_locale_string_helper (ecma_typedarray_info_t *info_p, /**< object info */
|
||||
uint32_t index) /** array index */
|
||||
{
|
||||
ecma_value_t element_value = ecma_get_typedarray_element (info_p->buffer_p + index, info_p->id);
|
||||
ecma_value_t element_value = ecma_get_typedarray_element (info_p, index);
|
||||
|
||||
ecma_value_t call_value = ecma_op_invoke_by_magic_id (element_value, LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, NULL, 0);
|
||||
|
||||
ecma_free_value (element_value);
|
||||
@ -1665,8 +1636,6 @@ ecma_builtin_typedarray_prototype_to_locale_string_helper (ecma_typedarray_info_
|
||||
static ecma_value_t
|
||||
ecma_builtin_typedarray_prototype_to_locale_string (ecma_typedarray_info_t *info_p) /**< object info */
|
||||
{
|
||||
uint32_t limit = info_p->length * info_p->element_size;
|
||||
|
||||
if (info_p->length == 0)
|
||||
{
|
||||
return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
|
||||
@ -1683,7 +1652,7 @@ ecma_builtin_typedarray_prototype_to_locale_string (ecma_typedarray_info_t *info
|
||||
ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (return_string_p);
|
||||
ecma_deref_ecma_string (return_string_p);
|
||||
|
||||
for (uint32_t k = info_p->element_size; k < limit; k += info_p->element_size)
|
||||
for (uint32_t k = 1; k < info_p->length; k++)
|
||||
{
|
||||
ecma_stringbuilder_append_byte (&builder, LIT_CHAR_COMMA);
|
||||
ecma_value_t next_element = ecma_builtin_typedarray_prototype_to_locale_string_helper (info_p, k);
|
||||
@ -1923,6 +1892,13 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
|
||||
}
|
||||
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BYTELENGTH_GETTER:
|
||||
{
|
||||
ecma_object_t *buffer_p = ecma_typedarray_get_arraybuffer (typedarray_p);
|
||||
|
||||
if (ecma_arraybuffer_is_detached (buffer_p))
|
||||
{
|
||||
return ecma_make_uint32_value (0);
|
||||
}
|
||||
|
||||
uint32_t length = ecma_typedarray_get_length (typedarray_p);
|
||||
uint8_t shift = ecma_typedarray_get_element_size_shift (typedarray_p);
|
||||
return ecma_make_uint32_value (length << shift);
|
||||
@ -1933,6 +1909,13 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
|
||||
}
|
||||
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_LENGTH_GETTER:
|
||||
{
|
||||
ecma_object_t *buffer_p = ecma_typedarray_get_arraybuffer (typedarray_p);
|
||||
|
||||
if (ecma_arraybuffer_is_detached (buffer_p))
|
||||
{
|
||||
return ecma_make_uint32_value (0);
|
||||
}
|
||||
|
||||
return ecma_make_uint32_value (ecma_typedarray_get_length (typedarray_p));
|
||||
}
|
||||
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_STRING_TAG_GETTER:
|
||||
|
||||
@ -117,24 +117,10 @@ ecma_builtin_typedarray_of (ecma_value_t this_arg, /**< 'this' argument */
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a constructor"));
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
|
||||
const uint8_t builtin_id = ecma_get_object_builtin_id (obj_p);
|
||||
|
||||
if (!ecma_typedarray_helper_is_typedarray (builtin_id))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a TypedArray constructor"));
|
||||
}
|
||||
|
||||
ecma_typedarray_type_t typedarray_id = ecma_typedarray_helper_builtin_to_typedarray_id (builtin_id);
|
||||
|
||||
ecma_object_t *proto_p = ecma_builtin_get (ecma_typedarray_helper_get_prototype_id (typedarray_id));
|
||||
const uint8_t element_size_shift = ecma_typedarray_helper_get_shift_size (typedarray_id);
|
||||
|
||||
ecma_value_t ret_val = ecma_typedarray_create_object_with_length (arguments_list_len,
|
||||
NULL,
|
||||
proto_p,
|
||||
element_size_shift,
|
||||
typedarray_id);
|
||||
ecma_object_t *constructor_obj_p = ecma_get_object_from_value (this_arg);
|
||||
ecma_value_t len_val = ecma_make_uint32_value (arguments_list_len);
|
||||
ecma_value_t ret_val = ecma_typedarray_create (constructor_obj_p, &len_val, 1);
|
||||
ecma_free_value (len_val);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ret_val))
|
||||
{
|
||||
|
||||
@ -324,17 +324,30 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi
|
||||
|
||||
bool system_is_little_endian = ecma_dataview_check_little_endian ();
|
||||
|
||||
ecma_typedarray_info_t info;
|
||||
info.id = id;
|
||||
info.length = view_size;
|
||||
info.shift = ecma_typedarray_helper_get_shift_size (id);
|
||||
info.element_size = element_size;
|
||||
info.offset = view_p->byte_offset;
|
||||
info.array_buffer_p = buffer_p;
|
||||
|
||||
/* GetViewValue 12. */
|
||||
if (ecma_is_value_empty (value_to_set))
|
||||
{
|
||||
JERRY_VLA (lit_utf8_byte_t, swap_block_p, element_size);
|
||||
memcpy (swap_block_p, block_p, element_size * sizeof (lit_utf8_byte_t));
|
||||
ecma_dataview_swap_order (system_is_little_endian, is_little_endian, element_size, swap_block_p);
|
||||
return ecma_get_typedarray_element (swap_block_p, id);
|
||||
info.buffer_p = swap_block_p;
|
||||
return ecma_get_typedarray_element (&info, 0);
|
||||
}
|
||||
if (!ecma_number_is_nan (get_index) && get_index <= 0)
|
||||
{
|
||||
get_index = 0;
|
||||
}
|
||||
|
||||
/* SetViewValue 14. */
|
||||
ecma_value_t set_element = ecma_set_typedarray_element (block_p, value_to_set, id);
|
||||
info.buffer_p = block_p;
|
||||
ecma_value_t set_element = ecma_set_typedarray_element (&info, value_to_set, 0);
|
||||
ecma_free_value (value_to_set);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (set_element))
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
#include "ecma-bigint.h"
|
||||
#include "jcontext.h"
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
@ -138,18 +139,28 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
|
||||
{
|
||||
break;
|
||||
}
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
bool is_same;
|
||||
if (num <= 0)
|
||||
{
|
||||
is_same = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
is_same = ecma_compare_ecma_strings (property_name_p, num_to_str);
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
}
|
||||
|
||||
uint32_t array_index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
if (is_same)
|
||||
{
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
ecma_value_t value = ECMA_VALUE_UNDEFINED;
|
||||
ecma_value_t value = ecma_get_typedarray_element (&info, num);
|
||||
|
||||
if (array_index < info.length)
|
||||
if (ECMA_IS_VALUE_ERROR (value))
|
||||
{
|
||||
uint32_t byte_pos = array_index << info.shift;
|
||||
value = ecma_get_typedarray_element (info.buffer_p + byte_pos, info.id);
|
||||
property_ref_p->virtual_value = value;
|
||||
return ECMA_PROPERTY_TYPE_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (!ecma_is_value_undefined (value))
|
||||
@ -165,21 +176,11 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
|
||||
|
||||
return ECMA_PROPERTY_ENUMERABLE_WRITABLE | ECMA_PROPERTY_VIRTUAL;
|
||||
}
|
||||
|
||||
return ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP;
|
||||
else
|
||||
{
|
||||
return ECMA_PROPERTY_TYPE_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
|
||||
if (ecma_compare_ecma_strings (property_name_p, num_to_str))
|
||||
{
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
|
||||
return ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP;
|
||||
}
|
||||
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
@ -453,6 +454,44 @@ ecma_op_object_has_property (ecma_object_t *object_p, /**< the object */
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
if (ecma_object_is_typedarray (object_p) && !ecma_prop_name_is_symbol (property_name_p))
|
||||
{
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
bool is_same;
|
||||
if (num <= 0)
|
||||
{
|
||||
is_same = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
is_same = ecma_compare_ecma_strings (property_name_p, num_to_str);
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
}
|
||||
|
||||
if (is_same)
|
||||
{
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
|
||||
if (ecma_arraybuffer_is_detached (info.array_buffer_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
if (!ecma_op_is_integer (num)
|
||||
|| num >= info.length
|
||||
|| num < 0
|
||||
|| (ecma_number_is_negative (num) && ecma_number_is_zero (num)))
|
||||
{
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
|
||||
return ECMA_VALUE_TRUE;
|
||||
}
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
/* 2 - 3. */
|
||||
if (ecma_op_ordinary_object_has_own_property (object_p, property_name_p))
|
||||
{
|
||||
@ -562,32 +601,25 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t array_index = ecma_string_get_array_index (property_name_p);
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
bool is_same;
|
||||
if (num <= 0)
|
||||
{
|
||||
is_same = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
is_same = ecma_compare_ecma_strings (property_name_p, num_to_str);
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
}
|
||||
|
||||
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
if (is_same)
|
||||
{
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
|
||||
if (array_index >= info.length)
|
||||
{
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
uint32_t byte_pos = array_index << info.shift;
|
||||
return ecma_get_typedarray_element (info.buffer_p + byte_pos, info.id);
|
||||
return ecma_get_typedarray_element (&info, num);
|
||||
}
|
||||
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
|
||||
if (ecma_compare_ecma_strings (property_name_p, num_to_str))
|
||||
{
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
@ -1410,29 +1442,23 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t array_index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
|
||||
if (array_index >= info.length)
|
||||
{
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
|
||||
uint32_t byte_pos = array_index << info.shift;
|
||||
return ecma_set_typedarray_element (info.buffer_p + byte_pos, value, info.id);
|
||||
}
|
||||
|
||||
ecma_number_t num = ecma_string_to_number (property_name_p);
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
bool is_same = ecma_compare_ecma_strings (property_name_p, num_to_str);
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
bool is_same;
|
||||
if (num <= 0)
|
||||
{
|
||||
is_same = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
is_same = ecma_compare_ecma_strings (property_name_p, num_to_str);
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
}
|
||||
|
||||
if (is_same)
|
||||
{
|
||||
return ECMA_VALUE_FALSE;
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);
|
||||
return ecma_set_typedarray_element (&info, value, num);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1929,12 +1955,17 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
ecma_property_ref_t property_ref;
|
||||
|
||||
property_ref.virtual_value = ECMA_VALUE_EMPTY;
|
||||
ecma_property_t property = ecma_op_object_get_own_property (object_p,
|
||||
property_name_p,
|
||||
&property_ref,
|
||||
ECMA_PROPERTY_GET_VALUE);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (property_ref.virtual_value))
|
||||
{
|
||||
return property_ref.virtual_value;
|
||||
}
|
||||
|
||||
if (property == ECMA_PROPERTY_TYPE_NOT_FOUND || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP)
|
||||
{
|
||||
return ECMA_VALUE_FALSE;
|
||||
|
||||
@ -632,10 +632,23 @@ ecma_get_typedarray_getter_fn (ecma_typedarray_type_t typedarray_id)
|
||||
* @return ecma_number_t: the value of the element
|
||||
*/
|
||||
extern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_get_typedarray_element (lit_utf8_byte_t *src_p,
|
||||
ecma_typedarray_type_t typedarray_id)
|
||||
ecma_get_typedarray_element (ecma_typedarray_info_t *info_p,
|
||||
ecma_number_t num)
|
||||
{
|
||||
return ecma_typedarray_getters[typedarray_id](src_p);
|
||||
if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
if (!ecma_op_is_integer (num)
|
||||
|| num >= info_p->length
|
||||
|| num < 0
|
||||
|| (ecma_number_is_negative (num) && ecma_number_is_zero (num)))
|
||||
{
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
uint32_t byte_pos = (uint32_t) num << info_p->shift;
|
||||
return ecma_typedarray_getters[info_p->id](info_p->buffer_p + byte_pos);
|
||||
} /* ecma_get_typedarray_element */
|
||||
|
||||
/**
|
||||
@ -653,11 +666,48 @@ ecma_get_typedarray_setter_fn (ecma_typedarray_type_t typedarray_id)
|
||||
* set typedarray's element value
|
||||
*/
|
||||
extern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_set_typedarray_element (lit_utf8_byte_t *dst_p,
|
||||
ecma_set_typedarray_element (ecma_typedarray_info_t *info_p,
|
||||
ecma_value_t value,
|
||||
ecma_typedarray_type_t typedarray_id)
|
||||
ecma_number_t num)
|
||||
{
|
||||
return ecma_typedarray_setters[typedarray_id](dst_p, value);
|
||||
ecma_value_t to_num;
|
||||
if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info_p->id))
|
||||
{
|
||||
to_num = ecma_bigint_to_bigint (value, false);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (to_num))
|
||||
{
|
||||
return to_num;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_number_t result_num;
|
||||
to_num = ecma_op_to_numeric (value, &result_num, ECMA_TO_NUMERIC_NO_OPTS);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (to_num))
|
||||
{
|
||||
return to_num;
|
||||
}
|
||||
}
|
||||
|
||||
if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))
|
||||
{
|
||||
ecma_free_value (to_num);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
if (!ecma_op_is_integer (num)
|
||||
|| num >= info_p->length
|
||||
|| num < 0
|
||||
|| (ecma_number_is_negative (num) && ecma_number_is_zero (num)))
|
||||
{
|
||||
ecma_free_value (to_num);
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
ecma_free_value (to_num);
|
||||
lit_utf8_byte_t *src_buffer = info_p->buffer_p + ((uint32_t) num << info_p->shift);
|
||||
return ecma_typedarray_setters[info_p->id](src_buffer, value);
|
||||
} /* ecma_set_typedarray_element */
|
||||
|
||||
/**
|
||||
@ -791,6 +841,12 @@ ecma_typedarray_create_object_with_length (uint32_t array_length, /**< length of
|
||||
ECMA_SET_NON_NULL_POINTER (new_arraybuffer_p->u2.prototype_cp, prototype_p);
|
||||
|
||||
ecma_deref_object (prototype_p);
|
||||
|
||||
if (ecma_arraybuffer_is_detached (src_buffer_p))
|
||||
{
|
||||
ecma_deref_object (new_arraybuffer_p);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Maximum TypedArray size is reached"));
|
||||
}
|
||||
}
|
||||
|
||||
ecma_object_t *object_p = ecma_create_object (proto_p,
|
||||
@ -1468,7 +1524,8 @@ ecma_typedarray_get_length (ecma_object_t *typedarray_p) /**< the pointer to the
|
||||
if (!(ext_object_p->u.cls.u2.typedarray_flags & ECMA_TYPEDARRAY_IS_EXTENDED))
|
||||
{
|
||||
ecma_object_t *arraybuffer_p = ecma_get_object_from_value (ext_object_p->u.cls.u3.arraybuffer);
|
||||
uint32_t buffer_length = ecma_arraybuffer_get_length (arraybuffer_p);
|
||||
ecma_extended_object_t *arraybuffer_object_p = (ecma_extended_object_t *) arraybuffer_p;
|
||||
uint32_t buffer_length = arraybuffer_object_p->u.cls.u3.length;
|
||||
uint8_t shift = ecma_typedarray_get_element_size_shift (typedarray_p);
|
||||
|
||||
return buffer_length >> shift;
|
||||
@ -1555,21 +1612,16 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
}
|
||||
else if (!ecma_is_value_object (arguments_list_p[0]))
|
||||
{
|
||||
/* 22.2.1.2 */
|
||||
if (ecma_is_value_undefined (arguments_list_p[0]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Length argument is undefined"));
|
||||
}
|
||||
ecma_number_t num = 0;
|
||||
|
||||
ecma_number_t num;
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (arguments_list_p[0], &num)))
|
||||
if (!ecma_is_value_undefined (arguments_list_p[0])
|
||||
&& ECMA_IS_VALUE_ERROR (ecma_op_to_number (arguments_list_p[0], &num)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
uint32_t length = ecma_number_to_uint32 (num);
|
||||
|
||||
if (num != ((ecma_number_t) length))
|
||||
if (ecma_number_is_infinity (num))
|
||||
{
|
||||
ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid TypedArray length"));
|
||||
}
|
||||
@ -1610,6 +1662,10 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
if (ecma_number_is_negative (offset) && ecma_number_is_zero (offset))
|
||||
{
|
||||
offset = 0;
|
||||
}
|
||||
if (ecma_number_is_negative (offset) || fmod (offset, (1 << element_size_shift)) != 0)
|
||||
{
|
||||
/* ES2015 22.2.1.5: 9 - 10. */
|
||||
@ -1638,8 +1694,8 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_length_t new_length;
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_length (arg3, &new_length)))
|
||||
ecma_number_t new_length;
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_index (arg3, &new_length)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
@ -1785,9 +1841,20 @@ ecma_op_typedarray_define_own_property (ecma_object_t *obj_p, /**< TypedArray ob
|
||||
|
||||
if (!ecma_prop_name_is_symbol (prop_name_p))
|
||||
{
|
||||
uint32_t array_index = ecma_string_get_array_index (prop_name_p);
|
||||
ecma_number_t num = ecma_string_to_number (prop_name_p);
|
||||
bool is_same;
|
||||
if (num <= 0)
|
||||
{
|
||||
is_same = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
is_same = ecma_compare_ecma_strings (prop_name_p, num_to_str);
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
}
|
||||
|
||||
if (array_index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
if (is_same)
|
||||
{
|
||||
if ((property_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))
|
||||
|| ((property_desc_p->flags & (JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE))
|
||||
@ -1802,34 +1869,27 @@ ecma_op_typedarray_define_own_property (ecma_object_t *obj_p, /**< TypedArray ob
|
||||
|
||||
ecma_typedarray_info_t info = ecma_typedarray_get_info (obj_p);
|
||||
|
||||
if (array_index >= info.length)
|
||||
if (!ecma_op_is_integer (num)
|
||||
|| num >= info.length
|
||||
|| num < 0
|
||||
|| (ecma_number_is_negative (num) && ecma_number_is_zero (num)))
|
||||
{
|
||||
return ECMA_REJECT ((property_desc_p->flags & JERRY_PROP_SHOULD_THROW), "Invalid typed array index");
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
|
||||
if (property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)
|
||||
{
|
||||
lit_utf8_byte_t *src_buffer = info.buffer_p + (array_index << info.shift);
|
||||
ecma_value_t set_element = ecma_set_typedarray_element (src_buffer, property_desc_p->value, info.id);
|
||||
ecma_value_t set_element = ecma_set_typedarray_element (&info, property_desc_p->value, num);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (set_element))
|
||||
{
|
||||
return set_element;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ECMA_VALUE_TRUE;
|
||||
}
|
||||
|
||||
ecma_number_t num = ecma_string_to_number (prop_name_p);
|
||||
ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);
|
||||
bool is_same = ecma_compare_ecma_strings (prop_name_p, num_to_str);
|
||||
ecma_deref_ecma_string (num_to_str);
|
||||
|
||||
if (is_same)
|
||||
{
|
||||
return ECMA_REJECT ((property_desc_p->flags & JERRY_PROP_SHOULD_THROW), "Invalid typed array index");
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_op_general_object_define_own_property (obj_p, prop_name_p, property_desc_p);
|
||||
|
||||
@ -32,11 +32,11 @@ uint8_t ecma_typedarray_helper_get_shift_size (ecma_typedarray_type_t typedarray
|
||||
lit_magic_string_id_t ecma_get_typedarray_magic_string_id (ecma_typedarray_type_t typedarray_id);
|
||||
ecma_typedarray_getter_fn_t ecma_get_typedarray_getter_fn (ecma_typedarray_type_t typedarray_id);
|
||||
ecma_typedarray_setter_fn_t ecma_get_typedarray_setter_fn (ecma_typedarray_type_t typedarray_id);
|
||||
ecma_value_t ecma_get_typedarray_element (lit_utf8_byte_t *src_p,
|
||||
ecma_typedarray_type_t typedarray_id);
|
||||
ecma_value_t ecma_set_typedarray_element (lit_utf8_byte_t *dst_p,
|
||||
ecma_value_t ecma_get_typedarray_element (ecma_typedarray_info_t *info_p,
|
||||
ecma_number_t num);
|
||||
ecma_value_t ecma_set_typedarray_element (ecma_typedarray_info_t *info_p,
|
||||
ecma_value_t value,
|
||||
ecma_typedarray_type_t typedarray_id);
|
||||
ecma_number_t num);
|
||||
bool ecma_typedarray_helper_is_typedarray (ecma_builtin_id_t builtin_id);
|
||||
ecma_typedarray_type_t ecma_get_typedarray_id (ecma_object_t *obj_p);
|
||||
ecma_builtin_id_t ecma_typedarray_helper_get_prototype_id (ecma_typedarray_type_t typedarray_id);
|
||||
|
||||
@ -28,7 +28,13 @@ var typedarrays = [
|
||||
|
||||
for (let ta of typedarrays) {
|
||||
for (let prop_name of [2, 5.1]) {
|
||||
let set_value = 4.2;
|
||||
var set_value = 4.2;
|
||||
|
||||
if (ta.constructor === BigInt64Array || ta.constructor === BigUint64Array)
|
||||
{
|
||||
set_value = 4n;
|
||||
}
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
let set_result = ta[prop_name] = set_value;
|
||||
|
||||
@ -105,48 +105,7 @@
|
||||
<test id="built-ins/String/prototype/toLocaleLowerCase/special_casing_conditional.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/toLowerCase/Final_Sigma_U180E.js"><reason></reason></test>
|
||||
<test id="built-ins/String/prototype/toLowerCase/special_casing_conditional.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/join/BigInt/get-length-uses-internal-arraylength.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator-symbol.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-separator.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/join/get-length-uses-internal-arraylength.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/join/return-abrupt-from-separator-symbol.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/join/return-abrupt-from-separator.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/slice/set-values-from-different-ctor-type.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArray/prototype/sort/sorted-values.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-negative-length.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-byteoffset.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors-bigint/length-arg/toindex-length.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors/buffer-arg/byteoffset-is-negative-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors/buffer-arg/defined-negative-length.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors/buffer-arg/toindex-byteoffset.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors/length-arg/toindex-length.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-minus-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-minus-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Get/BigInt/key-is-not-minus-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Get/key-is-not-minus-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/abrupt-from-ordinary-has-parent-hasproperty.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/inherited-property.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-greater-than-last-index.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-lower-than-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-minus-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/key-is-not-integer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/abrupt-from-ordinary-has-parent-hasproperty.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/inherited-property.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/key-is-greater-than-last-index.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/key-is-lower-than-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/key-is-minus-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/key-is-not-integer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-throws.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/tonumber-value-throws.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/of/BigInt/custom-ctor-returns-other-instance.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/of/BigInt/custom-ctor.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/of/BigInt/new-instance-using-custom-ctor.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/of/custom-ctor-returns-other-instance.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/of/custom-ctor.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/of/new-instance-using-custom-ctor.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js"><reason></reason></test>
|
||||
<test id="language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js"><reason></reason></test>
|
||||
@ -8330,16 +8289,6 @@
|
||||
<test id="built-ins/SharedArrayBuffer/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors/buffer-arg/proto-from-ctor-realm-sab.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Get/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/GetOwnProperty/BigInt/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/GetOwnProperty/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/BigInt/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="intl402/Collator/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="intl402/DateTimeFormat/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
<test id="intl402/DisplayNames/proto-from-ctor-realm.js"><reason></reason></test>
|
||||
@ -8381,39 +8330,5 @@
|
||||
<test id="built-ins/Atomics/wait/null-bufferdata-throws.js"><reason></reason></test>
|
||||
<test id="built-ins/Atomics/waitAsync/bigint/null-bufferdata-throws.js"><reason></reason></test>
|
||||
<test id="built-ins/Atomics/waitAsync/null-bufferdata-throws.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/detached-when-species-retrieved-different-type.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/detached-when-species-retrieved-same-type.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors/typedarray-arg/detached-when-species-retrieved-different-type.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/ctors/typedarray-arg/detached-when-species-retrieved-same-type.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/DefineOwnProperty/tonumber-value-detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Get/BigInt/detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Get/BigInt/infinity-detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Get/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Get/detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Get/infinity-detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/GetOwnProperty/BigInt/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/GetOwnProperty/BigInt/detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/GetOwnProperty/BigInt/enumerate-detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/GetOwnProperty/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/GetOwnProperty/detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/GetOwnProperty/enumerate-detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/BigInt/infinity-with-detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/HasProperty/infinity-with-detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/BigInt/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/BigInt/detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/detached-buffer-realm.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/detached-buffer.js"><reason></reason></test>
|
||||
<test id="built-ins/TypedArrayConstructors/internals/Set/tonumber-value-detached-buffer.js"><reason></reason></test>
|
||||
<!-- END - Missing test262 support in JerryScript REPL - missing $262.detachArrayBuffer function -->
|
||||
</excludeList>
|
||||
|
||||
@ -457,10 +457,28 @@ static void test_property_by_index (test_entry_t test_entries[])
|
||||
}
|
||||
|
||||
jerry_value_t set_undefined = jerry_set_property_by_index (typedarray, 100, jerry_create_number (50));
|
||||
TEST_ASSERT (jerry_value_is_boolean (set_undefined) && !jerry_get_boolean_value (set_undefined));
|
||||
jerry_value_t get_undefined = jerry_get_property_by_index (typedarray, 100);
|
||||
TEST_ASSERT (jerry_value_is_undefined (get_undefined));
|
||||
|
||||
if (type == JERRY_TYPEDARRAY_BIGINT64 || type == JERRY_TYPEDARRAY_BIGUINT64)
|
||||
{
|
||||
TEST_ASSERT (jerry_value_is_error (set_undefined));
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST_ASSERT (jerry_value_is_boolean (set_undefined) && !jerry_get_boolean_value (set_undefined));
|
||||
}
|
||||
|
||||
jerry_value_t get_undefined = jerry_get_property_by_index (typedarray, 100);
|
||||
|
||||
if (type == JERRY_TYPEDARRAY_BIGINT64 || type == JERRY_TYPEDARRAY_BIGUINT64)
|
||||
{
|
||||
TEST_ASSERT (jerry_value_is_error (set_undefined));
|
||||
}
|
||||
else
|
||||
{
|
||||
TEST_ASSERT (jerry_value_is_undefined (get_undefined));
|
||||
}
|
||||
|
||||
TEST_ASSERT (jerry_value_is_undefined (get_undefined));
|
||||
jerry_release_value (set_undefined);
|
||||
jerry_release_value (get_undefined);
|
||||
jerry_release_value (typedarray);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user