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

View File

@ -1,4 +1,5 @@
/* 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.
@ -810,28 +811,6 @@ ecma_uint32_to_utf8_string (uint32_t value, /**< value to convert */
return bytes_copied;
} /* ecma_uint32_to_utf8_string */
/**
* ECMA-defined conversion of UInt32 value to Number value
*
* @return number - result of conversion.
*/
ecma_number_t
ecma_uint32_to_number (uint32_t value) /**< unsigned 32-bit integer value */
{
return (ecma_number_t) value;
} /* ecma_uint32_to_number */
/**
* ECMA-defined conversion of Int32 value to Number value
*
* @return number - result of conversion.
*/
ecma_number_t
ecma_int32_to_number (int32_t value) /**< signed 32-bit integer value */
{
return (ecma_number_t) value;
} /* ecma_int32_to_number */
/**
* ECMA-defined conversion of Number value to UInt32 value
*
@ -1344,7 +1323,8 @@ ecma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */
// 5.
uint32_t num_uint32 = ecma_number_to_uint32 (num);
if (ecma_uint32_to_number (num_uint32) == num)
if (((ecma_number_t) num_uint32) == num)
{
size = ecma_uint32_to_utf8_string (num_uint32, dst_p, buffer_size);
}

View File

@ -230,7 +230,7 @@ ecma_number_get_sign_field (ecma_number_t num) /**< ecma-number */
fraction is filled with anything but not all zero bits,
* false - otherwise
*/
bool
bool __attr_always_inline___
ecma_number_is_nan (ecma_number_t num) /**< ecma-number */
{
bool is_nan = (num != num);
@ -283,7 +283,7 @@ ecma_number_make_infinity (bool sign) /**< true - for negative Infinity,
* @return true - if sign bit of ecma-number is set
* false - otherwise
*/
bool
bool __attr_always_inline___
ecma_number_is_negative (ecma_number_t num) /**< ecma-number */
{
JERRY_ASSERT (!ecma_number_is_nan (num));

View File

@ -238,7 +238,7 @@ ecma_string_t *
ecma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */
{
uint32_t uint32_num = ecma_number_to_uint32 (num);
if (num == ecma_uint32_to_number (uint32_num))
if (num == ((ecma_number_t) uint32_num))
{
return ecma_new_ecma_string_from_uint32 (uint32_num);
}
@ -533,7 +533,7 @@ ecma_string_to_number (const ecma_string_t *str_p) /**< ecma-string */
{
uint32_t uint32_number = str_p->u.uint32_number;
return ecma_uint32_to_number (uint32_number);
return ((ecma_number_t) uint32_number);
}
case ECMA_STRING_CONTAINER_HEAP_NUMBER:
@ -1002,36 +1002,13 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /* ecma-stri
return is_equal;
} /* ecma_compare_ecma_strings_longpath */
/**
* Compare ecma-string to ecma-string if they're hashes are equal
*
* @return true - if strings are equal;
* false - may be.
*/
bool
ecma_compare_ecma_strings_equal_hashes (const ecma_string_t *string1_p, /* ecma-string */
const ecma_string_t *string2_p) /* ecma-string */
{
JERRY_ASSERT (string1_p->hash == string2_p->hash);
if (ECMA_STRING_GET_CONTAINER (string1_p) == ECMA_STRING_GET_CONTAINER (string2_p)
&& string1_p->u.common_field == string2_p->u.common_field)
{
return true;
}
else
{
return false;
}
} /* ecma_compare_ecma_strings_equal_hashes */
/**
* Compare ecma-string to ecma-string
*
* @return true - if strings are equal;
* false - otherwise.
*/
bool
bool __attr_always_inline___
ecma_compare_ecma_strings (const ecma_string_t *string1_p, /* ecma-string */
const ecma_string_t *string2_p) /* ecma-string */
{
@ -1042,14 +1019,13 @@ ecma_compare_ecma_strings (const ecma_string_t *string1_p, /* ecma-string */
return false;
}
if (ecma_compare_ecma_strings_equal_hashes (string1_p, string2_p))
if (ECMA_STRING_GET_CONTAINER (string1_p) == ECMA_STRING_GET_CONTAINER (string2_p)
&& string1_p->u.common_field == string2_p->u.common_field)
{
return true;
}
else
{
return ecma_compare_ecma_strings_longpath (string1_p, string2_p);
}
return ecma_compare_ecma_strings_longpath (string1_p, string2_p);
} /* ecma_compare_ecma_strings */
/**

View File

@ -1,4 +1,5 @@
/* Copyright 2015-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.
@ -397,38 +398,16 @@ ecma_get_value_from_error_value (ecma_value_t value) /**< ecma value */
/**
* Copy ecma value.
*
* Note:
* Operation algorithm.
* switch (valuetype)
* case simple:
* simply return the value as it was passed;
* case number:
* copy the number
* and return new ecma value
* pointing to copy of the number;
* case string:
* increase reference counter of the string
* and return the value as it was passed.
* case object;
* increase reference counter of the object if do_ref_if_object is true
* and return the value as it was passed.
*
* @return See note.
* @return copy of the given value
*/
ecma_value_t
ecma_copy_value (ecma_value_t value, /**< ecma value */
bool do_ref_if_object) /**< if the value is object value,
increment reference counter of the object */
ecma_copy_value (ecma_value_t value) /**< value description */
{
ecma_value_t value_copy = 0;
switch (ecma_get_value_type_field (value))
{
case ECMA_TYPE_SIMPLE:
{
value_copy = value;
break;
return value;
}
case ECMA_TYPE_NUMBER:
{
@ -437,38 +416,38 @@ ecma_copy_value (ecma_value_t value, /**< ecma value */
ecma_number_t *number_copy_p = ecma_alloc_number ();
*number_copy_p = *num_p;
value_copy = ecma_make_number_value (number_copy_p);
break;
return ecma_make_number_value (number_copy_p);
}
case ECMA_TYPE_STRING:
{
ecma_string_t *string_p = ecma_get_string_from_value (value);
string_p = ecma_copy_or_ref_ecma_string (string_p);
value_copy = ecma_make_string_value (string_p);
break;
return ecma_make_string_value (ecma_copy_or_ref_ecma_string (ecma_get_string_from_value (value)));
}
case ECMA_TYPE_OBJECT:
{
ecma_object_t *obj_p = ecma_get_object_from_value (value);
if (do_ref_if_object)
{
ecma_ref_object (obj_p);
}
value_copy = value;
break;
ecma_ref_object (ecma_get_object_from_value (value));
return value;
}
}
return value_copy;
JERRY_UNREACHABLE ();
} /* ecma_copy_value */
/**
* Copy the ecma value if not an object
*
* @return copy of the given value
*/
ecma_value_t
ecma_copy_value_if_not_object (ecma_value_t value) /**< value description */
{
if (ecma_get_value_type_field (value) != ECMA_TYPE_OBJECT)
{
return ecma_copy_value (value);
}
return value;
} /* ecma_copy_value_if_not_object */
/**
* Free the ecma value
*/

View File

@ -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.
@ -67,7 +68,14 @@ ecma_new_values_collection (const ecma_value_t values_buffer[], /**< ecma values
JERRY_ASSERT (cur_value_buf_iter_p + 1 <= cur_value_buf_end_p);
*cur_value_buf_iter_p++ = ecma_copy_value (values_buffer[value_index], do_ref_if_object);
if (do_ref_if_object)
{
*cur_value_buf_iter_p++ = ecma_copy_value (values_buffer[value_index]);
}
else
{
*cur_value_buf_iter_p++ = ecma_copy_value_if_not_object (values_buffer[value_index]);
}
}
*next_chunk_cp_p = ECMA_NULL_POINTER;
@ -189,7 +197,14 @@ ecma_append_to_values_collection (ecma_collection_header_t *header_p, /**< colle
JERRY_ASSERT ((uint8_t *) (values_p + pos_of_new_value_in_chunk + 1) <= (uint8_t *) (chunk_p + 1));
values_p[pos_of_new_value_in_chunk] = ecma_copy_value (v, do_ref_if_object);
if (do_ref_if_object)
{
values_p[pos_of_new_value_in_chunk] = ecma_copy_value (v);
}
else
{
values_p[pos_of_new_value_in_chunk] = ecma_copy_value_if_not_object (v);
}
} /* ecma_append_to_values_collection */
/**

View File

@ -1001,7 +1001,7 @@ ecma_named_data_property_assign_value (ecma_object_t *obj_p, /**< object */
ecma_value_t v = ecma_get_named_data_property_value (prop_p);
ecma_free_value_if_not_object (v);
ecma_set_named_data_property_value (prop_p, ecma_copy_value (value, false));
ecma_set_named_data_property_value (prop_p, ecma_copy_value_if_not_object (value));
}
} /* ecma_named_data_property_assign_value */
@ -1283,7 +1283,7 @@ ecma_get_property_descriptor_from_property (ecma_property_t *prop_p) /**< proper
if (prop_p->flags & ECMA_PROPERTY_FLAG_NAMEDDATA)
{
prop_desc.value = ecma_copy_value (ecma_get_named_data_property_value (prop_p), true);
prop_desc.value = ecma_copy_value (ecma_get_named_data_property_value (prop_p));
prop_desc.is_value_defined = true;
prop_desc.is_writable = ecma_is_property_writable (prop_p);
prop_desc.is_writable_defined = true;

View File

@ -80,7 +80,8 @@ extern ecma_number_t *ecma_get_number_from_value (ecma_value_t) __attr_pure___;
extern ecma_string_t *ecma_get_string_from_value (ecma_value_t) __attr_pure___;
extern ecma_object_t *ecma_get_object_from_value (ecma_value_t) __attr_pure___;
extern ecma_value_t ecma_get_value_from_error_value (ecma_value_t) __attr_pure___;
extern ecma_value_t ecma_copy_value (ecma_value_t, bool);
extern ecma_value_t ecma_copy_value (ecma_value_t);
extern ecma_value_t ecma_copy_value_if_not_object (ecma_value_t);
extern void ecma_free_value (ecma_value_t);
extern void ecma_free_value_if_not_object (ecma_value_t);
@ -243,8 +244,6 @@ extern ecma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *, lit_ut
extern lit_utf8_size_t ecma_uint32_to_utf8_string (uint32_t, lit_utf8_byte_t *, lit_utf8_size_t);
extern uint32_t ecma_number_to_uint32 (ecma_number_t);
extern int32_t ecma_number_to_int32 (ecma_number_t);
extern ecma_number_t ecma_int32_to_number (int32_t);
extern ecma_number_t ecma_uint32_to_number (uint32_t);
extern lit_utf8_size_t ecma_number_to_utf8_string (ecma_number_t, lit_utf8_byte_t *, lit_utf8_size_t);
#endif /* !ECMA_HELPERS_H */

View File

@ -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.
@ -256,7 +257,10 @@ ecma_lcache_lookup (ecma_object_t *object_p, /**< object */
ecma_string_t *entry_prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t,
ecma_lcache_hash_table[hash_key][i].prop_name_cp);
if (ecma_compare_ecma_strings_equal_hashes (prop_name_p, entry_prop_name_p))
JERRY_ASSERT (prop_name_p->hash == entry_prop_name_p->hash);
if (ECMA_STRING_GET_CONTAINER (prop_name_p) == ECMA_STRING_GET_CONTAINER (entry_prop_name_p)
&& prop_name_p->u.common_field == entry_prop_name_p->u.common_field)
{
ecma_property_t *prop_p = ECMA_GET_POINTER (ecma_property_t, ecma_lcache_hash_table[hash_key][i].prop_cp);
JERRY_ASSERT (prop_p == NULL || ecma_is_property_lcached (prop_p));

View File

@ -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);

View File

@ -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
{

View File

@ -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 */

View File

@ -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
{

View File

@ -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);

View File

@ -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);
}

View File

@ -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))
{

View File

@ -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);

