Skip to content

Commit 723924f

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 603fa56 commit 723924f

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
@@ -574,6 +574,12 @@ typedef uint8_t ecma_char_t;
574574
typedef uint16_t ecma_char_t;
575575
#endif /* CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_UTF16 */
576576

577+
/**
578+
* Description of an ecma-character pointer
579+
*/
580+
typedef ecma_char_t* ecma_char_ptr_t;
581+
582+
577583
#if CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32
578584
/**
579585
* Description of an ecma-number
@@ -746,7 +752,8 @@ typedef enum
746752
ECMA_STRING_CONTAINER_UINT32_IN_DESC, /**< actual data is UInt32-represeneted Number
747753
stored locally in the string's descriptor */
748754
ECMA_STRING_CONTAINER_CONCATENATION, /**< the ecma-string is concatenation of two specified ecma-strings */
749-
ECMA_STRING_CONTAINER_MAGIC_STRING /**< the ecma-string is equal to one of ECMA magic strings */
755+
ECMA_STRING_CONTAINER_MAGIC_STRING, /**< the ecma-string is equal to one of ECMA magic strings */
756+
ECMA_STRING_CONTAINER_MAGIC_STRING_EX /**< the ecma-string is equal to one of external magic strings */
750757
} ecma_string_container_t;
751758

752759
FIXME (Move to library that should define the type (literal.h /* ? */))
@@ -768,6 +775,11 @@ typedef enum
768775
ECMA_MAGIC_STRING__COUNT /**< number of magic strings */
769776
} ecma_magic_string_id_t;
770777

778+
/**
779+
* Identifiers of implementation-defined external magic string constants
780+
*/
781+
typedef uint32_t ecma_magic_string_ex_id_t;
782+
771783
/**
772784
* ECMA string hash
773785
*/
@@ -823,6 +835,9 @@ typedef struct ecma_string_t
823835
/** Identifier of magic string */
824836
ecma_magic_string_id_t magic_string_id;
825837

838+
/** Identifier of external magic string */
839+
ecma_magic_string_ex_id_t magic_string_ex_id;
840+
826841
/** For zeroing and comparison in some cases */
827842
uint32_t common_field;
828843
} u;

0 commit comments

Comments
 (0)