Skip to content

Rename ecma_is_value_error to ECMA_IS_VALUE_ERROR. #1140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions jerry-core/ecma/base/ecma-globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ typedef int32_t ecma_integer_value_t;
#define ECMA_INTEGER_MULTIPLY_MAX 0x2d41
#endif /* CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32 */

/**
* Checks whether the error flag is set.
*/
#define ECMA_IS_VALUE_ERROR(value) \
(unlikely ((value & ECMA_VALUE_ERROR_FLAG) != 0))

/**
* Internal properties' identifiers.
*/
Expand Down
18 changes: 3 additions & 15 deletions jerry-core/ecma/base/ecma-helpers-value.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,18 +311,6 @@ ecma_is_value_object (ecma_value_t value) /**< ecma value */
return (ecma_get_value_type_field (value) == ECMA_TYPE_OBJECT);
} /* ecma_is_value_object */

/**
* Check if the value is an error value.
*
* @return true - if the value contains an error value,
* false - otherwise.
*/
inline bool __attr_pure___ __attr_always_inline___
ecma_is_value_error (ecma_value_t value) /**< ecma value */
{
return (value & ECMA_VALUE_ERROR_FLAG) != 0;
} /* ecma_is_value_error */

/**
* Debug assertion that specified value's type is one of ECMA-defined
* script-visible types, i.e.: undefined, null, boolean, number, string, object.
Expand Down Expand Up @@ -501,7 +489,7 @@ ecma_value_t __attr_const___
ecma_make_error_value (ecma_value_t value) /**< original ecma value */
{
/* Error values cannot be converted. */
JERRY_ASSERT (!ecma_is_value_error (value));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (value));

return value | ECMA_VALUE_ERROR_FLAG;
} /* ecma_make_error_value */
Expand Down Expand Up @@ -618,11 +606,11 @@ ecma_invert_boolean_value (ecma_value_t value) /**< ecma value */
ecma_value_t __attr_pure___
ecma_get_value_from_error_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_error (value));
JERRY_ASSERT (ECMA_IS_VALUE_ERROR (value));

value = (ecma_value_t) (value & ~ECMA_VALUE_ERROR_FLAG);

JERRY_ASSERT (!ecma_is_value_error (value));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (value));

