@@ -1414,11 +1414,17 @@ ecma_builtin_native_handler_list_lazy_property_names (ecma_object_t *object_p, /
1414
1414
void
1415
1415
ecma_builtin_routine_list_lazy_property_names (ecma_object_t * object_p , /**< a built-in object */
1416
1416
ecma_collection_t * prop_names_p , /**< prop name collection */
1417
- ecma_property_counter_t * prop_counter_p ) /**< prop counter */
1417
+ ecma_property_counter_t * prop_counter_p , /**< property counters */
1418
+ jerry_property_filter_t filter ) /**< name filters */
1418
1419
{
1419
1420
JERRY_ASSERT (ecma_get_object_type (object_p ) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION );
1420
1421
JERRY_ASSERT (ecma_builtin_function_is_routine (object_p ));
1421
1422
1423
+ if (filter & JERRY_PROPERTY_FILTER_EXLCUDE_STRINGS )
1424
+ {
1425
+ return ;
1426
+ }
1427
+
1422
1428
#if JERRY_ESNEXT
1423
1429
ecma_extended_object_t * ext_func_p = (ecma_extended_object_t * ) object_p ;
1424
1430
@@ -1456,7 +1462,8 @@ ecma_builtin_routine_list_lazy_property_names (ecma_object_t *object_p, /**< a b
1456
1462
void
1457
1463
ecma_builtin_list_lazy_property_names (ecma_object_t * object_p , /**< a built-in object */
1458
1464
ecma_collection_t * prop_names_p , /**< prop name collection */
1459
- ecma_property_counter_t * prop_counter_p ) /**< prop counter */
1465
+ ecma_property_counter_t * prop_counter_p , /**< property counters */
1466
+ jerry_property_filter_t filter ) /**< name filters */
1460
1467
{
1461
1468
JERRY_ASSERT (ecma_get_object_type (object_p ) != ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION
1462
1469
|| !ecma_builtin_function_is_routine (object_p ));
@@ -1477,57 +1484,95 @@ ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in
1477
1484
1478
1485
JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT );
1479
1486
1480
- const ecma_builtin_property_descriptor_t * curr_property_p = ecma_builtin_property_list_references [builtin_id ];
1481
-
1482
- uint32_t index = 0 ;
1483
- uint8_t bitset = built_in_props_p -> u2 .instantiated_bitset [0 ];
1487
+ #if JERRY_ESNEXT
1488
+ bool has_symbol = true;
1489
+ #endif /* JERRY_BUILTIN_REALMS */
1484
1490
1491
+ if (!(filter & JERRY_PROPERTY_FILTER_EXLCUDE_STRINGS ))
1492
+ {
1493
+ const ecma_builtin_property_descriptor_t * curr_property_p = ecma_builtin_property_list_references [builtin_id ];
1494
+ uint8_t bitset = built_in_props_p -> u2 .instantiated_bitset [0 ];
1485
1495
#if JERRY_BUILTIN_REALMS
1486
- uint8_t * bitset_p = built_in_props_p -> u2 .instantiated_bitset + 1 + sizeof (ecma_value_t );
1496
+ uint8_t * bitset_p = built_in_props_p -> u2 .instantiated_bitset + 1 + sizeof (ecma_value_t );
1487
1497
#else /* !JERRY_BUILTIN_REALMS */
1488
- uint8_t * bitset_p = built_in_props_p -> u2 .instantiated_bitset + 1 ;
1498
+ uint8_t * bitset_p = built_in_props_p -> u2 .instantiated_bitset + 1 ;
1489
1499
#endif /* JERRY_BUILTIN_REALMS */
1500
+ uint32_t index = 0 ;
1490
1501
1491
- while (curr_property_p -> magic_string_id != LIT_MAGIC_STRING__COUNT )
1492
- {
1493
- if (index == 8 )
1502
+ #if JERRY_ESNEXT
1503
+ has_symbol = false;
1504
+ #endif /* JERRY_BUILTIN_REALMS */
1505
+
1506
+ while (curr_property_p -> magic_string_id != LIT_MAGIC_STRING__COUNT )
1494
1507
{
1495
- bitset = * bitset_p ++ ;
1496
- index = 0 ;
1497
- }
1508
+ if (index == 8 )
1509
+ {
1510
+ bitset = * bitset_p ++ ;
1511
+ index = 0 ;
1512
+ }
1498
1513
1499
- uint32_t bit_for_index = (uint32_t ) 1u << index ;
1514
+ uint32_t bit_for_index = (uint32_t ) 1u << index ;
1500
1515
1501
- if (curr_property_p -> magic_string_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT )
1502
- {
1503
1516
#if JERRY_ESNEXT
1504
- if (LIT_IS_GLOBAL_SYMBOL (curr_property_p -> magic_string_id ))
1505
- {
1506
- ecma_string_t * name_p = ecma_op_get_global_symbol (curr_property_p -> magic_string_id );
1517
+ bool is_symbol = (curr_property_p -> magic_string_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT );
1518
+ #else /* !JERRY_ESNEXT */
1519
+ bool is_symbol = false;
1520
+ #endif /* JERRY_ESNEXT */
1507
1521
1508
- if (!(bitset & bit_for_index ))
1509
- {
1510
- ecma_value_t name = ecma_make_symbol_value (name_p );
1511
- ecma_collection_push_back (prop_names_p , name );
1512
- prop_counter_p -> symbol_named_props ++ ;
1513
- }
1514
- else
1515
- {
1516
- ecma_deref_ecma_string (name_p );
1517
- }
1518
- }
1522
+ if (is_symbol )
1523
+ {
1524
+ #if JERRY_ESNEXT
1525
+ JERRY_ASSERT (LIT_IS_GLOBAL_SYMBOL (curr_property_p -> magic_string_id ));
1526
+ has_symbol = true;
1519
1527
#endif /* JERRY_ESNEXT */
1528
+ }
1529
+ else if (!(bitset & bit_for_index ))
1530
+ {
1531
+ ecma_value_t name = ecma_make_magic_string_value ((lit_magic_string_id_t ) curr_property_p -> magic_string_id );
1532
+ ecma_collection_push_back (prop_names_p , name );
1533
+ prop_counter_p -> string_named_props ++ ;
1534
+ }
1535
+
1536
+ curr_property_p ++ ;
1537
+ index ++ ;
1520
1538
}
1521
- else if (!(bitset & bit_for_index ))
1539
+ }
1540
+
1541
+ #if JERRY_ESNEXT
1542
+ if (!(filter & JERRY_PROPERTY_FILTER_EXLCUDE_SYMBOLS ) && has_symbol )
1543
+ {
1544
+ const ecma_builtin_property_descriptor_t * curr_property_p = ecma_builtin_property_list_references [builtin_id ];
1545
+ uint8_t bitset = built_in_props_p -> u2 .instantiated_bitset [0 ];
1546
+ #if JERRY_BUILTIN_REALMS
1547
+ uint8_t * bitset_p = built_in_props_p -> u2 .instantiated_bitset + 1 + sizeof (ecma_value_t );
1548
+ #else /* !JERRY_BUILTIN_REALMS */
1549
+ uint8_t * bitset_p = built_in_props_p -> u2 .instantiated_bitset + 1 ;
1550
+ #endif /* JERRY_BUILTIN_REALMS */
1551
+ uint32_t index = 0 ;
1552
+
1553
+ while (curr_property_p -> magic_string_id != LIT_MAGIC_STRING__COUNT )
1522
1554
{
1523
- ecma_value_t name = ecma_make_magic_string_value ((lit_magic_string_id_t ) curr_property_p -> magic_string_id );
1524
- ecma_collection_push_back (prop_names_p , name );
1525
- prop_counter_p -> string_named_props ++ ;
1526
- }
1555
+ if (index == 8 )
1556
+ {
1557
+ bitset = * bitset_p ++ ;
1558
+ index = 0 ;
1559
+ }
1527
1560
1528
- curr_property_p ++ ;
1529
- index ++ ;
1561
+ uint32_t bit_for_index = (uint32_t ) 1u << index ;
1562
+
1563
+ if (curr_property_p -> magic_string_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT
1564
+ && !(bitset & bit_for_index ))
1565
+ {
1566
+ ecma_string_t * name_p = ecma_op_get_global_symbol (curr_property_p -> magic_string_id );
1567
+ ecma_collection_push_back (prop_names_p , ecma_make_symbol_value (name_p ));
1568
+ prop_counter_p -> symbol_named_props ++ ;
1569
+ }
1570
+
1571
+ curr_property_p ++ ;
1572
+ index ++ ;
1573
+ }
1530
1574
}
1575
+ #endif /* JERRY_ESNEXT */
1531
1576
} /* ecma_builtin_list_lazy_property_names */
1532
1577
1533
1578
/**
0 commit comments