Major property rework: introducing virtual properties.
Properties are changed to a type and value pair instead of a pointer to an internal representation. Functions such as ecma_op_object_get_[own_]property do not return with property pointers anymore. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -88,7 +88,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
|
||||
|
||||
for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)
|
||||
{
|
||||
ecma_property_types_t type = ECMA_PROPERTY_GET_TYPE (prop_iter_p->types + i);
|
||||
ecma_property_types_t type = ECMA_PROPERTY_GET_TYPE (prop_iter_p->types[i]);
|
||||
|
||||
if (type == ECMA_PROPERTY_TYPE_NAMEDDATA || type == ECMA_PROPERTY_TYPE_NAMEDACCESSOR)
|
||||
{
|
||||
@@ -119,7 +119,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
|
||||
|
||||
memset (hashmap_p, 0, total_size);
|
||||
|
||||
hashmap_p->header.types[0].type_and_flags = ECMA_PROPERTY_TYPE_HASHMAP;
|
||||
hashmap_p->header.types[0] = ECMA_PROPERTY_TYPE_HASHMAP;
|
||||
hashmap_p->header.next_property_cp = object_p->property_list_or_bound_object_cp;
|
||||
hashmap_p->max_property_count = max_property_count;
|
||||
hashmap_p->null_count = max_property_count - named_property_count;
|
||||
@@ -132,7 +132,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
|
||||
|
||||
if (max_property_count <= LIT_STRING_HASH_LIMIT)
|
||||
{
|
||||
hashmap_p->header.types[1].type_and_flags = 0;
|
||||
hashmap_p->header.types[1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -143,7 +143,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
|
||||
}
|
||||
}
|
||||
|
||||
hashmap_p->header.types[1].type_and_flags = shift_counter;
|
||||
hashmap_p->header.types[1] = shift_counter;
|
||||
|
||||
prop_iter_p = ecma_get_property_list (object_p);
|
||||
ECMA_SET_POINTER (object_p->property_list_or_bound_object_cp, hashmap_p);
|
||||
@@ -154,7 +154,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
|
||||
|
||||
for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)
|
||||
{
|
||||
ecma_property_types_t type = ECMA_PROPERTY_GET_TYPE (prop_iter_p->types + i);
|
||||
ecma_property_types_t type = ECMA_PROPERTY_GET_TYPE (prop_iter_p->types[i]);
|
||||
|
||||
if (!(type == ECMA_PROPERTY_TYPE_NAMEDDATA || type == ECMA_PROPERTY_TYPE_NAMEDACCESSOR))
|
||||
{
|
||||
@@ -225,7 +225,7 @@ ecma_property_hashmap_free (ecma_object_t *object_p) /**< object */
|
||||
ecma_property_header_t *property_p = ecma_get_property_list (object_p);
|
||||
|
||||
JERRY_ASSERT (property_p != NULL
|
||||
&& ECMA_PROPERTY_GET_TYPE (property_p->types + 0) == ECMA_PROPERTY_TYPE_HASHMAP);
|
||||
&& ECMA_PROPERTY_GET_TYPE (property_p->types[0]) == ECMA_PROPERTY_TYPE_HASHMAP);
|
||||
|
||||
ecma_property_hashmap_t *hashmap_p = (ecma_property_hashmap_t *) property_p;
|
||||
|
||||
@@ -251,7 +251,7 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
|
||||
ecma_property_hashmap_t *hashmap_p = ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t,
|
||||
object_p->property_list_or_bound_object_cp);
|
||||
|
||||
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (hashmap_p->header.types + 0) == ECMA_PROPERTY_TYPE_HASHMAP);
|
||||
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (hashmap_p->header.types[0]) == ECMA_PROPERTY_TYPE_HASHMAP);
|
||||
|
||||
/* The NULLs are reduced below 1/8 of the hashmap. */
|
||||
if (hashmap_p->null_count < (hashmap_p->max_property_count >> 3))
|
||||
@@ -273,7 +273,7 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
|
||||
}
|
||||
else
|
||||
{
|
||||
entry_index <<= hashmap_p->header.types[1].type_and_flags;
|
||||
entry_index <<= hashmap_p->header.types[1];
|
||||
}
|
||||
|
||||
#ifndef JERRY_NDEBUG
|
||||
@@ -334,7 +334,7 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
|
||||
ecma_property_hashmap_t *hashmap_p = ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t,
|
||||
object_p->property_list_or_bound_object_cp);
|
||||
|
||||
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (hashmap_p->header.types + 0) == ECMA_PROPERTY_TYPE_HASHMAP);
|
||||
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (hashmap_p->header.types[0]) == ECMA_PROPERTY_TYPE_HASHMAP);
|
||||
|
||||
uint32_t entry_index = name_p->hash;
|
||||
uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];
|
||||
@@ -348,7 +348,7 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
|
||||
}
|
||||
else
|
||||
{
|
||||
entry_index <<= hashmap_p->header.types[1].type_and_flags;
|
||||
entry_index <<= hashmap_p->header.types[1];
|
||||
JERRY_ASSERT (entry_index <= mask);
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
|
||||
}
|
||||
else
|
||||
{
|
||||
entry_index <<= hashmap_p->header.types[1].type_and_flags;
|
||||
entry_index <<= hashmap_p->header.types[1];
|
||||
JERRY_ASSERT (entry_index <= mask);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user