Implement the core of the map object. (#2447)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Robert Sipka
parent
65e81f3262
commit
d3d42f7685
+107
-24
@@ -32,10 +32,13 @@
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
|
||||
#include "ecma-typedarray-object.h"
|
||||
#endif
|
||||
#endif /* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
|
||||
#include "ecma-promise-object.h"
|
||||
#endif
|
||||
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN
|
||||
#include "ecma-map-object.h"
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||||
|
||||
/* TODO: Extract GC to a separate component */
|
||||
|
||||
@@ -206,6 +209,87 @@ ecma_gc_mark_property (ecma_property_pair_t *property_pair_p, /**< property pair
|
||||
}
|
||||
} /* ecma_gc_mark_property */
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
|
||||
|
||||
/**
|
||||
* Mark objects referenced by Promise built-in.
|
||||
*/
|
||||
static void
|
||||
ecma_gc_mark_promise_object (ecma_extended_object_t *ext_object_p) /**< extended object */
|
||||
{
|
||||
/* Mark promise result. */
|
||||
ecma_value_t result = ext_object_p->u.class_prop.u.value;
|
||||
|
||||
if (ecma_is_value_object (result))
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (result));
|
||||
}
|
||||
|
||||
/* Mark all reactions. */
|
||||
ecma_value_t *ecma_value_p;
|
||||
ecma_value_p = ecma_collection_iterator_init (((ecma_promise_object_t *) ext_object_p)->fulfill_reactions);
|
||||
|
||||
while (ecma_value_p != NULL)
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (*ecma_value_p));
|
||||
ecma_value_p = ecma_collection_iterator_next (ecma_value_p);
|
||||
}
|
||||
|
||||
ecma_value_p = ecma_collection_iterator_init (((ecma_promise_object_t *) ext_object_p)->reject_reactions);
|
||||
|
||||
while (ecma_value_p != NULL)
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (*ecma_value_p));
|
||||
ecma_value_p = ecma_collection_iterator_next (ecma_value_p);
|
||||
}
|
||||
} /* ecma_gc_mark_promise_object */
|
||||
|
||||
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN
|
||||
|
||||
/**
|
||||
* Mark objects referenced by Map built-in.
|
||||
*/
|
||||
static void
|
||||
ecma_gc_mark_map_object (ecma_extended_object_t *ext_object_p) /**< extended object */
|
||||
{
|
||||
ecma_map_object_t *map_object_p = (ecma_map_object_t *) ext_object_p;
|
||||
|
||||
jmem_cpointer_t first_chunk_cp = map_object_p->first_chunk_cp;
|
||||
|
||||
if (JERRY_UNLIKELY (first_chunk_cp == ECMA_NULL_POINTER))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_value_t *item_p = ECMA_GET_NON_NULL_POINTER (ecma_map_object_chunk_t, first_chunk_cp)->items;
|
||||
|
||||
while (true)
|
||||
{
|
||||
ecma_value_t item = *item_p++;
|
||||
|
||||
if (!ecma_is_value_pointer (item))
|
||||
{
|
||||
if (ecma_is_value_object (item))
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (item));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item_p = (ecma_value_t *) ecma_get_pointer_from_value (item);
|
||||
|
||||
if (item_p == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* ecma_gc_mark_map_object */
|
||||
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||||
|
||||
/**
|
||||
* Mark objects as visited starting from specified object as root
|
||||
*/
|
||||
@@ -243,43 +327,34 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
|
||||
|
||||
switch (ecma_get_object_type (object_p))
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
|
||||
case ECMA_OBJECT_TYPE_CLASS:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_PROMISE_UL)
|
||||
switch (ext_object_p->u.class_prop.class_id)
|
||||
{
|
||||
/* Mark promise result. */
|
||||
ecma_value_t result = ext_object_p->u.class_prop.u.value;
|
||||
|
||||
if (ecma_is_value_object (result))
|
||||
#ifndef CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
|
||||
case LIT_MAGIC_STRING_PROMISE_UL:
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (result));
|
||||
ecma_gc_mark_promise_object (ext_object_p);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Mark all reactions. */
|
||||
ecma_value_t *ecma_value_p;
|
||||
ecma_value_p = ecma_collection_iterator_init (((ecma_promise_object_t *) ext_object_p)->fulfill_reactions);
|
||||
|
||||
while (ecma_value_p != NULL)
|
||||
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN
|
||||
case LIT_MAGIC_STRING_MAP_UL:
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (*ecma_value_p));
|
||||
ecma_value_p = ecma_collection_iterator_next (ecma_value_p);
|
||||
ecma_gc_mark_map_object (ext_object_p);
|
||||
break;
|
||||
}
|
||||
|
||||
ecma_value_p = ecma_collection_iterator_init (((ecma_promise_object_t *) ext_object_p)->reject_reactions);
|
||||
|
||||
while (ecma_value_p != NULL)
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||||
default:
|
||||
{
|
||||
ecma_gc_set_object_visited (ecma_get_object_from_value (*ecma_value_p));
|
||||
ecma_value_p = ecma_collection_iterator_next (ecma_value_p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
#endif /*! CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
|
||||
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
@@ -582,6 +657,14 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
return;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */
|
||||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN
|
||||
case LIT_MAGIC_STRING_MAP_UL:
|
||||
{
|
||||
ecma_op_map_clear_map ((ecma_map_object_t *) object_p);
|
||||
ecma_dealloc_extended_object (object_p, sizeof (ecma_map_object_t));
|
||||
return;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||||
default:
|
||||
{
|
||||
/* The undefined id represents an uninitialized class. */
|
||||
|
||||
@@ -74,13 +74,12 @@ typedef enum
|
||||
ECMA_TYPE_FLOAT = 2, /**< pointer to a 64 or 32 bit floating point number */
|
||||
ECMA_TYPE_OBJECT = 3, /**< pointer to description of an object */
|
||||
ECMA_TYPE_DIRECT_STRING = 5, /**< directly encoded string values */
|
||||
ECMA_TYPE_ERROR = 7, /**< pointer to description of an error reference */
|
||||
ECMA_TYPE_COLLECTION_CHUNK = ECMA_TYPE_ERROR, /**< pointer to description of a collection chunk */
|
||||
ECMA_TYPE_ERROR = 7, /**< pointer to description of an error reference (only supported by C API) */
|
||||
ECMA_TYPE_POINTER = ECMA_TYPE_ERROR, /**< a generic aligned pointer */
|
||||
ECMA_TYPE_SNAPSHOT_OFFSET = ECMA_TYPE_ERROR, /**< offset to a snapshot number/string */
|
||||
ECMA_TYPE___MAX = ECMA_TYPE_ERROR /** highest value for ecma types */
|
||||
} ecma_type_t;
|
||||
|
||||
|
||||
/**
|
||||
* Option flags for script parsing.
|
||||
*/
|
||||
@@ -166,11 +165,11 @@ enum
|
||||
ECMA_VALUE_UNDEFINED = ECMA_MAKE_VALUE (4), /**< undefined value */
|
||||
ECMA_VALUE_NULL = ECMA_MAKE_VALUE (5), /**< null value */
|
||||
ECMA_VALUE_ARRAY_HOLE = ECMA_MAKE_VALUE (6), /**< array hole, used for
|
||||
* initialization of an array literal */
|
||||
* initialization of an array literal */
|
||||
ECMA_VALUE_NOT_FOUND = ECMA_MAKE_VALUE (7), /**< a special value returned by
|
||||
* ecma_op_object_find */
|
||||
* ecma_op_object_find */
|
||||
ECMA_VALUE_REGISTER_REF = ECMA_MAKE_VALUE (8), /**< register reference,
|
||||
* a special "base" value for vm */
|
||||
* a special "base" value for vm */
|
||||
};
|
||||
|
||||
#if CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32
|
||||
@@ -826,8 +825,8 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
ecma_extended_object_t header;
|
||||
const ecma_compiled_code_t *bytecode_p;
|
||||
ecma_extended_object_t header; /**< header part */
|
||||
const ecma_compiled_code_t *bytecode_p; /**< real byte code pointer */
|
||||
} ecma_static_function_t;
|
||||
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
@@ -860,6 +859,34 @@ typedef struct
|
||||
|
||||
#endif /* !CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
|
||||
|
||||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN
|
||||
|
||||
/**
|
||||
* Map item count of chunks
|
||||
*/
|
||||
#define ECMA_MAP_OBJECT_ITEM_COUNT 3
|
||||
|
||||
/**
|
||||
* Description of Map objects.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
ecma_extended_object_t header; /**< header part */
|
||||
jmem_cpointer_t first_chunk_cp; /**< first chunk of item list */
|
||||
jmem_cpointer_t last_chunk_cp; /**< last chunk of item list */
|
||||
} ecma_map_object_t;
|
||||
|
||||
/**
|
||||
* Description of Map memory chunk.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
ecma_value_t items[ECMA_MAP_OBJECT_ITEM_COUNT + 1]; /**< the last item is always a pointer to the next chunk,
|
||||
* the rest can be ECMA_VALUE_ARRAY_HOLE or any valid value. */
|
||||
} ecma_map_object_chunk_t;
|
||||
|
||||
#endif /* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||||
|
||||
/**
|
||||
* Description of ECMA property descriptor
|
||||
*
|
||||
|
||||
@@ -312,9 +312,9 @@ ecma_is_value_string (ecma_value_t value) /**< ecma value */
|
||||
} /* ecma_is_value_string */
|
||||
|
||||
/**
|
||||
* Check if the value is direct_ecma-string.
|
||||
* Check if the value is direct ecma-string.
|
||||
*
|
||||
* @return true - if the value contains ecma-string value,
|
||||
* @return true - if the value contains direct ecma-string value,
|
||||
* false - otherwise
|
||||
*/
|
||||
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
|
||||
@@ -323,6 +323,18 @@ ecma_is_value_direct_string (ecma_value_t value) /**< ecma value */
|
||||
return (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT_STRING);
|
||||
} /* ecma_is_value_direct_string */
|
||||
|
||||
/**
|
||||
* Check if the value is non-direct ecma-string.
|
||||
*
|
||||
* @return true - if the value contains non-direct ecma-string value,
|
||||
* false - otherwise
|
||||
*/
|
||||
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_is_value_non_direct_string (ecma_value_t value) /**< ecma value */
|
||||
{
|
||||
return (ecma_get_value_type_field (value) == ECMA_TYPE_STRING);
|
||||
} /* ecma_is_value_non_direct_string */
|
||||
|
||||
/**
|
||||
* Check if the value is object.
|
||||
*
|
||||
@@ -348,16 +360,16 @@ ecma_is_value_error_reference (ecma_value_t value) /**< ecma value */
|
||||
} /* ecma_is_value_error_reference */
|
||||
|
||||
/**
|
||||
* Check if the value is collection chunk.
|
||||
* Check if the value is an aligned pointer.
|
||||
*
|
||||
* @return true - if the value contains a collection chunk,
|
||||
* @return true - if the value contains an aligned pointer,
|
||||
* false - otherwise
|
||||
*/
|
||||
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_is_value_collection_chunk (ecma_value_t value) /**< ecma value */
|
||||
ecma_is_value_pointer (ecma_value_t value) /**< ecma value */
|
||||
{
|
||||
return (ecma_get_value_type_field (value) == ECMA_TYPE_COLLECTION_CHUNK);
|
||||
} /* ecma_is_value_collection_chunk */
|
||||
return (ecma_get_value_type_field (value) == ECMA_TYPE_POINTER);
|
||||
} /* ecma_is_value_pointer */
|
||||
|
||||
/**
|
||||
* Debug assertion that specified value's type is one of ECMA-defined
|
||||
@@ -566,27 +578,27 @@ ecma_make_error_reference_value (const ecma_error_reference_t *error_ref_p) /**<
|
||||
} /* ecma_make_error_reference_value */
|
||||
|
||||
/**
|
||||
* Collection chunk constructor
|
||||
* Create an ecma value from an aligned pointer
|
||||
*
|
||||
* @return ecma-value representation of the collection chunk
|
||||
* @return ecma-value representation of the aligned pointer
|
||||
*/
|
||||
inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_make_collection_chunk_value (const ecma_collection_chunk_t *collection_chunk_p) /**< collection chunk */
|
||||
ecma_make_pointer_value (const void *any_p) /**< any aligned pointer */
|
||||
{
|
||||
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
|
||||
|
||||
uintptr_t uint_ptr = (uintptr_t) collection_chunk_p;
|
||||
uintptr_t uint_ptr = (uintptr_t) any_p;
|
||||
JERRY_ASSERT ((uint_ptr & ECMA_VALUE_TYPE_MASK) == 0);
|
||||
return ((ecma_value_t) uint_ptr) | ECMA_TYPE_COLLECTION_CHUNK;
|
||||
return ((ecma_value_t) uint_ptr) | ECMA_TYPE_POINTER;
|
||||
|
||||
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
|
||||
|
||||
jmem_cpointer_t ptr_cp;
|
||||
ECMA_SET_POINTER (ptr_cp, collection_chunk_p);
|
||||
return (((ecma_value_t) ptr_cp) << ECMA_VALUE_SHIFT) | ECMA_TYPE_COLLECTION_CHUNK;
|
||||
ECMA_SET_POINTER (ptr_cp, any_p);
|
||||
return (((ecma_value_t) ptr_cp) << ECMA_VALUE_SHIFT) | ECMA_TYPE_POINTER;
|
||||
|
||||
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
|
||||
} /* ecma_make_collection_chunk_value */
|
||||
} /* ecma_make_pointer_value */
|
||||
|
||||
/**
|
||||
* Get integer value from an integer ecma value
|
||||
@@ -675,21 +687,21 @@ ecma_get_error_reference_from_value (ecma_value_t value) /**< ecma value */
|
||||
} /* ecma_get_error_reference_from_value */
|
||||
|
||||
/**
|
||||
* Get pointer to collection chunk from ecma value
|
||||
* Get an aligned pointer from an ecma value
|
||||
*
|
||||
* @return the pointer
|
||||
* @return pointer value
|
||||
*/
|
||||
inline ecma_collection_chunk_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_get_collection_chunk_from_value (ecma_value_t value) /**< ecma value */
|
||||
inline void * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_get_pointer_from_value (ecma_value_t value) /**< ecma value */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_COLLECTION_CHUNK);
|
||||
JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_POINTER);
|
||||
|
||||
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
|
||||
return (ecma_collection_chunk_t *) (uintptr_t) ((value) & ~ECMA_VALUE_TYPE_MASK);
|
||||
return (void *) (uintptr_t) ((value) & ~ECMA_VALUE_TYPE_MASK);
|
||||
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
|
||||
return ECMA_GET_POINTER (ecma_collection_chunk_t, value >> ECMA_VALUE_SHIFT);
|
||||
return ECMA_GET_POINTER (void, value >> ECMA_VALUE_SHIFT);
|
||||
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
|
||||
} /* ecma_get_collection_chunk_from_value */
|
||||
} /* ecma_get_pointer_from_value */
|
||||
|
||||
/**
|
||||
* Invert a boolean value
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
/**
|
||||
* The type of ecma error and ecma collection chunk must be the same.
|
||||
*/
|
||||
JERRY_STATIC_ASSERT (ECMA_TYPE_ERROR == ECMA_TYPE_COLLECTION_CHUNK,
|
||||
ecma_type_error_must_be_the_same_as_ecma_type_collection_chunk);
|
||||
JERRY_STATIC_ASSERT (ECMA_TYPE_ERROR == ECMA_TYPE_POINTER,
|
||||
ecma_type_error_must_be_the_same_as_ecma_type_pointer);
|
||||
|
||||
/**
|
||||
* Allocate a collection of ecma values.
|
||||
@@ -70,7 +70,7 @@ ecma_free_values_collection (ecma_collection_header_t *header_p, /**< collection
|
||||
{
|
||||
ecma_value_t *item_p = chunk_p->items;
|
||||
|
||||
JERRY_ASSERT (!ecma_is_value_collection_chunk (*item_p));
|
||||
JERRY_ASSERT (!ecma_is_value_pointer (*item_p));
|
||||
|
||||
do
|
||||
{
|
||||
@@ -83,9 +83,9 @@ ecma_free_values_collection (ecma_collection_header_t *header_p, /**< collection
|
||||
|
||||
item_p++;
|
||||
}
|
||||
while (!ecma_is_value_collection_chunk (*item_p));
|
||||
while (!ecma_is_value_pointer (*item_p));
|
||||
|
||||
ecma_collection_chunk_t *next_chunk_p = ecma_get_collection_chunk_from_value (*item_p);
|
||||
ecma_collection_chunk_t *next_chunk_p = (ecma_collection_chunk_t *) ecma_get_pointer_from_value (*item_p);
|
||||
|
||||
jmem_heap_free_block (chunk_p, sizeof (ecma_collection_chunk_t));
|
||||
|
||||
@@ -122,21 +122,21 @@ ecma_append_to_values_collection (ecma_collection_header_t *header_p, /**< colle
|
||||
|
||||
if (JERRY_UNLIKELY (item_index == 0))
|
||||
{
|
||||
JERRY_ASSERT (ecma_is_value_collection_chunk (chunk_p->items[ECMA_COLLECTION_CHUNK_ITEMS])
|
||||
&& ecma_get_collection_chunk_from_value (chunk_p->items[ECMA_COLLECTION_CHUNK_ITEMS]) == NULL);
|
||||
JERRY_ASSERT (ecma_is_value_pointer (chunk_p->items[ECMA_COLLECTION_CHUNK_ITEMS])
|
||||
&& ecma_get_pointer_from_value (chunk_p->items[ECMA_COLLECTION_CHUNK_ITEMS]) == NULL);
|
||||
|
||||
ecma_collection_chunk_t *next_chunk_p;
|
||||
next_chunk_p = (ecma_collection_chunk_t *) jmem_heap_alloc_block (sizeof (ecma_collection_chunk_t));
|
||||
|
||||
chunk_p->items[ECMA_COLLECTION_CHUNK_ITEMS] = ecma_make_collection_chunk_value (next_chunk_p);
|
||||
chunk_p->items[ECMA_COLLECTION_CHUNK_ITEMS] = ecma_make_pointer_value ((void *) next_chunk_p);
|
||||
ECMA_SET_POINTER (header_p->last_chunk_cp, next_chunk_p);
|
||||
|
||||
chunk_p = next_chunk_p;
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT (ecma_is_value_collection_chunk (chunk_p->items[item_index])
|
||||
&& ecma_get_collection_chunk_from_value (chunk_p->items[item_index]) == NULL);
|
||||
JERRY_ASSERT (ecma_is_value_pointer (chunk_p->items[item_index])
|
||||
&& ecma_get_pointer_from_value (chunk_p->items[item_index]) == NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ ecma_append_to_values_collection (ecma_collection_header_t *header_p, /**< colle
|
||||
}
|
||||
|
||||
chunk_p->items[item_index] = value;
|
||||
chunk_p->items[item_index + 1] = ecma_make_collection_chunk_value (NULL);
|
||||
chunk_p->items[item_index + 1] = ecma_make_pointer_value (NULL);
|
||||
header_p->item_count++;
|
||||
} /* ecma_append_to_values_collection */
|
||||
|
||||
@@ -183,11 +183,11 @@ ecma_collection_iterator_next (ecma_value_t *ecma_value_p) /**< current value */
|
||||
|
||||
ecma_value_p++;
|
||||
|
||||
if (JERRY_UNLIKELY (ecma_is_value_collection_chunk (*ecma_value_p)))
|
||||
if (JERRY_UNLIKELY (ecma_is_value_pointer (*ecma_value_p)))
|
||||
{
|
||||
ecma_value_p = ecma_get_collection_chunk_from_value (*ecma_value_p)->items;
|
||||
ecma_value_p = ((ecma_collection_chunk_t *) ecma_get_pointer_from_value (*ecma_value_p))->items;
|
||||
|
||||
JERRY_ASSERT (ecma_value_p == NULL || !ecma_is_value_collection_chunk (*ecma_value_p));
|
||||
JERRY_ASSERT (ecma_value_p == NULL || !ecma_is_value_pointer (*ecma_value_p));
|
||||
return ecma_value_p;
|
||||
}
|
||||
|
||||
|
||||
@@ -155,9 +155,10 @@ bool JERRY_ATTR_CONST ecma_is_value_float_number (ecma_value_t value);
|
||||
bool JERRY_ATTR_CONST ecma_is_value_number (ecma_value_t value);
|
||||
bool JERRY_ATTR_CONST ecma_is_value_string (ecma_value_t value);
|
||||
bool JERRY_ATTR_CONST ecma_is_value_direct_string (ecma_value_t value);
|
||||
bool JERRY_ATTR_CONST ecma_is_value_non_direct_string (ecma_value_t value);
|
||||
bool JERRY_ATTR_CONST ecma_is_value_object (ecma_value_t value);
|
||||
bool JERRY_ATTR_CONST ecma_is_value_error_reference (ecma_value_t value);
|
||||
bool JERRY_ATTR_CONST ecma_is_value_collection_chunk (ecma_value_t value);
|
||||
bool JERRY_ATTR_CONST ecma_is_value_pointer (ecma_value_t value);
|
||||
|
||||
void ecma_check_value_type_is_spec_defined (ecma_value_t value);
|
||||
|
||||
@@ -171,14 +172,14 @@ ecma_value_t JERRY_ATTR_PURE ecma_make_string_value (const ecma_string_t *ecma_s
|
||||
ecma_value_t JERRY_ATTR_PURE ecma_make_magic_string_value (lit_magic_string_id_t id);
|
||||
ecma_value_t JERRY_ATTR_PURE ecma_make_object_value (const ecma_object_t *object_p);
|
||||
ecma_value_t JERRY_ATTR_PURE ecma_make_error_reference_value (const ecma_error_reference_t *error_ref_p);
|
||||
ecma_value_t JERRY_ATTR_PURE ecma_make_collection_chunk_value (const ecma_collection_chunk_t *collection_chunk_p);
|
||||
ecma_value_t JERRY_ATTR_PURE ecma_make_pointer_value (const void *any_p);
|
||||
ecma_integer_value_t JERRY_ATTR_CONST ecma_get_integer_from_value (ecma_value_t value);
|
||||
ecma_number_t JERRY_ATTR_PURE ecma_get_float_from_value (ecma_value_t value);
|
||||
ecma_number_t JERRY_ATTR_PURE ecma_get_number_from_value (ecma_value_t value);
|
||||
ecma_string_t JERRY_ATTR_PURE *ecma_get_string_from_value (ecma_value_t value);
|
||||
ecma_object_t JERRY_ATTR_PURE *ecma_get_object_from_value (ecma_value_t value);
|
||||
ecma_error_reference_t JERRY_ATTR_PURE *ecma_get_error_reference_from_value (ecma_value_t value);
|
||||
ecma_collection_chunk_t JERRY_ATTR_PURE *ecma_get_collection_chunk_from_value (ecma_value_t value);
|
||||
void * JERRY_ATTR_PURE ecma_get_pointer_from_value (ecma_value_t value);
|
||||
ecma_value_t JERRY_ATTR_CONST ecma_invert_boolean_value (ecma_value_t value);
|
||||
ecma_value_t ecma_copy_value (ecma_value_t value);
|
||||
ecma_value_t ecma_fast_copy_value (ecma_value_t value);
|
||||
|
||||
Reference in New Issue
Block a user