Introduce ecma_op_object_get_length and ecma_op_object_get_by_index operations (#3245)

These two functions helps to reduce code duplication, also invokes the elimination of several ECMA_TRY_CATCH macros.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2019-10-29 10:07:20 +01:00
committed by GitHub
parent 11818f1cb0
commit 42ab062441
23 changed files with 679 additions and 776 deletions
@@ -1088,6 +1088,19 @@ ecma_op_array_object_define_own_property (ecma_object_t *object_p, /**< the arra
return ECMA_VALUE_TRUE;
} /* ecma_op_array_object_define_own_property */
/**
* Get the length of the an array object
*
* @return the array length
*/
extern inline uint32_t JERRY_ATTR_ALWAYS_INLINE
ecma_array_get_length (ecma_object_t *array_p) /**< array object */
{
JERRY_ASSERT (ecma_get_object_type (array_p) == ECMA_OBJECT_TYPE_ARRAY);
return ((ecma_extended_object_t *) array_p)->u.array.length;
} /* ecma_array_get_length */
/**
* List names of a String object's lazy instantiated properties
*