View File

@ -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
{

View File

@ -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);
}

View File

@ -1,4 +1,5 @@
/* 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.
@ -65,7 +66,7 @@ ecma_op_create_array_object (const ecma_value_t *arguments_list_p, /**< list of
{
ecma_number_t *num_p = ecma_get_number_from_value (arguments_list_p[0]);
uint32_t num_uint32 = ecma_number_to_uint32 (*num_p);
if (*num_p != ecma_uint32_to_number (num_uint32))
if (*num_p != ((ecma_number_t) num_uint32))
{
return ecma_raise_range_error (ECMA_ERR_MSG (""));
}
@ -100,7 +101,7 @@ ecma_op_create_array_object (const ecma_value_t *arguments_list_p, /**< list of
ecma_string_t *length_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
ecma_number_t *length_num_p = ecma_alloc_number ();
*length_num_p = ecma_uint32_to_number (length);
*length_num_p = ((ecma_number_t) length);
ecma_property_t *length_prop_p = ecma_create_named_data_property (obj_p,
length_magic_string_p,
@ -196,7 +197,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
uint32_t new_len_uint32 = ecma_number_to_uint32 (new_len_num);
// d.
if (ecma_uint32_to_number (new_len_uint32) != new_len_num)
if (((ecma_number_t) new_len_uint32) != new_len_num)
{
return ecma_raise_range_error (ECMA_ERR_MSG (""));
}
@ -321,7 +322,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
ecma_number_t *new_len_num_p = ecma_get_number_from_value (new_len_property_desc.value);
// 1.
*new_len_num_p = ecma_uint32_to_number (index + 1u);
*new_len_num_p = ((ecma_number_t) index + 1u);
// 2.
if (!new_writable)
@ -428,7 +429,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
{
// i., ii.
ecma_number_t *num_p = ecma_alloc_number ();
*num_p = ecma_number_add (ecma_uint32_to_number (index), ECMA_NUMBER_ONE);
*num_p = ecma_number_add (((ecma_number_t) index), ECMA_NUMBER_ONE);
ecma_named_data_property_assign_value (obj_p, len_prop_p, ecma_make_number_value (num_p));

View File

@ -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.
@ -178,7 +179,7 @@ ecma_op_to_primitive (ecma_value_t value, /**< ecma value */
}
else
{
return ecma_copy_value (value, true);
return ecma_copy_value (value);
}
} /* ecma_op_to_primitive */
@ -262,7 +263,7 @@ ecma_op_to_number (ecma_value_t value) /**< ecma value */
if (ecma_is_value_number (value))
{
return ecma_copy_value (value, true);
return ecma_copy_value (value);
}
else if (ecma_is_value_string (value))
{
@ -409,7 +410,7 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */
}
else if (ecma_is_value_object (value))
{
return ecma_copy_value (value, true);
return ecma_copy_value (value);
}
else
{
@ -664,7 +665,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
ret_value);
prop_desc.is_value_defined = true;
prop_desc.value = ecma_copy_value (value_prop_value, true);
prop_desc.value = ecma_copy_value (value_prop_value);
ECMA_FINALIZE (value_prop_value);
}

