ECMAScript Parameters cannot be passed in collections anymore, only as arrays.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
committed by
László Langó
parent
cc6fced17a
commit
cadc81d583
@@ -113,7 +113,7 @@ ecma_builtin_array_prototype_object_to_string (ecma_value_t this_arg) /**< this
|
||||
/* 4. */
|
||||
ecma_object_t *join_func_obj_p = ecma_get_object_from_value (join_value);
|
||||
|
||||
return_value = ecma_op_function_call (join_func_obj_p, this_arg, NULL);
|
||||
return_value = ecma_op_function_call (join_func_obj_p, this_arg, NULL, 0);
|
||||
}
|
||||
|
||||
ECMA_FINALIZE (join_value);
|
||||
@@ -545,8 +545,6 @@ ecma_builtin_array_prototype_object_push (ecma_value_t this_arg, /**< this argum
|
||||
const ecma_value_t *argument_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_number) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (argument_list_p == NULL || arguments_number > 0);
|
||||
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
/* 1. */
|
||||
@@ -1013,10 +1011,10 @@ ecma_builtin_array_prototype_object_sort_compare_helper (ecma_value_t j, /**< le
|
||||
ecma_value_t compare_args[] = {j, k};
|
||||
|
||||
ECMA_TRY_CATCH (call_value,
|
||||
ecma_op_function_call_array_args (comparefn_obj_p,
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
||||
compare_args,
|
||||
2),
|
||||
ecma_op_function_call (comparefn_obj_p,
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
||||
compare_args,
|
||||
2),
|
||||
ret_value);
|
||||
|
||||
if (!ecma_is_value_number (call_value))
|
||||
@@ -2047,7 +2045,7 @@ ecma_builtin_array_prototype_object_every (ecma_value_t this_arg, /**< this argu
|
||||
|
||||
ecma_value_t call_args[] = { get_value, current_index, obj_this };
|
||||
/* 7.c.ii */
|
||||
ECMA_TRY_CATCH (call_value, ecma_op_function_call_array_args (func_object_p, arg2, call_args, 3), ret_value);
|
||||
ECMA_TRY_CATCH (call_value, ecma_op_function_call (func_object_p, arg2, call_args, 3), ret_value);
|
||||
|
||||
/* 7.c.iii, ecma_op_to_boolean always returns a simple value, so no need to free. */
|
||||
if (ecma_is_completion_value_normal_false (ecma_op_to_boolean (call_value)))
|
||||
@@ -2148,7 +2146,7 @@ ecma_builtin_array_prototype_object_some (ecma_value_t this_arg, /**< this argum
|
||||
|
||||
ecma_value_t call_args[] = { get_value, current_index, obj_this };
|
||||
/* 7.c.ii */
|
||||
ECMA_TRY_CATCH (call_value, ecma_op_function_call_array_args (func_object_p, arg2, call_args, 3), ret_value);
|
||||
ECMA_TRY_CATCH (call_value, ecma_op_function_call (func_object_p, arg2, call_args, 3), ret_value);
|
||||
|
||||
/* 7.c.iii, ecma_op_to_boolean always returns a simple value, so no need to free. */
|
||||
if (ecma_is_completion_value_normal_true (ecma_op_to_boolean (call_value)))
|
||||
@@ -2248,7 +2246,7 @@ ecma_builtin_array_prototype_object_for_each (ecma_value_t this_arg, /**< this a
|
||||
|
||||
/* 7.c.ii */
|
||||
ecma_value_t call_args[] = {current_value, current_index, obj_this};
|
||||
ECMA_TRY_CATCH (call_value, ecma_op_function_call_array_args (func_object_p, arg2, call_args, 3), ret_value);
|
||||
ECMA_TRY_CATCH (call_value, ecma_op_function_call (func_object_p, arg2, call_args, 3), ret_value);
|
||||
|
||||
ECMA_FINALIZE (call_value);
|
||||
ECMA_FINALIZE (current_value);
|
||||
@@ -2345,7 +2343,7 @@ ecma_builtin_array_prototype_object_map (ecma_value_t this_arg, /**< this argume
|
||||
current_index = ecma_make_number_value (num_p);
|
||||
ecma_value_t call_args[] = {current_value, current_index, obj_this};
|
||||
|
||||
ECMA_TRY_CATCH (mapped_value, ecma_op_function_call_array_args (func_object_p, arg2, call_args, 3), ret_value);
|
||||
ECMA_TRY_CATCH (mapped_value, ecma_op_function_call (func_object_p, arg2, call_args, 3), ret_value);
|
||||
|
||||
/* 8.c.iii */
|
||||
/* This will always be a simple value since 'is_throw' is false, so no need to free. */
|
||||
@@ -2463,7 +2461,7 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t this_arg, /**< this arg
|
||||
|
||||
ecma_value_t call_args[] = { get_value, current_index, obj_this };
|
||||
/* 9.c.ii */
|
||||
ECMA_TRY_CATCH (call_value, ecma_op_function_call_array_args (func_object_p, arg2, call_args, 3), ret_value);
|
||||
ECMA_TRY_CATCH (call_value, ecma_op_function_call (func_object_p, arg2, call_args, 3), ret_value);
|
||||
|
||||
/* 9.c.iii, ecma_op_to_boolean always returns a simple value, so no need to free. */
|
||||
if (ecma_is_completion_value_normal_true (ecma_op_to_boolean (call_value)))
|
||||
@@ -2623,10 +2621,10 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
|
||||
ecma_value_t call_args[] = {accumulator, current_value, current_index, obj_this};
|
||||
|
||||
ECMA_TRY_CATCH (call_value,
|
||||
ecma_op_function_call_array_args (func_object_p,
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
||||
call_args,
|
||||
4),
|
||||
ecma_op_function_call (func_object_p,
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
||||
call_args,
|
||||
4),
|
||||
ret_value);
|
||||
|
||||
ecma_free_value (accumulator, true);
|
||||
@@ -2769,10 +2767,10 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
|
||||
ecma_value_t call_args[] = {accumulator, current_value, current_index, obj_this};
|
||||
|
||||
ECMA_TRY_CATCH (call_value,
|
||||
ecma_op_function_call_array_args (func_object_p,
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
||||
call_args,
|
||||
4),
|
||||
ecma_op_function_call (func_object_p,
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
||||
call_args,
|
||||
4),
|
||||
ret_value);
|
||||
|
||||
ecma_free_value (accumulator, true);
|
||||
|
||||
@@ -1213,7 +1213,7 @@ ecma_builtin_date_prototype_to_json (ecma_value_t this_arg, /**< this argument *
|
||||
else
|
||||
{
|
||||
ecma_object_t *to_iso_obj_p = ecma_get_object_from_value (to_iso);
|
||||
ret_value = ecma_op_function_call (to_iso_obj_p, this_arg, NULL);
|
||||
ret_value = ecma_op_function_call (to_iso_obj_p, this_arg, NULL, 0);
|
||||
}
|
||||
|
||||
ECMA_FINALIZE (to_iso);
|
||||
|
||||
@@ -98,7 +98,7 @@ ecma_builtin_function_prototype_object_apply (ecma_value_t this_arg, /**< this a
|
||||
/* 2. */
|
||||
if (ecma_is_value_null (arg2) || ecma_is_value_undefined (arg2))
|
||||
{
|
||||
ret_value = ecma_op_function_call (func_obj_p, arg1, NULL);
|
||||
ret_value = ecma_op_function_call (func_obj_p, arg1, NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -125,10 +125,13 @@ ecma_builtin_function_prototype_object_apply (ecma_value_t this_arg, /**< this a
|
||||
const uint32_t length = ecma_number_to_uint32 (length_number);
|
||||
|
||||
/* 6. */
|
||||
ecma_collection_header_t *arg_collection_p = ecma_new_values_collection (NULL, 0, true);
|
||||
MEM_DEFINE_LOCAL_ARRAY (arguments_list_p, length, ecma_value_t);
|
||||
uint32_t last_index = 0;
|
||||
|
||||
/* 7. */
|
||||
for (uint32_t index = 0; index < length && ecma_is_completion_value_empty (ret_value); index++)
|
||||
for (uint32_t index = 0;
|
||||
index < length && ecma_is_completion_value_empty (ret_value);
|
||||
index++)
|
||||
{
|
||||
ecma_string_t *curr_idx_str_p = ecma_new_ecma_string_from_uint32 (index);
|
||||
|
||||
@@ -136,22 +139,28 @@ ecma_builtin_function_prototype_object_apply (ecma_value_t this_arg, /**< this a
|
||||
ecma_op_object_get (obj_p, curr_idx_str_p),
|
||||
ret_value);
|
||||
|
||||
ecma_append_to_values_collection (arg_collection_p, get_value, true);
|
||||
arguments_list_p[index] = ecma_copy_value (get_value, true);
|
||||
last_index = index + 1;
|
||||
|
||||
ECMA_FINALIZE (get_value);
|
||||
ecma_deref_ecma_string (curr_idx_str_p);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (arg_collection_p->unit_number == length || !ecma_is_completion_value_empty (ret_value));
|
||||
|
||||
if (ecma_is_completion_value_empty (ret_value))
|
||||
{
|
||||
JERRY_ASSERT (last_index == length);
|
||||
ret_value = ecma_op_function_call (func_obj_p,
|
||||
arg1,
|
||||
arg_collection_p);
|
||||
arguments_list_p,
|
||||
length);
|
||||
}
|
||||
|
||||
ecma_free_values_collection (arg_collection_p, true);
|
||||
for (uint32_t index = 0; index < last_index; index++)
|
||||
{
|
||||
ecma_free_value (arguments_list_p[index], true);
|
||||
}
|
||||
|
||||
MEM_FINALIZE_LOCAL_ARRAY (arguments_list_p);
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (length_number);
|
||||
ECMA_FINALIZE (length_value);
|
||||
@@ -187,16 +196,18 @@ ecma_builtin_function_prototype_object_call (ecma_value_t this_arg, /**< this ar
|
||||
|
||||
if (arguments_number == 0)
|
||||
{
|
||||
/* Even a 'this' argument is missing. */
|
||||
return ecma_op_function_call (func_obj_p,
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
||||
NULL);
|
||||
NULL,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_op_function_call_array_args (func_obj_p,
|
||||
arguments_list_p[0],
|
||||
(arguments_number == 1u) ? NULL : (arguments_list_p + 1),
|
||||
(ecma_length_t) (arguments_number - 1u));
|
||||
return ecma_op_function_call (func_obj_p,
|
||||
arguments_list_p[0],
|
||||
arguments_list_p + 1,
|
||||
(ecma_length_t) (arguments_number - 1u));
|
||||
}
|
||||
}
|
||||
} /* ecma_builtin_function_prototype_object_call */
|
||||
|
||||
@@ -158,7 +158,8 @@ ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, /** < t
|
||||
ECMA_TRY_CATCH (call_value,
|
||||
ecma_op_function_call (locale_func_obj_p,
|
||||
ecma_make_object_value (index_obj_p),
|
||||
NULL),
|
||||
NULL,
|
||||
0),
|
||||
ret_value);
|
||||
ret_value = ecma_op_to_string (call_value);
|
||||
ECMA_FINALIZE (call_value);
|
||||
|
||||
@@ -675,10 +675,10 @@ ecma_builtin_json_walk (ecma_object_t *reviver_p, /**< reviver function */
|
||||
/*
|
||||
* The completion value can be anything including exceptions.
|
||||
*/
|
||||
ret_value = ecma_op_function_call_array_args (reviver_p,
|
||||
ecma_make_object_value (holder_p),
|
||||
arguments_list,
|
||||
2);
|
||||
ret_value = ecma_op_function_call (reviver_p,
|
||||
ecma_make_object_value (holder_p),
|
||||
arguments_list,
|
||||
2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1252,7 +1252,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
|
||||
ecma_object_t *toJSON_obj_p = ecma_get_object_from_value (toJSON);
|
||||
|
||||
ECMA_TRY_CATCH (func_ret_val,
|
||||
ecma_op_function_call_array_args (toJSON_obj_p, my_val, call_args, 1),
|
||||
ecma_op_function_call (toJSON_obj_p, my_val, call_args, 1),
|
||||
ret_value);
|
||||
|
||||
ecma_free_value (my_val, true);
|
||||
@@ -1274,7 +1274,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
|
||||
ecma_value_t call_args[] = { key_value, my_val };
|
||||
|
||||
ECMA_TRY_CATCH (func_ret_val,
|
||||
ecma_op_function_call_array_args (context_p->replacer_function_p, holder_value, call_args, 2),
|
||||
ecma_op_function_call (context_p->replacer_function_p, holder_value, call_args, 2),
|
||||
ret_value);
|
||||
|
||||
ecma_free_value (my_val, true);
|
||||
|
||||
@@ -110,7 +110,7 @@ ecma_builtin_object_prototype_object_to_locale_string (ecma_value_t this_arg) /*
|
||||
{
|
||||
/* 4. */
|
||||
ecma_object_t *to_string_func_obj_p = ecma_get_object_from_value (to_string_val);
|
||||
return_value = ecma_op_function_call (to_string_func_obj_p, this_arg, NULL);
|
||||
return_value = ecma_op_function_call (to_string_func_obj_p, this_arg, NULL, 0);
|
||||
}
|
||||
ECMA_FINALIZE (to_string_val);
|
||||
|
||||
|
||||
@@ -844,10 +844,10 @@ ecma_builtin_string_prototype_object_replace_get_string (ecma_builtin_replace_se
|
||||
arguments_list[match_length + 1] = ecma_copy_value (context_p->input_string, true);
|
||||
|
||||
ECMA_TRY_CATCH (result_value,
|
||||
ecma_op_function_call_array_args (context_p->replace_function_p,
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
||||
arguments_list,
|
||||
match_length + 2),
|
||||
ecma_op_function_call (context_p->replace_function_p,
|
||||
ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED),
|
||||
arguments_list,
|
||||
match_length + 2),
|
||||
ret_value);
|
||||
|
||||
ECMA_TRY_CATCH (to_string_value,
|
||||
|
||||
@@ -508,26 +508,13 @@ ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
|
||||
ecma_value_t this_arg_value, /**< 'this' argument value */
|
||||
ecma_collection_header_t *arg_collection_p) /**< arguments collection */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< arguments list length */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_object_is_builtin (obj_p));
|
||||
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
const ecma_length_t arguments_list_len = arg_collection_p != NULL ? arg_collection_p->unit_number : 0;
|
||||
MEM_DEFINE_LOCAL_ARRAY (arguments_list_p, arguments_list_len, ecma_value_t);
|
||||
|
||||
ecma_collection_iterator_t arg_collection_iter;
|
||||
ecma_collection_iterator_init (&arg_collection_iter,
|
||||
arg_collection_p);
|
||||
|
||||
for (ecma_length_t arg_index = 0;
|
||||
ecma_collection_iterator_next (&arg_collection_iter);
|
||||
arg_index++)
|
||||
{
|
||||
arguments_list_p[arg_index] = *arg_collection_iter.current_value_p;
|
||||
}
|
||||
|
||||
if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)
|
||||
{
|
||||
ecma_property_t *desc_prop_p = ecma_get_internal_property (obj_p,
|
||||
@@ -598,8 +585,6 @@ ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
|
||||
}
|
||||
}
|
||||
|
||||
MEM_FINALIZE_LOCAL_ARRAY (arguments_list_p);
|
||||
|
||||
JERRY_ASSERT (!ecma_is_completion_value_empty (ret_value));
|
||||
|
||||
return ret_value;
|
||||
@@ -612,27 +597,14 @@ ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */
|
||||
ecma_collection_header_t *arg_collection_p) /**< arguments collection */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< arguments list length */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_FUNCTION);
|
||||
JERRY_ASSERT (ecma_get_object_is_builtin (obj_p));
|
||||
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
const ecma_length_t arguments_list_len = arg_collection_p != NULL ? arg_collection_p->unit_number : 0;
|
||||
MEM_DEFINE_LOCAL_ARRAY (arguments_list_p, arguments_list_len, ecma_value_t);
|
||||
|
||||
ecma_collection_iterator_t arg_collection_iter;
|
||||
ecma_collection_iterator_init (&arg_collection_iter,
|
||||
arg_collection_p);
|
||||
|
||||
for (ecma_length_t arg_index = 0;
|
||||
ecma_collection_iterator_next (&arg_collection_iter);
|
||||
arg_index++)
|
||||
{
|
||||
arguments_list_p[arg_index] = *arg_collection_iter.current_value_p;
|
||||
}
|
||||
|
||||
ecma_property_t *built_in_id_prop_p = ecma_get_internal_property (obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_BUILT_IN_ID);
|
||||
ecma_builtin_id_t builtin_id = (ecma_builtin_id_t) built_in_id_prop_p->u.internal_property.value;
|
||||
@@ -674,8 +646,6 @@ ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */
|
||||
}
|
||||
}
|
||||
|
||||
MEM_FINALIZE_LOCAL_ARRAY (arguments_list_p);
|
||||
|
||||
JERRY_ASSERT (!ecma_is_completion_value_empty (ret_value));
|
||||
|
||||
return ret_value;
|
||||
|
||||
@@ -39,9 +39,11 @@ extern void ecma_init_builtins (void);
|
||||
extern void ecma_finalize_builtins (void);
|
||||
|
||||
extern ecma_completion_value_t
|
||||
ecma_builtin_dispatch_call (ecma_object_t *, ecma_value_t, ecma_collection_header_t *);
|
||||
ecma_builtin_dispatch_call (ecma_object_t *, ecma_value_t,
|
||||
const ecma_value_t *, ecma_length_t);
|
||||
extern ecma_completion_value_t
|
||||
ecma_builtin_dispatch_construct (ecma_object_t *, ecma_collection_header_t *);
|
||||
ecma_builtin_dispatch_construct (ecma_object_t *,
|
||||
const ecma_value_t *, ecma_length_t);
|
||||
extern ecma_property_t *
|
||||
ecma_builtin_try_to_instantiate_property (ecma_object_t *, ecma_string_t *);
|
||||
extern void
|
||||
|
||||
Reference in New Issue
Block a user