Skip to content

Commit f8d6306

Browse files
committed
Unicode support.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov [email protected]
1 parent 06dffde commit f8d6306

File tree

114 files changed

+3484
-2431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+3484
-2431
lines changed

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

Lines changed: 9 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
#include "config.h"
2727
#include "jrt.h"
28+
#include "lit-globals.h"
29+
#include "lit-magic-strings.h"
2830
#include "mem-allocator.h"
2931
#include "rcs-recordset.h"
3032

@@ -566,24 +568,6 @@ typedef struct
566568
bool is_configurable;
567569
} ecma_property_descriptor_t;
568570

569-
#if CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_ASCII
570-
/**
571-
* Description of an ecma-character
572-
*/
573-
typedef uint8_t ecma_char_t;
574-
#elif CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_UTF16
575-
/**
576-
* Description of an ecma-character
577-
*/
578-
typedef uint16_t ecma_char_t;
579-
#endif /* CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_UTF16 */
580-
581-
/**
582-
* Description of an ecma-character pointer
583-
*/
584-
typedef ecma_char_t* ecma_char_ptr_t;
585-
586-
587571
#if CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32
588572
/**
589573
* Description of an ecma-number
@@ -689,11 +673,6 @@ typedef double ecma_number_t;
689673
*/
690674
#define ECMA_NUMBER_SQRT2 ((ecma_number_t)1.4142135623730951)
691675

692-
/**
693-
* Null character (zt-string end marker)
694-
*/
695-
#define ECMA_CHAR_NULL ((ecma_char_t) '\0')
696-
697676
/**
698677
* Maximum number of characters in string representation of ecma-number
699678
*/
@@ -712,22 +691,17 @@ typedef double ecma_number_t;
712691
*/
713692
#define ECMA_MAX_VALUE_OF_VALID_ARRAY_INDEX ((uint32_t) (-1))
714693

715-
/**
716-
* Description of a collection's/string's length
717-
*/
718-
typedef uint16_t ecma_length_t;
719-
720694
/**
721695
* Description of a collection's header.
722696
*/
723697
typedef struct
724698
{
725-
/** Compressed pointer to next chunk with collection's data */
726-
mem_cpointer_t next_chunk_cp;
727-
728699
/** Number of elements in the collection */
729700
ecma_length_t unit_number;
730701

702+
/** Compressed pointer to next chunk with collection's data */
703+
mem_cpointer_t next_chunk_cp;
704+
731705
/** Place for the collection's data */
732706
uint8_t data[ sizeof (uint64_t) - sizeof (mem_cpointer_t) - sizeof (ecma_length_t) ];
733707
} ecma_collection_header_t;
@@ -741,7 +715,7 @@ typedef struct
741715
mem_cpointer_t next_chunk_cp;
742716

743717
/** Characters */
744-
uint8_t data[ sizeof (uint64_t) - sizeof (mem_cpointer_t) ];
718+
lit_utf8_byte_t data[ sizeof (uint64_t) - sizeof (mem_cpointer_t) ];
745719
} ecma_collection_chunk_t;
746720

747721
/**
@@ -768,39 +742,6 @@ FIXME (Move to library that should define the type (literal.h /* ? */))
768742
typedef rcs_record_t *literal_t;
769743
typedef rcs_cpointer_t lit_cpointer_t;
770744

771-
/**
772-
* Identifiers of ECMA and implementation-defined magic string constants
773-
*/
774-
typedef enum
775-
{
776-
#define ECMA_MAGIC_STRING_DEF(id, ascii_zt_string) \
777-
id,
778-
#include "ecma-magic-strings.inc.h"
779-
#undef ECMA_MAGIC_STRING_DEF
780-
781-
ECMA_MAGIC_STRING__COUNT /**< number of magic strings */
782-
} ecma_magic_string_id_t;
783-
784-
/**
785-
* Identifiers of implementation-defined external magic string constants
786-
*/
787-
typedef uint32_t ecma_magic_string_ex_id_t;
788-
789-
/**
790-
* ECMA string hash
791-
*/
792-
typedef uint8_t ecma_string_hash_t;
793-
794-
/**
795-
* Length of string hash, in bits
796-
*/
797-
#define ECMA_STRING_HASH_BITS (sizeof (ecma_string_hash_t) * JERRY_BITSINBYTE)
798-
799-
/**
800-
* Number of string's last characters to use for hash calculation
801-
*/
802-
#define ECMA_STRING_HASH_LAST_CHARS_COUNT (2)
803-
804745
/**
805746
* ECMA string-value descriptor
806747
*/
@@ -817,7 +758,7 @@ typedef struct ecma_string_t
817758
uint8_t container;
818759

819760
/** Hash of the string (calculated from two last characters of the string) */
820-
ecma_string_hash_t hash;
761+
lit_string_hash_t hash;
821762

822763
/**
823764
* Actual data or identifier of it's place in container (depending on 'container' field)
@@ -844,10 +785,10 @@ typedef struct ecma_string_t
844785
} concatenation;
845786

846787
/** Identifier of magic string */
847-
ecma_magic_string_id_t magic_string_id;
788+
lit_magic_string_id_t magic_string_id;
848789

849790
/** Identifier of external magic string */
850-
ecma_magic_string_ex_id_t magic_string_ex_id;
791+
lit_magic_string_ex_id_t magic_string_ex_id;
851792

852793
/** For zeroing and comparison in some cases */
853794
uint32_t common_field;

0 commit comments

Comments
 (0)