Returning ecma_value_t instead of ecma_completion_value_t from ECMA_TRY_CATCH for case when completion value is normal.

This commit is contained in:
Ruben Ayrapetyan
2015-01-27 22:07:26 +03:00
parent f231b9a0d2
commit 0f487a0bb7
25 changed files with 236 additions and 273 deletions
+8 -8
View File
@@ -35,10 +35,10 @@ opfunc_is_true_jmp_down (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (cond_value, get_variable_value (int_data, cond_var_idx, false), ret_value);
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (ecma_get_completion_value_value (cond_value));
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (cond_value);
JERRY_ASSERT (ecma_is_completion_value_normal (to_bool_completion));
if (ecma_is_value_true (ecma_get_completion_value_value (to_bool_completion)))
if (ecma_is_completion_value_normal_true (to_bool_completion))
{
JERRY_ASSERT (offset != 0 && ((uint32_t) int_data->pos + offset < MAX_OPCODES));
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
@@ -68,10 +68,10 @@ opfunc_is_true_jmp_up (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (cond_value, get_variable_value (int_data, cond_var_idx, false), ret_value);
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (ecma_get_completion_value_value (cond_value));
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (cond_value);
JERRY_ASSERT (ecma_is_completion_value_normal (to_bool_completion));
if (ecma_is_value_true (ecma_get_completion_value_value (to_bool_completion)))
if (ecma_is_completion_value_normal_true (to_bool_completion))
{
JERRY_ASSERT (offset != 0 && (uint32_t) int_data->pos >= offset);
int_data->pos = (opcode_counter_t) (int_data->pos - offset);
@@ -107,10 +107,10 @@ opfunc_is_false_jmp_down (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (cond_value, get_variable_value (int_data, cond_var_idx, false), ret_value);
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (ecma_get_completion_value_value (cond_value));
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (cond_value);
JERRY_ASSERT (ecma_is_completion_value_normal (to_bool_completion));
if (!ecma_is_value_true (ecma_get_completion_value_value (to_bool_completion)))
if (!ecma_is_completion_value_normal_true (to_bool_completion))
{
JERRY_ASSERT (offset != 0 && ((uint32_t) int_data->pos + offset < MAX_OPCODES));
int_data->pos = (opcode_counter_t) (int_data->pos + offset);
@@ -140,10 +140,10 @@ opfunc_is_false_jmp_up (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (cond_value, get_variable_value (int_data, cond_var_idx, false), ret_value);
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (ecma_get_completion_value_value (cond_value));
ecma_completion_value_t to_bool_completion = ecma_op_to_boolean (cond_value);
JERRY_ASSERT (ecma_is_completion_value_normal (to_bool_completion));
if (!ecma_is_value_true (ecma_get_completion_value_value (to_bool_completion)))
if (!ecma_is_completion_value_normal_true (to_bool_completion))
{
JERRY_ASSERT (offset != 0 && (uint32_t) int_data->pos >= offset);
int_data->pos = (opcode_counter_t) (int_data->pos - offset);
+20 -20
View File
@@ -115,22 +115,22 @@ opfunc_addition (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
ECMA_TRY_CATCH (prim_left_value,
ecma_op_to_primitive (ecma_get_completion_value_value (left_value),
ecma_op_to_primitive (left_value,
ECMA_PREFERRED_TYPE_NO),
ret_value);
ECMA_TRY_CATCH (prim_right_value,
ecma_op_to_primitive (ecma_get_completion_value_value (right_value),
ecma_op_to_primitive (right_value,
ECMA_PREFERRED_TYPE_NO),
ret_value);
if (ecma_is_value_string (ecma_get_completion_value_value (prim_left_value))
|| ecma_is_value_string (ecma_get_completion_value_value (prim_right_value)))
if (ecma_is_value_string (prim_left_value)
|| ecma_is_value_string (prim_right_value))
{
ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (ecma_get_completion_value_value (prim_left_value)), ret_value);
ECMA_TRY_CATCH (str_right_value, ecma_op_to_string (ecma_get_completion_value_value (prim_right_value)), ret_value);
ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (prim_left_value), ret_value);
ECMA_TRY_CATCH (str_right_value, ecma_op_to_string (prim_right_value), ret_value);
ecma_string_t *string1_p = ecma_get_string_from_completion_value (str_left_value);
ecma_string_t *string2_p = ecma_get_string_from_completion_value (str_right_value);
ecma_string_t *string1_p = ecma_get_string_from_value (str_left_value);
ecma_string_t *string2_p = ecma_get_string_from_value (str_right_value);
ecma_string_t *concat_str_p = ecma_concat_ecma_strings (string1_p, string2_p);
@@ -146,8 +146,8 @@ opfunc_addition (opcode_t opdata, /**< operation data */
ret_value = do_number_arithmetic (int_data,
dst_var_idx,
number_arithmetic_addition,
ecma_get_completion_value_value (prim_left_value),
ecma_get_completion_value_value (prim_right_value));
prim_left_value,
prim_right_value);
}
ECMA_FINALIZE (prim_right_value);
@@ -184,8 +184,8 @@ opfunc_substraction (opcode_t opdata, /**< operation data */
ret_value = do_number_arithmetic (int_data,
dst_var_idx,
number_arithmetic_substraction,
ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
left_value,
right_value);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
@@ -219,8 +219,8 @@ opfunc_multiplication (opcode_t opdata, /**< operation data */
ret_value = do_number_arithmetic (int_data,
dst_var_idx,
number_arithmetic_multiplication,
ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
left_value,
right_value);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
@@ -254,8 +254,8 @@ opfunc_division (opcode_t opdata, /**< operation data */
ret_value = do_number_arithmetic (int_data,
dst_var_idx,
number_arithmetic_division,
ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
left_value,
right_value);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
@@ -289,8 +289,8 @@ opfunc_remainder (opcode_t opdata, /**< operation data */
ret_value = do_number_arithmetic (int_data,
dst_var_idx,
number_arithmetic_remainder,
ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
left_value,
right_value);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
@@ -319,7 +319,7 @@ opfunc_unary_plus (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (var_value, get_variable_value (int_data, var_idx, false), ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (num_var_value,
ecma_get_completion_value_value (var_value),
var_value,
ret_value);
ecma_number_t *tmp_p = int_data->tmp_num_p;
@@ -356,7 +356,7 @@ opfunc_unary_minus (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (var_value, get_variable_value (int_data, var_idx, false), ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (num_var_value,
ecma_get_completion_value_value (var_value),
var_value,
ret_value);
ecma_number_t *tmp_p = int_data->tmp_num_p;
+14 -14
View File
@@ -134,8 +134,8 @@ opfunc_b_and (opcode_t opdata, /**< operation data */
ret_value = do_number_bitwise_logic (int_data,
dst_var_idx,
number_bitwise_logic_and,
ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
left_value,
right_value);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
@@ -169,8 +169,8 @@ opfunc_b_or (opcode_t opdata, /**< operation data */
ret_value = do_number_bitwise_logic (int_data,
dst_var_idx,
number_bitwise_logic_or,
ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
left_value,
right_value);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
@@ -204,8 +204,8 @@ opfunc_b_xor (opcode_t opdata, /**< operation data */
ret_value = do_number_bitwise_logic (int_data,
dst_var_idx,
number_bitwise_logic_xor,
ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
left_value,
right_value);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
@@ -239,8 +239,8 @@ opfunc_b_shift_left (opcode_t opdata, /**< operation data */
ret_value = do_number_bitwise_logic (int_data,
dst_var_idx,
number_bitwise_shift_left,
ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
left_value,
right_value);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
@@ -274,8 +274,8 @@ opfunc_b_shift_right (opcode_t opdata, /**< operation data */
ret_value = do_number_bitwise_logic (int_data,
dst_var_idx,
number_bitwise_shift_right,
ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
left_value,
right_value);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
@@ -309,8 +309,8 @@ opfunc_b_shift_uright (opcode_t opdata, /**< operation data */
ret_value = do_number_bitwise_logic (int_data,
dst_var_idx,
number_bitwise_shift_uright,
ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
left_value,
right_value);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
@@ -342,8 +342,8 @@ opfunc_b_not (opcode_t opdata, /**< operation data */
ret_value = do_number_bitwise_logic (int_data,
dst_var_idx,
number_bitwise_not,
ecma_get_completion_value_value (right_value),
ecma_get_completion_value_value (right_value));
right_value,
right_value);
ECMA_FINALIZE (right_value);
+9 -14
View File
@@ -37,15 +37,14 @@ opfunc_equal_value (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
ECMA_TRY_CATCH (compare_result,
ecma_op_abstract_equality_compare (ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value)),
ecma_op_abstract_equality_compare (left_value,
right_value),
ret_value);
JERRY_ASSERT (ecma_is_completion_value_normal_true (compare_result)
|| ecma_is_completion_value_normal_false (compare_result));
JERRY_ASSERT (ecma_is_value_boolean (compare_result));
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx,
ecma_get_completion_value_value (compare_result));
compare_result);
ECMA_FINALIZE (compare_result);
ECMA_FINALIZE (right_value);
@@ -77,14 +76,12 @@ opfunc_not_equal_value (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
ECMA_TRY_CATCH (compare_result,
ecma_op_abstract_equality_compare (ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value)),
ecma_op_abstract_equality_compare (left_value, right_value),
ret_value);
JERRY_ASSERT (ecma_is_completion_value_normal_true (compare_result)
|| ecma_is_completion_value_normal_false (compare_result));
JERRY_ASSERT (ecma_is_value_boolean (compare_result));
bool is_equal = ecma_is_completion_value_normal_true (compare_result);
bool is_equal = ecma_is_value_true (compare_result);
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx,
ecma_make_simple_value (is_equal ? ECMA_SIMPLE_VALUE_FALSE
@@ -120,8 +117,7 @@ opfunc_equal_value_type (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
bool is_equal = ecma_op_strict_equality_compare (ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
bool is_equal = ecma_op_strict_equality_compare (left_value, right_value);
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx,
ecma_make_simple_value (is_equal ? ECMA_SIMPLE_VALUE_TRUE
@@ -156,8 +152,7 @@ opfunc_not_equal_value_type (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
bool is_equal = ecma_op_strict_equality_compare (ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value));
bool is_equal = ecma_op_strict_equality_compare (left_value, right_value);
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx,
ecma_make_simple_value (is_equal ? ECMA_SIMPLE_VALUE_FALSE
+24 -33
View File
@@ -37,22 +37,20 @@ opfunc_less_than (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
ECMA_TRY_CATCH (compare_result,
ecma_op_abstract_relational_compare (ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value),
true),
ecma_op_abstract_relational_compare (left_value, right_value, true),
ret_value);
ecma_simple_value_t res;
if (ecma_is_value_undefined (ecma_get_completion_value_value (compare_result)))
if (ecma_is_value_undefined (compare_result))
{
res = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (ecma_get_completion_value_value (compare_result)));
JERRY_ASSERT (ecma_is_value_boolean (compare_result));
res = (ecma_is_completion_value_normal_true (compare_result) ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
res = (ecma_is_value_true (compare_result) ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
}
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx, ecma_make_simple_value (res));
@@ -87,22 +85,20 @@ opfunc_greater_than (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
ECMA_TRY_CATCH (compare_result,
ecma_op_abstract_relational_compare (ecma_get_completion_value_value (right_value),
ecma_get_completion_value_value (left_value),
false),
ecma_op_abstract_relational_compare (right_value, left_value, false),
ret_value);
ecma_simple_value_t res;
if (ecma_is_value_undefined (ecma_get_completion_value_value (compare_result)))
if (ecma_is_value_undefined (compare_result))
{
res = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (ecma_get_completion_value_value (compare_result)));
JERRY_ASSERT (ecma_is_value_boolean (compare_result));
res = (ecma_is_completion_value_normal_true (compare_result) ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
res = (ecma_is_value_true (compare_result) ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
}
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx, ecma_make_simple_value (res));
@@ -137,22 +133,20 @@ opfunc_less_or_equal_than (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
ECMA_TRY_CATCH (compare_result,
ecma_op_abstract_relational_compare (ecma_get_completion_value_value (right_value),
ecma_get_completion_value_value (left_value),
false),
ecma_op_abstract_relational_compare (right_value, left_value, false),
ret_value);
ecma_simple_value_t res;
if (ecma_is_value_undefined (ecma_get_completion_value_value (compare_result)))
if (ecma_is_value_undefined (compare_result))
{
res = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (ecma_get_completion_value_value (compare_result)));
JERRY_ASSERT (ecma_is_value_boolean (compare_result));
if (ecma_is_completion_value_normal_true (compare_result))
if (ecma_is_value_true (compare_result))
{
res = ECMA_SIMPLE_VALUE_FALSE;
}
@@ -194,22 +188,20 @@ opfunc_greater_or_equal_than (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
ECMA_TRY_CATCH (compare_result,
ecma_op_abstract_relational_compare (ecma_get_completion_value_value (left_value),
ecma_get_completion_value_value (right_value),
true),
ecma_op_abstract_relational_compare (left_value, right_value, true),
ret_value);
ecma_simple_value_t res;
if (ecma_is_value_undefined (ecma_get_completion_value_value (compare_result)))
if (ecma_is_value_undefined (compare_result))
{
res = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (ecma_get_completion_value_value (compare_result)));
JERRY_ASSERT (ecma_is_value_boolean (compare_result));
if (ecma_is_completion_value_normal_true (compare_result))
if (ecma_is_value_true (compare_result))
{
res = ECMA_SIMPLE_VALUE_FALSE;
}
@@ -251,20 +243,19 @@ opfunc_instanceof (opcode_t opdata __unused, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
if (!ecma_is_value_object (ecma_get_completion_value_value (right_value)))
if (!ecma_is_value_object (right_value))
{
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
ecma_object_t *right_value_obj_p = ecma_get_object_from_completion_value (right_value);
ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);
ECMA_TRY_CATCH (is_instance_of,
ecma_op_object_has_instance (right_value_obj_p,
ecma_get_completion_value_value (left_value)),
ecma_op_object_has_instance (right_value_obj_p, left_value),
ret_value);
ret_value = set_variable_value (int_data, int_data->pos, dst_idx, ecma_get_completion_value_value (is_instance_of));
ret_value = set_variable_value (int_data, int_data->pos, dst_idx, is_instance_of);
ECMA_FINALIZE (is_instance_of);
}
@@ -298,17 +289,17 @@ opfunc_in (opcode_t opdata __unused, /**< operation data */
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
if (!ecma_is_value_object (ecma_get_completion_value_value (right_value)))
if (!ecma_is_value_object (right_value))
{
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (ecma_get_completion_value_value (left_value)), ret_value);
ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (left_value), ret_value);
ecma_simple_value_t is_in = ECMA_SIMPLE_VALUE_UNDEFINED;
ecma_string_t *left_value_prop_name_p = ecma_get_string_from_completion_value (str_left_value);
ecma_object_t *right_value_obj_p = ecma_get_object_from_completion_value (right_value);
ecma_string_t *left_value_prop_name_p = ecma_get_string_from_value (str_left_value);
ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);
if (ecma_op_object_get_property (right_value_obj_p, left_value_prop_name_p) != NULL)
{
@@ -74,6 +74,7 @@ opfunc_try_block (opcode_t opdata, /**< operation data */
catch_exc_var_name_str_p,
false);
JERRY_ASSERT (ecma_is_completion_value_empty (completion));
completion = ecma_op_set_mutable_binding (catch_env_p,
catch_exc_var_name_str_p,
ecma_get_completion_value_value (try_completion),
+1 -1
View File
@@ -118,7 +118,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */
ecma_op_to_string (arg_values[0]),
ret_value);
ecma_string_t *str_p = ecma_get_string_from_completion_value (str_value);
ecma_string_t *str_p = ecma_get_string_from_value (str_value);
int32_t chars = ecma_string_get_length (str_p);
JERRY_ASSERT (chars >= 0);
+57 -68
View File
@@ -110,7 +110,7 @@ opfunc_assignment (opcode_t opdata, /**< operation data */
}
else if (type_value_right == OPCODE_ARG_TYPE_VARIABLE)
{
ECMA_TRY_CATCH (get_value_completion,
ECMA_TRY_CATCH (var_value,
get_variable_value (int_data,
src_val_descr,
false),
@@ -119,9 +119,9 @@ opfunc_assignment (opcode_t opdata, /**< operation data */
ret_value = set_variable_value (int_data,
int_data->pos,
dst_var_idx,
ecma_get_completion_value_value (get_value_completion));
var_value);
ECMA_FINALIZE (get_value_completion);
ECMA_FINALIZE (var_value);
}
else if (type_value_right == OPCODE_ARG_TYPE_NUMBER)
{
@@ -201,9 +201,7 @@ opfunc_pre_incr (opcode_t opdata, /**< operation data */
// 1., 2., 3.
ECMA_TRY_CATCH (old_value, get_variable_value (int_data, incr_var_idx, true), ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (old_num,
ecma_get_completion_value_value (old_value),
ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (old_num, old_value, ret_value);
// 4.
ecma_number_t* new_num_p = int_data->tmp_num_p;
@@ -250,9 +248,7 @@ opfunc_pre_decr (opcode_t opdata, /**< operation data */
// 1., 2., 3.
ECMA_TRY_CATCH (old_value, get_variable_value (int_data, decr_var_idx, true), ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (old_num,
ecma_get_completion_value_value (old_value),
ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (old_num, old_value, ret_value);
// 4.
ecma_number_t* new_num_p = int_data->tmp_num_p;
@@ -299,9 +295,7 @@ opfunc_post_incr (opcode_t opdata, /**< operation data */
// 1., 2., 3.
ECMA_TRY_CATCH (old_value, get_variable_value (int_data, incr_var_idx, true), ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (old_num,
ecma_get_completion_value_value (old_value),
ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (old_num, old_value, ret_value);
// 4.
ecma_number_t* new_num_p = int_data->tmp_num_p;
@@ -349,9 +343,7 @@ opfunc_post_decr (opcode_t opdata, /**< operation data */
// 1., 2., 3.
ECMA_TRY_CATCH (old_value, get_variable_value (int_data, decr_var_idx, true), ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (old_num,
ecma_get_completion_value_value (old_value),
ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (old_num, old_value, ret_value);
// 4.
ecma_number_t* new_num_p = int_data->tmp_num_p;
@@ -677,42 +669,44 @@ opfunc_call_n (opcode_t opdata, /**< operation data */
{
JERRY_ASSERT (args_read == args_number);
ecma_completion_value_t this_value;
ecma_completion_value_t get_this_completion_value;
if (this_arg_var_idx_set)
{
this_value = get_variable_value (int_data, this_arg_var_idx, false);
get_this_completion_value = get_variable_value (int_data, this_arg_var_idx, false);
}
else
{
this_value = ecma_op_implicit_this_value (int_data->lex_env_p);
get_this_completion_value = ecma_op_implicit_this_value (int_data->lex_env_p);
}
JERRY_ASSERT (ecma_is_completion_value_normal (this_value));
JERRY_ASSERT (ecma_is_completion_value_normal (get_this_completion_value));
if (!ecma_op_is_callable (ecma_get_completion_value_value (func_value)))
ecma_value_t this_value = ecma_get_completion_value_value (get_this_completion_value);
if (!ecma_op_is_callable (func_value))
{
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
ecma_object_t *func_obj_p = ecma_get_object_from_completion_value (func_value);
ecma_object_t *func_obj_p = ecma_get_object_from_value (func_value);
ECMA_TRY_CATCH (call_completion,
ECMA_TRY_CATCH (call_ret_value,
ecma_op_function_call (func_obj_p,
ecma_get_completion_value_value (this_value),
this_value,
arg_values,
args_number),
ret_value);
ret_value = set_variable_value (int_data, lit_oc,
lhs_var_idx,
ecma_get_completion_value_value (call_completion));
call_ret_value);
ECMA_FINALIZE (call_completion);
ECMA_FINALIZE (call_ret_value);
}
ecma_free_completion_value (this_value);
ecma_free_completion_value (get_this_completion_value);
}
else
{
@@ -771,24 +765,24 @@ opfunc_construct_n (opcode_t opdata, /**< operation data */
{
JERRY_ASSERT (args_read == args_number);
if (!ecma_is_constructor (ecma_get_completion_value_value (constructor_value)))
if (!ecma_is_constructor (constructor_value))
{
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
ecma_object_t *constructor_obj_p = ecma_get_object_from_completion_value (constructor_value);
ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor_value);
ECMA_TRY_CATCH (construction_completion,
ECMA_TRY_CATCH (construction_ret_value,
ecma_op_function_construct (constructor_obj_p,
arg_values,
args_number),
ret_value);
ret_value = set_variable_value (int_data, lit_oc, lhs_var_idx,
ecma_get_completion_value_value (construction_completion));
construction_ret_value);
ECMA_FINALIZE (construction_completion);
ECMA_FINALIZE (construction_ret_value);
}
}
else
@@ -852,7 +846,7 @@ opfunc_array_decl (opcode_t opdata, /**< operation data */
ret_value = set_variable_value (int_data, lit_oc,
lhs_var_idx,
ecma_get_completion_value_value (array_obj_value));
array_obj_value);
ECMA_FINALIZE (array_obj_value);
}
@@ -933,12 +927,12 @@ opfunc_obj_decl (opcode_t opdata, /**< operation data */
false),
ret_value);
ECMA_TRY_CATCH (prop_name_str_value,
ecma_op_to_string (ecma_get_completion_value_value (prop_name_value)),
ecma_op_to_string (prop_name_value),
ret_value);
bool is_throw_syntax_error = false;
ecma_string_t *prop_name_string_p = ecma_get_string_from_completion_value (prop_name_str_value);
ecma_string_t *prop_name_string_p = ecma_get_string_from_value (prop_name_str_value);
ecma_property_t *previous_p = ecma_op_object_get_own_property (obj_p, prop_name_string_p);
const bool is_previous_undefined = (previous_p == NULL);
@@ -1076,7 +1070,7 @@ opfunc_retval (opcode_t opdata __unused, /**< operation data */
ECMA_TRY_CATCH (expr_val, get_variable_value (int_data, opdata.data.retval.ret_value, false), ret_value);
ret_value = ecma_make_return_completion_value (ecma_copy_value (ecma_get_completion_value_value (expr_val), true));
ret_value = ecma_make_return_completion_value (ecma_copy_value (expr_val, true));
ECMA_FINALIZE (expr_val);
@@ -1109,20 +1103,18 @@ opfunc_prop_getter (opcode_t opdata __unused, /**< operation data */
get_variable_value (int_data, prop_name_var_idx, false),
ret_value);
ECMA_TRY_CATCH (check_coercible_ret,
ecma_op_check_object_coercible (ecma_get_completion_value_value (base_value)),
ecma_op_check_object_coercible (base_value),
ret_value);
ECMA_TRY_CATCH (prop_name_str_value,
ecma_op_to_string (ecma_get_completion_value_value (prop_name_value)),
ecma_op_to_string (prop_name_value),
ret_value);
ecma_string_t *prop_name_string_p = ecma_get_string_from_completion_value (prop_name_str_value);
ecma_reference_t ref = ecma_make_reference (ecma_get_completion_value_value (base_value),
prop_name_string_p,
int_data->is_strict);
ecma_string_t *prop_name_string_p = ecma_get_string_from_value (prop_name_str_value);
ecma_reference_t ref = ecma_make_reference (base_value, prop_name_string_p, int_data->is_strict);
ECMA_TRY_CATCH (prop_value, ecma_op_get_value_object_base (ref), ret_value);
ret_value = set_variable_value (int_data, int_data->pos, lhs_var_idx, ecma_get_completion_value_value (prop_value));
ret_value = set_variable_value (int_data, int_data->pos, lhs_var_idx, prop_value);
ECMA_FINALIZE (prop_value);
@@ -1164,19 +1156,19 @@ opfunc_prop_setter (opcode_t opdata __unused, /**< operation data */
get_variable_value (int_data, prop_name_var_idx, false),
ret_value);
ECMA_TRY_CATCH (check_coercible_ret,
ecma_op_check_object_coercible (ecma_get_completion_value_value (base_value)),
ecma_op_check_object_coercible (base_value),
ret_value);
ECMA_TRY_CATCH (prop_name_str_value,
ecma_op_to_string (ecma_get_completion_value_value (prop_name_value)),
ecma_op_to_string (prop_name_value),
ret_value);
ecma_string_t *prop_name_string_p = ecma_get_string_from_completion_value (prop_name_str_value);
ecma_reference_t ref = ecma_make_reference (ecma_get_completion_value_value (base_value),
ecma_string_t *prop_name_string_p = ecma_get_string_from_value (prop_name_str_value);
ecma_reference_t ref = ecma_make_reference (base_value,
prop_name_string_p,
int_data->is_strict);
ECMA_TRY_CATCH (rhs_value, get_variable_value (int_data, rhs_var_idx, false), ret_value);
ret_value = ecma_op_put_value_object_base (ref, ecma_get_completion_value_value (rhs_value));
ret_value = ecma_op_put_value_object_base (ref, rhs_value);
ECMA_FINALIZE (rhs_value);
ecma_free_reference (ref);
@@ -1234,7 +1226,7 @@ opfunc_logical_not (opcode_t opdata, /**< operation data */
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
ecma_simple_value_t old_value = ECMA_SIMPLE_VALUE_TRUE;
ecma_completion_value_t to_bool_value = ecma_op_to_boolean (ecma_get_completion_value_value (right_value));
ecma_completion_value_t to_bool_value = ecma_op_to_boolean (right_value);
if (ecma_is_value_true (ecma_get_completion_value_value (to_bool_value)))
{
@@ -1300,12 +1292,12 @@ opfunc_with (opcode_t opdata, /**< operation data */
false),
ret_value);
ECMA_TRY_CATCH (obj_expr_value,
ecma_op_to_object (ecma_get_completion_value_value (expr_value)),
ecma_op_to_object (expr_value),
ret_value);
int_data->pos++;
ecma_object_t *obj_p = ecma_get_object_from_completion_value (obj_expr_value);
ecma_object_t *obj_p = ecma_get_object_from_value (obj_expr_value);
ecma_object_t *old_env_p = int_data->lex_env_p;
ecma_object_t *new_env_p = ecma_create_object_lex_env (old_env_p,
@@ -1364,7 +1356,7 @@ opfunc_throw_value (opcode_t opdata, /**< operation data */
false),
ret_value);
ret_value = ecma_make_throw_completion_value (ecma_copy_value (ecma_get_completion_value_value (var_value), true));
ret_value = ecma_make_throw_completion_value (ecma_copy_value (var_value, true));
ECMA_FINALIZE (var_value);
@@ -1438,12 +1430,11 @@ opfunc_typeof (opcode_t opdata, /**< operation data */
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (typeof_evaluate_arg_completion,
ECMA_TRY_CATCH (typeof_arg,
evaluate_arg_for_typeof (int_data,
obj_var_idx),
ret_value);
ecma_value_t typeof_arg = ecma_get_completion_value_value (typeof_evaluate_arg_completion);
ecma_string_t *type_str_p = NULL;
@@ -1487,7 +1478,7 @@ opfunc_typeof (opcode_t opdata, /**< operation data */
ecma_deref_ecma_string (type_str_p);
ECMA_FINALIZE (typeof_evaluate_arg_completion);
ECMA_FINALIZE (typeof_arg);
int_data->pos++;
@@ -1547,8 +1538,7 @@ opfunc_delete_var (opcode_t opdata, /**< operation data */
ref.referenced_name_cp)),
ret_value);
ret_value = set_variable_value (int_data, lit_oc, dst_var_idx,
ecma_get_completion_value_value (delete_completion));
ret_value = set_variable_value (int_data, lit_oc, dst_var_idx, delete_completion);
ECMA_FINALIZE (delete_completion);
}
@@ -1587,16 +1577,16 @@ opfunc_delete_prop (opcode_t opdata, /**< operation data */
get_variable_value (int_data, name_var_idx, false),
ret_value);
ECMA_TRY_CATCH (check_coercible_ret,
ecma_op_check_object_coercible (ecma_get_completion_value_value (base_value)),
ecma_op_check_object_coercible (base_value),
ret_value);
ECMA_TRY_CATCH (str_name_value,
ecma_op_to_string (ecma_get_completion_value_value (name_value)),
ecma_op_to_string (name_value),
ret_value);
JERRY_ASSERT (ecma_is_value_string (ecma_get_completion_value_value (str_name_value)));
ecma_string_t *name_string_p = ecma_get_string_from_completion_value (str_name_value);
JERRY_ASSERT (ecma_is_value_string (str_name_value));
ecma_string_t *name_string_p = ecma_get_string_from_value (str_name_value);
if (ecma_is_value_undefined (ecma_get_completion_value_value (base_value)))
if (ecma_is_value_undefined (base_value))
{
if (int_data->is_strict)
{
@@ -1610,20 +1600,19 @@ opfunc_delete_prop (opcode_t opdata, /**< operation data */
}
else
{
ECMA_TRY_CATCH (obj_value, ecma_op_to_object (ecma_get_completion_value_value (base_value)), ret_value);
ECMA_TRY_CATCH (obj_value, ecma_op_to_object (base_value), ret_value);
JERRY_ASSERT (ecma_is_value_object (ecma_get_completion_value_value (obj_value)));
ecma_object_t *obj_p = ecma_get_object_from_completion_value (obj_value);
JERRY_ASSERT (ecma_is_value_object (obj_value));
ecma_object_t *obj_p = ecma_get_object_from_value (obj_value);
JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));
ECMA_TRY_CATCH (delete_op_completion,
ECMA_TRY_CATCH (delete_op_ret_val,
ecma_op_object_delete (obj_p, name_string_p, int_data->is_strict),
ret_value);
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx,
ecma_get_completion_value_value (delete_op_completion));
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx, delete_op_ret_val);
ECMA_FINALIZE (delete_op_completion);
ECMA_FINALIZE (delete_op_ret_val);
ECMA_FINALIZE (obj_value);
}
@@ -58,26 +58,26 @@ ecma_builtin_boolean_prototype_object_to_string (const ecma_value_t& this_arg) /
{
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (completion_value_of,
ECMA_TRY_CATCH (value_of_ret,
ecma_builtin_boolean_prototype_object_value_of (this_arg),
ret_value);
ecma_string_t *ret_str_p;
if (ecma_is_completion_value_normal_true (completion_value_of))
if (ecma_is_value_true (value_of_ret))
{
ret_str_p = ecma_get_magic_string (ECMA_MAGIC_STRING_TRUE);
}
else
{
JERRY_ASSERT (ecma_is_completion_value_normal_false (completion_value_of));
JERRY_ASSERT (ecma_is_value_boolean (value_of_ret));
ret_str_p = ecma_get_magic_string (ECMA_MAGIC_STRING_FALSE);
}
ret_value = ecma_make_normal_completion_value (ecma_make_string_value (ret_str_p));
ECMA_FINALIZE (completion_value_of);
ECMA_FINALIZE (value_of_ret);
return ret_value;
} /* ecma_builtin_boolean_prototype_object_to_string */
@@ -68,13 +68,13 @@ ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
ecma_string_t *name_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_NAME);
ECMA_TRY_CATCH (name_get_completion,
ECMA_TRY_CATCH (name_get_ret_value,
ecma_op_object_get (obj_p, name_magic_string_p),
ret_value);
ecma_completion_value_t name_to_str_completion;
if (ecma_is_completion_value_normal_simple_value (name_get_completion, ECMA_SIMPLE_VALUE_UNDEFINED))
if (ecma_is_value_undefined (name_get_ret_value))
{
ecma_string_t *error_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_ERROR_UL);
@@ -82,7 +82,7 @@ ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**
}
else
{
name_to_str_completion = ecma_op_to_string (ecma_get_completion_value_value (name_get_completion));
name_to_str_completion = ecma_op_to_string (name_get_ret_value);
}
if (unlikely (!ecma_is_completion_value_normal (name_to_str_completion)))
@@ -93,13 +93,13 @@ ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**
{
ecma_string_t *message_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_MESSAGE);
ECMA_TRY_CATCH (msg_get_completion,
ECMA_TRY_CATCH (msg_get_ret_value,
ecma_op_object_get (obj_p, message_magic_string_p),
ret_value);
ecma_completion_value_t msg_to_str_completion;
if (ecma_is_completion_value_normal_simple_value (msg_get_completion, ECMA_SIMPLE_VALUE_UNDEFINED))
if (ecma_is_value_undefined (msg_get_ret_value))
{
ecma_string_t *empty_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING__EMPTY);
@@ -107,7 +107,7 @@ ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**
}
else
{
msg_to_str_completion = ecma_op_to_string (ecma_get_completion_value_value (msg_get_completion));
msg_to_str_completion = ecma_op_to_string (msg_get_ret_value);
}
if (unlikely (!ecma_is_completion_value_normal (msg_to_str_completion)))
@@ -116,9 +116,6 @@ ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**
}
else
{
JERRY_ASSERT (ecma_is_value_string (ecma_get_completion_value_value (name_to_str_completion)));
JERRY_ASSERT (ecma_is_value_string (ecma_get_completion_value_value (msg_to_str_completion)));
ecma_string_t *name_string_p = ecma_get_string_from_completion_value (name_to_str_completion);
ecma_string_t *msg_string_p = ecma_get_string_from_completion_value (msg_to_str_completion);
@@ -185,14 +182,14 @@ ecma_builtin_error_prototype_object_to_string (const ecma_value_t& this_arg) /**
ecma_free_completion_value (msg_to_str_completion);
ECMA_FINALIZE (msg_get_completion);
ECMA_FINALIZE (msg_get_ret_value);
ecma_deref_ecma_string (message_magic_string_p);
}
ecma_free_completion_value (name_to_str_completion);
ECMA_FINALIZE (name_get_completion);
ECMA_FINALIZE (name_get_ret_value);
ecma_deref_ecma_string (name_magic_string_p);
}
+3 -3
View File
@@ -59,16 +59,16 @@ ecma_builtin_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg
{
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (msg_to_str_completion,
ECMA_TRY_CATCH (msg_str_value,
ecma_op_to_string (arguments_list_p[0]),
ret_value);
ecma_string_t *message_string_p = ecma_get_string_from_completion_value (msg_to_str_completion);
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_COMMON,
message_string_p);
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
ECMA_FINALIZE (msg_to_str_completion);
ECMA_FINALIZE (msg_str_value);
return ret_value;
}
+3 -3
View File
@@ -59,16 +59,16 @@ ecma_builtin_eval_error_dispatch_call (const ecma_value_t *arguments_list_p, /**
{
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (msg_to_str_completion,
ECMA_TRY_CATCH (msg_str_value,
ecma_op_to_string (arguments_list_p[0]),
ret_value);
ecma_string_t *message_string_p = ecma_get_string_from_completion_value (msg_to_str_completion);
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_EVAL,
message_string_p);
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
ECMA_FINALIZE (msg_to_str_completion);
ECMA_FINALIZE (msg_str_value);
return ret_value;
}
+1 -1
View File
@@ -325,7 +325,7 @@ ecma_builtin_object_object_define_property (const ecma_value_t& this_arg __unuse
ecma_op_to_string (arg2),
ret_value);
ecma_string_t *name_str_p = ecma_get_string_from_completion_value (name_str_value);
ecma_string_t *name_str_p = ecma_get_string_from_value (name_str_value);
ecma_property_descriptor_t prop_desc;
@@ -59,16 +59,16 @@ ecma_builtin_range_error_dispatch_call (const ecma_value_t *arguments_list_p, /*
{
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (msg_to_str_completion,
ECMA_TRY_CATCH (msg_str_value,
ecma_op_to_string (arguments_list_p[0]),
ret_value);
ecma_string_t *message_string_p = ecma_get_string_from_completion_value (msg_to_str_completion);
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_RANGE,
message_string_p);
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
ECMA_FINALIZE (msg_to_str_completion);
ECMA_FINALIZE (msg_str_value);
return ret_value;
}
@@ -59,16 +59,16 @@ ecma_builtin_reference_error_dispatch_call (const ecma_value_t *arguments_list_p
{
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (msg_to_str_completion,
ECMA_TRY_CATCH (msg_str_value,
ecma_op_to_string (arguments_list_p[0]),
ret_value);
ecma_string_t *message_string_p = ecma_get_string_from_completion_value (msg_to_str_completion);
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_REFERENCE,
message_string_p);
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
ECMA_FINALIZE (msg_to_str_completion);
ECMA_FINALIZE (msg_str_value);
return ret_value;
}
@@ -59,16 +59,16 @@ ecma_builtin_syntax_error_dispatch_call (const ecma_value_t *arguments_list_p, /
{
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (msg_to_str_completion,
ECMA_TRY_CATCH (msg_str_value,
ecma_op_to_string (arguments_list_p[0]),
ret_value);
ecma_string_t *message_string_p = ecma_get_string_from_completion_value (msg_to_str_completion);
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_SYNTAX,
message_string_p);
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
ECMA_FINALIZE (msg_to_str_completion);
ECMA_FINALIZE (msg_str_value);
return ret_value;
}
+3 -3
View File
@@ -59,16 +59,16 @@ ecma_builtin_type_error_dispatch_call (const ecma_value_t *arguments_list_p, /**
{
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (msg_to_str_completion,
ECMA_TRY_CATCH (msg_str_value,
ecma_op_to_string (arguments_list_p[0]),
ret_value);
ecma_string_t *message_string_p = ecma_get_string_from_completion_value (msg_to_str_completion);
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_TYPE,
message_string_p);
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
ECMA_FINALIZE (msg_to_str_completion);
ECMA_FINALIZE (msg_str_value);
return ret_value;
}
+3 -3
View File
@@ -59,16 +59,16 @@ ecma_builtin_uri_error_dispatch_call (const ecma_value_t *arguments_list_p, /**<
{
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (msg_to_str_completion,
ECMA_TRY_CATCH (msg_str_value,
ecma_op_to_string (arguments_list_p[0]),
ret_value);
ecma_string_t *message_string_p = ecma_get_string_from_completion_value (msg_to_str_completion);
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_URI,
message_string_p);
ret_value = ecma_make_normal_completion_value (ecma_make_object_value (new_error_object_p));
ECMA_FINALIZE (msg_to_str_completion);
ECMA_FINALIZE (msg_str_value);
return ret_value;
}
+14 -26
View File
@@ -139,8 +139,7 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
ecma_op_to_number (y),
ret_value);
ret_value = ecma_op_abstract_equality_compare (x,
ecma_get_completion_value_value (y_num_value));
ret_value = ecma_op_abstract_equality_compare (x, y_num_value);
ECMA_FINALIZE (y_num_value);
}
@@ -151,8 +150,7 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
ecma_op_to_number (x),
ret_value);
ret_value = ecma_op_abstract_equality_compare (ecma_get_completion_value_value (x_num_value),
y);
ret_value = ecma_op_abstract_equality_compare (x_num_value, y);
ECMA_FINALIZE (x_num_value);
}
@@ -163,8 +161,7 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
ecma_op_to_number (x),
ret_value);
ret_value = ecma_op_abstract_equality_compare (ecma_get_completion_value_value (x_num_value),
y);
ret_value = ecma_op_abstract_equality_compare (x_num_value, y);
ECMA_FINALIZE (x_num_value);
}
@@ -175,8 +172,7 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
ecma_op_to_number (y),
ret_value);
ret_value = ecma_op_abstract_equality_compare (x,
ecma_get_completion_value_value (y_num_value));
ret_value = ecma_op_abstract_equality_compare (x, y_num_value);
ECMA_FINALIZE (y_num_value);
}
@@ -188,8 +184,7 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
ecma_op_to_primitive (y, ECMA_PREFERRED_TYPE_NO),
ret_value);
ret_value = ecma_op_abstract_equality_compare (x,
ecma_get_completion_value_value (y_prim_value));
ret_value = ecma_op_abstract_equality_compare (x, y_prim_value);
ECMA_FINALIZE (y_prim_value);
}
@@ -201,8 +196,7 @@ ecma_op_abstract_equality_compare (const ecma_value_t& x, /**< first operand */
ecma_op_to_primitive (x, ECMA_PREFERRED_TYPE_NO),
ret_value);
ret_value = ecma_op_abstract_equality_compare (ecma_get_completion_value_value (x_prim_value),
y);
ret_value = ecma_op_abstract_equality_compare (x_prim_value, y);
ECMA_FINALIZE (x_prim_value);
}
@@ -352,25 +346,19 @@ ecma_op_abstract_relational_compare (const ecma_value_t& x, /**< first operand *
ecma_op_to_primitive (second_converted_value, ECMA_PREFERRED_TYPE_NUMBER),
ret_value);
ecma_completion_value_t px, py;
const ecma_value_t &px = left_first ? prim_first_converted_value : prim_second_converted_value;
const ecma_value_t &py = left_first ? prim_second_converted_value : prim_first_converted_value;
px = left_first ? prim_first_converted_value : prim_second_converted_value;
py = left_first ? prim_second_converted_value : prim_first_converted_value;
const bool is_px_string = ecma_is_value_string (ecma_get_completion_value_value (px));
const bool is_py_string = ecma_is_value_string (ecma_get_completion_value_value (py));
const bool is_px_string = ecma_is_value_string (px);
const bool is_py_string = ecma_is_value_string (py);
if (!(is_px_string && is_py_string))
{
// 3.
// a.
ECMA_OP_TO_NUMBER_TRY_CATCH (nx,
ecma_get_completion_value_value (px),
ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (ny,
ecma_get_completion_value_value (py),
ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (nx, px, ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (ny, py, ret_value);
// b.
if (ecma_number_is_nan (nx)
@@ -451,8 +439,8 @@ ecma_op_abstract_relational_compare (const ecma_value_t& x, /**< first operand *
{ // 4.
JERRY_ASSERT (is_px_string && is_py_string);
ecma_string_t *str_x_p = ecma_get_string_from_completion_value (px);
ecma_string_t *str_y_p = ecma_get_string_from_completion_value (py);
ecma_string_t *str_x_p = ecma_get_string_from_value (px);
ecma_string_t *str_y_p = ecma_get_string_from_value (py);
bool is_px_less = ecma_compare_ecma_strings_relational (str_x_p, str_y_p);
+24 -24
View File
@@ -269,13 +269,13 @@ ecma_op_to_number (const ecma_value_t& value) /**< ecma-value */
{
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (completion_to_primitive,
ECMA_TRY_CATCH (primitive_value,
ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_NUMBER),
ret_value);
ret_value = ecma_op_to_number (ecma_get_completion_value_value (completion_to_primitive));
ret_value = ecma_op_to_number (primitive_value);
ECMA_FINALIZE (completion_to_primitive);
ECMA_FINALIZE (primitive_value);
return ret_value;
}
@@ -331,7 +331,7 @@ ecma_op_to_string (const ecma_value_t& value) /**< ecma-value */
ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_STRING),
ret_value);
ret_value = ecma_op_to_string (ecma_get_completion_value_value (prim_value));
ret_value = ecma_op_to_string (prim_value);
ECMA_FINALIZE (prim_value);
@@ -585,17 +585,17 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
ecma_op_object_get (obj_p, enumerable_magic_string_p),
ret_value);
ECMA_TRY_CATCH (boolean_enumerable_prop_value,
ecma_op_to_boolean (ecma_get_completion_value_value (enumerable_prop_value)),
ecma_op_to_boolean (enumerable_prop_value),
ret_value);
prop_desc.is_enumerable_defined = true;
if (ecma_is_completion_value_normal_true (boolean_enumerable_prop_value))
if (ecma_is_value_true (boolean_enumerable_prop_value))
{
prop_desc.is_enumerable = true;
}
else
{
JERRY_ASSERT (ecma_is_completion_value_normal_false (boolean_enumerable_prop_value));
JERRY_ASSERT (ecma_is_value_boolean (boolean_enumerable_prop_value));
prop_desc.is_enumerable = false;
}
@@ -619,17 +619,17 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
ecma_op_object_get (obj_p, configurable_magic_string_p),
ret_value);
ECMA_TRY_CATCH (boolean_configurable_prop_value,
ecma_op_to_boolean (ecma_get_completion_value_value (configurable_prop_value)),
ecma_op_to_boolean (configurable_prop_value),
ret_value);
prop_desc.is_configurable_defined = true;
if (ecma_is_completion_value_normal_true (boolean_configurable_prop_value))
if (ecma_is_value_true (boolean_configurable_prop_value))
{
prop_desc.is_configurable = true;
}
else
{
JERRY_ASSERT (ecma_is_completion_value_normal_false (boolean_configurable_prop_value));
JERRY_ASSERT (ecma_is_value_boolean (boolean_configurable_prop_value));
prop_desc.is_configurable = false;
}
@@ -655,7 +655,7 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
ret_value);
prop_desc.is_value_defined = true;
prop_desc.value = ecma_copy_value (ecma_get_completion_value_value (value_prop_value), true);
prop_desc.value = ecma_copy_value (value_prop_value, true);
ECMA_FINALIZE (value_prop_value);
}
@@ -676,17 +676,17 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
ecma_op_object_get (obj_p, writable_magic_string_p),
ret_value);
ECMA_TRY_CATCH (boolean_writable_prop_value,
ecma_op_to_boolean (ecma_get_completion_value_value (writable_prop_value)),
ecma_op_to_boolean (writable_prop_value),
ret_value);
prop_desc.is_writable_defined = true;
if (ecma_is_completion_value_normal_true (boolean_writable_prop_value))
if (ecma_is_value_true (boolean_writable_prop_value))
{
prop_desc.is_writable = true;
}
else
{
JERRY_ASSERT (ecma_is_completion_value_normal_false (boolean_writable_prop_value));
JERRY_ASSERT (ecma_is_value_boolean (boolean_writable_prop_value));
prop_desc.is_writable = false;
}
@@ -711,8 +711,8 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
ecma_op_object_get (obj_p, get_magic_string_p),
ret_value);
if (!ecma_op_is_callable (ecma_get_completion_value_value (get_prop_value))
&& !ecma_is_value_undefined (ecma_get_completion_value_value (get_prop_value)))
if (!ecma_op_is_callable (get_prop_value)
&& !ecma_is_value_undefined (get_prop_value))
{
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
@@ -720,15 +720,15 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
{
prop_desc.is_get_defined = true;
if (ecma_is_value_undefined (ecma_get_completion_value_value (get_prop_value)))
if (ecma_is_value_undefined (get_prop_value))
{
prop_desc.get_p = NULL;
}
else
{
JERRY_ASSERT (ecma_is_value_object (ecma_get_completion_value_value (get_prop_value)));
JERRY_ASSERT (ecma_is_value_object (get_prop_value));
ecma_object_t *get_p = ecma_get_object_from_completion_value (get_prop_value);
ecma_object_t *get_p = ecma_get_object_from_value (get_prop_value);
ecma_ref_object (get_p);
prop_desc.get_p = get_p;
@@ -755,8 +755,8 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
ecma_op_object_get (obj_p, set_magic_string_p),
ret_value);
if (!ecma_op_is_callable (ecma_get_completion_value_value (set_prop_value))
&& !ecma_is_value_undefined (ecma_get_completion_value_value (set_prop_value)))
if (!ecma_op_is_callable (set_prop_value)
&& !ecma_is_value_undefined (set_prop_value))
{
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
@@ -764,15 +764,15 @@ ecma_op_to_property_descriptor (const ecma_value_t& obj_value, /**< object value
{
prop_desc.is_set_defined = true;
if (ecma_is_value_undefined (ecma_get_completion_value_value (set_prop_value)))
if (ecma_is_value_undefined (set_prop_value))
{
prop_desc.set_p = NULL;
}
else
{
JERRY_ASSERT (ecma_is_value_object (ecma_get_completion_value_value (set_prop_value)));
JERRY_ASSERT (ecma_is_value_object (set_prop_value));
ecma_object_t *set_p = ecma_get_object_from_completion_value (set_prop_value);
ecma_object_t *set_p = ecma_get_object_from_value (set_prop_value);
ecma_ref_object (set_p);
prop_desc.set_p = set_p;
+8 -8
View File
@@ -399,13 +399,13 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
ecma_op_object_get (func_obj_p, prototype_magic_string_p),
ret_value);
if (!ecma_is_value_object (ecma_get_completion_value_value (prototype_obj_value)))
if (!ecma_is_value_object (prototype_obj_value))
{
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
ecma_object_t *prototype_obj_p = ecma_get_object_from_completion_value (prototype_obj_value);
ecma_object_t *prototype_obj_p = ecma_get_object_from_value (prototype_obj_value);
JERRY_ASSERT (prototype_obj_p != NULL);
do
@@ -513,7 +513,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
ecma_object_t *local_env_p = ecma_create_decl_lex_env (scope_p);
// 9.
ECMA_TRY_CATCH (args_var_declaration_completion,
ECMA_TRY_CATCH (args_var_declaration_ret,
ecma_function_call_setup_args_variables (func_obj_p,
local_env_p,
arguments_list_p,
@@ -535,7 +535,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
ret_value = completion;
}
ECMA_FINALIZE (args_var_declaration_completion);
ECMA_FINALIZE (args_var_declaration_ret);
ecma_deref_object (local_env_p);
ecma_free_value (this_binding, true);
@@ -591,9 +591,9 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
// 6.
ecma_object_t *prototype_p;
if (ecma_is_value_object (ecma_get_completion_value_value (func_obj_prototype_prop_value)))
if (ecma_is_value_object (func_obj_prototype_prop_value))
{
prototype_p = ecma_get_object_from_completion_value (func_obj_prototype_prop_value);
prototype_p = ecma_get_object_from_value (func_obj_prototype_prop_value);
ecma_ref_object (prototype_p);
}
else
@@ -622,11 +622,11 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
ecma_value_t obj_value;
// 9.
if (ecma_is_value_object (ecma_get_completion_value_value (call_completion)))
if (ecma_is_value_object (call_completion))
{
ecma_deref_object (obj_p);
obj_value = ecma_copy_value (ecma_get_completion_value_value (call_completion), true);
obj_value = ecma_copy_value (call_completion, true);
}
else
{
+6 -6
View File
@@ -108,7 +108,7 @@ ecma_op_get_value_object_base (ecma_reference_t ref) /**< ECMA-reference */
ECMA_TRY_CATCH (obj_base, ecma_op_to_object (base), ret_value);
ecma_object_t *obj_p = ecma_get_object_from_completion_value (obj_base);
ecma_object_t *obj_p = ecma_get_object_from_value (obj_base);
JERRY_ASSERT (obj_p != NULL
&& !ecma_is_lexical_environment (obj_p));
@@ -229,7 +229,7 @@ ecma_op_put_value_object_base (ecma_reference_t ref, /**< ECMA-reference */
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (put_completion,
ECMA_TRY_CATCH (put_ret_value,
ecma_op_object_put (obj_p,
ECMA_GET_NON_NULL_POINTER (ecma_string_t,
ref.referenced_name_cp),
@@ -239,7 +239,7 @@ ecma_op_put_value_object_base (ecma_reference_t ref, /**< ECMA-reference */
ret_value = ecma_make_empty_completion_value ();
ECMA_FINALIZE (put_completion);
ECMA_FINALIZE (put_ret_value);
return ret_value;
}
@@ -251,7 +251,7 @@ ecma_op_put_value_object_base (ecma_reference_t ref, /**< ECMA-reference */
// sub_1.
ECMA_TRY_CATCH (obj_base, ecma_op_to_object (base), ret_value);
ecma_object_t *obj_p = ecma_get_object_from_completion_value (obj_base);
ecma_object_t *obj_p = ecma_get_object_from_value (obj_base);
JERRY_ASSERT (obj_p != NULL
&& !ecma_is_lexical_environment (obj_p));
@@ -288,13 +288,13 @@ ecma_op_put_value_object_base (ecma_reference_t ref, /**< ECMA-reference */
prop_p->u.named_accessor_property.set_p);
JERRY_ASSERT (setter_p != NULL);
ECMA_TRY_CATCH (call_completion,
ECMA_TRY_CATCH (call_ret,
ecma_op_function_call (setter_p, base, &value, 1),
ret_value);
ret_value = ecma_make_empty_completion_value ();
ECMA_FINALIZE (call_completion);
ECMA_FINALIZE (call_ret);
}
}
@@ -503,13 +503,13 @@ ecma_op_arguments_object_delete (ecma_object_t *obj_p, /**< the object */
// 3.
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (delete_in_args_completion,
ECMA_TRY_CATCH (delete_in_args_ret,
ecma_op_general_object_delete (obj_p,
property_name_p,
is_throw),
ret_value);
if (ecma_is_completion_value_normal_true (delete_in_args_completion))
if (ecma_is_value_true (delete_in_args_ret))
{
if (mapped_prop_p != NULL)
{
@@ -523,12 +523,12 @@ ecma_op_arguments_object_delete (ecma_object_t *obj_p, /**< the object */
}
else
{
JERRY_ASSERT (ecma_is_completion_value_normal_false (delete_in_args_completion));
JERRY_ASSERT (ecma_is_value_boolean (delete_in_args_ret));
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE);
}
ECMA_FINALIZE (delete_in_args_completion);
ECMA_FINALIZE (delete_in_args_ret);
return ret_value;
} /* ecma_op_arguments_object_delete */
+2 -2
View File
@@ -292,7 +292,7 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */
ecma_completion_value_t ret_value;
ECMA_TRY_CATCH (call_completion,
ECMA_TRY_CATCH (call_ret,
ecma_op_function_call (setter_p,
ecma_make_object_value (obj_p),
&value,
@@ -301,7 +301,7 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
ECMA_FINALIZE (call_completion);
ECMA_FINALIZE (call_ret);
return ret_value;
}
+10 -8
View File
@@ -30,14 +30,16 @@
* statement with same argument as corresponding ECMA_TRY_CATCH's first argument.
*/
#define ECMA_TRY_CATCH(var, op, return_value) \
ecma_completion_value_t var = op; \
if (unlikely (ecma_is_completion_value_throw (var))) \
ecma_completion_value_t var ## _completion = op; \
if (unlikely (ecma_is_completion_value_throw (var ## _completion))) \
{ \
return_value = var; \
return_value = var ## _completion; \
} \
else \
{ \
JERRY_ASSERT(ecma_is_completion_value_normal (var))
JERRY_ASSERT(ecma_is_completion_value_normal (var ## _completion)); \
\
ecma_value_t var __unused = ecma_get_completion_value_value (var ## _completion)
/**
* The macro marks end of code block that is defined by corresponding
@@ -47,7 +49,7 @@
* Each ECMA_TRY_CATCH should be followed by ECMA_FINALIZE with same argument
* as corresponding ECMA_TRY_CATCH's first argument.
*/
#define ECMA_FINALIZE(var) ecma_free_completion_value (var); \
#define ECMA_FINALIZE(var) ecma_free_completion_value (var ## _completion); \
}
/**
@@ -70,13 +72,13 @@
} \
else \
{ \
ECMA_TRY_CATCH (to_number_completion_value, \
ECMA_TRY_CATCH (to_number_value, \
ecma_op_to_number (value), \
return_value); \
\
num_var = *ecma_get_number_from_completion_value (to_number_completion_value); \
num_var = *ecma_get_number_from_value (to_number_value); \
\
ECMA_FINALIZE (to_number_completion_value); \
ECMA_FINALIZE (to_number_value); \
} \
\
if (ecma_is_completion_value_empty (return_value)) \