return value;
} /* ecma_get_value_from_error_value */
Expand Down
1 change: 0 additions & 1 deletion jerry-core/ecma/base/ecma-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ extern bool ecma_is_value_float_number (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_number (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_string (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_object (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_error (ecma_value_t) __attr_pure___;

extern void ecma_check_value_type_is_spec_defined (ecma_value_t);

Expand Down
10 changes: 5 additions & 5 deletions jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,7 @@ ecma_builtin_array_prototype_object_every (ecma_value_t this_arg, /**< this argu

/* We already checked that arg1 is callable, so it will always coerce to an object. */
ecma_value_t to_object_comp = ecma_op_to_object (arg1);
JERRY_ASSERT (!ecma_is_value_error (to_object_comp));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (to_object_comp));

func_object_p = ecma_get_object_from_value (to_object_comp);

Expand Down Expand Up @@ -2103,7 +2103,7 @@ ecma_builtin_array_prototype_object_some (ecma_value_t this_arg, /**< this argum

/* We already checked that arg1 is callable, so it will always coerce to an object. */
ecma_value_t to_object_comp = ecma_op_to_object (arg1);
JERRY_ASSERT (!ecma_is_value_error (to_object_comp));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (to_object_comp));

func_object_p = ecma_get_object_from_value (to_object_comp);

Expand Down Expand Up @@ -2200,7 +2200,7 @@ ecma_builtin_array_prototype_object_for_each (ecma_value_t this_arg, /**< this a

/* We already checked that arg1 is callable, so it will always coerce to an object. */
ecma_value_t to_object_comp = ecma_op_to_object (arg1);
JERRY_ASSERT (!ecma_is_value_error (to_object_comp));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (to_object_comp));

func_object_p = ecma_get_object_from_value (to_object_comp);

Expand Down Expand Up @@ -2295,7 +2295,7 @@ ecma_builtin_array_prototype_object_map (ecma_value_t this_arg, /**< this argume

/* 6. */
ecma_value_t new_array = ecma_op_create_array_object (NULL, 0, false);
JERRY_ASSERT (!ecma_is_value_error (new_array));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (new_array));
ecma_object_t *new_array_p = ecma_get_object_from_value (new_array);

/* 7-8. */
Expand Down Expand Up @@ -2402,7 +2402,7 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t this_arg, /**< this arg

/* 6. */
ecma_value_t new_array = ecma_op_create_array_object (NULL, 0, false);
JERRY_ASSERT (!ecma_is_value_error (new_array));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (new_array));
ecma_object_t *new_array_p = ecma_get_object_from_value (new_array);

/* We already checked that arg1 is callable, so it will always be an object. */
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/builtin-objects/ecma-builtin-date.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ ecma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**<
}
else
{
JERRY_ASSERT (ecma_is_value_error (ret_value));
JERRY_ASSERT (ECMA_IS_VALUE_ERROR (ret_value));
ecma_deref_object (obj_p);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
name_to_str_completion = ecma_op_to_string (name_get_ret_value);
}

if (unlikely (ecma_is_value_error (name_to_str_completion)))
if (unlikely (ECMA_IS_VALUE_ERROR (name_to_str_completion)))
{
ret_value = ecma_copy_value (name_to_str_completion);
}
Expand All @@ -112,7 +112,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
msg_to_str_completion = ecma_op_to_string (msg_get_ret_value);
}

if (unlikely (ecma_is_value_error (msg_to_str_completion)))
if (unlikely (ECMA_IS_VALUE_ERROR (msg_to_str_completion)))
{
ret_value = ecma_copy_value (msg_to_str_completion);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ ecma_builtin_function_prototype_object_bind (ecma_value_t this_arg, /**< this ar
if (ecma_object_get_class_name (this_arg_obj_p) == LIT_MAGIC_STRING_FUNCTION_UL)
{
ecma_value_t get_len_value = ecma_op_object_get (this_arg_obj_p, magic_string_length_p);
JERRY_ASSERT (!ecma_is_value_error (get_len_value));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (get_len_value));
JERRY_ASSERT (ecma_is_value_number (get_len_value));

const ecma_length_t bound_arg_count = arg_count > 1 ? arg_count - 1 : 0;
Expand Down
4 changes: 2 additions & 2 deletions jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ecma_builtin_helper_object_to_string (const ecma_value_t this_arg) /**< this arg
{
ecma_value_t obj_this = ecma_op_to_object (this_arg);

if (ecma_is_value_error (obj_this))
if (ECMA_IS_VALUE_ERROR (obj_this))
{
return obj_this;
}
Expand Down Expand Up @@ -200,7 +200,7 @@ ecma_builtin_helper_object_get_properties (ecma_object_t *obj_p, /**< object */
JERRY_ASSERT (obj_p != NULL);

ecma_value_t new_array = ecma_op_create_array_object (NULL, 0, false);
JERRY_ASSERT (!ecma_is_value_error (new_array));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (new_array));
ecma_object_t *new_array_p = ecma_get_object_from_value (new_array);

uint32_t index = 0;
Expand Down
10 changes: 5 additions & 5 deletions jerry-core/ecma/builtin-objects/ecma-builtin-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ ecma_builtin_json_parse_value (ecma_json_token_t *token_p) /**< token argument *
uint32_t length = 0;

ecma_value_t array_construction = ecma_op_create_array_object (NULL, 0, false);
JERRY_ASSERT (!ecma_is_value_error (array_construction));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (array_construction));

ecma_object_t *array_p = ecma_get_object_from_value (array_construction);

Expand Down Expand Up @@ -678,7 +678,7 @@ ecma_builtin_json_walk (ecma_object_t *reviver_p, /**< reviver function */
}
else
{
JERRY_ASSERT (ecma_is_value_error (ret_value));
JERRY_ASSERT (ECMA_IS_VALUE_ERROR (ret_value));
}

ECMA_FINALIZE (value_get);
Expand Down Expand Up @@ -1323,7 +1323,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
if (ecma_is_value_null (my_val) || ecma_is_value_boolean (my_val))
{
ret_value = ecma_op_to_string (my_val);
JERRY_ASSERT (!ecma_is_value_error (ret_value));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (ret_value));
}
/* 8. */
else if (ecma_is_value_string (my_val))
Expand All @@ -1340,7 +1340,7 @@ ecma_builtin_json_str (ecma_string_t *key_p, /**< property key*/
if (!ecma_number_is_nan (num_value_p) && !ecma_number_is_infinity (num_value_p))
{
ret_value = ecma_op_to_string (my_val);
JERRY_ASSERT (!ecma_is_value_error (ret_value));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (ret_value));
}
else
{
Expand Down Expand Up @@ -1482,7 +1482,7 @@ ecma_builtin_json_object (ecma_object_t *obj_p, /**< the object*/

/* 8.b.i */
ecma_value_t str_comp_val = ecma_builtin_json_quote (key_p);
JERRY_ASSERT (!ecma_is_value_error (str_comp_val));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (str_comp_val));

ecma_string_t *member_str_p = ecma_get_string_from_value (str_comp_val);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1763,7 +1763,7 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_arg, /**< this arg
ecma_string_t *zero_str_p = ecma_new_ecma_string_from_number (ECMA_NUMBER_ZERO);
ecma_value_t match_comp_value = ecma_op_object_get (match_array_obj_p, zero_str_p);

JERRY_ASSERT (!ecma_is_value_error (match_comp_value));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (match_comp_value));

ecma_string_t *match_str_p = ecma_get_string_from_value (match_comp_value);
ecma_length_t match_str_length = ecma_string_get_length (match_str_p);
Expand Down Expand Up @@ -1842,7 +1842,7 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_arg, /**< this arg

ecma_value_t match_comp_value = ecma_op_object_get (match_array_obj_p, idx_str_p);

JERRY_ASSERT (!ecma_is_value_error (match_comp_value));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (match_comp_value));

/* 13.c.iii.7.b */
ecma_value_t put_comp = ecma_builtin_helper_def_prop (new_array_p,
Expand Down
6 changes: 3 additions & 3 deletions jerry-core/ecma/operations/ecma-array-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o

// c.
ecma_value_t completion = ecma_op_to_number (property_desc_p->value);
if (ecma_is_value_error (completion))
if (ECMA_IS_VALUE_ERROR (completion))
{
return completion;
}

JERRY_ASSERT (!ecma_is_value_error (completion)
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (completion)
&& ecma_is_value_number (completion));

ecma_number_t new_len_num = ecma_get_number_from_value (completion);
Expand Down Expand Up @@ -255,7 +255,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
if (!ecma_is_value_true (succeeded))
{
JERRY_ASSERT (ecma_is_value_false (succeeded)
|| ecma_is_value_error (succeeded));
|| ECMA_IS_VALUE_ERROR (succeeded));

// k.
ret_value = succeeded;
Expand Down
4 changes: 2 additions & 2 deletions jerry-core/ecma/operations/ecma-comparison.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
// 4.
ecma_value_t x_num_value = ecma_op_to_number (x);

if (ecma_is_value_error (x_num_value))
if (ECMA_IS_VALUE_ERROR (x_num_value))
{
return x_num_value;
}
Expand Down Expand Up @@ -146,7 +146,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
// 9.
ecma_value_t x_prim_value = ecma_op_to_primitive (x, ECMA_PREFERRED_TYPE_NO);

if (ecma_is_value_error (x_prim_value))
if (ECMA_IS_VALUE_ERROR (x_prim_value))
{
return x_prim_value;
}
Expand Down
14 changes: 7 additions & 7 deletions jerry-core/ecma/operations/ecma-conversion.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */

ecma_deref_ecma_string (enumerable_magic_string_p);

if (!ecma_is_value_error (ret_value))
if (!ECMA_IS_VALUE_ERROR (ret_value))
{
JERRY_ASSERT (ecma_is_value_empty (ret_value));

Expand All @@ -621,7 +621,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
ecma_deref_ecma_string (configurable_magic_string_p);
}

if (!ecma_is_value_error (ret_value))
if (!ECMA_IS_VALUE_ERROR (ret_value))
{
JERRY_ASSERT (ecma_is_value_empty (ret_value));

Expand All @@ -643,7 +643,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
ecma_deref_ecma_string (value_magic_string_p);
}

if (!ecma_is_value_error (ret_value))
if (!ECMA_IS_VALUE_ERROR (ret_value))
{
JERRY_ASSERT (ecma_is_value_empty (ret_value));

Expand All @@ -665,7 +665,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
ecma_deref_ecma_string (writable_magic_string_p);
}

if (!ecma_is_value_error (ret_value))
if (!ECMA_IS_VALUE_ERROR (ret_value))
{
JERRY_ASSERT (ecma_is_value_empty (ret_value));

Expand Down Expand Up @@ -708,7 +708,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
ecma_deref_ecma_string (get_magic_string_p);
}

if (!ecma_is_value_error (ret_value))
if (!ECMA_IS_VALUE_ERROR (ret_value))
{
JERRY_ASSERT (ecma_is_value_empty (ret_value));

Expand Down Expand Up @@ -752,7 +752,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
ecma_deref_ecma_string (set_magic_string_p);
}

if (!ecma_is_value_error (ret_value))
if (!ECMA_IS_VALUE_ERROR (ret_value))
{
JERRY_ASSERT (ecma_is_value_empty (ret_value));

Expand All @@ -768,7 +768,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
}
}

if (!ecma_is_value_error (ret_value))
if (!ECMA_IS_VALUE_ERROR (ret_value))
{
JERRY_ASSERT (ecma_is_value_empty (ret_value));
}
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/operations/ecma-function-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
// 3., 4.
this_binding = ecma_op_to_object (this_arg_value);

JERRY_ASSERT (!ecma_is_value_error (this_binding));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (this_binding));
}

