Skip to content

Commit 3230b03

Browse files
committed
Check whether the aligned pointers value of the internal properties can be stored directly
in ecma_value_t or not. This change affects those internal properties that haven't been checked previously. JerryScript-DCO-1.0-Signed-off-by: Robert Sipka [email protected]
1 parent 0c7d3fb commit 3230b03

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

jerry-core/ecma/base/ecma-gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ ecma_gc_mark_property (ecma_property_t *property_p) /**< property */
290290

291291
case ECMA_INTERNAL_PROPERTY_BOUND_FUNCTION_BOUND_ARGS: /* a collection of ecma values */
292292
{
293-
ecma_collection_header_t *bound_arg_list_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_header_t,
294-
property_value);
293+
ecma_collection_header_t *bound_arg_list_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_header_t,
294+
property_value);
295295

296296
ecma_collection_iterator_t bound_args_iterator;
297297
ecma_collection_iterator_init (&bound_args_iterator, bound_arg_list_p);

jerry-core/ecma/base/ecma-helpers.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,8 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */
807807
case ECMA_INTERNAL_PROPERTY_NUMBER_INDEXED_ARRAY_VALUES: /* a collection */
808808
case ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES: /* a collection */
809809
{
810-
ecma_free_values_collection (ECMA_GET_NON_NULL_POINTER (ecma_collection_header_t,
811-
property_value),
810+
ecma_free_values_collection (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_header_t,
811+
property_value),
812812
true);
813813

814814
break;
@@ -867,7 +867,7 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */
867867
{
868868
if (property_value != ECMA_NULL_POINTER)
869869
{
870-
ecma_free_values_collection (ECMA_GET_NON_NULL_POINTER (ecma_collection_header_t, property_value),
870+
ecma_free_values_collection (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_header_t, property_value),
871871
false);
872872
}
873873

@@ -883,13 +883,13 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */
883883

884884
case ECMA_INTERNAL_PROPERTY_CODE_BYTECODE: /* compressed pointer to a bytecode array */
885885
{
886-
ecma_bytecode_deref (ECMA_GET_NON_NULL_POINTER (ecma_compiled_code_t, property_value));
886+
ecma_bytecode_deref (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, property_value));
887887
break;
888888
}
889889

890890
case ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE: /* compressed pointer to a regexp bytecode array */
891891
{
892-
ecma_compiled_code_t *bytecode_p = ECMA_GET_POINTER (ecma_compiled_code_t, property_value);
892+
ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, property_value);
893893

894894
if (bytecode_p != NULL)
895895
{

jerry-core/ecma/base/ecma-helpers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@
9595
ECMA_SET_NON_NULL_POINTER (field, non_compressed_pointer)
9696

9797
/**
98-
* Get an internal property value of pointer from specified non-null compressed pointer.
98+
* Get an internal property value of pointer from specified compressed pointer.
9999
*/
100100
#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \
101-
ECMA_GET_NON_NULL_POINTER (type, field)
101+
ECMA_GET_POINTER (type, field)
102102

103103
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
104104

jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ ecma_builtin_function_prototype_object_bind (ecma_value_t this_arg, /**< this ar
272272

273273
ecma_property_t *bound_args_prop_p;
274274
bound_args_prop_p = ecma_create_internal_property (function_p, ECMA_INTERNAL_PROPERTY_BOUND_FUNCTION_BOUND_ARGS);
275-
ECMA_SET_NON_NULL_POINTER (ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value, bound_args_collection_p);
275+
ECMA_SET_INTERNAL_VALUE_POINTER (ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value, bound_args_collection_p);
276276
}
277277

278278
/*

jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,15 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
136136
/* Should always succeed, since we're compiling from a source that has been compiled previously. */
137137
JERRY_ASSERT (ecma_is_value_empty (bc_comp));
138138

139-
re_compiled_code_t *old_bc_p = ECMA_GET_POINTER (re_compiled_code_t,
140-
ecma_get_internal_property_value (bc_prop_p));
139+
re_compiled_code_t *old_bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
140+
ecma_get_internal_property_value (bc_prop_p));
141141
if (old_bc_p != NULL)
142142
{
143143
/* Free the old bytecode */
144144
ecma_bytecode_deref ((ecma_compiled_code_t *) old_bc_p);
145145
}
146146

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

149149
re_initialize_props (this_obj_p, pattern_string_p, flags);
150150

@@ -205,16 +205,16 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
205205
re_compile_bytecode (&new_bc_p, pattern_string_p, flags),
206206
ret_value);
207207

208-
re_compiled_code_t *old_bc_p = ECMA_GET_POINTER (re_compiled_code_t,
209-
ecma_get_internal_property_value (bc_prop_p));
208+
re_compiled_code_t *old_bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
209+
ecma_get_internal_property_value (bc_prop_p));
210210