View File

@ -591,7 +591,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
// 1.
if (is_strict)
{
this_binding = ecma_copy_value (this_arg_value, true);
this_binding = ecma_copy_value (this_arg_value);
}
else if (ecma_is_value_undefined (this_arg_value)
|| ecma_is_value_null (this_arg_value))
@ -794,7 +794,7 @@ ecma_op_function_construct_simple_or_external (ecma_object_t *func_obj_p, /**< F
// 9.
if (ecma_is_value_object (call_completion))
{
ret_value = ecma_copy_value (call_completion, true);
ret_value = ecma_copy_value (call_completion);
}
else
{

View File

@ -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.
@ -126,7 +127,7 @@ ecma_op_get_value_object_base (ecma_reference_t ref) /**< ECMA-reference */
else if (prop_p->flags & ECMA_PROPERTY_FLAG_NAMEDDATA)
{
// 4.
ret_value = ecma_copy_value (ecma_get_named_data_property_value (prop_p), true);
ret_value = ecma_copy_value (ecma_get_named_data_property_value (prop_p));
}
else
{

View File

@ -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.
@ -277,7 +278,7 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
}
}
return ecma_copy_value (prop_value, true);
return ecma_copy_value (prop_value);
}
else
{

View File

@ -80,7 +80,7 @@ ecma_op_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function
// 1.
ecma_number_t *len_p = ecma_alloc_number ();
*len_p = ecma_uint32_to_number (arguments_number);
*len_p = ((ecma_number_t) arguments_number);
// 4.
ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);

