@@ -642,7 +642,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
642642 parser_line_counter_t column = context_p -> column ;
643643 const uint8_t * source_end_p = context_p -> source_end_p ;
644644 size_t length = 0 ;
645- uint8_t has_escape = false ;
645+ lexer_lit_location_flags_t status_flags = LEXER_LIT_LOCATION_IS_ASCII ;
646646
647647 do
648648 {
@@ -657,7 +657,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
657657 return true;
658658 }
659659
660- has_escape = true ;
660+ status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE ;
661661
662662#if JERRY_ESNEXT
663663 if (source_p + 5 <= source_end_p && source_p [1 ] == LIT_CHAR_LOWERCASE_U )
@@ -711,6 +711,8 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
711711
712712 if (JERRY_UNLIKELY (code_point >= LIT_UTF8_2_BYTE_MARKER ))
713713 {
714+ status_flags &= (uint32_t ) ~LEXER_LIT_LOCATION_IS_ASCII ;
715+
714716#if JERRY_ESNEXT
715717 utf8_length = lit_read_code_point_from_utf8 (source_p ,
716718 (lit_utf8_size_t ) (source_end_p - source_p ),
@@ -738,7 +740,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
738740 else if (source_p [0 ] >= LIT_UTF8_4_BYTE_MARKER )
739741 {
740742 decoded_length = 2 * 3 ;
741- has_escape = true ;
743+ status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE ;
742744 }
743745#else /* !JERRY_ESNEXT */
744746 if (code_point < LIT_UTF8_4_BYTE_MARKER )
@@ -789,7 +791,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
789791
790792 context_p -> token .type = LEXER_LITERAL ;
791793 context_p -> token .lit_location .type = LEXER_IDENT_LITERAL ;
792- context_p -> token .lit_location .has_escape = has_escape ;
794+ context_p -> token .lit_location .status_flags = ( uint8_t ) status_flags ;
793795
794796 context_p -> token .column = context_p -> column ;
795797 context_p -> token .lit_location .char_p = context_p -> source_p ;
@@ -807,7 +809,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
807809 const uint8_t * ident_start_p = context_p -> source_p ;
808810 uint8_t buffer_p [LEXER_KEYWORD_MAX_LENGTH ];
809811
810- if (JERRY_UNLIKELY (context_p -> token .lit_location .has_escape ))
812+ if (JERRY_UNLIKELY (context_p -> token .lit_location .status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ))
811813 {
812814 lexer_convert_ident_to_cesu8 (buffer_p , ident_start_p , (prop_length_t ) length );
813815 ident_start_p = buffer_p ;
@@ -953,7 +955,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
953955 parser_line_counter_t original_line = line ;
954956 parser_line_counter_t original_column = column ;
955957 size_t length = 0 ;
956- uint8_t has_escape = false ;
958+ lexer_lit_location_flags_t status_flags = LEXER_LIT_LOCATION_IS_ASCII ;
957959
958960#if JERRY_ESNEXT
959961 if (str_end_character == LIT_CHAR_RIGHT_BRACE )
@@ -986,7 +988,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
986988 continue ;
987989 }
988990
989- has_escape = true ;
991+ status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE ;
990992
991993 /* Newline is ignored. */
992994 if (* source_p == LIT_CHAR_CR )
@@ -1163,7 +1165,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
11631165 * after a backslash). Always converted to two 3 byte
11641166 * long sequence. */
11651167 length += 2 * 3 ;
1166- has_escape = true ;
1168+ status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE ;
11671169 source_p += 4 ;
11681170#if JERRY_ESNEXT
11691171 raw_length_adjust += 2 ;
@@ -1192,7 +1194,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
11921194 Note: ECMAScript v6, 11.8.6.1 <CR> or <CR><LF> are both normalized to <LF> */
11931195 if (* source_p == LIT_CHAR_CR )
11941196 {
1195- has_escape = true ;
1197+ status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE ;
11961198 source_p ++ ;
11971199 length ++ ;
11981200 if (source_p < source_end_p
@@ -1261,7 +1263,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
12611263 context_p -> token .lit_location .char_p = string_start_p ;
12621264 context_p -> token .lit_location .length = (prop_length_t ) length ;
12631265 context_p -> token .lit_location .type = LEXER_STRING_LITERAL ;
1264- context_p -> token .lit_location .has_escape = has_escape ;
1266+ context_p -> token .lit_location .status_flags = ( uint8_t ) status_flags ;
12651267
12661268 context_p -> source_p = source_p + 1 ;
12671269 context_p -> line = line ;
@@ -1328,7 +1330,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
13281330 context_p -> token .extra_value = LEXER_NUMBER_DECIMAL ;
13291331 context_p -> token .lit_location .char_p = source_p ;
13301332 context_p -> token .lit_location .type = LEXER_NUMBER_LITERAL ;
1331- context_p -> token .lit_location .has_escape = false ;
1333+ context_p -> token .lit_location .status_flags = LEXER_LIT_LOCATION_IS_ASCII ;
13321334
13331335 if (source_p [0 ] == LIT_CHAR_0
13341336 && source_p + 1 < source_end_p )
@@ -2240,7 +2242,7 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
22402242{
22412243 JERRY_ASSERT (context_p -> u .allocated_buffer_p == NULL );
22422244
2243- if (!literal_p -> has_escape )
2245+ if (!( literal_p -> status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ) )
22442246 {
22452247 return literal_p -> char_p ;
22462248 }
@@ -2601,6 +2603,11 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */
26012603 status_flags |= LEXER_FLAG_USED ;
26022604 }
26032605
2606+ if (lit_location_p -> status_flags & LEXER_LIT_LOCATION_IS_ASCII )
2607+ {
2608+ literal_p -> status_flags |= LEXER_FLAG_ASCII ;
2609+ }
2610+
26042611 literal_p -> status_flags = status_flags ;
26052612
26062613 context_p -> lit_object .literal_p = literal_p ;
@@ -3490,7 +3497,7 @@ lexer_compare_identifier_to_string (const lexer_lit_location_t *left_p, /**< lef
34903497 return false;
34913498 }
34923499
3493- if (!left_p -> has_escape )
3500+ if (!( left_p -> status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ) )
34943501 {
34953502 return memcmp (left_p -> char_p , right_p , size ) == 0 ;
34963503 }
@@ -3518,12 +3525,12 @@ lexer_compare_identifiers (parser_context_t *context_p, /**< context */
35183525 return false;
35193526 }
35203527
3521- if (!left_p -> has_escape )
3528+ if (!( left_p -> status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ) )
35223529 {
35233530 return lexer_compare_identifier_to_chars (right_p -> char_p , left_p -> char_p , length );
35243531 }
35253532
3526- if (!right_p -> has_escape )
3533+ if (!( right_p -> status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ) )
35273534 {
35283535 return lexer_compare_identifier_to_chars (left_p -> char_p , right_p -> char_p , length );
35293536 }
@@ -3568,7 +3575,7 @@ lexer_current_is_literal (parser_context_t *context_p, /**< context */
35683575 return false;
35693576 }
35703577
3571- if (!left_ident_p -> has_escape && ! right_ident_p -> has_escape )
3578+ if (!(( left_ident_p -> status_flags | right_ident_p -> status_flags ) & LEXER_LIT_LOCATION_HAS_ESCAPE ) )
35723579 {
35733580 return memcmp (left_ident_p -> char_p , right_ident_p -> char_p , left_ident_p -> length ) == 0 ;
35743581 }
@@ -3591,7 +3598,7 @@ lexer_string_is_use_strict (parser_context_t *context_p) /**< context */
35913598 && context_p -> token .lit_location .type == LEXER_STRING_LITERAL );
35923599
35933600 return (context_p -> token .lit_location .length == 10
3594- && !context_p -> token .lit_location .has_escape
3601+ && !( context_p -> token .lit_location .status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE )
35953602 && memcmp (context_p -> token .lit_location .char_p , "use strict" , 10 ) == 0 );
35963603} /* lexer_string_is_use_strict */
35973604
@@ -3649,7 +3656,7 @@ lexer_token_is_let (parser_context_t *context_p) /**< context */
36493656 JERRY_ASSERT (context_p -> token .type == LEXER_LITERAL );
36503657
36513658 return (context_p -> token .keyword_type == LEXER_KEYW_LET
3652- && !context_p -> token .lit_location .has_escape );
3659+ && !( context_p -> token .lit_location .status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ) );
36533660} /* lexer_token_is_let */
36543661
36553662/**
@@ -3667,7 +3674,7 @@ lexer_token_is_async (parser_context_t *context_p) /**< context */
36673674 || context_p -> token .type == LEXER_TEMPLATE_LITERAL );
36683675
36693676 return (context_p -> token .keyword_type == LEXER_KEYW_ASYNC
3670- && !context_p -> token .lit_location .has_escape );
3677+ && !( context_p -> token .lit_location .status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ) );
36713678} /* lexer_token_is_async */
36723679
36733680#endif /* JERRY_ESNEXT */
0 commit comments