Passing ecma_value_t by value instead of by reference.

This commit is contained in:
Ruben Ayrapetyan
2015-04-15 22:25:40 +03:00
parent b81e535e1c
commit 175f8912b2
47 changed files with 319 additions and 344 deletions
@@ -39,7 +39,7 @@
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_create_boolean_object (const ecma_value_t& arg) /**< argument passed to the Boolean constructor */
ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boolean constructor */
{
ecma_completion_value_t conv_to_boolean_completion = ecma_op_to_boolean (arg);
@@ -25,7 +25,7 @@
* @{
*/
extern ecma_completion_value_t ecma_op_create_boolean_object (const ecma_value_t& arg);
extern ecma_completion_value_t ecma_op_create_boolean_object (ecma_value_t arg);
/**
* @}
@@ -35,8 +35,8 @@
* false - otherwise.
*/
ecma_completion_value_t
ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
const ecma_value_t& y) /**< second operand */
ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
ecma_value_t y) /**< second operand */
{
const bool is_x_undefined = ecma_is_value_undefined (x);
const bool is_x_null = ecma_is_value_null (x);
@@ -217,8 +217,8 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
* false - otherwise.
*/
bool
ecma_op_strict_equality_compare (const ecma_value_t& x, /**< first operand */
const ecma_value_t& y) /**< second operand */
ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */
ecma_value_t y) /**< second operand */
{
const bool is_x_undefined = ecma_is_value_undefined (x);
const bool is_x_null = ecma_is_value_null (x);
@@ -329,14 +329,14 @@ ecma_op_strict_equality_compare (const ecma_value_t& x, /**< first operand */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_abstract_relational_compare (const ecma_value_t& x, /**< first operand */
const ecma_value_t& y, /**< second operand */
ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
ecma_value_t y, /**< second operand */
bool left_first) /**< 'LeftFirst' flag */
{
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
const ecma_value_t& first_converted_value = left_first ? x : y;
const ecma_value_t& second_converted_value = left_first ? y : x;
ecma_value_t first_converted_value = left_first ? x : y;
ecma_value_t second_converted_value = left_first ? y : x;
// 1., 2.
ECMA_TRY_CATCH(prim_first_converted_value,
+6 -6
View File
@@ -26,12 +26,12 @@
* @{
*/
extern ecma_completion_value_t ecma_op_abstract_equality_compare (const ecma_value_t& x,
const ecma_value_t& y);
extern bool ecma_op_strict_equality_compare (const ecma_value_t& x,
const ecma_value_t& y);
extern ecma_completion_value_t ecma_op_abstract_relational_compare (const ecma_value_t& x,
const ecma_value_t& y,
extern ecma_completion_value_t ecma_op_abstract_equality_compare (ecma_value_t x,
ecma_value_t y);
extern bool ecma_op_strict_equality_compare (ecma_value_t x,
ecma_value_t y);
extern ecma_completion_value_t ecma_op_abstract_relational_compare (ecma_value_t x,
ecma_value_t y,
bool left_first);
/**
@@ -49,7 +49,7 @@
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_check_object_coercible (const ecma_value_t& value) /**< ecma-value */
ecma_op_check_object_coercible (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
@@ -74,8 +74,8 @@ ecma_op_check_object_coercible (const ecma_value_t& value) /**< ecma-value */
* false - otherwise.
*/
bool
ecma_op_same_value (const ecma_value_t& x, /**< ecma-value */
const ecma_value_t& y) /**< ecma-value */
ecma_op_same_value (ecma_value_t x, /**< ecma-value */
ecma_value_t y) /**< ecma-value */
{
const bool is_x_undefined = ecma_is_value_undefined (x);
const bool is_x_null = ecma_is_value_null (x);
@@ -157,7 +157,7 @@ ecma_op_same_value (const ecma_value_t& x, /**< ecma-value */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_to_primitive (const ecma_value_t& value, /**< ecma-value */
ecma_op_to_primitive (ecma_value_t value, /**< ecma-value */
ecma_preferred_type_hint_t preferred_type) /**< preferred type hint */
{
ecma_check_value_type_is_spec_defined (value);
@@ -185,7 +185,7 @@ ecma_op_to_primitive (const ecma_value_t& value, /**< ecma-value */
* However, ecma_free_completion_value may be called for it, but it is a no-op.
*/
ecma_completion_value_t
ecma_op_to_boolean (const ecma_value_t& value) /**< ecma-value */
ecma_op_to_boolean (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
@@ -248,7 +248,7 @@ ecma_op_to_boolean (const ecma_value_t& value) /**< ecma-value */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_to_number (const ecma_value_t& value) /**< ecma-value */
ecma_op_to_number (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
@@ -319,7 +319,7 @@ ecma_op_to_number (const ecma_value_t& value) /**< ecma-value */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_to_string (const ecma_value_t& value) /**< ecma-value */
ecma_op_to_string (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
@@ -387,7 +387,7 @@ ecma_op_to_string (const ecma_value_t& value) /**< ecma-value */
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_to_object (const ecma_value_t& value) /**< ecma-value */
ecma_op_to_object (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
@@ -557,7 +557,7 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_des
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value */
ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
ecma_property_descriptor_t *out_prop_desc_p) /**< out: filled property descriptor
if return value is normal
empty completion value */
+9 -9
View File
@@ -37,18 +37,18 @@ typedef enum
ECMA_PREFERRED_TYPE_STRING /**< String */
} ecma_preferred_type_hint_t;
extern ecma_completion_value_t ecma_op_check_object_coercible (const ecma_value_t& value);
extern bool ecma_op_same_value (const ecma_value_t& x,
const ecma_value_t& y);
extern ecma_completion_value_t ecma_op_to_primitive (const ecma_value_t& value,
extern ecma_completion_value_t ecma_op_check_object_coercible (ecma_value_t value);
extern bool ecma_op_same_value (ecma_value_t x,
ecma_value_t y);
extern ecma_completion_value_t ecma_op_to_primitive (ecma_value_t value,
ecma_preferred_type_hint_t preferred_type);
extern ecma_completion_value_t ecma_op_to_boolean (const ecma_value_t& value);
extern ecma_completion_value_t ecma_op_to_number (const ecma_value_t& value);
extern ecma_completion_value_t ecma_op_to_string (const ecma_value_t& value);
extern ecma_completion_value_t ecma_op_to_object (const ecma_value_t& value);
extern ecma_completion_value_t ecma_op_to_boolean (ecma_value_t value);
extern ecma_completion_value_t ecma_op_to_number (ecma_value_t value);
extern ecma_completion_value_t ecma_op_to_string (ecma_value_t value);
extern ecma_completion_value_t ecma_op_to_object (ecma_value_t value);
extern ecma_object_t* ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_desc_p);
extern ecma_completion_value_t ecma_op_to_property_descriptor (const ecma_value_t& obj_value,
extern ecma_completion_value_t ecma_op_to_property_descriptor (ecma_value_t obj_value,
ecma_property_descriptor_t *out_prop_desc_p);
/**
@@ -90,7 +90,7 @@ ecma_unpack_code_internal_property_value (uint32_t value, /**< packed value */
* false - otherwise.
*/
bool
ecma_op_is_callable (const ecma_value_t& value) /**< ecma-value */
ecma_op_is_callable (ecma_value_t value) /**< ecma-value */
{
if (!ecma_is_value_object (value))
{
@@ -115,7 +115,7 @@ ecma_op_is_callable (const ecma_value_t& value) /**< ecma-value */
* false - otherwise.
*/
bool
ecma_is_constructor (const ecma_value_t& value) /**< ecma-value */
ecma_is_constructor (ecma_value_t value) /**< ecma-value */
{
if (!ecma_is_value_object (value))
{
@@ -432,7 +432,7 @@ ecma_function_call_setup_args_variables (ecma_object_t *func_obj_p, /**< Functio
*/
ecma_completion_value_t
ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object */
const ecma_value_t& value) /**< argument 'V' */
ecma_value_t value) /**< argument 'V' */
{
JERRY_ASSERT(func_obj_p != NULL
&& !ecma_is_lexical_environment (func_obj_p));
@@ -512,7 +512,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
*/
ecma_completion_value_t
ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
const ecma_value_t& this_arg_value, /**< 'this' argument's value */
ecma_value_t this_arg_value, /**< 'this' argument's value */
const ecma_value_t* arguments_list_p, /**< arguments list */
ecma_length_t arguments_list_len) /**< length of arguments list */
{
@@ -26,8 +26,8 @@
* @{
*/
extern bool ecma_op_is_callable (const ecma_value_t& value);
extern bool ecma_is_constructor (const ecma_value_t& value);
extern bool ecma_op_is_callable (ecma_value_t value);
extern bool ecma_is_constructor (ecma_value_t value);
extern ecma_object_t*
ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[],
@@ -40,7 +40,7 @@ ecma_op_create_external_function_object (ecma_external_pointer_t code_p);
extern ecma_completion_value_t
ecma_op_function_call (ecma_object_t *func_obj_p,
const ecma_value_t& this_arg_value,
ecma_value_t this_arg_value,
const ecma_value_t* arguments_list_p,
ecma_length_t arguments_list_len);
@@ -51,7 +51,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p,
extern ecma_completion_value_t
ecma_op_function_has_instance (ecma_object_t *func_obj_p,
const ecma_value_t& value);
ecma_value_t value);
extern ecma_completion_value_t
ecma_op_function_declaration (ecma_object_t *lex_env_p,
@@ -132,7 +132,7 @@ ecma_completion_value_t
ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< reference's base (lexical environment) */
ecma_string_t *var_name_string_p, /**< variable name */
bool is_strict, /**< flag indicating strict mode */
const ecma_value_t& value) /**< ECMA-value */
ecma_value_t value) /**< ECMA-value */
{
const bool is_unresolvable_reference = (ref_base_lex_env_p == NULL);
@@ -203,7 +203,7 @@ ecma_reject_put (bool is_throw) /**< Throw flag */
*/
ecma_completion_value_t
ecma_op_put_value_object_base (ecma_reference_t ref, /**< ECMA-reference */
const ecma_value_t& value) /**< ECMA-value */
ecma_value_t value) /**< ECMA-value */
{
const ecma_value_t base = ref.base;
const bool is_unresolvable_reference = ecma_is_value_undefined (base);
+2 -2
View File
@@ -206,7 +206,7 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
ecma_completion_value_t
ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */
ecma_string_t *name_p, /**< argument N */
const ecma_value_t& value, /**< argument V */
ecma_value_t value, /**< argument V */
bool is_strict) /**< argument S */
{
JERRY_ASSERT(lex_env_p != NULL
@@ -479,7 +479,7 @@ ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environ
void
ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */
ecma_string_t *name_p, /**< argument N */
const ecma_value_t& value) /**< argument V */
ecma_value_t value) /**< argument V */
{
JERRY_ASSERT(lex_env_p != NULL
&& ecma_is_lexical_environment (lex_env_p));
+4 -4
View File
@@ -51,9 +51,9 @@ extern ecma_completion_value_t ecma_op_get_value_object_base (ecma_reference_t r
extern ecma_completion_value_t ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p,
ecma_string_t *var_name_string_p,
bool is_strict,
const ecma_value_t& value);
ecma_value_t value);
extern ecma_completion_value_t ecma_op_put_value_object_base (ecma_reference_t ref,
const ecma_value_t& value);
ecma_value_t value);
/* ECMA-262 v5, Table 17. Abstract methods of Environment Records */
extern bool ecma_op_has_binding (ecma_object_t *lex_env_p,
@@ -63,7 +63,7 @@ extern ecma_completion_value_t ecma_op_create_mutable_binding (ecma_object_t *le
bool is_deletable);
extern ecma_completion_value_t ecma_op_set_mutable_binding (ecma_object_t *lex_env_p,
ecma_string_t *name_p,
const ecma_value_t& value,
ecma_value_t value,
bool is_strict);
extern ecma_completion_value_t ecma_op_get_binding_value (ecma_object_t *lex_env_p,
ecma_string_t *name_p,
@@ -77,7 +77,7 @@ extern void ecma_op_create_immutable_binding (ecma_object_t *lex_env_p,
ecma_string_t *name_p);
extern void ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p,
ecma_string_t *name_p,
const ecma_value_t& value);
ecma_value_t value);
extern ecma_object_t* ecma_op_create_global_environment (ecma_object_t *glob_obj_p);
@@ -39,7 +39,7 @@
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_create_number_object (const ecma_value_t& arg) /**< argument passed to the Number constructor */
ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Number constructor */
{
ecma_completion_value_t conv_to_num_completion = ecma_op_to_number (arg);
@@ -25,7 +25,7 @@
* @{
*/
extern ecma_completion_value_t ecma_op_create_number_object (const ecma_value_t& arg);
extern ecma_completion_value_t ecma_op_create_number_object (ecma_value_t arg);
/**
* @}
@@ -80,7 +80,7 @@ ecma_op_create_object_object_noarg (void)
* @return pointer to newly created 'Object' object
*/
ecma_completion_value_t
ecma_op_create_object_object_arg (const ecma_value_t& value) /**< argument of constructor */
ecma_op_create_object_object_arg (ecma_value_t value) /**< argument of constructor */
{
ecma_check_value_type_is_spec_defined (value);
@@ -234,7 +234,7 @@ ecma_op_general_object_get_property (ecma_object_t *obj_p, /**< the object */
ecma_completion_value_t
ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */
ecma_string_t *property_name_p, /**< property name */
const ecma_value_t& value, /**< ecma-value */
ecma_value_t value, /**< ecma-value */
bool is_throw) /**< flag that controls failure handling */
{
JERRY_ASSERT(obj_p != NULL
@@ -27,7 +27,7 @@
*/
extern ecma_object_t* ecma_op_create_object_object_noarg (void);
extern ecma_completion_value_t ecma_op_create_object_object_arg (const ecma_value_t& value);
extern ecma_completion_value_t ecma_op_create_object_object_arg (ecma_value_t value);
extern ecma_completion_value_t ecma_op_general_object_get (ecma_object_t *obj_p,
ecma_string_t *property_name_p);
@@ -37,7 +37,7 @@ extern ecma_property_t *ecma_op_general_object_get_property (ecma_object_t *obj_
ecma_string_t *property_name_p);
extern ecma_completion_value_t ecma_op_general_object_put (ecma_object_t *obj_p,
ecma_string_t *property_name_p,
const ecma_value_t& value,
ecma_value_t value,
bool is_throw);
extern bool ecma_op_general_object_can_put (ecma_object_t *obj_p,
ecma_string_t *property_name_p);
+2 -2
View File
@@ -242,7 +242,7 @@ ecma_op_object_get_property (ecma_object_t *obj_p, /**< the object */
ecma_completion_value_t
ecma_op_object_put (ecma_object_t *obj_p, /**< the object */
ecma_string_t *property_name_p, /**< property name */
const ecma_value_t& value, /**< ecma-value */
ecma_value_t value, /**< ecma-value */
bool is_throw) /**< flag that controls failure handling */
{
JERRY_ASSERT(obj_p != NULL
@@ -473,7 +473,7 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
*/
ecma_completion_value_t
ecma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */
const ecma_value_t& value) /**< argument 'V' */
ecma_value_t value) /**< argument 'V' */
{
JERRY_ASSERT(obj_p != NULL
&& !ecma_is_lexical_environment (obj_p));
+2 -2
View File
@@ -31,7 +31,7 @@ extern ecma_property_t *ecma_op_object_get_own_property (ecma_object_t *obj_p, e
extern ecma_property_t *ecma_op_object_get_property (ecma_object_t *obj_p, ecma_string_t *property_name_p);
extern ecma_completion_value_t ecma_op_object_put (ecma_object_t *obj_p,
ecma_string_t *property_name_p,
const ecma_value_t& value,
ecma_value_t value,
bool is_throw);
extern bool ecma_op_object_can_put (ecma_object_t *obj_p, ecma_string_t *property_name_p);
extern ecma_completion_value_t ecma_op_object_delete (ecma_object_t *obj_p,
@@ -44,7 +44,7 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p,
const ecma_property_descriptor_t* property_desc_p,
bool is_throw);
extern ecma_completion_value_t ecma_op_object_has_instance (ecma_object_t *obj_p,
const ecma_value_t& value);
ecma_value_t value);
/**
* @}
* @}
@@ -93,7 +93,7 @@ ecma_op_get_identifier_reference (ecma_object_t *lex_env_p, /**< lexical environ
* Returned value must be freed through ecma_free_reference.
*/
ecma_reference_t
ecma_make_reference (const ecma_value_t& base, /**< base value */
ecma_make_reference (ecma_value_t base, /**< base value */
ecma_string_t *name_p, /**< referenced name */
bool is_strict) /**< strict reference flag */
{
+1 -1
View File
@@ -49,7 +49,7 @@ extern ecma_object_t* ecma_op_resolve_reference_base (ecma_object_t *lex_env_p,
extern ecma_reference_t ecma_op_get_identifier_reference (ecma_object_t *lex_env_p,
ecma_string_t *name_p,
bool is_strict);
extern ecma_reference_t ecma_make_reference (const ecma_value_t& base,
extern ecma_reference_t ecma_make_reference (ecma_value_t base,
ecma_string_t *name_p,
bool is_strict);
extern void ecma_free_reference (ecma_reference_t ref);