Support large string constants in 32 bit cpointer mode. (#2233)
After this patch, all sunspider tests run when cpointer 32 is enabled. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -74,6 +74,15 @@ typedef enum
|
||||
/* Initialize this variable after the byte code is freed. */
|
||||
#define LEXER_FLAG_LATE_INIT 0x80
|
||||
|
||||
/**
|
||||
* Type of property length.
|
||||
*/
|
||||
#ifdef JERRY_CPOINTER_32_BIT
|
||||
typedef uint32_t prop_length_t;
|
||||
#else /* !JERRY_CPOINTER_32_BIT */
|
||||
typedef uint16_t prop_length_t;
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
|
||||
/**
|
||||
* Literal data.
|
||||
*/
|
||||
@@ -93,7 +102,7 @@ typedef struct
|
||||
union
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
{
|
||||
uint16_t length; /**< length of ident / string literal */
|
||||
prop_length_t length; /**< length of ident / string literal */
|
||||
uint16_t index; /**< real index during post processing */
|
||||
} prop;
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
|
||||
{
|
||||
/* Fill literal data. */
|
||||
context_p->token.lit_location.char_p = ident_start_p;
|
||||
context_p->token.lit_location.length = (uint16_t) length;
|
||||
context_p->token.lit_location.length = (prop_length_t) length;
|
||||
}
|
||||
|
||||
context_p->source_p = source_p;
|
||||
@@ -815,7 +815,7 @@ lexer_parse_string (parser_context_t *context_p) /**< context */
|
||||
|
||||
/* Fill literal data. */
|
||||
context_p->token.lit_location.char_p = string_start_p;
|
||||
context_p->token.lit_location.length = (uint16_t) length;
|
||||
context_p->token.lit_location.length = (prop_length_t) length;
|
||||
context_p->token.lit_location.type = LEXER_STRING_LITERAL;
|
||||
context_p->token.lit_location.has_escape = has_escape;
|
||||
|
||||
@@ -966,7 +966,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
|
||||
parser_raise_error (context_p, PARSER_ERR_NUMBER_TOO_LONG);
|
||||
}
|
||||
|
||||
context_p->token.lit_location.length = (uint16_t) length;
|
||||
context_p->token.lit_location.length = (prop_length_t) length;
|
||||
PARSER_PLUS_EQUAL_LC (context_p->column, length);
|
||||
context_p->source_p = source_p;
|
||||
} /* lexer_parse_number */
|
||||
@@ -1374,7 +1374,7 @@ lexer_process_char_literal (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
|
||||
literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);
|
||||
literal_p->prop.length = (uint16_t) length;
|
||||
literal_p->prop.length = (prop_length_t) length;
|
||||
literal_p->type = literal_type;
|
||||
literal_p->status_flags = has_escape ? 0 : LEXER_FLAG_SOURCE_PTR;
|
||||
|
||||
@@ -1718,7 +1718,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
|
||||
lexer_literal_t *literal_p;
|
||||
ecma_number_t num;
|
||||
uint32_t literal_index = 0;
|
||||
uint16_t length = context_p->token.lit_location.length;
|
||||
prop_length_t length = context_p->token.lit_location.length;
|
||||
|
||||
if (context_p->token.extra_value != LEXER_NUMBER_OCTAL)
|
||||
{
|
||||
@@ -2007,7 +2007,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
|
||||
literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);
|
||||
literal_p->prop.length = (uint16_t) length;
|
||||
literal_p->prop.length = (prop_length_t) length;
|
||||
literal_p->type = LEXER_UNUSED_LITERAL;
|
||||
literal_p->status_flags = 0;
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ typedef enum
|
||||
typedef struct
|
||||
{
|
||||
const uint8_t *char_p; /**< start of identifier or string token */
|
||||
uint16_t length; /**< length or index of a literal */
|
||||
prop_length_t length; /**< length or index of a literal */
|
||||
uint8_t type; /**< type of the current literal */
|
||||
uint8_t has_escape; /**< has escape sequences */
|
||||
} lexer_lit_location_t;
|
||||
|
||||
@@ -32,10 +32,18 @@
|
||||
#define PARSER_MAXIMUM_IDENT_LENGTH 255
|
||||
#endif /* !PARSER_MAXIMUM_IDENT_LENGTH */
|
||||
|
||||
/* Maximum string limit.
|
||||
* Limit: 2147483647 / 65535. */
|
||||
#ifdef JERRY_CPOINTER_32_BIT
|
||||
#define PARSER_MAXIMUM_STRING_LIMIT 2147483647
|
||||
#else /* !JERRY_CPOINTER_32_BIT */
|
||||
#define PARSER_MAXIMUM_STRING_LIMIT 65535
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
|
||||
/* Maximum string length.
|
||||
* Limit: 65535. */
|
||||
* Limit: PARSER_MAXIMUM_STRING_LIMIT. */
|
||||
#ifndef PARSER_MAXIMUM_STRING_LENGTH
|
||||
#define PARSER_MAXIMUM_STRING_LENGTH 65535
|
||||
#define PARSER_MAXIMUM_STRING_LENGTH PARSER_MAXIMUM_STRING_LIMIT
|
||||
#endif /* !PARSER_MAXIMUM_STRING_LENGTH */
|
||||
|
||||
/* Maximum number of literals.
|
||||
@@ -65,9 +73,9 @@
|
||||
|
||||
/* Checks. */
|
||||
|
||||
#if (PARSER_MAXIMUM_STRING_LENGTH < 1) || (PARSER_MAXIMUM_STRING_LENGTH > 65535)
|
||||
#if (PARSER_MAXIMUM_STRING_LENGTH < 1) || (PARSER_MAXIMUM_STRING_LENGTH > PARSER_MAXIMUM_STRING_LIMIT)
|
||||
#error "Maximum string length is not within range."
|
||||
#endif /* (PARSER_MAXIMUM_STRING_LENGTH < 1) || (PARSER_MAXIMUM_STRING_LENGTH > 65535) */
|
||||
#endif /* (PARSER_MAXIMUM_STRING_LENGTH < 1) || (PARSER_MAXIMUM_STRING_LENGTH > PARSER_MAXIMUM_STRING_LIMIT) */
|
||||
|
||||
#if (PARSER_MAXIMUM_IDENT_LENGTH < 1) || (PARSER_MAXIMUM_IDENT_LENGTH > PARSER_MAXIMUM_STRING_LENGTH)
|
||||
#error "Maximum identifier length is not within range."
|
||||
|
||||
@@ -106,7 +106,7 @@ parser_copy_identifiers (parser_context_t *context_p) /**< context */
|
||||
/* The literal data is updated at every iteration to handle out-of memory. */
|
||||
parent_p->literal_pool_data = parent_literal_pool.data;
|
||||
|
||||
parent_literal_p->prop.length = (uint16_t) length;
|
||||
parent_literal_p->prop.length = (prop_length_t) length;
|
||||
parent_literal_p->type = LEXER_IDENT_LITERAL;
|
||||
parent_literal_p->status_flags = (uint8_t) (literal_p->status_flags & LEXER_FLAG_SOURCE_PTR);
|
||||
parent_literal_p->status_flags |= LEXER_FLAG_NO_REG_STORE | LEXER_FLAG_UNUSED_IDENT;
|
||||
|
||||
Reference in New Issue
Block a user