@@ -642,7 +642,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
642
642
parser_line_counter_t column = context_p -> column ;
643
643
const uint8_t * source_end_p = context_p -> source_end_p ;
644
644
size_t length = 0 ;
645
- uint8_t has_escape = false ;
645
+ lexer_lit_location_flags_t status_flags = LEXER_LIT_LOCATION_IS_ASCII ;
646
646
647
647
do
648
648
{
@@ -657,7 +657,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
657
657
return true;
658
658
}
659
659
660
- has_escape = true ;
660
+ status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE ;
661
661
662
662
#if JERRY_ESNEXT
663
663
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 */
711
711
712
712
if (JERRY_UNLIKELY (code_point >= LIT_UTF8_2_BYTE_MARKER ))
713
713
{
714
+ status_flags &= (uint32_t ) ~LEXER_LIT_LOCATION_IS_ASCII ;
715
+
714
716
#if JERRY_ESNEXT
715
717
utf8_length = lit_read_code_point_from_utf8 (source_p ,
716
718
(lit_utf8_size_t ) (source_end_p - source_p ),
@@ -738,7 +740,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
738
740
else if (source_p [0 ] >= LIT_UTF8_4_BYTE_MARKER )
739
741
{
740
742
decoded_length = 2 * 3 ;
741
- has_escape = true ;
743
+ status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE ;
742
744
}
743
745
#else /* !JERRY_ESNEXT */
744
746
if (code_point < LIT_UTF8_4_BYTE_MARKER )
@@ -789,7 +791,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
789
791
790
792
context_p -> token .type = LEXER_LITERAL ;
791
793
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 ;
793
795
794
796
context_p -> token .column = context_p -> column ;
795
797
context_p -> token .lit_location .char_p = context_p -> source_p ;
@@ -807,7 +809,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
807
809
const uint8_t * ident_start_p = context_p -> source_p ;
808
810
uint8_t buffer_p [LEXER_KEYWORD_MAX_LENGTH ];
809
811
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 ))
811
813
{
812
814
lexer_convert_ident_to_cesu8 (buffer_p , ident_start_p , (prop_length_t ) length );
813
815
ident_start_p = buffer_p ;
@@ -953,7 +955,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
953
955
parser_line_counter_t original_line = line ;
954
956
parser_line_counter_t original_column = column ;
955
957
size_t length = 0 ;
956
- uint8_t has_escape = false ;
958
+ lexer_lit_location_flags_t status_flags = LEXER_LIT_LOCATION_IS_ASCII ;
957
959
958
960
#if JERRY_ESNEXT
959
961
if (str_end_character == LIT_CHAR_RIGHT_BRACE )
@@ -986,7 +988,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
986
988
continue ;
987
989
}
988
990
989
- has_escape = true ;
991
+ status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE ;
990
992
991
993
/* Newline is ignored. */
992
994
if (* source_p == LIT_CHAR_CR )
@@ -1163,7 +1165,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
1163
1165
* after a backslash). Always converted to two 3 byte
1164
1166
* long sequence. */
1165
1167
length += 2 * 3 ;
1166
- has_escape = true ;
1168
+ status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE ;
1167
1169
source_p += 4 ;
1168
1170
#if JERRY_ESNEXT
1169
1171
raw_length_adjust += 2 ;
@@ -1192,7 +1194,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
1192
1194
Note: ECMAScript v6, 11.8.6.1 <CR> or <CR><LF> are both normalized to <LF> */
1193
1195
if (* source_p == LIT_CHAR_CR )
1194
1196
{
1195
- has_escape = true ;
1197
+ status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE ;
1196
1198
source_p ++ ;
1197
1199
length ++ ;
1198
1200
if (source_p < source_end_p
@@ -1261,7 +1263,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
1261
1263
context_p -> token .lit_location .char_p = string_start_p ;
1262
1264
context_p -> token .lit_location .length = (prop_length_t ) length ;
1263
1265
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 ;
1265
1267
1266
1268
context_p -> source_p = source_p + 1 ;
1267
1269
context_p -> line = line ;
@@ -1328,7 +1330,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
1328
1330
context_p -> token .extra_value = LEXER_NUMBER_DECIMAL ;
1329
1331
context_p -> token .lit_location .char_p = source_p ;
1330
1332
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 ;
1332
1334
1333
1335
if (source_p [0 ] == LIT_CHAR_0
1334
1336
&& source_p + 1 < source_end_p )
@@ -2240,7 +2242,7 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
2240
2242
{
2241
2243
JERRY_ASSERT (context_p -> u .allocated_buffer_p == NULL );
2242
2244
2243
- if (!literal_p -> has_escape )
2245
+ if (!( literal_p -> status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ) )
2244
2246
{
2245
2247
return literal_p -> char_p ;
2246
2248
}
@@ -2601,6 +2603,11 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */
2601
2603
status_flags |= LEXER_FLAG_USED ;
2602
2604
}
2603
2605
2606
+ if (lit_location_p -> status_flags & LEXER_LIT_LOCATION_IS_ASCII )
2607
+ {
2608
+ literal_p -> status_flags |= LEXER_FLAG_ASCII ;
2609
+ }
2610
+
2604
2611
literal_p -> status_flags = status_flags ;
2605
2612
2606
2613
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
3490
3497
return false;
3491
3498
}
3492
3499
3493
- if (!left_p -> has_escape )
3500
+ if (!( left_p -> status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ) )
3494
3501
{
3495
3502
return memcmp (left_p -> char_p , right_p , size ) == 0 ;
3496
3503
}
@@ -3518,12 +3525,12 @@ lexer_compare_identifiers (parser_context_t *context_p, /**< context */
3518
3525
return false;
3519
3526
}
3520
3527
3521
- if (!left_p -> has_escape )
3528
+ if (!( left_p -> status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ) )
3522
3529
{
3523
3530
return lexer_compare_identifier_to_chars (right_p -> char_p , left_p -> char_p , length );
3524
3531
}
3525
3532
3526
- if (!right_p -> has_escape )
3533
+ if (!( right_p -> status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE ) )
3527
3534
{
3528
3535
return lexer_compare_identifier_to_chars (left_p -> char_p , right_p -> char_p , length );
3529
3536
}
@@ -3568,7 +3575,7 @@ lexer_current_is_literal (parser_context_t *context_p, /**< context */
3568
3575
return false;
3569
3576
}
3570
3577
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 ) )
3572
3579
{
3573
3580
return memcmp (left_ident_p -> char_p , right_ident_p -> char_p , left_ident_p -> length ) == 0 ;
3574
3581
}
@@ -3591,7 +3598,7 @@ lexer_string_is_use_strict (parser_context_t *context_p) /**< context */
3591
3598
&& context_p -> token .lit_location .type == LEXER_STRING_LITERAL );
3592
3599
3593
3600
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 )
3595
3602
&& memcmp (context_p -> token .lit_location .char_p , "use strict" , 10 ) == 0 );
3596
3603
} /* lexer_string_is_use_strict */
3597
3604
@@ -3649,7 +3656,7 @@ lexer_token_is_let (parser_context_t *context_p) /**< context */
3649
3656
JERRY_ASSERT (context_p -> token .type == LEXER_LITERAL );
3650
3657
3651
3658
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 ) );
3653
3660
} /* lexer_token_is_let */
3654
3661
3655
3662
/**
@@ -3667,7 +3674,7 @@ lexer_token_is_async (parser_context_t *context_p) /**< context */
3667
3674
|| context_p -> token .type == LEXER_TEMPLATE_LITERAL );
3668
3675
3669
3676
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 ) );
3671
3678
} /* lexer_token_is_async */
3672
3679
3673
3680
#endif /* JERRY_ESNEXT */
0 commit comments