Implement external strings. (#4028)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-07-22 12:27:12 +02:00
committed by GitHub
parent 04f0a7a670
commit 0124368ae7
9 changed files with 504 additions and 122 deletions
+28
View File
@@ -179,6 +179,34 @@ ecma_dealloc_extended_string (ecma_extended_string_t *ext_string_p) /**< extende
jmem_heap_free_block (ext_string_p, sizeof (ecma_extended_string_t));
} /* ecma_dealloc_extended_string */
/**
* Allocate memory for external ecma-string descriptor
*
* @return pointer to allocated memory
*/
inline ecma_external_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_external_string (void)
{
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_allocate_string_bytes (sizeof (ecma_external_string_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
return (ecma_external_string_t *) jmem_heap_alloc_block (sizeof (ecma_external_string_t));
} /* ecma_alloc_external_string */
/**
* Dealloc memory from external ecma-string descriptor
*/
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_external_string (ecma_external_string_t *ext_string_p) /**< external string to be freed */
{
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_free_string_bytes (sizeof (ecma_external_string_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
jmem_heap_free_block (ext_string_p, sizeof (ecma_external_string_t));
} /* ecma_dealloc_external_string */
/**
* Allocate memory for an string with character data
*