Skip to content

Commit afd532d

Browse files
committed
New External Magic String API to save heap memory
JerryScript-DCO-1.0-Signed-off-by: SaeHie Park [email protected]
1 parent d6fb764 commit afd532d

File tree

13 files changed

+457
-12
lines changed

13 files changed

+457
-12
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,12 @@ typedef uint8_t ecma_char_t;
561561
typedef uint16_t ecma_char_t;
562562
#endif /* CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_UTF16 */
563563

564+
/**
565+
* Description of an ecma-character pointer
566+
*/
567+
typedef ecma_char_t* ecma_char_ptr_t;
568+
569+
564570
#if CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32
565571
/**
566572
* Description of an ecma-number
@@ -733,7 +739,8 @@ typedef enum
733739
ECMA_STRING_CONTAINER_UINT32_IN_DESC, /**< actual data is UInt32-represeneted Number
734740
stored locally in the string's descriptor */
735741
ECMA_STRING_CONTAINER_CONCATENATION, /**< the ecma-string is concatenation of two specified ecma-strings */
736-
ECMA_STRING_CONTAINER_MAGIC_STRING /**< the ecma-string is equal to one of ECMA magic strings */
742+
ECMA_STRING_CONTAINER_MAGIC_STRING, /**< the ecma-string is equal to one of ECMA magic strings */
743+
ECMA_STRING_CONTAINER_MAGIC_STRING_EX /**< the ecma-string is equal to one of external magic strings */
737744
} ecma_string_container_t;
738745

739746
FIXME (Move to library that should define the type (literal.h /* ? */))
@@ -755,6 +762,11 @@ typedef enum
755762
ECMA_MAGIC_STRING__COUNT /**< number of magic strings */
756763
} ecma_magic_string_id_t;
757764

765+
/**
766+
* Identifiers of implementation-defined external magic string constants
767+
*/
768+
typedef uint32_t ecma_magic_string_ex_id_t;
769+
758770
/**
759771
* ECMA string hash
760772
*/
@@ -810,6 +822,9 @@ typedef struct ecma_string_t
810822
/** Identifier of magic string */
811823
ecma_magic_string_id_t magic_string_id;
812824

825+
/** Identifier of external magic string */
826+
ecma_magic_string_ex_id_t magic_string_ex_id;
827+
813828
/** For zeroing and comparison in some cases */
814829
uint32_t common_field;
815830
} u;

0 commit comments

Comments
 (0)