diff --git a/src/libcoreint/opcodes-ecma-arithmetics.c b/src/libcoreint/opcodes-ecma-arithmetics.c index 2569ff4b1..64e6b6d6e 100644 --- a/src/libcoreint/opcodes-ecma-arithmetics.c +++ b/src/libcoreint/opcodes-ecma-arithmetics.c @@ -54,8 +54,8 @@ do_number_arithmetic (int_data_t *int_data, /**< interpreter context */ ECMA_TRY_CATCH (num_right_value, ecma_op_to_number (right_value), ret_value); ecma_number_t *left_p, *right_p, *res_p; - left_p = (ecma_number_t*) ECMA_GET_POINTER (num_left_value.u.value.value); - right_p = (ecma_number_t*) ECMA_GET_POINTER (num_right_value.u.value.value); + left_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (num_left_value.u.value.value); + right_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (num_right_value.u.value.value); res_p = ecma_alloc_number (); @@ -131,8 +131,8 @@ opfunc_addition (opcode_t opdata, /**< operation data */ ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (prim_left_value.u.value), ret_value); ECMA_TRY_CATCH (str_right_value, ecma_op_to_string (prim_right_value.u.value), ret_value); - ecma_string_t *string1_p = ECMA_GET_POINTER (str_left_value.u.value.value); - ecma_string_t *string2_p = ECMA_GET_POINTER (str_right_value.u.value.value); + ecma_string_t *string1_p = ECMA_GET_NON_NULL_POINTER (str_left_value.u.value.value); + ecma_string_t *string2_p = ECMA_GET_NON_NULL_POINTER (str_right_value.u.value.value); ecma_string_t *concat_str_p = ecma_concat_ecma_strings (string1_p, string2_p); @@ -322,7 +322,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_TRY_CATCH (num_value, ecma_op_to_number (var_value.u.value), ret_value); - ecma_number_t *var_p = (ecma_number_t*) ECMA_GET_POINTER (num_value.u.value.value); + ecma_number_t *var_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (num_value.u.value.value); ret_value = set_variable_value (int_data, dst_var_idx, ecma_make_number_value (var_p)); @@ -356,7 +356,7 @@ opfunc_unary_minus (opcode_t opdata, /**< operation data */ ECMA_TRY_CATCH (num_value, ecma_op_to_number (var_value.u.value), ret_value); ecma_number_t *var_p, *res_p; - var_p = (ecma_number_t*) ECMA_GET_POINTER (num_value.u.value.value); + var_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (num_value.u.value.value); res_p = ecma_alloc_number (); if (ecma_number_is_nan (*var_p)) diff --git a/src/libcoreint/opcodes-ecma-bitwise.c b/src/libcoreint/opcodes-ecma-bitwise.c index bedb7cc4f..4d14d53de 100644 --- a/src/libcoreint/opcodes-ecma-bitwise.c +++ b/src/libcoreint/opcodes-ecma-bitwise.c @@ -54,8 +54,8 @@ do_number_bitwise_logic (int_data_t *int_data, /**< interpreter context */ ECMA_TRY_CATCH (num_right_value, ecma_op_to_number (right_value), ret_value); ecma_number_t *left_p, *right_p; - left_p = (ecma_number_t*) ECMA_GET_POINTER (num_left_value.u.value.value); - right_p = (ecma_number_t*) ECMA_GET_POINTER (num_right_value.u.value.value); + left_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (num_left_value.u.value.value); + right_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (num_right_value.u.value.value); ecma_number_t* res_p = ecma_alloc_number (); diff --git a/src/libcoreint/opcodes-ecma-relational.c b/src/libcoreint/opcodes-ecma-relational.c index d8b5b302f..a30cdbd8e 100644 --- a/src/libcoreint/opcodes-ecma-relational.c +++ b/src/libcoreint/opcodes-ecma-relational.c @@ -259,7 +259,7 @@ opfunc_instanceof (opcode_t opdata __unused, /**< operation data */ } else { - ecma_object_t *right_value_obj_p = ECMA_GET_POINTER (right_value.u.value.value); + ecma_object_t *right_value_obj_p = ECMA_GET_NON_NULL_POINTER (right_value.u.value.value); ECMA_TRY_CATCH (is_instance_of, ecma_op_object_has_instance (right_value_obj_p, @@ -309,8 +309,8 @@ opfunc_in (opcode_t opdata __unused, /**< operation data */ ECMA_TRY_CATCH (str_left_value, ecma_op_to_string (left_value.u.value), ret_value); ecma_simple_value_t is_in = ECMA_SIMPLE_VALUE_UNDEFINED; - ecma_string_t *left_value_prop_name_p = ECMA_GET_POINTER (str_left_value.u.value.value); - ecma_object_t *right_value_obj_p = ECMA_GET_POINTER (right_value.u.value.value); + ecma_string_t *left_value_prop_name_p = ECMA_GET_NON_NULL_POINTER (str_left_value.u.value.value); + ecma_object_t *right_value_obj_p = ECMA_GET_NON_NULL_POINTER (right_value.u.value.value); if (ecma_op_object_has_property (right_value_obj_p, left_value_prop_name_p)) { diff --git a/src/libcoreint/opcodes-helpers-variables.c b/src/libcoreint/opcodes-helpers-variables.c index 942def6ad..53f240794 100644 --- a/src/libcoreint/opcodes-helpers-variables.c +++ b/src/libcoreint/opcodes-helpers-variables.c @@ -42,9 +42,9 @@ do_strict_eval_arguments_check (ecma_reference_t ref) /**< ECMA-reference */ ecma_string_t* magic_string_eval = ecma_get_magic_string (ECMA_MAGIC_STRING_EVAL); ecma_string_t* magic_string_arguments = ecma_get_magic_string (ECMA_MAGIC_STRING_ARGUMENTS); - ret = (ecma_compare_ecma_strings (ECMA_GET_POINTER (ref.referenced_name_cp), + ret = (ecma_compare_ecma_strings (ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp), magic_string_eval) - || ecma_compare_ecma_strings (ECMA_GET_POINTER (ref.referenced_name_cp), + || ecma_compare_ecma_strings (ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp), magic_string_arguments)); ecma_deref_ecma_string (magic_string_eval); diff --git a/src/libcoreint/opcodes-native-call.c b/src/libcoreint/opcodes-native-call.c index bd72fc5d7..ddcd1c0d0 100644 --- a/src/libcoreint/opcodes-native-call.c +++ b/src/libcoreint/opcodes-native-call.c @@ -63,7 +63,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */ { JERRY_ASSERT (args_number == 1); JERRY_ASSERT (arg_values[0].value_type == ECMA_TYPE_NUMBER); - ecma_number_t* num_p = (ecma_number_t*) ECMA_GET_POINTER (arg_values[0].value); + ecma_number_t* num_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_values[0].value); uint32_t int_num = ecma_number_to_uint32 (*num_p); led_toggle (int_num); @@ -74,7 +74,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */ { JERRY_ASSERT (args_number == 1); JERRY_ASSERT (arg_values[0].value_type == ECMA_TYPE_NUMBER); - ecma_number_t* num_p = (ecma_number_t*) ECMA_GET_POINTER (arg_values[0].value); + ecma_number_t* num_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_values[0].value); uint32_t int_num = ecma_number_to_uint32 (*num_p); led_on (int_num); @@ -85,7 +85,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */ { JERRY_ASSERT (args_number == 1); JERRY_ASSERT (arg_values[0].value_type == ECMA_TYPE_NUMBER); - ecma_number_t* num_p = (ecma_number_t*) ECMA_GET_POINTER (arg_values[0].value); + ecma_number_t* num_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_values[0].value); uint32_t int_num = ecma_number_to_uint32 (*num_p); led_off (int_num); @@ -96,7 +96,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */ { JERRY_ASSERT (args_number == 1); JERRY_ASSERT (arg_values[0].value_type == ECMA_TYPE_NUMBER); - ecma_number_t* num_p = (ecma_number_t*) ECMA_GET_POINTER (arg_values[0].value); + ecma_number_t* num_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_values[0].value); uint32_t int_num = ecma_number_to_uint32 (*num_p); led_blink_once (int_num); @@ -107,7 +107,7 @@ opfunc_native_call (opcode_t opdata, /**< operation data */ { JERRY_ASSERT (args_number == 1); JERRY_ASSERT (arg_values[0].value_type == ECMA_TYPE_NUMBER); - ecma_number_t* num_p = (ecma_number_t*) ECMA_GET_POINTER (arg_values[0].value); + ecma_number_t* num_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_values[0].value); uint32_t int_num = ecma_number_to_uint32 (*num_p); wait_ms (int_num); @@ -123,7 +123,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_POINTER (str_value.u.value.value); + ecma_string_t *str_p = ECMA_GET_NON_NULL_POINTER (str_value.u.value.value); int32_t chars = ecma_string_get_length (str_p); JERRY_ASSERT (chars >= 0); diff --git a/src/libcoreint/opcodes.c b/src/libcoreint/opcodes.c index 22dd5f39d..849db24b6 100644 --- a/src/libcoreint/opcodes.c +++ b/src/libcoreint/opcodes.c @@ -177,7 +177,7 @@ opfunc_pre_incr (opcode_t opdata, /**< operation data */ // 4. ecma_number_t* new_num_p = ecma_alloc_number (); - ecma_number_t* old_num_p = (ecma_number_t*) ECMA_GET_POINTER (old_num_value.u.value.value); + ecma_number_t* old_num_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (old_num_value.u.value.value); *new_num_p = ecma_number_add (*old_num_p, ECMA_NUMBER_ONE); ecma_value_t new_num_value = ecma_make_number_value (new_num_p); @@ -227,7 +227,7 @@ opfunc_pre_decr (opcode_t opdata, /**< operation data */ // 4. ecma_number_t* new_num_p = ecma_alloc_number (); - ecma_number_t* old_num_p = (ecma_number_t*) ECMA_GET_POINTER (old_num_value.u.value.value); + ecma_number_t* old_num_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (old_num_value.u.value.value); *new_num_p = ecma_number_substract (*old_num_p, ECMA_NUMBER_ONE); ecma_value_t new_num_value = ecma_make_number_value (new_num_p); @@ -277,7 +277,7 @@ opfunc_post_incr (opcode_t opdata, /**< operation data */ // 4. ecma_number_t* new_num_p = ecma_alloc_number (); - ecma_number_t* old_num_p = (ecma_number_t*) ECMA_GET_POINTER (old_num_value.u.value.value); + ecma_number_t* old_num_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (old_num_value.u.value.value); *new_num_p = ecma_number_add (*old_num_p, ECMA_NUMBER_ONE); // 5. @@ -325,7 +325,7 @@ opfunc_post_decr (opcode_t opdata, /**< operation data */ // 4. ecma_number_t* new_num_p = ecma_alloc_number (); - ecma_number_t* old_num_p = (ecma_number_t*) ECMA_GET_POINTER (old_num_value.u.value.value); + ecma_number_t* old_num_p = (ecma_number_t*) ECMA_GET_NON_NULL_POINTER (old_num_value.u.value.value); *new_num_p = ecma_number_substract (*old_num_p, ECMA_NUMBER_ONE); // 5. @@ -635,7 +635,7 @@ opfunc_call_n (opcode_t opdata, /**< operation data */ } else { - ecma_object_t *func_obj_p = ECMA_GET_POINTER (func_value.u.value.value); + ecma_object_t *func_obj_p = ECMA_GET_NON_NULL_POINTER (func_value.u.value.value); ECMA_TRY_CATCH (call_completion, ecma_op_function_call (func_obj_p, this_value.u.value, arg_values, args_number), @@ -707,7 +707,7 @@ opfunc_construct_n (opcode_t opdata, /**< operation data */ } else { - ecma_object_t *constructor_obj_p = ECMA_GET_POINTER (constructor_value.u.value.value); + ecma_object_t *constructor_obj_p = ECMA_GET_NON_NULL_POINTER (constructor_value.u.value.value); ECMA_TRY_CATCH (construction_completion, ecma_op_function_construct (constructor_obj_p, @@ -861,7 +861,7 @@ opfunc_obj_decl (opcode_t opdata, /**< operation data */ bool is_throw_syntax_error = false; - ecma_string_t *prop_name_string_p = ECMA_GET_POINTER (prop_name_str_value.u.value.value); + ecma_string_t *prop_name_string_p = ECMA_GET_NON_NULL_POINTER (prop_name_str_value.u.value.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); @@ -901,7 +901,7 @@ opfunc_obj_decl (opcode_t opdata, /**< operation data */ JERRY_ASSERT (value_for_prop_desc.u.value.value_type == ECMA_TYPE_OBJECT); prop_desc.is_get_defined = true; - prop_desc.get_p = ECMA_GET_POINTER (value_for_prop_desc.u.value.value); + prop_desc.get_p = ECMA_GET_NON_NULL_POINTER (value_for_prop_desc.u.value.value); if (!is_previous_undefined && is_previous_data_desc) @@ -914,7 +914,7 @@ opfunc_obj_decl (opcode_t opdata, /**< operation data */ JERRY_ASSERT (value_for_prop_desc.u.value.value_type == ECMA_TYPE_OBJECT); prop_desc.is_set_defined = true; - prop_desc.set_p = ECMA_GET_POINTER (value_for_prop_desc.u.value.value); + prop_desc.set_p = ECMA_GET_NON_NULL_POINTER (value_for_prop_desc.u.value.value); if (!is_previous_undefined && is_previous_data_desc) @@ -1036,7 +1036,7 @@ opfunc_prop_getter (opcode_t opdata __unused, /**< operation data */ ECMA_TRY_CATCH (check_coercible_ret, ecma_op_check_object_coercible (base_value.u.value), ret_value); ECMA_TRY_CATCH (prop_name_str_value, ecma_op_to_string (prop_name_value.u.value), ret_value); - ecma_string_t *prop_name_string_p = ECMA_GET_POINTER (prop_name_str_value.u.value.value); + ecma_string_t *prop_name_string_p = ECMA_GET_NON_NULL_POINTER (prop_name_str_value.u.value.value); ecma_reference_t ref = ecma_make_reference (base_value.u.value, prop_name_string_p, int_data->is_strict); @@ -1083,7 +1083,7 @@ opfunc_prop_setter (opcode_t opdata __unused, /**< operation data */ ECMA_TRY_CATCH (check_coercible_ret, ecma_op_check_object_coercible (base_value.u.value), ret_value); ECMA_TRY_CATCH (prop_name_str_value, ecma_op_to_string (prop_name_value.u.value), ret_value); - ecma_string_t *prop_name_string_p = ECMA_GET_POINTER (prop_name_str_value.u.value.value); + ecma_string_t *prop_name_string_p = ECMA_GET_NON_NULL_POINTER (prop_name_str_value.u.value.value); ecma_reference_t ref = ecma_make_reference (base_value.u.value, prop_name_string_p, int_data->is_strict); @@ -1215,7 +1215,7 @@ opfunc_with (opcode_t opdata, /**< operation data */ ecma_op_to_object (expr_value.u.value), ret_value); - ecma_object_t *obj_p = ECMA_GET_POINTER (obj_expr_value.u.value.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (obj_expr_value.u.value.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, @@ -1467,11 +1467,12 @@ opfunc_delete_var (opcode_t opdata, /**< operation data */ else { JERRY_ASSERT (ref.base.value_type == ECMA_TYPE_OBJECT); - ecma_object_t *bindings_p = ECMA_GET_POINTER (ref.base.value); + ecma_object_t *bindings_p = ECMA_GET_NON_NULL_POINTER (ref.base.value); JERRY_ASSERT (ecma_is_lexical_environment (bindings_p)); ECMA_TRY_CATCH (delete_completion, - ecma_op_delete_binding (bindings_p, ECMA_GET_POINTER (ref.referenced_name_cp)), + ecma_op_delete_binding (bindings_p, + ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp)), ret_value); ret_value = set_variable_value (int_data, dst_var_idx, delete_completion.u.value); @@ -1514,7 +1515,7 @@ opfunc_delete_prop (opcode_t opdata, /**< operation data */ ECMA_TRY_CATCH (str_name_value, ecma_op_to_string (name_value.u.value), ret_value); JERRY_ASSERT (str_name_value.u.value.value_type == ECMA_TYPE_STRING); - ecma_string_t *name_string_p = ECMA_GET_POINTER (str_name_value.u.value.value); + ecma_string_t *name_string_p = ECMA_GET_NON_NULL_POINTER (str_name_value.u.value.value); if (ecma_is_value_undefined (base_value.u.value)) { @@ -1533,7 +1534,7 @@ opfunc_delete_prop (opcode_t opdata, /**< operation data */ ECMA_TRY_CATCH (obj_value, ecma_op_to_object (base_value.u.value), ret_value); JERRY_ASSERT (obj_value.u.value.value_type == ECMA_TYPE_OBJECT); - ecma_object_t *obj_p = ECMA_GET_POINTER (obj_value.u.value.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (obj_value.u.value.value); JERRY_ASSERT (!ecma_is_lexical_environment (obj_p)); ECMA_TRY_CATCH (delete_op_completion, diff --git a/src/libecmabuiltins/ecma-builtin-array.c b/src/libecmabuiltins/ecma-builtin-array.c index c6bae59a4..c8e8fd45a 100644 --- a/src/libecmabuiltins/ecma-builtin-array.c +++ b/src/libecmabuiltins/ecma-builtin-array.c @@ -61,7 +61,7 @@ ecma_builtin_array_object_is_array (ecma_value_t this_arg __unused, /**< 'this' if (arg.value_type == ECMA_TYPE_OBJECT) { - ecma_object_t *obj_p = ECMA_GET_POINTER (arg.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (arg.value); ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS); diff --git a/src/libecmabuiltins/ecma-builtin-boolean-prototype.c b/src/libecmabuiltins/ecma-builtin-boolean-prototype.c index 2201167ab..d4e082aa2 100644 --- a/src/libecmabuiltins/ecma-builtin-boolean-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-boolean-prototype.c @@ -100,7 +100,7 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_value_t this) /**< this arg } else if (this.value_type == ECMA_TYPE_OBJECT) { - ecma_object_t *obj_p = ECMA_GET_POINTER (this.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value); ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS); diff --git a/src/libecmabuiltins/ecma-builtin-error-prototype.c b/src/libecmabuiltins/ecma-builtin-error-prototype.c index 85244e07a..87f5696e3 100644 --- a/src/libecmabuiltins/ecma-builtin-error-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-error-prototype.c @@ -65,7 +65,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this) /**< this argu } else { - ecma_object_t *obj_p = ECMA_GET_POINTER (this.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value); ecma_string_t *name_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_NAME); ECMA_TRY_CATCH (name_get_completion, @@ -119,8 +119,8 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this) /**< this argu JERRY_ASSERT (name_to_str_completion.u.value.value_type == ECMA_TYPE_STRING); JERRY_ASSERT (msg_to_str_completion.u.value.value_type == ECMA_TYPE_STRING); - ecma_string_t *name_string_p = ECMA_GET_POINTER (name_to_str_completion.u.value.value); - ecma_string_t *msg_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value); + ecma_string_t *name_string_p = ECMA_GET_NON_NULL_POINTER (name_to_str_completion.u.value.value); + ecma_string_t *msg_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.value); ecma_string_t *ret_str_p; diff --git a/src/libecmabuiltins/ecma-builtin-error.c b/src/libecmabuiltins/ecma-builtin-error.c index c3d036805..944f9ec39 100644 --- a/src/libecmabuiltins/ecma-builtin-error.c +++ b/src/libecmabuiltins/ecma-builtin-error.c @@ -63,7 +63,7 @@ ecma_builtin_error_dispatch_call (ecma_value_t *arguments_list_p, /**< arguments ecma_op_to_string (arguments_list_p[0]), ret_value); - ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value); + ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.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)); diff --git a/src/libecmabuiltins/ecma-builtin-evalerror.c b/src/libecmabuiltins/ecma-builtin-evalerror.c index 0fbf6d831..98ee87e6c 100644 --- a/src/libecmabuiltins/ecma-builtin-evalerror.c +++ b/src/libecmabuiltins/ecma-builtin-evalerror.c @@ -63,7 +63,7 @@ ecma_builtin_eval_error_dispatch_call (ecma_value_t *arguments_list_p, /**< argu ecma_op_to_string (arguments_list_p[0]), ret_value); - ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value); + ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.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)); diff --git a/src/libecmabuiltins/ecma-builtin-global.c b/src/libecmabuiltins/ecma-builtin-global.c index 41b5f7444..5fc8abd16 100644 --- a/src/libecmabuiltins/ecma-builtin-global.c +++ b/src/libecmabuiltins/ecma-builtin-global.c @@ -105,7 +105,7 @@ ecma_builtin_global_object_is_nan (ecma_value_t this_arg __unused, /**< this arg ECMA_TRY_CATCH (num_value, ecma_op_to_number (arg), ret_value); - ecma_number_t *num_p = ECMA_GET_POINTER (num_value.u.value.value); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (num_value.u.value.value); bool is_nan = ecma_number_is_nan (*num_p); @@ -134,7 +134,7 @@ ecma_builtin_global_object_is_finite (ecma_value_t this_arg __unused, /**< this ECMA_TRY_CATCH (num_value, ecma_op_to_number (arg), ret_value); - ecma_number_t *num_p = ECMA_GET_POINTER (num_value.u.value.value); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (num_value.u.value.value); bool is_finite = !(ecma_number_is_nan (*num_p) || ecma_number_is_infinity (*num_p)); diff --git a/src/libecmabuiltins/ecma-builtin-math.c b/src/libecmabuiltins/ecma-builtin-math.c index d3d98de0d..375b82822 100644 --- a/src/libecmabuiltins/ecma-builtin-math.c +++ b/src/libecmabuiltins/ecma-builtin-math.c @@ -66,7 +66,7 @@ ecma_builtin_math_object_abs (ecma_value_t this_arg __unused, /**< 'this' argume ecma_number_t *num_p = ecma_alloc_number (); - const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value); + const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value); if (ecma_number_is_nan (arg_num)) { @@ -202,7 +202,7 @@ ecma_builtin_math_object_exp (ecma_value_t this_arg __unused, /**< 'this' argume ecma_number_t *num_p = ecma_alloc_number (); - const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value); + const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value); if (ecma_number_is_nan (arg_num)) { @@ -272,7 +272,7 @@ ecma_builtin_math_object_log (ecma_value_t this_arg __unused, /**< 'this' argume ecma_number_t *num_p = ecma_alloc_number (); - const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value); + const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value); if (ecma_number_is_nan (arg_num)) { @@ -332,7 +332,7 @@ ecma_builtin_math_object_max (ecma_value_t this_arg __unused, /**< 'this' argume if (!is_just_convert) { - ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value); + ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value); if (unlikely (ecma_number_is_nan (arg_num))) { @@ -423,7 +423,7 @@ ecma_builtin_math_object_min (ecma_value_t this_arg __unused, /**< 'this' argume if (!is_just_convert) { - ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value); + ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value); if (unlikely (ecma_number_is_nan (arg_num))) { @@ -509,8 +509,8 @@ ecma_builtin_math_object_pow (ecma_value_t this_arg __unused, /**< 'this' argume ecma_number_t *num_p = ecma_alloc_number (); - const ecma_number_t x = *(ecma_number_t*) ECMA_GET_POINTER (arg1_num_value.u.value.value); - const ecma_number_t y = *(ecma_number_t*) ECMA_GET_POINTER (arg2_num_value.u.value.value); + const ecma_number_t x = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg1_num_value.u.value.value); + const ecma_number_t y = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg2_num_value.u.value.value); if (ecma_number_is_nan (y) || (ecma_number_is_nan (x) @@ -787,7 +787,7 @@ ecma_builtin_math_object_round (ecma_value_t this_arg __unused, /**< 'this' argu ecma_number_t *num_p = ecma_alloc_number (); - const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value); + const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value); if (ecma_number_is_nan (arg_num) || ecma_number_is_zero (arg_num) @@ -859,7 +859,7 @@ ecma_builtin_math_object_sqrt (ecma_value_t this_arg __unused, /**< 'this' argum ecma_op_to_number (arg), ret_value); - const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_POINTER (arg_num_value.u.value.value); + const ecma_number_t arg_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value); ecma_number_t ret_num; if (ecma_number_is_nan (arg_num) diff --git a/src/libecmabuiltins/ecma-builtin-number-prototype.c b/src/libecmabuiltins/ecma-builtin-number-prototype.c index 5660c0c2f..aeebd3837 100644 --- a/src/libecmabuiltins/ecma-builtin-number-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-number-prototype.c @@ -62,13 +62,13 @@ ecma_builtin_number_prototype_object_to_string (ecma_value_t this, /**< this arg if (this.value_type == ECMA_TYPE_NUMBER) { - ecma_number_t *this_arg_number_p = ECMA_GET_POINTER (this.value); + ecma_number_t *this_arg_number_p = ECMA_GET_NON_NULL_POINTER (this.value); this_arg_number = *this_arg_number_p; } else if (this.value_type == ECMA_TYPE_OBJECT) { - ecma_object_t *obj_p = ECMA_GET_POINTER (this.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value); ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS); @@ -77,7 +77,7 @@ ecma_builtin_number_prototype_object_to_string (ecma_value_t this, /**< this arg ecma_property_t *prim_value_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE); - ecma_number_t *prim_value_num_p = ECMA_GET_POINTER (prim_value_prop_p->u.internal_property.value); + ecma_number_t *prim_value_num_p = ECMA_GET_NON_NULL_POINTER (prim_value_prop_p->u.internal_property.value); this_arg_number = *prim_value_num_p; } else @@ -134,7 +134,7 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this) /**< this argu } else if (this.value_type == ECMA_TYPE_OBJECT) { - ecma_object_t *obj_p = ECMA_GET_POINTER (this.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value); ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS); @@ -143,7 +143,7 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this) /**< this argu ecma_property_t *prim_value_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE); - ecma_number_t *prim_value_num_p = ECMA_GET_POINTER (prim_value_prop_p->u.internal_property.value); + ecma_number_t *prim_value_num_p = ECMA_GET_NON_NULL_POINTER (prim_value_prop_p->u.internal_property.value); ecma_number_t *ret_num_p = ecma_alloc_number (); *ret_num_p = *prim_value_num_p; diff --git a/src/libecmabuiltins/ecma-builtin-object-prototype.c b/src/libecmabuiltins/ecma-builtin-object-prototype.c index 283e4e332..786734a3b 100644 --- a/src/libecmabuiltins/ecma-builtin-object-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-object-prototype.c @@ -75,7 +75,7 @@ ecma_builtin_object_prototype_object_to_string (ecma_value_t this) /**< this arg JERRY_ASSERT (obj_this.u.value.value_type == ECMA_TYPE_OBJECT); - ecma_object_t *obj_p = ECMA_GET_POINTER (obj_this.u.value.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (obj_this.u.value.value); ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS); diff --git a/src/libecmabuiltins/ecma-builtin-object.c b/src/libecmabuiltins/ecma-builtin-object.c index 0a4799f70..fd9e14cc3 100644 --- a/src/libecmabuiltins/ecma-builtin-object.c +++ b/src/libecmabuiltins/ecma-builtin-object.c @@ -319,13 +319,13 @@ ecma_builtin_object_object_define_property (ecma_value_t this_arg __unused, /**< } else { - ecma_object_t *obj_p = ECMA_GET_POINTER (arg1.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (arg1.value); ECMA_TRY_CATCH (name_str_value, ecma_op_to_string (arg2), ret_value); - ecma_string_t *name_str_p = ECMA_GET_POINTER (name_str_value.u.value.value); + ecma_string_t *name_str_p = ECMA_GET_NON_NULL_POINTER (name_str_value.u.value.value); ecma_property_descriptor_t prop_desc; diff --git a/src/libecmabuiltins/ecma-builtin-rangeerror.c b/src/libecmabuiltins/ecma-builtin-rangeerror.c index 0c0a90d2e..395c35919 100644 --- a/src/libecmabuiltins/ecma-builtin-rangeerror.c +++ b/src/libecmabuiltins/ecma-builtin-rangeerror.c @@ -63,7 +63,7 @@ ecma_builtin_range_error_dispatch_call (ecma_value_t *arguments_list_p, /**< arg ecma_op_to_string (arguments_list_p[0]), ret_value); - ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value); + ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.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)); diff --git a/src/libecmabuiltins/ecma-builtin-referenceerror.c b/src/libecmabuiltins/ecma-builtin-referenceerror.c index 4b191d843..11dc94a08 100644 --- a/src/libecmabuiltins/ecma-builtin-referenceerror.c +++ b/src/libecmabuiltins/ecma-builtin-referenceerror.c @@ -63,7 +63,7 @@ ecma_builtin_reference_error_dispatch_call (ecma_value_t *arguments_list_p, /**< ecma_op_to_string (arguments_list_p[0]), ret_value); - ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value); + ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.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)); diff --git a/src/libecmabuiltins/ecma-builtin-string-prototype.c b/src/libecmabuiltins/ecma-builtin-string-prototype.c index ea8f6250a..98d063cd7 100644 --- a/src/libecmabuiltins/ecma-builtin-string-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-string-prototype.c @@ -62,7 +62,7 @@ ecma_builtin_string_prototype_object_to_string (ecma_value_t this) /**< this arg } else if (this.value_type == ECMA_TYPE_OBJECT) { - ecma_object_t *obj_p = ECMA_GET_POINTER (this.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value); ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS); @@ -71,7 +71,7 @@ ecma_builtin_string_prototype_object_to_string (ecma_value_t this) /**< this arg ecma_property_t *prim_value_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PRIMITIVE_STRING_VALUE); - ecma_string_t *prim_value_str_p = ECMA_GET_POINTER (prim_value_prop_p->u.internal_property.value); + ecma_string_t *prim_value_str_p = ECMA_GET_NON_NULL_POINTER (prim_value_prop_p->u.internal_property.value); prim_value_str_p = ecma_copy_or_ref_ecma_string (prim_value_str_p); diff --git a/src/libecmabuiltins/ecma-builtin-string.c b/src/libecmabuiltins/ecma-builtin-string.c index 72f2b3056..239088593 100644 --- a/src/libecmabuiltins/ecma-builtin-string.c +++ b/src/libecmabuiltins/ecma-builtin-string.c @@ -75,7 +75,7 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg __unused, /**< ret_value); JERRY_ASSERT (arg_num_value.u.value.value_type == ECMA_TYPE_NUMBER); - ecma_number_t *arg_num_p = ECMA_GET_POINTER (arg_num_value.u.value.value); + ecma_number_t *arg_num_p = ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value); uint32_t uint32_char_code = ecma_number_to_uint32 (*arg_num_p); uint16_t uint16_char_code = (uint16_t) uint32_char_code; diff --git a/src/libecmabuiltins/ecma-builtin-syntaxerror.c b/src/libecmabuiltins/ecma-builtin-syntaxerror.c index a3a043c01..51169a84f 100644 --- a/src/libecmabuiltins/ecma-builtin-syntaxerror.c +++ b/src/libecmabuiltins/ecma-builtin-syntaxerror.c @@ -63,7 +63,7 @@ ecma_builtin_syntax_error_dispatch_call (ecma_value_t *arguments_list_p, /**< ar ecma_op_to_string (arguments_list_p[0]), ret_value); - ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value); + ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.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)); diff --git a/src/libecmabuiltins/ecma-builtin-typeerror.c b/src/libecmabuiltins/ecma-builtin-typeerror.c index a873a2e96..f9e2a2d38 100644 --- a/src/libecmabuiltins/ecma-builtin-typeerror.c +++ b/src/libecmabuiltins/ecma-builtin-typeerror.c @@ -63,7 +63,7 @@ ecma_builtin_type_error_dispatch_call (ecma_value_t *arguments_list_p, /**< argu ecma_op_to_string (arguments_list_p[0]), ret_value); - ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value); + ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.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)); diff --git a/src/libecmabuiltins/ecma-builtin-urierror.c b/src/libecmabuiltins/ecma-builtin-urierror.c index 052d9d7b4..111bfae4f 100644 --- a/src/libecmabuiltins/ecma-builtin-urierror.c +++ b/src/libecmabuiltins/ecma-builtin-urierror.c @@ -63,7 +63,7 @@ ecma_builtin_uri_error_dispatch_call (ecma_value_t *arguments_list_p, /**< argum ecma_op_to_string (arguments_list_p[0]), ret_value); - ecma_string_t *message_string_p = ECMA_GET_POINTER (msg_to_str_completion.u.value.value); + ecma_string_t *message_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.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)); diff --git a/src/libecmaobjects/ecma-gc.c b/src/libecmaobjects/ecma-gc.c index 3c7d284fe..28097f6ea 100644 --- a/src/libecmaobjects/ecma-gc.c +++ b/src/libecmaobjects/ecma-gc.c @@ -243,7 +243,7 @@ ecma_gc_update_may_ref_younger_object_flag_by_value (ecma_object_t *obj_p, /**< return; } - ecma_object_t *ref_obj_p = ECMA_GET_POINTER(value.value); + ecma_object_t *ref_obj_p = ECMA_GET_NON_NULL_POINTER(value.value); JERRY_ASSERT(ref_obj_p != NULL); ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, ref_obj_p); @@ -323,7 +323,7 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */ property_p != NULL; property_p = next_property_p) { - next_property_p = ECMA_GET_POINTER(property_p->next_property_p); + next_property_p = ECMA_GET_NON_NULL_POINTER(property_p->next_property_p); switch ((ecma_property_type_t) property_p->type) { @@ -333,7 +333,7 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */ if (value.value_type == ECMA_TYPE_OBJECT) { - ecma_object_t *value_obj_p = ECMA_GET_POINTER(value.value); + ecma_object_t *value_obj_p = ECMA_GET_NON_NULL_POINTER(value.value); if (ecma_gc_get_object_generation (value_obj_p) <= maximum_gen_to_traverse) { @@ -423,7 +423,7 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */ case ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP: /* an object */ case ECMA_INTERNAL_PROPERTY_BINDING_OBJECT: /* an object */ { - ecma_object_t *obj_p = ECMA_GET_POINTER(property_value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER(property_value); if (ecma_gc_get_object_generation (obj_p) <= maximum_gen_to_traverse) { diff --git a/src/libecmaobjects/ecma-helpers-string.c b/src/libecmaobjects/ecma-helpers-string.c index 6c5b41adf..afef104d9 100644 --- a/src/libecmaobjects/ecma-helpers-string.c +++ b/src/libecmaobjects/ecma-helpers-string.c @@ -309,8 +309,8 @@ ecma_copy_ecma_string (ecma_string_t *string_desc_p) /**< string descriptor */ case ECMA_STRING_CONTAINER_CONCATENATION: { - ecma_string_t *part1_p = ECMA_GET_POINTER (string_desc_p->u.concatenation.string1_cp); - ecma_string_t *part2_p = ECMA_GET_POINTER (string_desc_p->u.concatenation.string2_cp); + ecma_string_t *part1_p = ECMA_GET_NON_NULL_POINTER (string_desc_p->u.concatenation.string1_cp); + ecma_string_t *part2_p = ECMA_GET_NON_NULL_POINTER (string_desc_p->u.concatenation.string2_cp); new_str_p = ecma_concat_ecma_strings (part1_p, part2_p); @@ -319,7 +319,7 @@ ecma_copy_ecma_string (ecma_string_t *string_desc_p) /**< string descriptor */ case ECMA_STRING_CONTAINER_HEAP_NUMBER: { - ecma_number_t *num_p = ECMA_GET_POINTER (string_desc_p->u.number_cp); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (string_desc_p->u.number_cp); new_str_p = ecma_new_ecma_string_from_number (*num_p); @@ -328,7 +328,7 @@ ecma_copy_ecma_string (ecma_string_t *string_desc_p) /**< string descriptor */ case ECMA_STRING_CONTAINER_HEAP_CHUNKS: { - ecma_collection_chunk_t *str_heap_chunk_p = ECMA_GET_POINTER (string_desc_p->u.chunk_cp); + ecma_collection_chunk_t *str_heap_chunk_p = ECMA_GET_NON_NULL_POINTER (string_desc_p->u.chunk_cp); JERRY_ASSERT (str_heap_chunk_p != NULL); new_str_p = ecma_alloc_string (); @@ -432,7 +432,7 @@ ecma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */ { case ECMA_STRING_CONTAINER_HEAP_CHUNKS: { - ecma_collection_chunk_t *chunk_p = ECMA_GET_POINTER (string_p->u.chunk_cp); + ecma_collection_chunk_t *chunk_p = ECMA_GET_NON_NULL_POINTER (string_p->u.chunk_cp); JERRY_ASSERT (chunk_p != NULL); @@ -449,7 +449,7 @@ ecma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */ } case ECMA_STRING_CONTAINER_HEAP_NUMBER: { - ecma_number_t *num_p = ECMA_GET_POINTER (string_p->u.number_cp); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (string_p->u.number_cp); ecma_dealloc_number (num_p); @@ -459,8 +459,8 @@ ecma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */ { ecma_string_t *string1_p, *string2_p; - string1_p = ECMA_GET_POINTER (string_p->u.concatenation.string1_cp); - string2_p = ECMA_GET_POINTER (string_p->u.concatenation.string2_cp); + string1_p = ECMA_GET_NON_NULL_POINTER (string_p->u.concatenation.string1_cp); + string2_p = ECMA_GET_NON_NULL_POINTER (string_p->u.concatenation.string2_cp); ecma_deref_ecma_string (string1_p); ecma_deref_ecma_string (string2_p); @@ -498,7 +498,7 @@ ecma_string_to_number (const ecma_string_t *str_p) /**< ecma-string */ case ECMA_STRING_CONTAINER_HEAP_NUMBER: { - ecma_number_t *num_p = ECMA_GET_POINTER (str_p->u.number_cp); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (str_p->u.number_cp); return *num_p; } @@ -590,7 +590,7 @@ ecma_string_to_zt_string (const ecma_string_t *string_desc_p, /**< ecma-string d { ecma_length_t string_length = string_desc_p->length; - ecma_collection_chunk_t *string_chunk_p = ECMA_GET_POINTER (string_desc_p->u.chunk_cp); + ecma_collection_chunk_t *string_chunk_p = ECMA_GET_NON_NULL_POINTER (string_desc_p->u.chunk_cp); const ecma_length_t max_chars_in_chunk = sizeof (string_chunk_p->data) / sizeof (ecma_char_t); @@ -634,7 +634,7 @@ ecma_string_to_zt_string (const ecma_string_t *string_desc_p, /**< ecma-string d } case ECMA_STRING_CONTAINER_HEAP_NUMBER: { - ecma_number_t *num_p = ECMA_GET_POINTER (string_desc_p->u.number_cp); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (string_desc_p->u.number_cp); ecma_length_t length = ecma_number_to_zt_string (*num_p, buffer_p, buffer_size); @@ -646,8 +646,8 @@ ecma_string_to_zt_string (const ecma_string_t *string_desc_p, /**< ecma-string d } case ECMA_STRING_CONTAINER_CONCATENATION: { - const ecma_string_t *string1_p = ECMA_GET_POINTER (string_desc_p->u.concatenation.string1_cp); - const ecma_string_t *string2_p = ECMA_GET_POINTER (string_desc_p->u.concatenation.string2_cp); + const ecma_string_t *string1_p = ECMA_GET_NON_NULL_POINTER (string_desc_p->u.concatenation.string1_cp); + const ecma_string_t *string2_p = ECMA_GET_NON_NULL_POINTER (string_desc_p->u.concatenation.string2_cp); ecma_char_t *dest_p = buffer_p; @@ -703,8 +703,8 @@ ecma_compare_strings_in_heap_chunks (const ecma_string_t *string1_p, /* ecma-str && string2_p->container == ECMA_STRING_CONTAINER_HEAP_CHUNKS); JERRY_ASSERT (ecma_string_get_length (string1_p) == ecma_string_get_length (string2_p)); - ecma_collection_chunk_t *string1_chunk_p = ECMA_GET_POINTER (string1_p->u.chunk_cp); - ecma_collection_chunk_t *string2_chunk_p = ECMA_GET_POINTER (string2_p->u.chunk_cp); + ecma_collection_chunk_t *string1_chunk_p = ECMA_GET_NON_NULL_POINTER (string1_p->u.chunk_cp); + ecma_collection_chunk_t *string2_chunk_p = ECMA_GET_NON_NULL_POINTER (string2_p->u.chunk_cp); ecma_length_t chars_left = string1_p->length; const ecma_length_t max_chars_in_chunk = sizeof (string1_chunk_p->data) / sizeof (ecma_char_t); @@ -744,7 +744,7 @@ ecma_compare_ecma_string_to_zt_string (const ecma_string_t *string_p, /**< ecma- { JERRY_ASSERT (string_p->container == ECMA_STRING_CONTAINER_HEAP_CHUNKS); - ecma_collection_chunk_t *string_chunk_p = ECMA_GET_POINTER (string_p->u.chunk_cp); + ecma_collection_chunk_t *string_chunk_p = ECMA_GET_NON_NULL_POINTER (string_p->u.chunk_cp); ecma_length_t chars_left = string_p->length; const ecma_length_t max_chars_in_chunk = sizeof (string_chunk_p->data) / sizeof (ecma_char_t); @@ -935,8 +935,8 @@ ecma_compare_ecma_strings (const ecma_string_t *string1_p, /* ecma-string */ case ECMA_STRING_CONTAINER_HEAP_NUMBER: { ecma_number_t *num1_p, *num2_p; - num1_p = ECMA_GET_POINTER (string1_p->u.number_cp); - num2_p = ECMA_GET_POINTER (string2_p->u.number_cp); + num1_p = ECMA_GET_NON_NULL_POINTER (string1_p->u.number_cp); + num2_p = ECMA_GET_NON_NULL_POINTER (string2_p->u.number_cp); if (ecma_number_is_nan (*num1_p) && ecma_number_is_nan (*num2_p)) @@ -1115,8 +1115,8 @@ ecma_string_get_length (const ecma_string_t *string_p) /**< ecma-string */ { const ecma_string_t *string1_p, *string2_p; - string1_p = ECMA_GET_POINTER (string_p->u.concatenation.string1_cp); - string2_p = ECMA_GET_POINTER (string_p->u.concatenation.string2_cp); + string1_p = ECMA_GET_NON_NULL_POINTER (string_p->u.concatenation.string1_cp); + string2_p = ECMA_GET_NON_NULL_POINTER (string_p->u.concatenation.string2_cp); return ecma_string_get_length (string1_p) + ecma_string_get_length (string2_p); } diff --git a/src/libecmaobjects/ecma-helpers-value.c b/src/libecmaobjects/ecma-helpers-value.c index 7c74e720e..3285e9612 100644 --- a/src/libecmaobjects/ecma-helpers-value.c +++ b/src/libecmaobjects/ecma-helpers-value.c @@ -193,7 +193,7 @@ ecma_copy_value (const ecma_value_t value, /**< ecma-value */ } case ECMA_TYPE_NUMBER: { - ecma_number_t *num_p = ECMA_GET_POINTER(value.value); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER(value.value); JERRY_ASSERT(num_p != NULL); ecma_number_t *number_copy_p = ecma_alloc_number (); @@ -209,7 +209,7 @@ ecma_copy_value (const ecma_value_t value, /**< ecma-value */ } case ECMA_TYPE_STRING: { - ecma_string_t *string_p = ECMA_GET_POINTER(value.value); + ecma_string_t *string_p = ECMA_GET_NON_NULL_POINTER(value.value); JERRY_ASSERT(string_p != NULL); string_p = ecma_copy_or_ref_ecma_string (string_p); @@ -224,7 +224,7 @@ ecma_copy_value (const ecma_value_t value, /**< ecma-value */ } case ECMA_TYPE_OBJECT: { - ecma_object_t *obj_p = ECMA_GET_POINTER(value.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER(value.value); JERRY_ASSERT(obj_p != NULL); if (do_ref_if_object) @@ -259,14 +259,14 @@ ecma_free_value (ecma_value_t value, /**< value description */ case ECMA_TYPE_NUMBER: { - ecma_number_t *number_p = ECMA_GET_POINTER(value.value); + ecma_number_t *number_p = ECMA_GET_NON_NULL_POINTER(value.value); ecma_dealloc_number (number_p); break; } case ECMA_TYPE_STRING: { - ecma_string_t *string_p = ECMA_GET_POINTER(value.value); + ecma_string_t *string_p = ECMA_GET_NON_NULL_POINTER(value.value); ecma_deref_ecma_string (string_p); break; } @@ -275,7 +275,7 @@ ecma_free_value (ecma_value_t value, /**< value description */ { if (do_deref_if_object) { - ecma_deref_object (ECMA_GET_POINTER(value.value)); + ecma_deref_object (ECMA_GET_NON_NULL_POINTER(value.value)); } break; } @@ -497,7 +497,7 @@ ecma_free_completion_value (ecma_completion_value_t completion_value) /**< compl case ECMA_COMPLETION_TYPE_CONTINUE: case ECMA_COMPLETION_TYPE_BREAK: { - ecma_dealloc_label_descriptor (ECMA_GET_POINTER (completion_value.u.label_desc_cp)); + ecma_dealloc_label_descriptor (ECMA_GET_NON_NULL_POINTER (completion_value.u.label_desc_cp)); break; } case ECMA_COMPLETION_TYPE_META: diff --git a/src/libecmaobjects/ecma-helpers.c b/src/libecmaobjects/ecma-helpers.c index 1f1e42042..5910548bf 100644 --- a/src/libecmaobjects/ecma-helpers.c +++ b/src/libecmaobjects/ecma-helpers.c @@ -530,11 +530,11 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in if (property_p->type == ECMA_PROPERTY_NAMEDDATA) { - property_name_p = ECMA_GET_POINTER(property_p->u.named_data_property.name_p); + property_name_p = ECMA_GET_NON_NULL_POINTER(property_p->u.named_data_property.name_p); } else if (property_p->type == ECMA_PROPERTY_NAMEDACCESSOR) { - property_name_p = ECMA_GET_POINTER(property_p->u.named_accessor_property.name_p); + property_name_p = ECMA_GET_NON_NULL_POINTER(property_p->u.named_accessor_property.name_p); } else { @@ -606,7 +606,7 @@ ecma_free_named_data_property (ecma_property_t *property_p) /**< the property */ { JERRY_ASSERT(property_p->type == ECMA_PROPERTY_NAMEDDATA); - ecma_deref_ecma_string (ECMA_GET_POINTER (property_p->u.named_data_property.name_p)); + ecma_deref_ecma_string (ECMA_GET_NON_NULL_POINTER (property_p->u.named_data_property.name_p)); ecma_free_value (property_p->u.named_data_property.value, false); ecma_dealloc_property (property_p); @@ -620,7 +620,7 @@ ecma_free_named_accessor_property (ecma_property_t *property_p) /**< the propert { JERRY_ASSERT(property_p->type == ECMA_PROPERTY_NAMEDACCESSOR); - ecma_deref_ecma_string (ECMA_GET_POINTER (property_p->u.named_accessor_property.name_p)); + ecma_deref_ecma_string (ECMA_GET_NON_NULL_POINTER (property_p->u.named_accessor_property.name_p)); ecma_dealloc_property (property_p); } /* ecma_free_named_accessor_property */ @@ -641,7 +641,7 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */ case ECMA_INTERNAL_PROPERTY_NUMBER_INDEXED_ARRAY_VALUES: /* a collection */ case ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES: /* a collection */ { - ecma_free_values_collection (ECMA_GET_POINTER(property_value), true); + ecma_free_values_collection (ECMA_GET_NON_NULL_POINTER(property_value), true); break; } @@ -650,14 +650,14 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */ { if (property_value != ECMA_NULL_POINTER) { - ecma_free_values_collection (ECMA_GET_POINTER(property_value), false); + ecma_free_values_collection (ECMA_GET_NON_NULL_POINTER(property_value), false); } break; } case ECMA_INTERNAL_PROPERTY_PRIMITIVE_STRING_VALUE: /* compressed pointer to a ecma_string_t */ { - ecma_string_t *str_p = ECMA_GET_POINTER (property_value); + ecma_string_t *str_p = ECMA_GET_NON_NULL_POINTER (property_value); ecma_deref_ecma_string (str_p); break; @@ -665,7 +665,7 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */ case ECMA_INTERNAL_PROPERTY_PRIMITIVE_NUMBER_VALUE: /* pointer to a ecma_number_t */ { - ecma_number_t *num_p = ECMA_GET_POINTER (property_value); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (property_value); ecma_dealloc_number (num_p); break; diff --git a/src/libecmaobjects/ecma-helpers.h b/src/libecmaobjects/ecma-helpers.h index 2bb1483df..2b60232cb 100644 --- a/src/libecmaobjects/ecma-helpers.h +++ b/src/libecmaobjects/ecma-helpers.h @@ -26,11 +26,24 @@ #include "ecma-globals.h" #include "mem-allocator.h" +/** + * Get value of pointer from specified non-null compressed pointer field. + */ +#define ECMA_GET_NON_NULL_POINTER(field) \ + (mem_decompress_pointer (field)) + /** * Get value of pointer from specified compressed pointer field. */ #define ECMA_GET_POINTER(field) \ - ((unlikely (field == ECMA_NULL_POINTER)) ? NULL : mem_decompress_pointer (field)) + ((unlikely (field == ECMA_NULL_POINTER)) ? NULL : ECMA_GET_NON_NULL_POINTER (field)) + +/** + * Set value of non-null compressed pointer field so that it will correspond + * to specified non_compressed_pointer. + */ +#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) \ + (field) = (mem_compress_pointer (non_compressed_pointer) & ((1u << ECMA_POINTER_FIELD_WIDTH) - 1)) /** * Set value of compressed pointer field so that it will correspond @@ -47,13 +60,6 @@ : (mem_compress_pointer (non_compressed_pointer) \ & ((1u << ECMA_POINTER_FIELD_WIDTH) - 1))) -/** - * Set value of non-null compressed pointer field so that it will correspond - * to specified non_compressed_pointer. - */ -#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) \ - (field) = (mem_compress_pointer (non_compressed_pointer) & ((1u << ECMA_POINTER_FIELD_WIDTH) - 1)) - /* ecma-helpers-value.c */ extern bool ecma_is_value_empty (ecma_value_t value); extern bool ecma_is_value_undefined (ecma_value_t value); diff --git a/src/libecmaoperations/ecma-array-object.c b/src/libecmaoperations/ecma-array-object.c index 129f23e2a..d1f803da9 100644 --- a/src/libecmaoperations/ecma-array-object.c +++ b/src/libecmaoperations/ecma-array-object.c @@ -81,7 +81,7 @@ ecma_op_create_array_object (ecma_value_t *arguments_list_p, /**< list of argume && arguments_list_len == 1 && arguments_list_p[0].value_type == ECMA_TYPE_NUMBER) { - ecma_number_t *num_p = ECMA_GET_POINTER (arguments_list_p[0].value); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (arguments_list_p[0].value); uint32_t num_uint32 = ecma_number_to_uint32 (*num_p); if (*num_p != ecma_uint32_to_number (num_uint32)) { @@ -187,7 +187,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o JERRY_ASSERT (old_len_value.value_type == ECMA_TYPE_NUMBER); - ecma_number_t *num_p = ECMA_GET_POINTER (old_len_value.value); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (old_len_value.value); uint32_t old_len_uint32 = ecma_number_to_uint32 (*num_p); // 3. @@ -217,7 +217,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o JERRY_ASSERT (ecma_is_completion_value_normal (completion) && completion.u.value.value_type == ECMA_TYPE_NUMBER); - new_len_num = *(ecma_number_t*) ECMA_GET_POINTER (completion.u.value.value); + new_len_num = *(ecma_number_t*) ECMA_GET_NON_NULL_POINTER (completion.u.value.value); ecma_free_completion_value (completion); @@ -317,7 +317,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o { JERRY_ASSERT (new_len_property_desc.value.value_type == ECMA_TYPE_NUMBER); - ecma_number_t *new_len_num_p = ECMA_GET_POINTER (new_len_property_desc.value.value); + ecma_number_t *new_len_num_p = ECMA_GET_NON_NULL_POINTER (new_len_property_desc.value.value); // 1. *new_len_num_p = ecma_uint32_to_number (old_len_uint32 + 1); diff --git a/src/libecmaoperations/ecma-comparison.c b/src/libecmaoperations/ecma-comparison.c index d443a801b..627fc452f 100644 --- a/src/libecmaoperations/ecma-comparison.c +++ b/src/libecmaoperations/ecma-comparison.c @@ -73,8 +73,8 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ } else if (is_x_number) { // c. - ecma_number_t x_num = *(ecma_number_t*)(ECMA_GET_POINTER(x.value)); - ecma_number_t y_num = *(ecma_number_t*)(ECMA_GET_POINTER(y.value)); + ecma_number_t x_num = *(ecma_number_t*)(ECMA_GET_NON_NULL_POINTER(x.value)); + ecma_number_t y_num = *(ecma_number_t*)(ECMA_GET_NON_NULL_POINTER(y.value)); bool is_equal; @@ -98,8 +98,8 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ } else if (is_x_string) { // d. - ecma_string_t* x_str_p = ECMA_GET_POINTER(x.value); - ecma_string_t* y_str_p = ECMA_GET_POINTER(y.value); + ecma_string_t* x_str_p = ECMA_GET_NON_NULL_POINTER(x.value); + ecma_string_t* y_str_p = ECMA_GET_NON_NULL_POINTER(y.value); bool is_equal = ecma_compare_ecma_strings (x_str_p, y_str_p); @@ -267,8 +267,8 @@ ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */ // d. If x is +0 and y is -0, return true. // e. If x is -0 and y is +0, return true. - ecma_number_t x_num = *(ecma_number_t*) (ECMA_GET_POINTER (x.value)); - ecma_number_t y_num = *(ecma_number_t*) (ECMA_GET_POINTER (y.value)); + ecma_number_t x_num = *(ecma_number_t*) (ECMA_GET_NON_NULL_POINTER (x.value)); + ecma_number_t y_num = *(ecma_number_t*) (ECMA_GET_NON_NULL_POINTER (y.value)); if (ecma_number_is_nan (x_num) || ecma_number_is_nan (y_num)) @@ -291,8 +291,8 @@ ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */ // (same length and same characters in corresponding positions); otherwise, return false. if (is_x_string) { - ecma_string_t* x_str_p = ECMA_GET_POINTER (x.value); - ecma_string_t* y_str_p = ECMA_GET_POINTER (y.value); + ecma_string_t* x_str_p = ECMA_GET_NON_NULL_POINTER (x.value); + ecma_string_t* y_str_p = ECMA_GET_NON_NULL_POINTER (y.value); return ecma_compare_ecma_strings (x_str_p, y_str_p); } @@ -306,7 +306,7 @@ ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */ // 7. Return true if x and y refer to the same object. Otherwise, return false. JERRY_ASSERT (is_x_object); - return (ECMA_GET_POINTER (x.value) == ECMA_GET_POINTER (y.value)); + return (ECMA_GET_NON_NULL_POINTER (x.value) == ECMA_GET_NON_NULL_POINTER (y.value)); } /* ecma_op_strict_equality_compare */ /** @@ -351,8 +351,8 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */ // b. ECMA_TRY_CATCH(ny, ecma_op_to_number (py.u.value), ret_value); - ecma_number_t* num_x_p = (ecma_number_t*)ECMA_GET_POINTER(nx.u.value.value); - ecma_number_t* num_y_p = (ecma_number_t*)ECMA_GET_POINTER(ny.u.value.value); + ecma_number_t* num_x_p = (ecma_number_t*)ECMA_GET_NON_NULL_POINTER(nx.u.value.value); + ecma_number_t* num_y_p = (ecma_number_t*)ECMA_GET_NON_NULL_POINTER(ny.u.value.value); if (ecma_number_is_nan (*num_x_p) || ecma_number_is_nan (*num_y_p)) @@ -418,8 +418,8 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */ { // 4. JERRY_ASSERT (is_px_string && is_py_string); - ecma_string_t *str_x_p = ECMA_GET_POINTER (px.u.value.value); - ecma_string_t *str_y_p = ECMA_GET_POINTER (py.u.value.value); + ecma_string_t *str_x_p = ECMA_GET_NON_NULL_POINTER (px.u.value.value); + ecma_string_t *str_y_p = ECMA_GET_NON_NULL_POINTER (py.u.value.value); bool is_px_less = ecma_compare_ecma_strings_relational (str_x_p, str_y_p); diff --git a/src/libecmaoperations/ecma-conversion.c b/src/libecmaoperations/ecma-conversion.c index f09f731f4..579c31d50 100644 --- a/src/libecmaoperations/ecma-conversion.c +++ b/src/libecmaoperations/ecma-conversion.c @@ -130,8 +130,8 @@ ecma_op_same_value (ecma_value_t x, /**< ecma-value */ if (is_x_number) { - ecma_number_t *x_num_p = (ecma_number_t*)ECMA_GET_POINTER(x.value); - ecma_number_t *y_num_p = (ecma_number_t*)ECMA_GET_POINTER(y.value); + ecma_number_t *x_num_p = (ecma_number_t*)ECMA_GET_NON_NULL_POINTER(x.value); + ecma_number_t *y_num_p = (ecma_number_t*)ECMA_GET_NON_NULL_POINTER(y.value); if (ecma_number_is_nan (*x_num_p) && ecma_number_is_nan (*y_num_p)) @@ -150,8 +150,8 @@ ecma_op_same_value (ecma_value_t x, /**< ecma-value */ if (is_x_string) { - ecma_string_t* x_str_p = ECMA_GET_POINTER(x.value); - ecma_string_t* y_str_p = ECMA_GET_POINTER(y.value); + ecma_string_t* x_str_p = ECMA_GET_NON_NULL_POINTER(x.value); + ecma_string_t* y_str_p = ECMA_GET_NON_NULL_POINTER(y.value); return ecma_compare_ecma_strings (x_str_p, y_str_p); } @@ -163,7 +163,7 @@ ecma_op_same_value (ecma_value_t x, /**< ecma-value */ JERRY_ASSERT(is_x_object); - return (ECMA_GET_POINTER(x.value) == ECMA_GET_POINTER(y.value)); + return (ECMA_GET_NON_NULL_POINTER(x.value) == ECMA_GET_NON_NULL_POINTER(y.value)); } /* ecma_op_same_value */ /** @@ -190,7 +190,7 @@ ecma_op_to_primitive (ecma_value_t value, /**< ecma-value */ case ECMA_TYPE_OBJECT: { - ecma_object_t *obj_p = ECMA_GET_POINTER (value.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (value.value); return ecma_op_object_default_value (obj_p, preferred_type); } @@ -216,7 +216,7 @@ ecma_op_to_boolean (ecma_value_t value) /**< ecma-value */ { case ECMA_TYPE_NUMBER: { - ecma_number_t *num_p = ECMA_GET_POINTER(value.value); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER(value.value); if (ecma_number_is_nan (*num_p) || ecma_number_is_zero (*num_p)) @@ -250,7 +250,7 @@ ecma_op_to_boolean (ecma_value_t value) /**< ecma-value */ } case ECMA_TYPE_STRING: { - ecma_string_t *str_p = ECMA_GET_POINTER(value.value); + ecma_string_t *str_p = ECMA_GET_NON_NULL_POINTER(value.value); return ecma_make_simple_completion_value ((ecma_string_get_length (str_p) == 0) ? ECMA_SIMPLE_VALUE_FALSE : ECMA_SIMPLE_VALUE_TRUE); @@ -323,7 +323,7 @@ ecma_op_to_number (ecma_value_t value) /**< ecma-value */ } case ECMA_TYPE_STRING: { - ecma_string_t *str_p = ECMA_GET_POINTER (value.value); + ecma_string_t *str_p = ECMA_GET_NON_NULL_POINTER (value.value); ecma_number_t *num_p = ecma_alloc_number (); *num_p = ecma_string_to_number (str_p); @@ -418,7 +418,7 @@ ecma_op_to_string (ecma_value_t value) /**< ecma-value */ case ECMA_TYPE_NUMBER: { - ecma_number_t *num_p = ECMA_GET_POINTER (value.value); + ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (value.value); res_p = ecma_new_ecma_string_from_number (*num_p); break; @@ -426,7 +426,7 @@ ecma_op_to_string (ecma_value_t value) /**< ecma-value */ case ECMA_TYPE_STRING: { - res_p = ECMA_GET_POINTER (value.value); + res_p = ECMA_GET_NON_NULL_POINTER (value.value); res_p = ecma_copy_or_ref_ecma_string (res_p); break; @@ -649,7 +649,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ } else { - ecma_object_t *obj_p = ECMA_GET_POINTER (obj_value.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (obj_value.value); // 2. ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor (); @@ -806,7 +806,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ { JERRY_ASSERT (get_prop_value.u.value.value_type == ECMA_TYPE_OBJECT); - ecma_object_t *get_p = ECMA_GET_POINTER (get_prop_value.u.value.value); + ecma_object_t *get_p = ECMA_GET_NON_NULL_POINTER (get_prop_value.u.value.value); ecma_ref_object (get_p); prop_desc.get_p = get_p; @@ -850,7 +850,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ { JERRY_ASSERT (set_prop_value.u.value.value_type == ECMA_TYPE_OBJECT); - ecma_object_t *set_p = ECMA_GET_POINTER (set_prop_value.u.value.value); + ecma_object_t *set_p = ECMA_GET_NON_NULL_POINTER (set_prop_value.u.value.value); ecma_ref_object (set_p); prop_desc.set_p = set_p; diff --git a/src/libecmaoperations/ecma-function-object.c b/src/libecmaoperations/ecma-function-object.c index e0f7b5f24..170b6b5e7 100644 --- a/src/libecmaoperations/ecma-function-object.c +++ b/src/libecmaoperations/ecma-function-object.c @@ -94,7 +94,7 @@ ecma_op_is_callable (ecma_value_t value) /**< ecma-value */ return false; } - ecma_object_t *obj_p = ECMA_GET_POINTER(value.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER(value.value); JERRY_ASSERT(obj_p != NULL); JERRY_ASSERT(!ecma_is_lexical_environment (obj_p)); @@ -118,7 +118,7 @@ ecma_is_constructor (ecma_value_t value) /**< ecma-value */ return false; } - ecma_object_t *obj_p = ECMA_GET_POINTER(value.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER(value.value); JERRY_ASSERT(obj_p != NULL); JERRY_ASSERT(!ecma_is_lexical_environment (obj_p)); @@ -339,7 +339,7 @@ ecma_function_call_setup_args_variables (ecma_object_t *func_obj_p, /**< Functio ecma_value_t formal_parameter_name_value = *formal_params_iterator.current_value_p; JERRY_ASSERT (formal_parameter_name_value.value_type == ECMA_TYPE_STRING); - ecma_string_t *formal_parameter_name_string_p = ECMA_GET_POINTER (formal_parameter_name_value.value); + ecma_string_t *formal_parameter_name_string_p = ECMA_GET_NON_NULL_POINTER (formal_parameter_name_value.value); bool arg_already_declared = ecma_op_has_binding (env_p, formal_parameter_name_string_p); if (!arg_already_declared) @@ -395,7 +395,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object * return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE); } - ecma_object_t* v_obj_p = ECMA_GET_POINTER (value.value); + ecma_object_t* v_obj_p = ECMA_GET_NON_NULL_POINTER (value.value); JERRY_ASSERT (v_obj_p != NULL); ecma_string_t *prototype_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_PROTOTYPE); @@ -412,7 +412,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object * } else { - ecma_object_t *prototype_obj_p = ECMA_GET_POINTER (prototype_obj_value.u.value.value); + ecma_object_t *prototype_obj_p = ECMA_GET_NON_NULL_POINTER (prototype_obj_value.u.value.value); JERRY_ASSERT (prototype_obj_p != NULL); do @@ -487,7 +487,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */ ecma_property_t *scope_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_SCOPE); ecma_property_t *code_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_CODE); - ecma_object_t *scope_p = ECMA_GET_POINTER(scope_prop_p->u.internal_property.value); + ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER(scope_prop_p->u.internal_property.value); uint32_t code_prop_value = code_prop_p->u.internal_property.value; bool is_strict; @@ -599,7 +599,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */ ecma_object_t *prototype_p; if (func_obj_prototype_prop_value.u.value.value_type == ECMA_TYPE_OBJECT) { - prototype_p = ECMA_GET_POINTER (func_obj_prototype_prop_value.u.value.value); + prototype_p = ECMA_GET_NON_NULL_POINTER (func_obj_prototype_prop_value.u.value.value); ecma_ref_object (prototype_p); } else diff --git a/src/libecmaoperations/ecma-get-put-value.c b/src/libecmaoperations/ecma-get-put-value.c index 822d719bc..4c6d12068 100644 --- a/src/libecmaoperations/ecma-get-put-value.c +++ b/src/libecmaoperations/ecma-get-put-value.c @@ -56,13 +56,13 @@ ecma_op_get_value_lex_env_base (ecma_reference_t ref) /**< ECMA-reference */ } // 5. - ecma_object_t *lex_env_p = ECMA_GET_POINTER(base.value); + ecma_object_t *lex_env_p = ECMA_GET_NON_NULL_POINTER(base.value); JERRY_ASSERT(lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); // 5.a return ecma_op_get_binding_value (lex_env_p, - ECMA_GET_POINTER (ref.referenced_name_cp), + ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp), ref.is_strict); } /* ecma_op_get_value_lex_env_base */ @@ -83,7 +83,7 @@ ecma_op_get_value_object_base (ecma_reference_t ref) /**< ECMA-reference */ || base.value_type == ECMA_TYPE_NUMBER || base.value_type == ECMA_TYPE_STRING); const bool has_object_base = (base.value_type == ECMA_TYPE_OBJECT - && !(ecma_is_lexical_environment ((ecma_object_t*)ECMA_GET_POINTER(base.value)))); + && !(ecma_is_lexical_environment (ECMA_GET_NON_NULL_POINTER(base.value)))); const bool is_property_reference = has_primitive_base || has_object_base; JERRY_ASSERT (!is_unresolvable_reference); @@ -98,7 +98,7 @@ ecma_op_get_value_object_base (ecma_reference_t ref) /**< ECMA-reference */ JERRY_ASSERT(obj_p != NULL && !ecma_is_lexical_environment (obj_p)); - return ecma_op_object_get (obj_p, ECMA_GET_POINTER (ref.referenced_name_cp)); + return ecma_op_object_get (obj_p, ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp)); } else { @@ -107,11 +107,11 @@ 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_POINTER (obj_base.u.value.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (obj_base.u.value.value); JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p)); - ret_value = ecma_op_object_get (obj_p, ECMA_GET_POINTER (ref.referenced_name_cp)); + ret_value = ecma_op_object_get (obj_p, ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp)); ECMA_FINALIZE (obj_base); @@ -148,7 +148,7 @@ ecma_op_put_value_lex_env_base (ecma_reference_t ref, /**< ECMA-reference */ ecma_object_t *global_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL); ecma_completion_value_t completion = ecma_op_object_put (global_object_p, - ECMA_GET_POINTER (ref.referenced_name_cp), + ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp), value, false); @@ -162,13 +162,13 @@ ecma_op_put_value_lex_env_base (ecma_reference_t ref, /**< ECMA-reference */ } // 5. - ecma_object_t *lex_env_p = ECMA_GET_POINTER(base.value); + ecma_object_t *lex_env_p = ECMA_GET_NON_NULL_POINTER(base.value); JERRY_ASSERT(lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); // 5.a return ecma_op_set_mutable_binding (lex_env_p, - ECMA_GET_POINTER (ref.referenced_name_cp), + ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp), value, ref.is_strict); } /* ecma_op_put_value_lex_env_base */ @@ -210,7 +210,7 @@ ecma_op_put_value_object_base (ecma_reference_t ref, /**< ECMA-reference */ || base.value_type == ECMA_TYPE_NUMBER || base.value_type == ECMA_TYPE_STRING); const bool has_object_base = (base.value_type == ECMA_TYPE_OBJECT - && !(ecma_is_lexical_environment ((ecma_object_t*)ECMA_GET_POINTER(base.value)))); + && !(ecma_is_lexical_environment (ECMA_GET_NON_NULL_POINTER(base.value)))); const bool is_property_reference = has_primitive_base || has_object_base; JERRY_ASSERT (!is_unresolvable_reference); @@ -221,7 +221,7 @@ ecma_op_put_value_object_base (ecma_reference_t ref, /**< ECMA-reference */ { // 4.b case 1 - ecma_object_t *obj_p = ECMA_GET_POINTER(base.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER(base.value); 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_TRY_CATCH (put_completion, ecma_op_object_put (obj_p, - ECMA_GET_POINTER (ref.referenced_name_cp), + ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp), value, ref.is_strict), ret_value); @@ -248,11 +248,11 @@ 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_POINTER (obj_base.u.value.value); + ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (obj_base.u.value.value); JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p)); - ecma_string_t *referenced_name_p = ECMA_GET_POINTER (ref.referenced_name_cp); + ecma_string_t *referenced_name_p = ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp); // sub_2. if (!ecma_op_object_can_put (obj_p, referenced_name_p)) @@ -280,7 +280,7 @@ ecma_op_put_value_object_base (ecma_reference_t ref, /**< ECMA-reference */ // sub_6. JERRY_ASSERT (prop_p != NULL && prop_p->type == ECMA_PROPERTY_NAMEDACCESSOR); - ecma_object_t *setter_p = ECMA_GET_POINTER(prop_p->u.named_accessor_property.set_p); + ecma_object_t *setter_p = ECMA_GET_NON_NULL_POINTER(prop_p->u.named_accessor_property.set_p); JERRY_ASSERT (setter_p != NULL); ECMA_TRY_CATCH (call_completion, diff --git a/src/libecmaoperations/ecma-lex-env.c b/src/libecmaoperations/ecma-lex-env.c index ea62b04c6..d9f48d244 100644 --- a/src/libecmaoperations/ecma-lex-env.c +++ b/src/libecmaoperations/ecma-lex-env.c @@ -47,7 +47,7 @@ ecma_get_lex_env_binding_object (ecma_object_t* obj_lex_env_p) /**< object lexic JERRY_ASSERT(binding_obj_prop_p != NULL && binding_obj_prop_p->u.internal_property.type == ECMA_INTERNAL_PROPERTY_BINDING_OBJECT); - return ECMA_GET_POINTER(binding_obj_prop_p->u.internal_property.value); + return ECMA_GET_NON_NULL_POINTER (binding_obj_prop_p->u.internal_property.value); } /* ecma_get_lex_env_binding_object */ /** diff --git a/src/libecmaoperations/ecma-number-object.c b/src/libecmaoperations/ecma-number-object.c index cccf5f787..f258988df 100644 --- a/src/libecmaoperations/ecma-number-object.c +++ b/src/libecmaoperations/ecma-number-object.c @@ -48,7 +48,7 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb return conv_to_num_completion; } - ecma_number_t *prim_value_p = ECMA_GET_POINTER (conv_to_num_completion.u.value.value); + ecma_number_t *prim_value_p = ECMA_GET_NON_NULL_POINTER (conv_to_num_completion.u.value.value); #ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE); diff --git a/src/libecmaoperations/ecma-objects-arguments.c b/src/libecmaoperations/ecma-objects-arguments.c index 1841e8fd7..7c90132c0 100644 --- a/src/libecmaoperations/ecma-objects-arguments.c +++ b/src/libecmaoperations/ecma-objects-arguments.c @@ -141,7 +141,7 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */ JERRY_ASSERT (param_index < formal_params_number); JERRY_ASSERT (formal_params_iter_p->current_value_p->value_type == ECMA_TYPE_STRING); - formal_params[param_index] = ECMA_GET_POINTER (formal_params_iter_p->current_value_p->value); + formal_params[param_index] = ECMA_GET_NON_NULL_POINTER (formal_params_iter_p->current_value_p->value); } for (int32_t indx = formal_params_number - 1; @@ -277,14 +277,14 @@ ecma_arguments_get_mapped_arg_value (ecma_object_t *map_p, /**< [[ParametersMap] equal to mapped argument's name */ { ecma_property_t *scope_prop_p = ecma_get_internal_property (map_p, ECMA_INTERNAL_PROPERTY_SCOPE); - ecma_object_t *lex_env_p = ECMA_GET_POINTER (scope_prop_p->u.internal_property.value); + ecma_object_t *lex_env_p = ECMA_GET_NON_NULL_POINTER (scope_prop_p->u.internal_property.value); JERRY_ASSERT(lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); ecma_value_t arg_name_prop_value = arg_name_prop_p->u.named_data_property.value; JERRY_ASSERT (arg_name_prop_value.value_type == ECMA_TYPE_STRING); - ecma_string_t *arg_name_p = ECMA_GET_POINTER (arg_name_prop_value.value); + ecma_string_t *arg_name_p = ECMA_GET_NON_NULL_POINTER (arg_name_prop_value.value); ecma_completion_value_t completion = ecma_op_get_binding_value (lex_env_p, arg_name_p, @@ -310,7 +310,7 @@ ecma_op_arguments_object_get (ecma_object_t *obj_p, /**< the object */ { // 1. ecma_property_t *map_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP); - ecma_object_t *map_p = ECMA_GET_POINTER (map_prop_p->u.internal_property.value); + ecma_object_t *map_p = ECMA_GET_NON_NULL_POINTER (map_prop_p->u.internal_property.value); // 2. ecma_property_t *mapped_prop_p = ecma_op_object_get_own_property (map_p, property_name_p); @@ -355,7 +355,7 @@ ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p, /**< the object // 3. ecma_property_t *map_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP); - ecma_object_t *map_p = ECMA_GET_POINTER (map_prop_p->u.internal_property.value); + ecma_object_t *map_p = ECMA_GET_NON_NULL_POINTER (map_prop_p->u.internal_property.value); // 4. ecma_property_t *mapped_prop_p = ecma_op_object_get_own_property (map_p, property_name_p); @@ -395,7 +395,7 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *obj_p, /**< the obj { // 1. ecma_property_t *map_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP); - ecma_object_t *map_p = ECMA_GET_POINTER (map_prop_p->u.internal_property.value); + ecma_object_t *map_p = ECMA_GET_NON_NULL_POINTER (map_prop_p->u.internal_property.value); // 2. ecma_property_t *mapped_prop_p = ecma_op_object_get_own_property (map_p, property_name_p); @@ -488,7 +488,7 @@ ecma_op_arguments_object_delete (ecma_object_t *obj_p, /**< the object */ { // 1. ecma_property_t *map_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP); - ecma_object_t *map_p = ECMA_GET_POINTER (map_prop_p->u.internal_property.value); + ecma_object_t *map_p = ECMA_GET_NON_NULL_POINTER (map_prop_p->u.internal_property.value); // 2. ecma_property_t *mapped_prop_p = ecma_op_object_get_own_property (map_p, property_name_p); diff --git a/src/libecmaoperations/ecma-objects-general.c b/src/libecmaoperations/ecma-objects-general.c index 454ae5465..78705db10 100644 --- a/src/libecmaoperations/ecma-objects-general.c +++ b/src/libecmaoperations/ecma-objects-general.c @@ -306,7 +306,7 @@ ecma_op_general_object_put (ecma_object_t *obj_p, /**< the object */ && desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR) { // a. - ecma_object_t *setter_p = ECMA_GET_POINTER(desc_p->u.named_accessor_property.set_p); + ecma_object_t *setter_p = ECMA_GET_NON_NULL_POINTER(desc_p->u.named_accessor_property.set_p); JERRY_ASSERT(setter_p != NULL); ecma_completion_value_t ret_value; @@ -606,7 +606,7 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */ if (ecma_op_is_callable (function_value_get_completion.u.value)) { - ecma_object_t *func_obj_p = ECMA_GET_POINTER (function_value_get_completion.u.value.value); + ecma_object_t *func_obj_p = ECMA_GET_NON_NULL_POINTER (function_value_get_completion.u.value.value); call_completion = ecma_op_function_call (func_obj_p, ecma_make_object_value (obj_p), diff --git a/src/libecmaoperations/ecma-reference.c b/src/libecmaoperations/ecma-reference.c index d9415e75c..5013a5faf 100644 --- a/src/libecmaoperations/ecma-reference.c +++ b/src/libecmaoperations/ecma-reference.c @@ -95,7 +95,7 @@ void ecma_free_reference (ecma_reference_t ref) /**< reference */ { ecma_free_value (ref.base, true); - ecma_deref_ecma_string (ECMA_GET_POINTER (ref.referenced_name_cp)); + ecma_deref_ecma_string (ECMA_GET_NON_NULL_POINTER (ref.referenced_name_cp)); } /* ecma_free_reference */ /** diff --git a/src/libecmaoperations/ecma-string-object.c b/src/libecmaoperations/ecma-string-object.c index 9bc0ead5d..84d2511ab 100644 --- a/src/libecmaoperations/ecma-string-object.c +++ b/src/libecmaoperations/ecma-string-object.c @@ -68,7 +68,7 @@ ecma_op_create_string_object (ecma_value_t *arguments_list_p, /**< list of argum JERRY_ASSERT (ecma_is_completion_value_normal (to_str_arg_value)); JERRY_ASSERT (to_str_arg_value.u.value.value_type == ECMA_TYPE_STRING); - prim_prop_str_value_p = ECMA_GET_POINTER (to_str_arg_value.u.value.value); + prim_prop_str_value_p = ECMA_GET_NON_NULL_POINTER (to_str_arg_value.u.value.value); int32_t string_len = ecma_string_get_length (prim_prop_str_value_p); JERRY_ASSERT (string_len >= 0); @@ -169,7 +169,7 @@ ecma_op_string_object_get_own_property (ecma_object_t *obj_p, /**< the array obj // 4. ecma_property_t* prim_value_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PRIMITIVE_STRING_VALUE); - ecma_string_t *prim_value_str_p = ECMA_GET_POINTER (prim_value_prop_p->u.internal_property.value); + ecma_string_t *prim_value_str_p = ECMA_GET_NON_NULL_POINTER (prim_value_prop_p->u.internal_property.value); // 6. int32_t length = ecma_string_get_length (prim_value_str_p);