Skip to content

Check whether the aligned pointers value of the internal properties c… #1033

New issue

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

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

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jerry-core/ecma/base/ecma-gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ ecma_gc_mark_property (ecma_property_t *property_p) /**< property */

case ECMA_INTERNAL_PROPERTY_BOUND_FUNCTION_BOUND_ARGS: /* a collection of ecma values */
{
ecma_collection_header_t *bound_arg_list_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_header_t,
property_value);
ecma_collection_header_t *bound_arg_list_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_header_t,
property_value);

ecma_collection_iterator_t bound_args_iterator;
ecma_collection_iterator_init (&bound_args_iterator, bound_arg_list_p);
Expand Down
10 changes: 5 additions & 5 deletions jerry-core/ecma/base/ecma-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,8 @@ 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_NON_NULL_POINTER (ecma_collection_header_t,
property_value),
ecma_free_values_collection (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_header_t,
property_value),
true);

break;
Expand Down Expand Up @@ -865,7 +865,7 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */
{
if (property_value != ECMA_NULL_POINTER)
{
ecma_free_values_collection (ECMA_GET_NON_NULL_POINTER (ecma_collection_header_t, property_value),
ecma_free_values_collection (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_header_t, property_value),
false);
}

Expand All @@ -881,13 +881,13 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */

case ECMA_INTERNAL_PROPERTY_CODE_BYTECODE: /* compressed pointer to a bytecode array */
{
ecma_bytecode_deref (ECMA_GET_NON_NULL_POINTER (ecma_compiled_code_t, property_value));
ecma_bytecode_deref (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, property_value));
break;
}

case ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE: /* compressed pointer to a regexp bytecode array */
{
ecma_compiled_code_t *bytecode_p = ECMA_GET_POINTER (ecma_compiled_code_t, property_value);
ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, property_value);

if (bytecode_p != NULL)
{
Expand Down
4 changes: 2 additions & 2 deletions jerry-core/ecma/base/ecma-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@
ECMA_SET_NON_NULL_POINTER (field, non_compressed_pointer)

/**
* Get an internal property value of pointer from specified non-null compressed pointer.
* Get an internal property value of pointer from specified compressed pointer.
*/
#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \
ECMA_GET_NON_NULL_POINTER (type, field)
ECMA_GET_POINTER (type, field)

#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ ecma_builtin_function_prototype_object_bind (ecma_value_t this_arg, /**< this ar

ecma_property_t *bound_args_prop_p;
bound_args_prop_p = ecma_create_internal_property (function_p, ECMA_INTERNAL_PROPERTY_BOUND_FUNCTION_BOUND_ARGS);
ECMA_SET_NON_NULL_POINTER (ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value, bound_args_collection_p);
ECMA_SET_INTERNAL_VALUE_POINTER (ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value, bound_args_collection_p);
}

/*
Expand Down
14 changes: 7 additions & 7 deletions jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
/* Should always succeed, since we're compiling from a source that has been compiled previously. */
JERRY_ASSERT (ecma_is_value_empty (bc_comp));

re_compiled_code_t *old_bc_p = ECMA_GET_POINTER (re_compiled_code_t,
ecma_get_internal_property_value (bc_prop_p));
re_compiled_code_t *old_bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
ecma_get_internal_property_value (bc_prop_p));
if (old_bc_p != NULL)
{
/* Free the old bytecode */
ecma_bytecode_deref ((ecma_compiled_code_t *) old_bc_p);
}

ECMA_SET_POINTER (ECMA_PROPERTY_VALUE_PTR (bc_prop_p)->value, new_bc_p);
ECMA_SET_INTERNAL_VALUE_POINTER (ECMA_PROPERTY_VALUE_PTR (bc_prop_p)->value, new_bc_p);

re_initialize_props (this_obj_p, pattern_string_p, flags);

Expand Down Expand Up @@ -205,16 +205,16 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
re_compile_bytecode (&new_bc_p, pattern_string_p, flags),
ret_value);

re_compiled_code_t *old_bc_p = ECMA_GET_POINTER (re_compiled_code_t,
ecma_get_internal_property_value (bc_prop_p));
re_compiled_code_t *old_bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
ecma_get_internal_property_value (bc_prop_p));

