Check whether the aligned pointers value of the internal properties can be stored directly in ecma_value_t.

Those internal properties which have a primitive value field or where the property value type
is an ecma_object_t ptr were checked earlier.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
Robert Sipka
2016-04-26 15:59:59 +02:00
parent af65a9e912
commit 19b972b8eb
7 changed files with 30 additions and 30 deletions
+2 -2
View File
@@ -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);
+5 -5
View File
@@ -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;
@@ -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);
}
@@ -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)
{
+2 -2
View File
@@ -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 */
@@ -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);
}
/*
@@ -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);
@@ -205,8 +205,8 @@ 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)
{
@@ -214,7 +214,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this argument
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);
@@ -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)
{
@@ -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.
@@ -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)
{
@@ -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;
@@ -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);
@@ -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);
@@ -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 */
@@ -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);
@@ -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)
{