mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Introducing ecma_string_t type that will be used for ecma-strings instead of ecma_array_first_chunk_t.
This commit is contained in:
parent
567d54f7e5
commit
b66981d19f
@ -47,6 +47,7 @@ JERRY_STATIC_ASSERT(sizeof (ecma_object_t) <= 2 * sizeof (uint64_t));
|
||||
JERRY_STATIC_ASSERT(sizeof (ecma_array_header_t) <= sizeof (uint32_t));
|
||||
JERRY_STATIC_ASSERT(sizeof (ecma_array_first_chunk_t) == sizeof (uint64_t));
|
||||
JERRY_STATIC_ASSERT(sizeof (ecma_array_non_first_chunk_t) == sizeof (uint64_t));
|
||||
JERRY_STATIC_ASSERT(sizeof (ecma_string_t) == sizeof (uint64_t));
|
||||
JERRY_STATIC_ASSERT(sizeof (ecma_completion_value_t) == sizeof (uint32_t));
|
||||
|
||||
/**
|
||||
|
||||
@ -521,6 +521,53 @@ typedef struct
|
||||
uint8_t data[ sizeof (uint64_t) - sizeof (uint16_t) ];
|
||||
} ecma_array_non_first_chunk_t;
|
||||
|
||||
/**
|
||||
* Identifier for ecma-string's actual data container
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ECMA_STRING_CONTAINER_HEAP, /**< actual data is on the heap
|
||||
in ecma_array_non_first_chunk_t */
|
||||
ECMA_STRING_CONTAINER_LIT_TABLE, /**< actual data is in literal table */
|
||||
ECMA_STRING_CONTAINER_IN_DESCRIPTOR /**< actual data is locally in the string's descriptor */
|
||||
} ecma_string_container_t;
|
||||
|
||||
FIXME (Move to library that should define the type (libserializer /* ? */))
|
||||
/**
|
||||
* Index in literal table
|
||||
*/
|
||||
typedef uint32_t literal_index_t;
|
||||
|
||||
/**
|
||||
* ECMA string-value descriptor
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/** Reference counter for the string */
|
||||
unsigned int refs : CONFIG_ECMA_REFERENCE_COUNTER_WIDTH;
|
||||
|
||||
/** Where the string's data is placed (ecma_string_container_t) */
|
||||
unsigned int container : 2;
|
||||
|
||||
/** String's length */
|
||||
ecma_length_t length;
|
||||
|
||||
/**
|
||||
* Actual data or identifier of it's place in container (depending on 'container' field)
|
||||
*/
|
||||
union
|
||||
{
|
||||
/** Index of string in literal table */
|
||||
literal_index_t lit_index;
|
||||
|
||||
/** Compressed pointer to array_non_first_chunk_t */
|
||||
unsigned int chunk_cp : ECMA_POINTER_FIELD_WIDTH;
|
||||
|
||||
/** Actual data if placed locally in the descriptor */
|
||||
ecma_char_t chars[ sizeof (uint64_t) - sizeof (uint32_t) ];
|
||||
} u;
|
||||
} ecma_string_t;
|
||||
|
||||
/**
|
||||
* \addtogroup reference ECMA-reference
|
||||
* @{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user