Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/operations/ecma-objects.c (C)

Code before:
          }
        }
      }
#if ENABLED (JERRY_ES2015)
    }
#endif /* ENABLED (JERRY_ES2015) */

    ecma_value_t *buffer_p = prop_names_p->buffer_p;

    const size_t own_names_hashes_bitmap_size = ECMA_OBJECT_HASH_BITMAP_SIZE / bitmap_row_size;
    JERRY_VLA (uint32_t, own_names_hashes_bitmap, own_names_hashes_bitmap_size);
    memset (own_names_hashes_bitmap, 0, own_names_hashes_bitmap_size * sizeof (own_names_hashes_bitmap[0]));

    for (uint32_t i = 0; i < prop_names_p->item_count; i++)
    {
      ecma_string_t *name_p = ecma_get_string_from_value (buffer_p[i]);
      uint32_t index = ecma_string_get_array_index (name_p);

      if (index != ECMA_STRING_NOT_ARRAY_INDEX)
      {
        array_index_named_properties_count++;
      }
      else if (is_array_indices_only)
      {
        ecma_free_value (buffer_p[i]);
        ecma_collection_remove (prop_names_p, i);
        continue;
      }
#if ENABLED (JERRY_ES2015)
      else if (ecma_prop_name_is_symbol (name_p))
      {
        symbol_named_properties_count++;
      }
#endif /* ENABLED (JERRY_ES2015) */
      else
      {
        string_named_properties_count++;
      }

#if ENABLED (JERRY_ES2015)
      /* Symbols are never lazy listed */
      JERRY_ASSERT (!ecma_prop_name_is_symbol (name_p));
#endif /* ENABLED (JERRY_ES2015) */

      uint8_t hash = (uint8_t) ecma_string_hash (name_p);
      uint32_t bitmap_row = (uint32_t) (hash / bitmap_row_size);
      uint32_t bitmap_column = (uint32_t) (hash % bitmap_row_size);

      if ((own_names_hashes_bitmap[bitmap_row] & (1u << bitmap_column)) == 0)
      {
        own_names_hashes_bitmap[bitmap_row] |= (1u << bitmap_column);

Review comment (suggestion):
Question: How about passing the listing options to each lazy_list_property names functions instead of `is_enumerable_only` ? Therefore these function do not put elements to the collection which should have been removed.

Code after:
          }
        }
      }
#if ENABLED (JERRY_ES2015)
    }
#endif /* ENABLED (JERRY_ES2015) */

    ecma_value_t *buffer_p = prop_names_p->buffer_p;

    const size_t own_names_hashes_bitmap_size = ECMA_OBJECT_HASH_BITMAP_SIZE / bitmap_row_size;
    JERRY_VLA (uint32_t, own_names_hashes_bitmap, own_names_hashes_bitmap_size);
    memset (own_names_hashes_bitmap, 0, own_names_hashes_bitmap_size * sizeof (own_names_hashes_bitmap[0]));

    for (uint32_t i = 0; i < prop_names_p->item_count; i++)
    {
      ecma_string_t *name_p = ecma_get_string_from_value (buffer_p[i]);

      if (ecma_string_get_array_index (name_p) != ECMA_STRING_NOT_ARRAY_INDEX)
      {
        array_index_named_properties_count++;
      }
#if ENABLED (JERRY_ES2015)
      else if (ecma_prop_name_is_symbol (name_p))
      {
        symbol_named_properties_count++;
      }
#endif /* ENABLED (JERRY_ES2015) */
      else
      {
        string_named_properties_count++;
      }

#if ENABLED (JERRY_ES2015)
      /* Symbols are never lazy listed */
      JERRY_ASSERT (!ecma_prop_name_is_symbol (name_p));
#endif /* ENABLED (JERRY_ES2015) */

      uint8_t hash = (uint8_t) ecma_string_hash (name_p);
      uint32_t bitmap_row = (uint32_t) (hash / bitmap_row_size);
      uint32_t bitmap_column = (uint32_t) (hash % bitmap_row_size);

      if ((own_names_hashes_bitmap[bitmap_row] & (1u << bitmap_column)) == 0)
      {
        own_names_hashes_bitmap[bitmap_row] |= (1u << bitmap_column);
      }
    }

    jmem_cpointer_t prop_iter_cp = prototype_chain_iter_p->u1.property_list_cp;

    if (ecma_op_object_is_fast_array (prototype_chain_iter_p) && prop_iter_cp != JMEM_CP_NULL)
    {