@@ -1388,7 +1388,8 @@ ecma_builtin_global_object_unescape (ecma_value_t this_arg __attr_unused___, /**
13881388 ssize_t sz = ecma_string_to_utf8_string (input_string_p, input_start_p, (ssize_t ) (input_size));
13891389 JERRY_ASSERT (sz >= 0 );
13901390
1391- lit_utf8_iterator_t iterator = lit_utf8_iterator_create (input_start_p, input_size);
1391+ lit_utf8_byte_t *input_curr_p = input_start_p;
1392+ lit_utf8_byte_t *input_end_p = input_start_p + input_size;
13921393 /* 4. */
13931394 /* The length of input string is always greater than output string
13941395 * so we re-use the input string buffer.
@@ -1407,13 +1408,12 @@ ecma_builtin_global_object_unescape (ecma_value_t this_arg __attr_unused___, /**
14071408 * 8 found valid '%uwxyz' pattern
14081409 */
14091410 uint8_t status = 0 ;
1410- lit_code_point_t high_surrogate = 0 ;
14111411 lit_code_point_t hex_digits = 0 ;
14121412 /* 5. */
1413- while (! lit_utf8_iterator_is_eos (&iterator) )
1413+ while (input_curr_p < input_end_p )
14141414 {
14151415 /* 6. */
1416- lit_code_point_t code_point = lit_utf8_iterator_read_next (&iterator );
1416+ ecma_char_t code_point = lit_utf8_read_next (&input_curr_p );
14171417
14181418 /* 7-8. */
14191419 if (status == 0 && code_point == LIT_CHAR_PERCENT)
@@ -1443,30 +1443,10 @@ ecma_builtin_global_object_unescape (ecma_value_t this_arg __attr_unused___, /**
14431443 hex_digits = 0 ;
14441444 }
14451445
1446- /* Handle surrogate pairs. */
1447- bool is_non_bmp_middle = iterator.buf_pos .is_non_bmp_middle ;
1448- if (!high_surrogate && lit_is_code_unit_high_surrogate ((ecma_char_t ) code_point))
1449- {
1450- high_surrogate = code_point;
1451-
1452- if (is_non_bmp_middle)
1453- {
1454- code_point = lit_utf8_iterator_read_next (&iterator);
1455- }
1456- }
1457-
1458- if (high_surrogate && lit_is_code_unit_low_surrogate ((ecma_char_t ) code_point))
1459- {
1460- output_char_p -= is_non_bmp_middle ? 0 : 3 ;
1461- code_point = lit_convert_surrogate_pair_to_code_point ((ecma_char_t ) high_surrogate,
1462- (ecma_char_t ) code_point);
1463- high_surrogate = 0 ;
1464- }
1465-
14661446 /* Copying character. */
1467- lit_utf8_size_t lit_size = lit_code_point_to_utf8 (code_point, output_char_p);
1447+ lit_utf8_size_t lit_size = lit_code_point_to_cesu8 (code_point, output_char_p);
14681448 output_char_p += lit_size;
1469- JERRY_ASSERT (output_char_p - input_start_p <= iterator. buf_pos . offset );
1449+ // JERRY_ASSERT (output_char_p - input_curr_p == 0 );
14701450 }
14711451
14721452 lit_utf8_size_t output_length = (lit_utf8_size_t ) (output_char_p - input_start_p);
0 commit comments