Implement direct strings. (#2196)

Direct strings are a new type of direct ecma-values (no memory allocation
is needed for encoding them) in JerryScript. Currently magic strings,
external magic strings and uint values are encoded as direct strings.

The constant pool of JerryScript byte-code is changed to hold ecma-values
rather than cpointers to support direct strings.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
This commit is contained in:
Zoltan Herczeg authored and yichoi committed 2018-02-23 08:21:46 +09:00
1 parent fbf5c32747
commit 51e3c4455a
37 files changed
+1492 -1147

No files matched your search

+1 -1
View File
@@ -85,7 +85,7 @@ typedef enum
typedef struct
{
ecma_compiled_code_t header; /**< compiled code header */
jmem_cpointer_t pattern_cp; /**< original RegExp pattern */
ecma_value_t pattern; /**< original RegExp pattern */
uint32_t num_of_captures; /**< number of capturing brackets */
uint32_t num_of_non_captures; /**< number of non capturing brackets */
} re_compiled_code_t;
+2 -3
View File
@@ -468,8 +468,7 @@ re_find_bytecode_in_cache (ecma_string_t *pattern_str_p, /**< pattern string */
if (cached_bytecode_p != NULL)
{
ecma_string_t *cached_pattern_str_p;
cached_pattern_str_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, cached_bytecode_p->pattern_cp);
ecma_string_t *cached_pattern_str_p = ecma_get_string_from_value (cached_bytecode_p->pattern);
if ((cached_bytecode_p->header.status_flags & RE_FLAGS_MASK) == flags
&& ecma_compare_ecma_strings (cached_pattern_str_p, pattern_str_p))
@@ -580,7 +579,7 @@ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] point
re_compiled_code.header.refs = 1;
re_compiled_code.header.status_flags = re_ctx.flags;
ecma_ref_ecma_string (pattern_str_p);
ECMA_SET_NON_NULL_POINTER (re_compiled_code.pattern_cp, pattern_str_p);
re_compiled_code.pattern = ecma_make_string_value (pattern_str_p);
re_compiled_code.num_of_captures = re_ctx.num_of_captures * 2;
re_compiled_code.num_of_non_captures = re_ctx.num_of_non_captures;