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
@@ -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));
+6 -5
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);
}
@@ -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
{
@@ -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
{
+3 -2
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
{
@@ -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);
@@ -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
{
+3 -2
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);
@@ -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);
}
}