if (old_bc_p != NULL)
{
/* Free the old bytecode */
ecma_bytecode_deref ((ecma_compiled_code_t *) old_bc_p);
}

ECMA_SET_POINTER (ECMA_PROPERTY_VALUE_PTR (bc_prop_p)->value, new_bc_p);
ECMA_SET_INTERNAL_VALUE_POINTER (ECMA_PROPERTY_VALUE_PTR (bc_prop_p)->value, new_bc_p);
re_initialize_props (this_obj_p, pattern_string_p, flags);
ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);

Expand Down Expand Up @@ -269,7 +269,7 @@ ecma_builtin_regexp_prototype_exec (ecma_value_t this_arg, /**< this argument */
ecma_object_t *obj_p = ecma_get_object_from_value (obj_this);
bytecode_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);

void *bytecode_p = ECMA_GET_POINTER (void, ecma_get_internal_property_value (bytecode_prop_p));
void *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (void, ecma_get_internal_property_value (bytecode_prop_p));

if (bytecode_p == NULL)
{
Expand Down
18 changes: 9 additions & 9 deletions jerry-core/ecma/operations/ecma-function-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */

// 10., 11., 12.
ecma_property_t *bytecode_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CODE_BYTECODE);
MEM_CP_SET_NON_NULL_POINTER (ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value, bytecode_data_p);
ECMA_SET_INTERNAL_VALUE_POINTER (ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value, bytecode_data_p);
ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);

// 14., 15., 16., 17., 18.
Expand Down Expand Up @@ -294,8 +294,8 @@ ecma_op_function_try_lazy_instantiate_property (ecma_object_t *obj_p, /**< the f
ecma_property_t *bytecode_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CODE_BYTECODE);

const ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = MEM_CP_GET_POINTER (const ecma_compiled_code_t,
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);
bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);

if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)
{
Expand Down Expand Up @@ -585,8 +585,8 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
bool is_no_lex_env;

const ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = MEM_CP_GET_POINTER (const ecma_compiled_code_t,
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);
bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);

is_strict = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE) ? true : false;
is_no_lex_env = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED) ? true : false;
Expand Down Expand Up @@ -696,8 +696,8 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
if (bound_args_prop_p != NULL)
{
ecma_collection_header_t *bound_arg_list_p;
bound_arg_list_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_header_t,
ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value);
bound_arg_list_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_header_t,
ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value);

JERRY_ASSERT (bound_arg_list_p->unit_number > 0);

Expand Down Expand Up @@ -887,8 +887,8 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
if (bound_args_prop_p != NULL)
{
ecma_collection_header_t *bound_arg_list_p;
bound_arg_list_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_header_t,
ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value);
bound_arg_list_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_header_t,
ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value);

JERRY_ASSERT (bound_arg_list_p->unit_number > 0);

Expand Down
8 changes: 4 additions & 4 deletions jerry-core/ecma/operations/ecma-regexp-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ ecma_op_create_regexp_object_from_bytecode (re_compiled_code_t *bytecode_p) /**<
/* Set bytecode internal property. */
ecma_property_t *bytecode_prop_p;
bytecode_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);
ECMA_SET_NON_NULL_POINTER (ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value, bytecode_p);
ECMA_SET_INTERNAL_VALUE_POINTER (ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value, bytecode_p);
ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_p);

/* Initialize RegExp object properties */
Expand Down Expand Up @@ -305,7 +305,7 @@ ecma_op_create_regexp_object (ecma_string_t *pattern_p, /**< input pattern */
const re_compiled_code_t *bc_p = NULL;
ECMA_TRY_CATCH (empty, re_compile_bytecode (&bc_p, pattern_p, flags), ret_value);

ECMA_SET_POINTER (ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value, bc_p);
ECMA_SET_INTERNAL_VALUE_POINTER (ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value, bc_p);
ret_value = ecma_make_object_value (obj_p);

ECMA_FINALIZE (empty);
Expand Down Expand Up @@ -1262,8 +1262,8 @@ ecma_regexp_exec_helper (ecma_value_t regexp_value, /**< RegExp object */

ecma_property_t *bytecode_prop_p = ecma_get_internal_property (regexp_object_p,
ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);
re_compiled_code_t *bc_p = ECMA_GET_POINTER (re_compiled_code_t,
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);

if (bc_p == NULL)
{
Expand Down