Optimize ecma_op_function_call (#4817)

Remove redundant isCallable checks

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
This commit is contained in:
Robert Fancsik
2021-11-04 17:26:28 +01:00
committed by GitHub
parent 7ea0000ee0
commit bc091e1742
11 changed files with 326 additions and 371 deletions
@@ -97,29 +97,21 @@ ecma_async_generator_enqueue (vm_executable_object_t *async_generator_object_p,
static ecma_value_t
ecma_async_yield_call (ecma_value_t function, /**< function (takes reference) */
vm_executable_object_t *async_generator_object_p, /**< async generator */
ecma_value_t argument, /**< argument passed to the function */
const char *error_msg_p) /**< error message when the function is not callable */
ecma_value_t argument) /**< argument passed to the function */
{
if (!ecma_is_value_object (function) || !ecma_op_is_callable (function))
{
ecma_free_value (function);
return ecma_raise_type_error (error_msg_p);
}
ecma_object_t *return_obj_p = ecma_get_object_from_value (function);
ecma_value_t iterator = async_generator_object_p->iterator;
ecma_value_t result;
if (argument == ECMA_VALUE_EMPTY)
{
result = ecma_op_function_call (return_obj_p, iterator, NULL, 0);
result = ecma_op_function_validated_call (function, iterator, NULL, 0);
}
else
{
result = ecma_op_function_call (return_obj_p, iterator, &argument, 1);
result = ecma_op_function_validated_call (function, iterator, &argument, 1);
}
ecma_deref_object (return_obj_p);
ecma_free_value (function);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -155,8 +147,7 @@ ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< a
result = ecma_async_yield_call (result,
async_generator_object_p,
ECMA_VALUE_EMPTY,
ECMA_ERR_MSG ("Iterator 'return' is not callable"));
ECMA_VALUE_EMPTY);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -169,8 +160,7 @@ ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< a
result = ecma_async_yield_call (result,
async_generator_object_p,
value,
ECMA_ERR_MSG ("Iterator 'throw' is not callable"));
value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -419,8 +409,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl
result = ecma_async_yield_call (result,
executable_object_p,
value,
ECMA_ERR_MSG ("Iterator 'return' is not callable"));
value);
ecma_free_value (value);
if (ECMA_IS_VALUE_ERROR (result))