211211
if (old_bc_p != NULL)
212212
{
213213
/* Free the old bytecode */
214214
ecma_bytecode_deref ((ecma_compiled_code_t *) old_bc_p);
215215
}
216216

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

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

272-
void *bytecode_p = ECMA_GET_POINTER (void, ecma_get_internal_property_value (bytecode_prop_p));
272+
void *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (void, ecma_get_internal_property_value (bytecode_prop_p));
273273

274274
if (bytecode_p == NULL)
275275
{

jerry-core/ecma/operations/ecma-function-object.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
172172

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

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

296296
const ecma_compiled_code_t *bytecode_data_p;
297-
bytecode_data_p = MEM_CP_GET_POINTER (const ecma_compiled_code_t,
298-
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);
297+
bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
298+
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);
299299

300300
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)
301301
{
@@ -585,8 +585,8 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
585585
bool is_no_lex_env;
586586

587587
const ecma_compiled_code_t *bytecode_data_p;
588-
bytecode_data_p = MEM_CP_GET_POINTER (const ecma_compiled_code_t,
589-
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);
588+
bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
589+
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);
590590

591591
is_strict = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE) ? true : false;
592592
is_no_lex_env = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED) ? true : false;
@@ -696,8 +696,8 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
696696
if (bound_args_prop_p != NULL)
697697
{
698698
ecma_collection_header_t *bound_arg_list_p;
699-
bound_arg_list_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_header_t,
700-
ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value);
699+
bound_arg_list_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_header_t,
700+
ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value);
701701

702702
JERRY_ASSERT (bound_arg_list_p->unit_number > 0);
703703

@@ -887,8 +887,8 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
887887
if (bound_args_prop_p != NULL)
888888
{
889889
ecma_collection_header_t *bound_arg_list_p;
890-
bound_arg_list_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_header_t,
891-
ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value);
890+
bound_arg_list_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_header_t,
891+
ECMA_PROPERTY_VALUE_PTR (bound_args_prop_p)->value);
892892

893893
JERRY_ASSERT (bound_arg_list_p->unit_number > 0);
894894

jerry-core/ecma/operations/ecma-regexp-object.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ ecma_op_create_regexp_object_from_bytecode (re_compiled_code_t *bytecode_p) /**<
246246
/* Set bytecode internal property. */
247247
ecma_property_t *bytecode_prop_p;
248248
bytecode_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);
249-
ECMA_SET_NON_NULL_POINTER (ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value, bytecode_p);
249+
ECMA_SET_INTERNAL_VALUE_POINTER (ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value, bytecode_p);
250250
ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_p);
251251

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

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

311311
ECMA_FINALIZE (empty);
@@ -1262,8 +1262,8 @@ ecma_regexp_exec_helper (ecma_value_t regexp_value, /**< RegExp object */
12621262

12631263
ecma_property_t *bytecode_prop_p = ecma_get_internal_property (regexp_object_p,
12641264
ECMA_INTERNAL_PROPERTY_REGEXP_BYTECODE);
1265-
re_compiled_code_t *bc_p = ECMA_GET_POINTER (re_compiled_code_t,
1266-
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);
1265+
re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
1266+
ECMA_PROPERTY_VALUE_PTR (bytecode_prop_p)->value);
12671267

12681268
if (bc_p == NULL)
12691269
{

0 commit comments

Comments
 (0)