Eliminate ECMA_TRY_CATCH macros part I. (#3006)

Also this patch introduces several helper function to find/put/delete properties by indexed property names to reduce code duplications.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2019-08-26 17:20:00 +02:00
committed by Dániel Bátyai
parent 3af0079a0e
commit b47c36ad18
9 changed files with 852 additions and 643 deletions
File diff suppressed because it is too large Load Diff
@@ -472,11 +472,6 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, /**< array */
ecma_deref_ecma_string (new_array_index_string_p);
}
if (ecma_is_value_empty (ret_value))
{
ret_value = ECMA_VALUE_TRUE;
}
return ret_value;
} /* ecma_builtin_helper_array_concat_value */
@@ -795,6 +790,41 @@ ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, /**< index
return match_found;
} /* ecma_builtin_helper_string_find_index */
/**
* Helper function for using [[DefineOwnProperty]] specialized for indexed property names
*
* Note: this method falls back to the general ecma_builtin_helper_def_prop
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, /**< object */
uint32_t index, /**< property index */
ecma_value_t value, /**< value */
uint32_t opts, /**< any combination of ecma_property_flag_t bits */
bool is_throw) /**< is_throw */
{
if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))
{
return ecma_builtin_helper_def_prop (obj_p,
ECMA_CREATE_DIRECT_UINT32_STRING (index),
value,
opts,
is_throw);
}
ecma_string_t *index_str_p = ecma_new_non_direct_string_from_uint32 (index);
ecma_value_t ret_value = ecma_builtin_helper_def_prop (obj_p,
index_str_p,
value,
opts,
is_throw);
ecma_deref_ecma_string (index_str_p);
return ret_value;
} /* ecma_builtin_helper_def_prop_by_index */
/**
* Helper function for using [[DefineOwnProperty]].
*
@@ -60,6 +60,9 @@ ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, ecma_strin
ecma_value_t
ecma_builtin_helper_def_prop (ecma_object_t *obj_p, ecma_string_t *index_p, ecma_value_t value,
uint32_t opts, bool is_throw);
ecma_value_t
ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, uint32_t index, ecma_value_t value,
uint32_t opts, bool is_throw);
#if ENABLED (JERRY_BUILTIN_DATE)