// 5.
Expand Down
4 changes: 2 additions & 2 deletions jerry-core/ecma/operations/ecma-lex-env.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
is_deletable, /* Configurable */
true); /* Failure handling */

if (ecma_is_value_error (completion))
if (ECMA_IS_VALUE_ERROR (completion))
{
return completion;
}
Expand Down Expand Up @@ -218,7 +218,7 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
value,
is_strict);

if (ecma_is_value_error (completion))
if (ECMA_IS_VALUE_ERROR (completion))
{
return completion;
}
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/operations/ecma-number-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb
{
ecma_value_t conv_to_num_completion = ecma_op_to_number (arg);

if (ecma_is_value_error (conv_to_num_completion))
if (ECMA_IS_VALUE_ERROR (conv_to_num_completion))
{
return conv_to_num_completion;
}
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/operations/ecma-objects-arguments.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ ecma_arguments_get_mapped_arg_value (ecma_object_t *map_p, /**< [[ParametersMap]
ecma_string_t *arg_name_p = ecma_get_string_from_value (arg_name_prop_value);

ecma_value_t completion = ecma_op_get_binding_value (lex_env_p, arg_name_p, true);
JERRY_ASSERT (!ecma_is_value_error (completion));
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (completion));

return completion;
} /* ecma_arguments_get_mapped_arg_value */
Expand Down
Loading