View File

@ -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.
@ -158,7 +159,7 @@ ecma_op_general_object_get (ecma_object_t *obj_p, /**< the object */
// 3.
if (prop_p->flags & ECMA_PROPERTY_FLAG_NAMEDDATA)
{
return ecma_copy_value (ecma_get_named_data_property_value (prop_p), true);
return ecma_copy_value (ecma_get_named_data_property_value (prop_p));
}
else
{

View File

@ -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.
@ -100,7 +101,7 @@ ecma_make_reference (ecma_value_t base, /**< base value */
name_p = ecma_copy_or_ref_ecma_string (name_p);
ecma_reference_t ref;
ref.base = ecma_copy_value (base, true);
ref.base = ecma_copy_value (base);
ref.is_strict = (is_strict != 0);
ECMA_SET_POINTER (ref.referenced_name_cp, name_p);

View File

@ -72,7 +72,7 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of
prim_prop_str_value_p = ecma_get_string_from_value (to_str_arg_value);
ecma_length_t string_len = ecma_string_get_length (prim_prop_str_value_p);
length_value = ecma_uint32_to_number ((uint32_t) string_len);
length_value = ((ecma_number_t) (uint32_t) string_len);
}
}

View File

@ -749,7 +749,7 @@ jerry_api_create_array_object (jerry_api_size_t size) /* size of array */
JERRY_ASSERT (size > 0);
ecma_number_t *length_num_p = ecma_alloc_number ();
*length_num_p = ecma_uint32_to_number (size);
*length_num_p = ((ecma_number_t) size);
ecma_value_t array_length = ecma_make_number_value (length_num_p);
jerry_api_length_t argument_size = 1;

View File

@ -49,47 +49,47 @@ do_number_bitwise_logic (number_bitwise_logic_op op, /**< number bitwise logic o
ECMA_OP_TO_NUMBER_TRY_CATCH (num_right, right_value, ret_value);
ecma_number_t *res_p = ecma_alloc_number ();
int32_t left_int32 = ecma_number_to_int32 (num_left);
uint32_t left_uint32 = ecma_number_to_uint32 (num_left);
uint32_t right_uint32 = ecma_number_to_uint32 (num_right);
switch (op)
{
case NUMBER_BITWISE_LOGIC_AND:
{
*res_p = ecma_int32_to_number ((int32_t) (left_uint32 & right_uint32));
uint32_t left_uint32 = ecma_number_to_uint32 (num_left);
*res_p = (ecma_number_t) ((int32_t) (left_uint32 & right_uint32));
break;
}
case NUMBER_BITWISE_LOGIC_OR:
{
*res_p = ecma_int32_to_number ((int32_t) (left_uint32 | right_uint32));
uint32_t left_uint32 = ecma_number_to_uint32 (num_left);
*res_p = (ecma_number_t) ((int32_t) (left_uint32 | right_uint32));
break;
}
case NUMBER_BITWISE_LOGIC_XOR:
{
*res_p = ecma_int32_to_number ((int32_t) (left_uint32 ^ right_uint32));
uint32_t left_uint32 = ecma_number_to_uint32 (num_left);
*res_p = (ecma_number_t) ((int32_t) (left_uint32 ^ right_uint32));
break;
}
case NUMBER_BITWISE_SHIFT_LEFT:
{
*res_p = ecma_int32_to_number (left_int32 << (right_uint32 & 0x1F));
*res_p = (ecma_number_t) (ecma_number_to_int32 (num_left) << (right_uint32 & 0x1F));
break;
}
case NUMBER_BITWISE_SHIFT_RIGHT:
{
*res_p = ecma_int32_to_number (left_int32 >> (right_uint32 & 0x1F));
*res_p = (ecma_number_t) (ecma_number_to_int32 (num_left) >> (right_uint32 & 0x1F));
break;
}
case NUMBER_BITWISE_SHIFT_URIGHT:
{
*res_p = ecma_uint32_to_number (left_uint32 >> (right_uint32 & 0x1F));
uint32_t left_uint32 = ecma_number_to_uint32 (num_left);
*res_p = (ecma_number_t) (left_uint32 >> (right_uint32 & 0x1F));
break;
}
case NUMBER_BITWISE_NOT:
{
*res_p = ecma_int32_to_number ((int32_t) ~right_uint32);
*res_p = (ecma_number_t) ((int32_t) ~right_uint32);
break;
}
}

View File

@ -224,7 +224,7 @@ vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
/* ECMA-262 v5, 10.4.2 */
if (is_direct)
{
this_binding = ecma_copy_value (vm_top_context_p->this_binding, true);
this_binding = ecma_copy_value (vm_top_context_p->this_binding);
lex_env_p = vm_top_context_p->lex_env_p;
ecma_ref_object (vm_top_context_p->lex_env_p);
}
@ -477,7 +477,7 @@ enum
if ((literal_index) < register_end) \
{ \
/* Note: There should be no specialization for arguments. */ \
(target_value) = ecma_copy_value (frame_ctx_p->registers_p[literal_index], true); \
(target_value) = ecma_copy_value (frame_ctx_p->registers_p[literal_index]); \
target_free_op; \
} \
else \
@ -836,7 +836,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
case VM_OC_GET_DATA_GET_ID (VM_OC_GET_THIS_LITERAL):
{
right_value = left_value;
left_value = ecma_copy_value (frame_ctx_p->this_binding, true);
left_value = ecma_copy_value (frame_ctx_p->this_binding);
free_flags = (uint8_t) ((free_flags << 1) | VM_FREE_LEFT_VALUE);
break;
}
@ -947,7 +947,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_PUSH_THIS:
{
result = ecma_copy_value (frame_ctx_p->this_binding, true);
result = ecma_copy_value (frame_ctx_p->this_binding);
break;
}
case VM_OC_PUSH_NUMBER:
@ -1130,7 +1130,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
{
*stack_top_p++ = ecma_make_simple_value (ECMA_SIMPLE_VALUE_REGISTER_REF);
*stack_top_p++ = literal_index;
result = ecma_copy_value (frame_ctx_p->registers_p[literal_index], true);
result = ecma_copy_value (frame_ctx_p->registers_p[literal_index]);
}
else
{
@ -1185,8 +1185,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
{
JERRY_ASSERT (opcode == CBC_PUSH_PROP_LITERAL_LITERAL_REFERENCE
|| opcode == CBC_PUSH_PROP_THIS_LITERAL_REFERENCE);
*stack_top_p++ = ecma_copy_value (left_value, true);
*stack_top_p++ = ecma_copy_value (right_value, true);
*stack_top_p++ = ecma_copy_value (left_value);
*stack_top_p++ = ecma_copy_value (right_value);
}
/* FALLTHRU */
}
@ -1253,7 +1253,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
JERRY_ASSERT (opcode == CBC_POST_INCR_IDENT_PUSH_RESULT
|| opcode == CBC_POST_DECR_IDENT_PUSH_RESULT);
*stack_top_p++ = ecma_copy_value (result, true);
*stack_top_p++ = ecma_copy_value (result);
}
else
{
@ -1266,14 +1266,14 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
stack_top_p++;
stack_top_p[-1] = stack_top_p[-2];
stack_top_p[-2] = stack_top_p[-3];
stack_top_p[-3] = ecma_copy_value (result, true);
stack_top_p[-3] = ecma_copy_value (result);
}
opcode_data &= (uint32_t)~VM_OC_PUT_STACK;
}
else if (opcode_data & VM_OC_PUT_BLOCK)
{
ecma_free_value (block_result);
block_result = ecma_copy_value (result, true);
block_result = ecma_copy_value (result);
opcode_data &= (uint32_t) ~VM_OC_PUT_BLOCK;
}
}
@ -1297,7 +1297,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
case VM_OC_ASSIGN_PROP_THIS:
{
result = stack_top_p[-1];
stack_top_p[-1] = ecma_copy_value (frame_ctx_p->this_binding, true);
stack_top_p[-1] = ecma_copy_value (frame_ctx_p->this_binding);
*stack_top_p++ = left_value;
free_flags = 0;
break;
@ -1542,7 +1542,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (literal_index < register_end)
{
left_value = ecma_copy_value (frame_ctx_p->registers_p[literal_index], true);
left_value = ecma_copy_value (frame_ctx_p->registers_p[literal_index]);
free_flags = VM_FREE_LEFT_VALUE;
}
else
@ -2110,7 +2110,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (opcode_data & (VM_OC_PUT_STACK | VM_OC_PUT_BLOCK))
{
result = ecma_copy_value (result, true);
result = ecma_copy_value (result);
}
}
else
@ -2154,7 +2154,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (opcode_data & (VM_OC_PUT_STACK | VM_OC_PUT_BLOCK))
{
result = ecma_copy_value (result, true);
result = ecma_copy_value (result);
}
}
else
@ -2372,7 +2372,7 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
ecma_collection_iterator_next (&arguments_iterator);
value = *arguments_iterator.current_value_p;
frame_ctx_p->registers_p[i] = ecma_copy_value (value, true);
frame_ctx_p->registers_p[i] = ecma_copy_value (value);
}
}
else
@ -2387,7 +2387,7 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
for (uint32_t i = 0; i < arg_list_len; i++)
{
frame_ctx_p->registers_p[i] = ecma_copy_value (src_p[i], true);
frame_ctx_p->registers_p[i] = ecma_copy_value (src_p[i]);
}
}