@@ -1390,7 +1390,8 @@ ecma_builtin_global_object_unescape (ecma_value_t this_arg __attr_unused___, /**
1390
1390
ssize_t sz = ecma_string_to_utf8_string (input_string_p, input_start_p, (ssize_t ) (input_size));
1391
1391
JERRY_ASSERT (sz >= 0 );
1392
1392
1393
- lit_utf8_iterator_t iterator = lit_utf8_iterator_create (input_start_p, input_size);
1393
+ lit_utf8_byte_t *input_curr_p = input_start_p;
1394
+ lit_utf8_byte_t *input_end_p = input_start_p + input_size;
1394
1395
/* 4. */
1395
1396
/* The length of input string is always greater than output string
1396
1397
* so we re-use the input string buffer.
@@ -1409,30 +1410,29 @@ ecma_builtin_global_object_unescape (ecma_value_t this_arg __attr_unused___, /**
1409
1410
* 8 found valid '%uwxyz' pattern
1410
1411
*/
1411
1412
uint8_t status = 0 ;
1412
- lit_code_point_t high_surrogate = 0 ;
1413
- lit_code_point_t hex_digits = 0 ;
1413
+ ecma_char_t hex_digits = 0 ;
1414
1414
/* 5. */
1415
- while (! lit_utf8_iterator_is_eos (&iterator) )
1415
+ while (input_curr_p < input_end_p )
1416
1416
{
1417
1417
/* 6. */
1418
- lit_code_point_t code_point = lit_utf8_iterator_read_next (&iterator );
1418
+ ecma_char_t chr = lit_utf8_read_next (&input_curr_p );
1419
1419
1420
1420
/* 7-8. */
1421
- if (status == 0 && code_point == LIT_CHAR_PERCENT)
1421
+ if (status == 0 && chr == LIT_CHAR_PERCENT)
1422
1422
{
1423
1423
/* Found '%' char, start of escape sequence. */
1424
1424
status = 1 ;
1425
1425
}
1426
1426
/* 9-10. */
1427
- else if (status == 1 && code_point == LIT_CHAR_LOWERCASE_U)
1427
+ else if (status == 1 && chr == LIT_CHAR_LOWERCASE_U)
1428
1428
{
1429
1429
/* Found 'u' char after '%'. */
1430
1430
status = 4 ;
1431
1431
}
1432
- else if (status > 0 && lit_char_is_hex_digit (( ecma_char_t ) code_point ))
1432
+ else if (status > 0 && lit_char_is_hex_digit (chr ))
1433
1433
{
1434
1434
/* Found hexadecimal digit in escape sequence. */
1435
- hex_digits = hex_digits * 16 + lit_char_hex_to_int (( ecma_char_t ) code_point );
1435
+ hex_digits = ( ecma_char_t ) ( hex_digits * 16 + ( ecma_char_t ) lit_char_hex_to_int (chr) );
1436
1436
status++;
1437
1437
}
1438
1438
@@ -1441,34 +1441,14 @@ ecma_builtin_global_object_unescape (ecma_value_t this_arg __attr_unused___, /**
1441
1441
{
1442
1442
output_char_p -= (status == 3 ) ? 2 : 5 ;
1443
1443
status = 0 ;
1444
- code_point = ( ecma_char_t ) hex_digits;
1444
+ chr = hex_digits;
1445
1445
hex_digits = 0 ;
1446
1446
}
1447
1447
1448
- /* Handle surrogate pairs. */
1449
- bool is_non_bmp_middle = iterator.buf_pos .is_non_bmp_middle ;
1450
- if (!high_surrogate && lit_is_code_unit_high_surrogate ((ecma_char_t ) code_point))
1451
- {
1452
- high_surrogate = code_point;
1453
-
1454
- if (is_non_bmp_middle)
1455
- {
1456
- code_point = lit_utf8_iterator_read_next (&iterator);
1457
- }
1458
- }
1459
-
1460
- if (high_surrogate && lit_is_code_unit_low_surrogate ((ecma_char_t ) code_point))
1461
- {
1462
- output_char_p -= is_non_bmp_middle ? 0 : 3 ;
1463
- code_point = lit_convert_surrogate_pair_to_code_point ((ecma_char_t ) high_surrogate,
1464
- (ecma_char_t ) code_point);
1465
- high_surrogate = 0 ;
1466
- }
1467
-
1468
1448
/* Copying character. */
1469
- lit_utf8_size_t lit_size = lit_code_point_to_utf8 (code_point , output_char_p);
1449
+ lit_utf8_size_t lit_size = lit_code_unit_to_utf8 (chr , output_char_p);
1470
1450
output_char_p += lit_size;
1471
- JERRY_ASSERT (output_char_p - input_start_p <= iterator. buf_pos . offset );
1451
+ JERRY_ASSERT (output_char_p <= input_curr_p );
1472
1452
}
1473
1453
1474
1454
lit_utf8_size_t output_length = (lit_utf8_size_t ) (output_char_p - input_start_p);
0 commit comments