Performance optimizations

* inline some hot function
 * add 'ecma_copy_value_if_not_object' similer to 'ecma_value_free_if_not_object'
 * remove unnecessary helpers
 * improve 'do_number_bitwise_logic'

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2016-03-17 11:08:53 +01:00
parent 94f887919e
commit 2027caeda5
30 changed files with 202 additions and 242 deletions
@@ -270,7 +270,7 @@ ecma_builtin_array_prototype_object_concat (ecma_value_t this_arg, /**< this arg
if (ecma_is_value_empty (ret_value))
{
ECMA_TRY_CATCH (set_length_value,
ecma_builtin_array_prototype_helper_set_length (new_array_p, ecma_uint32_to_number (new_length)),
ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) new_length)),
ret_value);
ret_value = new_array;
ECMA_FINALIZE (set_length_value);
@@ -512,10 +512,10 @@ ecma_builtin_array_prototype_object_pop (ecma_value_t this_arg) /**< this argume
/* 5.d */
ECMA_TRY_CATCH (set_length_value,
ecma_builtin_array_prototype_helper_set_length (obj_p, ecma_uint32_to_number (len)),
ecma_builtin_array_prototype_helper_set_length (obj_p, ((ecma_number_t) len)),
ret_value);
ret_value = ecma_copy_value (get_value, true);
ret_value = ecma_copy_value (get_value);
ECMA_FINALIZE (set_length_value);
ECMA_FINALIZE (del_value);
@@ -561,7 +561,7 @@ ecma_builtin_array_prototype_object_push (ecma_value_t this_arg, /**< this argum
/* 3. */
ECMA_OP_TO_NUMBER_TRY_CATCH (length_var, length_value, ret_value);
ecma_number_t n = ecma_uint32_to_number (ecma_number_to_uint32 (length_var));
ecma_number_t n = ((ecma_number_t) ecma_number_to_uint32 (length_var));
/* 5. */
for (uint32_t index = 0;
@@ -691,7 +691,7 @@ ecma_builtin_array_prototype_object_reverse (ecma_value_t this_arg) /**< this ar
if (ecma_is_value_empty (ret_value))
{
/* 7. */
ret_value = ecma_copy_value (obj_this, true);
ret_value = ecma_copy_value (obj_this);
}
ECMA_OP_TO_NUMBER_FINALIZE (len_number);
@@ -793,10 +793,10 @@ ecma_builtin_array_prototype_object_shift (ecma_value_t this_arg) /**< this argu
/* 9. */
ECMA_TRY_CATCH (set_length_value,
ecma_builtin_array_prototype_helper_set_length (obj_p, ecma_uint32_to_number (len)),
ecma_builtin_array_prototype_helper_set_length (obj_p, ((ecma_number_t) len)),
ret_value);
/* 10. */
ret_value = ecma_copy_value (first_value, true);
ret_value = ecma_copy_value (first_value);
ECMA_FINALIZE (set_length_value);
ECMA_FINALIZE (del_value);
@@ -1266,7 +1266,7 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum
ECMA_TRY_CATCH (index_value, ecma_op_object_get (obj_p, property_name_p), ret_value);
values_buffer[copied_num++] = ecma_copy_value (index_value, true);
values_buffer[copied_num++] = ecma_copy_value (index_value);
ECMA_FINALIZE (index_value);
}
@@ -1330,7 +1330,7 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum
if (ecma_is_value_empty (ret_value))
{
ret_value = ecma_copy_value (this_arg, true);
ret_value = ecma_copy_value (this_arg);
}
ECMA_OP_TO_NUMBER_FINALIZE (len_number);
@@ -1607,7 +1607,7 @@ ecma_builtin_array_prototype_object_splice (ecma_value_t this_arg, /**< this arg
if (ecma_is_value_empty (ret_value))
{
ECMA_TRY_CATCH (set_length_value,
ecma_builtin_array_prototype_helper_set_length (obj_p, ecma_uint32_to_number (new_len)),
ecma_builtin_array_prototype_helper_set_length (obj_p, ((ecma_number_t) new_len)),
ret_value);
ECMA_FINALIZE (set_length_value);
@@ -1670,7 +1670,7 @@ ecma_builtin_array_prototype_object_unshift (ecma_value_t this_arg, /**< this ar
/* 6.a */
ecma_string_t *from_str_p = ecma_new_ecma_string_from_uint32 (k - 1);
/* 6.b */
ecma_number_t new_idx = ecma_uint32_to_number (k) + ecma_uint32_to_number (args_number) - 1;
ecma_number_t new_idx = ((ecma_number_t) k) + ((ecma_number_t) args_number) - 1;
ecma_string_t *to_str_p = ecma_new_ecma_string_from_number (new_idx);
/* 6.c */
@@ -1708,7 +1708,7 @@ ecma_builtin_array_prototype_object_unshift (ecma_value_t this_arg, /**< this ar
if (ecma_is_value_empty (ret_value))
{
ecma_number_t new_len = ecma_uint32_to_number (len) + ecma_uint32_to_number (args_number);
ecma_number_t new_len = ((ecma_number_t) len) + ((ecma_number_t) args_number);
/* 10. */
ECMA_TRY_CATCH (set_length_value,
ecma_builtin_array_prototype_helper_set_length (obj_p, new_len),
@@ -1796,7 +1796,7 @@ ecma_builtin_array_prototype_object_index_of (ecma_value_t this_arg, /**< this a
/* 9.b.ii */
if (ecma_op_strict_equality_compare (arg1, get_value))
{
found_index = ecma_uint32_to_number (from_idx);
found_index = ((ecma_number_t) from_idx);
}
ECMA_FINALIZE (get_value);
@@ -1951,7 +1951,7 @@ ecma_builtin_array_prototype_object_last_index_of (ecma_value_t this_arg, /**< t
/* 8.b.ii */
if (ecma_op_strict_equality_compare (search_element, get_value))
{
*num_p = ecma_uint32_to_number (from_idx);
*num_p = ((ecma_number_t) from_idx);
}
ECMA_FINALIZE (get_value);
@@ -2041,7 +2041,7 @@ ecma_builtin_array_prototype_object_every (ecma_value_t this_arg, /**< this argu
/* 7.c.i */
ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
*num_p = ecma_uint32_to_number (index);
*num_p = ((ecma_number_t) index);
current_index = ecma_make_number_value (num_p);
ecma_value_t call_args[] = { get_value, current_index, obj_this };
@@ -2142,7 +2142,7 @@ ecma_builtin_array_prototype_object_some (ecma_value_t this_arg, /**< this argum
/* 7.c.i */
ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
*num_p = ecma_uint32_to_number (index);
*num_p = ((ecma_number_t) index);
current_index = ecma_make_number_value (num_p);
ecma_value_t call_args[] = { get_value, current_index, obj_this };
@@ -2242,7 +2242,7 @@ ecma_builtin_array_prototype_object_for_each (ecma_value_t this_arg, /**< this a
/* 7.c.i */
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
*num_p = ecma_uint32_to_number (index);
*num_p = ((ecma_number_t) index);
current_index = ecma_make_number_value (num_p);
/* 7.c.ii */
@@ -2340,7 +2340,7 @@ ecma_builtin_array_prototype_object_map (ecma_value_t this_arg, /**< this argume
/* 8.c.i */
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
/* 8.c.ii */
*num_p = ecma_uint32_to_number (index);
*num_p = ((ecma_number_t) index);
current_index = ecma_make_number_value (num_p);
ecma_value_t call_args[] = {current_value, current_index, obj_this};
@@ -2367,7 +2367,7 @@ ecma_builtin_array_prototype_object_map (ecma_value_t this_arg, /**< this argume
if (ecma_is_value_empty (ret_value))
{
ECMA_TRY_CATCH (set_length_value,
ecma_builtin_array_prototype_helper_set_length (new_array_p, ecma_uint32_to_number (len)),
ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) len)),
ret_value);
ret_value = new_array;
ECMA_FINALIZE (set_length_value);
@@ -2457,7 +2457,7 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t this_arg, /**< this arg
/* 9.c.i */
ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
*num_p = ecma_uint32_to_number (index);
*num_p = ((ecma_number_t) index);
current_index = ecma_make_number_value (num_p);
ecma_value_t call_args[] = { get_value, current_index, obj_this };
@@ -2574,7 +2574,7 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
/* 7.a */
if (args_number > 1)
{
accumulator = ecma_copy_value (initial_value, true);
accumulator = ecma_copy_value (initial_value);
}
else
{
@@ -2590,7 +2590,7 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
if ((k_present = (ecma_op_object_get_property (obj_p, index_str_p) != NULL)))
{
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
accumulator = ecma_copy_value (current_value, true);
accumulator = ecma_copy_value (current_value);
ECMA_FINALIZE (current_value);
}
/* 8.b.iv */
@@ -2617,7 +2617,7 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
/* 9.c.i */
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
/* 9.c.ii */
*num_p = ecma_uint32_to_number (index);
*num_p = ((ecma_number_t) index);
current_index = ecma_make_number_value (num_p);
ecma_value_t call_args[] = {accumulator, current_value, current_index, obj_this};
@@ -2629,7 +2629,7 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
ret_value);
ecma_free_value (accumulator);
accumulator = ecma_copy_value (call_value, true);
accumulator = ecma_copy_value (call_value);
ECMA_FINALIZE (call_value);
ECMA_FINALIZE (current_value);
@@ -2640,7 +2640,7 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
if (ecma_is_value_empty (ret_value))
{
ret_value = ecma_copy_value (accumulator, true);
ret_value = ecma_copy_value (accumulator);
}
}
@@ -2720,7 +2720,7 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
/* 7.a */
if (args_number > 1)
{
accumulator = ecma_copy_value (initial_value, true);
accumulator = ecma_copy_value (initial_value);
}
else
{
@@ -2736,7 +2736,7 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
if ((k_present = (ecma_op_object_get_property (obj_p, index_str_p) != NULL)))
{
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
accumulator = ecma_copy_value (current_value, true);
accumulator = ecma_copy_value (current_value);
ECMA_FINALIZE (current_value);
}
/* 8.b.iv */
@@ -2763,7 +2763,7 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
/* 9.c.i */
ECMA_TRY_CATCH (current_value, ecma_op_object_get (obj_p, index_str_p), ret_value);
/* 9.c.ii */
*num_p = ecma_uint32_to_number ((uint32_t) index);
*num_p = ((ecma_number_t) (uint32_t) index);
current_index = ecma_make_number_value (num_p);
ecma_value_t call_args[] = {accumulator, current_value, current_index, obj_this};
@@ -2775,7 +2775,7 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
ret_value);
ecma_free_value (accumulator);
accumulator = ecma_copy_value (call_value, true);
accumulator = ecma_copy_value (call_value);
ECMA_FINALIZE (call_value);
ECMA_FINALIZE (current_value);
@@ -2786,7 +2786,7 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
if (ecma_is_value_empty (ret_value))
{
ret_value = ecma_copy_value (accumulator, true);
ret_value = ecma_copy_value (accumulator);
}
ecma_free_value (accumulator);
@@ -1,4 +1,5 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -88,7 +89,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
if (unlikely (ecma_is_value_error (name_to_str_completion)))
{
ret_value = ecma_copy_value (name_to_str_completion, true);
ret_value = ecma_copy_value (name_to_str_completion);
}
else
{
@@ -113,7 +114,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
if (unlikely (ecma_is_value_error (msg_to_str_completion)))
{
ret_value = ecma_copy_value (msg_to_str_completion, true);
ret_value = ecma_copy_value (msg_to_str_completion);
}
else
{
@@ -1,4 +1,4 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2015-2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -139,7 +139,7 @@ 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);
arguments_list_p[index] = ecma_copy_value (get_value, true);
arguments_list_p[index] = ecma_copy_value (get_value);
last_index = index + 1;
ECMA_FINALIZE (get_value);
@@ -256,7 +256,7 @@ ecma_builtin_function_prototype_object_bind (ecma_value_t this_arg, /**< this ar
if (arg_count > 0)
{
bound_this_prop_p->v.internal_property.value = ecma_copy_value (arguments_list_p[0], false);
bound_this_prop_p->v.internal_property.value = ecma_copy_value_if_not_object (arguments_list_p[0]);
}
else
{
@@ -292,7 +292,7 @@ ecma_builtin_function_prototype_object_bind (ecma_value_t this_arg, /**< this ar
const ecma_length_t bound_arg_count = arg_count > 1 ? arg_count - 1 : 0;
/* 15.a */
*length_p = *ecma_get_number_from_value (get_len_value) - ecma_uint32_to_number (bound_arg_count);
*length_p = *ecma_get_number_from_value (get_len_value) - ((ecma_number_t) bound_arg_count);
ecma_free_value (get_len_value);
/* 15.b */
@@ -173,7 +173,7 @@ ecma_builtin_global_object_eval (ecma_value_t this_arg __attr_unused___, /**< th
if (!ecma_is_value_string (x))
{
/* step 1 */
ret_value = ecma_copy_value (x, true);
ret_value = ecma_copy_value (x);
}
else
{
@@ -527,7 +527,7 @@ ecma_builtin_helper_string_prototype_object_index_of (ecma_value_t this_arg, /**
ecma_length_t index_of = 0;
if (ecma_builtin_helper_string_find_index (original_str_p, search_str_p, first_index, start, &index_of))
{
*ret_num_p = ecma_uint32_to_number (index_of);
*ret_num_p = ((ecma_number_t) index_of);
}
ret_value = ecma_make_number_value (ret_num_p);
@@ -853,7 +853,7 @@ ecma_builtin_json_stringify (ecma_value_t this_arg __attr_unused___, /**< 'this'
/* 4.b.ii.2 */
if (ecma_is_value_string (value))
{
item = ecma_copy_value (value, true);
item = ecma_copy_value (value);
}
/* 4.b.ii.3 */
else if (ecma_is_value_number (value))
@@ -862,7 +862,7 @@ ecma_builtin_json_stringify (ecma_value_t this_arg __attr_unused___, /**< 'this'
ecma_op_to_string (value),
ret_value);
item = ecma_copy_value (str_val, true);
item = ecma_copy_value (str_val);
ECMA_FINALIZE (str_val);
}
@@ -880,7 +880,7 @@ ecma_builtin_json_stringify (ecma_value_t this_arg __attr_unused___, /**< 'this'
ecma_op_to_string (value),
ret_value);
item = ecma_copy_value (val, true);
item = ecma_copy_value (val);
ECMA_FINALIZE (val);
}
@@ -916,7 +916,7 @@ ecma_builtin_json_stringify (ecma_value_t this_arg __attr_unused___, /**< 'this'
if (ecma_is_value_empty (ret_value))
{
ecma_value_t space = ecma_copy_value (arg3, true);
ecma_value_t space = ecma_copy_value (arg3);
/* 5. */
if (ecma_is_value_object (arg3))
@@ -932,7 +932,7 @@ ecma_builtin_json_stringify (ecma_value_t this_arg __attr_unused___, /**< 'this'
ret_value);
ecma_free_value (space);
space = ecma_copy_value (val, true);
space = ecma_copy_value (val);
ECMA_FINALIZE (val);
}
@@ -944,7 +944,7 @@ ecma_builtin_json_stringify (ecma_value_t this_arg __attr_unused___, /**< 'this'
ret_value);
ecma_free_value (space);
space = ecma_copy_value (val, true);
space = ecma_copy_value (val);
ECMA_FINALIZE (val);
}
@@ -1028,7 +1028,7 @@ ecma_builtin_json_stringify (ecma_value_t this_arg __attr_unused___, /**< 'this'
ecma_builtin_json_str (empty_str_p, obj_wrapper_p, &context),
ret_value);
ret_value = ecma_copy_value (str_val, true);
ret_value = ecma_copy_value (str_val);
ECMA_FINALIZE (str_val);
@@ -1229,7 +1229,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
ecma_op_object_get (holder_p, key_p),
ret_value);
ecma_value_t my_val = ecma_copy_value (value, true);
ecma_value_t my_val = ecma_copy_value (value);
/* 2. */
if (ecma_is_value_object (my_val))
@@ -1254,7 +1254,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
ret_value);
ecma_free_value (my_val);
my_val = ecma_copy_value (func_ret_val, true);
my_val = ecma_copy_value (func_ret_val);
ECMA_FINALIZE (func_ret_val);
}
@@ -1276,7 +1276,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
ret_value);
ecma_free_value (my_val);
my_val = ecma_copy_value (func_ret_val, true);
my_val = ecma_copy_value (func_ret_val);
ECMA_FINALIZE (func_ret_val);
}
@@ -1295,7 +1295,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
ret_value);
ecma_free_value (my_val);
my_val = ecma_copy_value (val, true);
my_val = ecma_copy_value (val);
ECMA_FINALIZE (val);
}
@@ -1307,7 +1307,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
ret_value);
ecma_free_value (my_val);
my_val = ecma_copy_value (val, true);
my_val = ecma_copy_value (val);
ECMA_FINALIZE (val);
}
@@ -1319,7 +1319,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
ret_value);
ecma_free_value (my_val);
my_val = ecma_copy_value (val, true);
my_val = ecma_copy_value (val);
ECMA_FINALIZE (val);
}
@@ -1370,7 +1370,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
ecma_builtin_json_array (obj_p, context_p),
ret_value);
ret_value = ecma_copy_value (val, true);
ret_value = ecma_copy_value (val);
ECMA_FINALIZE (val);
}
@@ -1381,7 +1381,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
ecma_builtin_json_object (obj_p, context_p),
ret_value);
ret_value = ecma_copy_value (val, true);
ret_value = ecma_copy_value (val);
ECMA_FINALIZE (val);
}
@@ -1,4 +1,4 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2015-2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -346,7 +346,7 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this_arg) /**< this
{
if (ecma_is_value_number (this_arg))
{
return ecma_copy_value (this_arg, true);
return ecma_copy_value (this_arg);
}
else if (ecma_is_value_object (this_arg))
{
@@ -1,4 +1,4 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2015-2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -230,7 +230,7 @@ ecma_builtin_object_object_seal (ecma_value_t this_arg __attr_unused___, /**< 't
ecma_set_object_extensible (obj_p, false);
// 4.
ret_value = ecma_copy_value (arg, true);
ret_value = ecma_copy_value (arg);
}
}
@@ -309,7 +309,7 @@ ecma_builtin_object_object_freeze (ecma_value_t this_arg __attr_unused___, /**<
ecma_set_object_extensible (obj_p, false);
// 4.
ret_value = ecma_copy_value (arg, true);
ret_value = ecma_copy_value (arg);
}
}
@@ -340,7 +340,7 @@ ecma_builtin_object_object_prevent_extensions (ecma_value_t this_arg __attr_unus
ecma_object_t *obj_p = ecma_get_object_from_value (arg);
ecma_set_object_extensible (obj_p, false);
ret_value = ecma_copy_value (arg, true);
ret_value = ecma_copy_value (arg);
}
return ret_value;
@@ -654,7 +654,7 @@ ecma_builtin_object_object_create (ecma_value_t this_arg, /**< 'this' argument *
// 5.
if (ecma_is_value_empty (ret_value))
{
ret_value = ecma_copy_value (ecma_make_object_value (result_obj_p), true);
ret_value = ecma_copy_value (ecma_make_object_value (result_obj_p));
}
ecma_deref_object (result_obj_p);
@@ -760,7 +760,7 @@ ecma_builtin_object_object_define_properties (ecma_value_t this_arg __attr_unuse
// 7.
if (ecma_is_value_empty (ret_value))
{
ret_value = ecma_copy_value (arg1, true);
ret_value = ecma_copy_value (arg1);
}
ECMA_FINALIZE (props);
@@ -813,7 +813,7 @@ ecma_builtin_object_object_define_property (ecma_value_t this_arg __attr_unused_
true),
ret_value);
ret_value = ecma_copy_value (arg1, true);
ret_value = ecma_copy_value (arg1);
ECMA_FINALIZE (define_own_prop_ret);
ecma_free_property_descriptor (&prop_desc);
@@ -85,7 +85,7 @@ ecma_builtin_regexp_dispatch_construct (const ecma_value_t *arguments_list_p, /*
{
if (ecma_is_value_undefined (flags_value))
{
ret_value = ecma_copy_value (pattern_value, true);
ret_value = ecma_copy_value (pattern_value);
}
else
{
@@ -68,7 +68,7 @@ ecma_builtin_string_prototype_object_to_string (ecma_value_t this_arg) /**< this
{
if (ecma_is_value_string (this_arg))
{
return ecma_copy_value (this_arg, true);
return ecma_copy_value (this_arg);
}
else if (ecma_is_value_object (this_arg))
{
@@ -214,7 +214,7 @@ ecma_builtin_string_prototype_object_char_code_at (ecma_value_t this_arg, /**< t
JERRY_ASSERT (ecma_number_is_nan (index_num) || ecma_number_to_uint32 (index_num) == ecma_number_trunc (index_num));
ecma_char_t new_ecma_char = ecma_string_get_char_at_pos (original_string_p, ecma_number_to_uint32 (index_num));
*ret_num_p = ecma_uint32_to_number (new_ecma_char);
*ret_num_p = ((ecma_number_t) new_ecma_char);
}
ecma_value_t new_value = ecma_make_number_value (ret_num_p);
@@ -419,7 +419,7 @@ ecma_builtin_string_prototype_object_match (ecma_value_t this_arg, /**< this arg
if (ecma_is_value_object (arg)
&& ecma_object_get_class_name (ecma_get_object_from_value (arg)) == LIT_MAGIC_STRING_REGEXP_UL)
{
regexp_value = ecma_copy_value (arg, true);
regexp_value = ecma_copy_value (arg);
}
else
{
@@ -429,7 +429,7 @@ ecma_builtin_string_prototype_object_match (ecma_value_t this_arg, /**< this arg
ecma_builtin_regexp_dispatch_construct (regexp_arguments, 1),
ret_value);
regexp_value = ecma_copy_value (new_regexp_value, true);
regexp_value = ecma_copy_value (new_regexp_value);
ECMA_FINALIZE (new_regexp_value);
}
@@ -584,7 +584,7 @@ ecma_builtin_string_prototype_object_match (ecma_value_t this_arg, /**< this arg
else
{
/* 8.h. */
ret_value = ecma_copy_value (new_array_value, true);
ret_value = ecma_copy_value (new_array_value);
}
}
@@ -733,7 +733,7 @@ ecma_builtin_string_prototype_object_replace_match (ecma_builtin_replace_search_
JERRY_ASSERT ((ecma_length_t) ecma_number_to_uint32 (*index_number_p) == context_p->match_start);
ret_value = ecma_copy_value (match_value, true);
ret_value = ecma_copy_value (match_value);
ECMA_FINALIZE (result_string_value);
ECMA_FINALIZE (index_value);
@@ -765,7 +765,7 @@ ecma_builtin_string_prototype_object_replace_match (ecma_builtin_replace_search_
context_p->match_start = index_of;
context_p->match_end = index_of + ecma_string_get_length (search_string_p);
ret_value = ecma_copy_value (new_array_value, true);
ret_value = ecma_copy_value (new_array_value);
ECMA_FINALIZE (new_array_value);
}
@@ -824,7 +824,7 @@ ecma_builtin_string_prototype_object_replace_get_string (ecma_builtin_replace_se
ecma_op_object_get (match_object_p, index_p),
ret_value);
arguments_list[i] = ecma_copy_value (current_value, true);
arguments_list[i] = ecma_copy_value (current_value);
values_copied++;
ECMA_FINALIZE (current_value);
@@ -837,7 +837,7 @@ ecma_builtin_string_prototype_object_replace_get_string (ecma_builtin_replace_se
*index_number_p = context_p->match_start;
arguments_list[match_length] = ecma_make_number_value (index_number_p);
arguments_list[match_length + 1] = ecma_copy_value (context_p->input_string, true);
arguments_list[match_length + 1] = ecma_copy_value (context_p->input_string);
ECMA_TRY_CATCH (result_value,
ecma_op_function_call (context_p->replace_function_p,
@@ -850,7 +850,7 @@ ecma_builtin_string_prototype_object_replace_get_string (ecma_builtin_replace_se
ecma_op_to_string (result_value),
ret_value);
ret_value = ecma_copy_value (to_string_value, true);
ret_value = ecma_copy_value (to_string_value);
ECMA_FINALIZE (to_string_value);
ECMA_FINALIZE (result_value);
@@ -1370,7 +1370,7 @@ ecma_builtin_string_prototype_object_search (ecma_value_t this_arg, /**< this ar
if (ecma_is_value_object (regexp_arg)
&& ecma_object_get_class_name (ecma_get_object_from_value (regexp_arg)) == LIT_MAGIC_STRING_REGEXP_UL)
{
regexp_value = ecma_copy_value (regexp_arg, true);
regexp_value = ecma_copy_value (regexp_arg);
}
else
{
@@ -1381,7 +1381,7 @@ ecma_builtin_string_prototype_object_search (ecma_value_t this_arg, /**< this ar
ecma_builtin_regexp_dispatch_construct (regexp_arguments, 1),
ret_value);
regexp_value = ecma_copy_value (new_regexp_value, true);
regexp_value = ecma_copy_value (new_regexp_value);
ECMA_FINALIZE (new_regexp_value);
}
@@ -1536,7 +1536,7 @@ ecma_builtin_helper_split_match (ecma_value_t input_string, /**< first argument
if (ecma_is_value_object (separator)
&& ecma_object_get_class_name (ecma_get_object_from_value (separator)) == LIT_MAGIC_STRING_REGEXP_UL)
{
ecma_value_t regexp_value = ecma_copy_value (separator, false);
ecma_value_t regexp_value = ecma_copy_value_if_not_object (separator);
ECMA_TRY_CATCH (to_string_val,
ecma_op_to_string (input_string),
@@ -1611,7 +1611,7 @@ ecma_builtin_helper_split_match (ecma_value_t input_string, /**< first argument
ecma_deref_ecma_string (magic_index_str_p);
ecma_number_t *index_num_p = ecma_alloc_number ();
*index_num_p = ecma_uint32_to_number (start_idx);
*index_num_p = ((ecma_number_t) start_idx);
ecma_named_data_property_assign_value (match_array_p, index_prop_p, ecma_make_number_value (index_num_p));
@@ -1719,7 +1719,7 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_arg, /**< this arg
if (ecma_is_value_object (arg1)
&& ecma_object_get_class_name (ecma_get_object_from_value (arg1)) == LIT_MAGIC_STRING_REGEXP_UL)
{
separator = ecma_copy_value (arg1, true);
separator = ecma_copy_value (arg1);
}
else
{
@@ -1727,7 +1727,7 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_arg, /**< this arg
ecma_op_to_string (arg1),
ret_value);
separator = ecma_copy_value (separator_to_string_val, true);
separator = ecma_copy_value (separator_to_string_val);
ECMA_FINALIZE (separator_to_string_val);
}