Merged conditions of if statements where possible. (#2380)

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2018-06-06 08:08:17 +02:00
committed by yichoi
parent b61d0ed856
commit b4b0b7d572
11 changed files with 138 additions and 173 deletions
@@ -1716,13 +1716,11 @@ ecma_builtin_array_prototype_object_index_of (ecma_value_t this_arg, /**< this a
/* 9.a */
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, idx_str_p), ret_value);
if (ecma_is_value_found (get_value))
/* 9.b.i, 9.b.ii */
if (ecma_is_value_found (get_value)
&& ecma_op_strict_equality_compare (arg1, get_value))
{
/* 9.b.i, 9.b.ii */
if (ecma_op_strict_equality_compare (arg1, get_value))
{
found_index = ((ecma_number_t) from_idx);
}
found_index = ((ecma_number_t) from_idx);
}
ECMA_FINALIZE (get_value);
@@ -1863,13 +1861,11 @@ ecma_builtin_array_prototype_object_last_index_of (ecma_value_t this_arg, /**< t
/* 8.a */
ECMA_TRY_CATCH (get_value, ecma_op_object_find (obj_p, idx_str_p), ret_value);
if (ecma_is_value_found (get_value))
/* 8.b.i, 8.b.ii */
if (ecma_is_value_found (get_value)
&& ecma_op_strict_equality_compare (search_element, get_value))
{
/* 8.b.i, 8.b.ii */
if (ecma_op_strict_equality_compare (search_element, get_value))
{
num = ((ecma_number_t) from_idx);
}
num = ((ecma_number_t) from_idx);
}
ECMA_FINALIZE (get_value);
@@ -190,17 +190,16 @@ ecma_builtin_global_object_parse_int (ecma_value_t this_arg, /**< this argument
if (ecma_is_value_empty (ret_value))
{
/* 10. */
if (strip_prefix)
if (strip_prefix
&& ((end_p - start_p) >= 2)
&& (current == LIT_CHAR_0))
{
if (end_p - start_p >= 2 && current == LIT_CHAR_0)
ecma_char_t next = *string_curr_p;
if (next == LIT_CHAR_LOWERCASE_X || next == LIT_CHAR_UPPERCASE_X)
{
ecma_char_t next = *string_curr_p;
if (next == LIT_CHAR_LOWERCASE_X || next == LIT_CHAR_UPPERCASE_X)
{
/* Skip the 'x' or 'X' characters. */
start_p = ++string_curr_p;
rad = 16;
}
/* Skip the 'x' or 'X' characters. */
start_p = ++string_curr_p;
rad = 16;
}
}
@@ -213,27 +213,25 @@ ecma_builtin_math_dispatch_routine (uint16_t builtin_routine_id, /**< built-in w
}
}
if (builtin_routine_id >= ECMA_MATH_OBJECT_ATAN2)
if (builtin_routine_id >= ECMA_MATH_OBJECT_ATAN2
&& arguments_number >= 2)
{
if (arguments_number >= 2)
if (ecma_is_value_number (arguments_list[1]))
{
if (ecma_is_value_number (arguments_list[1]))
y = ecma_get_number_from_value (arguments_list[1]);
}
else
{
ecma_value_t value = ecma_op_to_number (arguments_list[1]);
if (ECMA_IS_VALUE_ERROR (value))
{
y = ecma_get_number_from_value (arguments_list[1]);
return value;
}
else
{
ecma_value_t value = ecma_op_to_number (arguments_list[1]);
if (ECMA_IS_VALUE_ERROR (value))
{
return value;
}
y = ecma_get_number_from_value (value);
y = ecma_get_number_from_value (value);
ecma_fast_free_value (value);
}
ecma_fast_free_value (value);
}
}
@@ -198,12 +198,10 @@ ecma_builtin_typedarray_prototype_exec_routine (ecma_value_t this_arg, /**< this
ret_value = ECMA_VALUE_FALSE;
}
}
else if (mode == TYPEDARRAY_ROUTINE_SOME)
else if (mode == TYPEDARRAY_ROUTINE_SOME
&& ecma_op_to_boolean (call_value))
{
if (ecma_op_to_boolean (call_value))
{
ret_value = ECMA_VALUE_TRUE;
}
ret_value = ECMA_VALUE_TRUE;
}
ECMA_FINALIZE (call_value);