Revisit unused global functions in jerry-core (#2450)

There are some leftover global functions in the code that are not
referenced at all anymore. These functions are removed by this
patch.

There are also some global functions that are only used in their
own modules. These functions are made static by this patch.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2018-08-08 16:34:13 +02:00
committed by yichoi
parent 47087dec56
commit 58c568a68f
21 changed files with 204 additions and 293 deletions
-29
View File
@@ -184,35 +184,6 @@ ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
jmem_heap_free_block (string_p, size);
} /* ecma_dealloc_string_buffer */
/**
* Allocate memory for getter-setter pointer pair
*
* @return pointer to allocated memory
*/
inline ecma_getter_setter_pointers_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_getter_setter_pointers (void)
{
#ifdef JMEM_STATS
jmem_stats_allocate_property_bytes (sizeof (ecma_property_pair_t));
#endif /* JMEM_STATS */
return (ecma_getter_setter_pointers_t *) jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));
} /* ecma_alloc_getter_setter_pointers */
/**
* Dealloc memory from getter-setter pointer pair
*/
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_getter_setter_pointers (ecma_getter_setter_pointers_t *getter_setter_pointers_p) /**< pointer pair
* to be freed */
{
#ifdef JMEM_STATS
jmem_stats_free_property_bytes (sizeof (ecma_property_pair_t));
#endif /* JMEM_STATS */
jmem_pools_free (getter_setter_pointers_p, sizeof (ecma_getter_setter_pointers_t));
} /* ecma_dealloc_getter_setter_pointers */
/**
* Allocate memory for ecma-property pair
*
-12
View File
@@ -85,18 +85,6 @@ ecma_string_t *ecma_alloc_string_buffer (size_t size);
*/
void ecma_dealloc_string_buffer (ecma_string_t *string_p, size_t size);
/**
* Allocate memory for getter-setter pointer pair
*
* @return pointer to allocated memory
*/
ecma_getter_setter_pointers_t *ecma_alloc_getter_setter_pointers (void);
/**
* Dealloc memory from getter-setter pointer pair
*/
void ecma_dealloc_getter_setter_pointers (ecma_getter_setter_pointers_t *getter_setter_pointers_p);
/**
* Allocate memory for ecma-property pair
*
+2 -2
View File
@@ -351,7 +351,7 @@ ecma_number_is_infinity (ecma_number_t num) /**< ecma-number */
*
* @return shift of dot in the fraction
*/
int32_t
static int32_t
ecma_number_get_fraction_and_exponent (ecma_number_t num, /**< ecma-number */
uint64_t *out_fraction_p, /**< [out] fraction of the number */
int32_t *out_exponent_p) /**< [out] exponent of the number */
@@ -410,7 +410,7 @@ ecma_number_get_fraction_and_exponent (ecma_number_t num, /**< ecma-number */
*
* @return ecma-number
*/
ecma_number_t
static ecma_number_t
ecma_number_make_normal_positive_from_fraction_and_exponent (uint64_t fraction, /**< fraction */
int32_t exponent) /**< exponent */
{
+24 -24
View File
@@ -175,6 +175,30 @@ ecma_string_get_chars_fast (const ecma_string_t *string_p, /**< ecma-string */
}
} /* ecma_string_get_chars_fast */
/**
* Allocate new ecma-string and fill it with reference to ECMA magic string
*
* @return pointer to ecma-string descriptor
*/
static ecma_string_t *
ecma_new_ecma_string_from_magic_string_ex_id (lit_magic_string_ex_id_t id) /**< identifier of externl magic string */
{
JERRY_ASSERT (id < lit_get_magic_string_ex_count ());
if (JERRY_LIKELY (id <= ECMA_DIRECT_STRING_MAX_IMM))
{
return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_MAGIC_EX, (uintptr_t) id);
}
ecma_string_t *string_desc_p = ecma_alloc_string ();
string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_MAGIC_STRING_EX | ECMA_STRING_REF_ONE;
string_desc_p->hash = (lit_string_hash_t) (LIT_MAGIC_STRING__COUNT + id);
string_desc_p->u.magic_string_ex_id = id;
return string_desc_p;
} /* ecma_new_ecma_string_from_magic_string_ex_id */
/**
* Allocate new ecma-string and fill it with characters from the utf8 string
*
@@ -480,30 +504,6 @@ ecma_get_magic_string (lit_magic_string_id_t id) /**< identifier of magic string
return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_MAGIC, (uintptr_t) id);
} /* ecma_get_magic_string */
/**
* Allocate new ecma-string and fill it with reference to ECMA magic string
*
* @return pointer to ecma-string descriptor
*/
ecma_string_t *
ecma_new_ecma_string_from_magic_string_ex_id (lit_magic_string_ex_id_t id) /**< identifier of externl magic string */
{
JERRY_ASSERT (id < lit_get_magic_string_ex_count ());
if (JERRY_LIKELY (id <= ECMA_DIRECT_STRING_MAX_IMM))
{
return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_MAGIC_EX, (uintptr_t) id);
}
ecma_string_t *string_desc_p = ecma_alloc_string ();
string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_MAGIC_STRING_EX | ECMA_STRING_REF_ONE;
string_desc_p->hash = (lit_string_hash_t) (LIT_MAGIC_STRING__COUNT + id);
string_desc_p->u.magic_string_ex_id = id;
return string_desc_p;
} /* ecma_new_ecma_string_from_magic_string_ex_id */
/**
* Append a cesu8 string after an ecma-string
*
-5
View File
@@ -200,7 +200,6 @@ ecma_string_t *ecma_new_ecma_string_from_uint32 (uint32_t uint32_number);
ecma_string_t *ecma_get_ecma_string_from_uint32 (uint32_t uint32_number);
ecma_string_t *ecma_new_ecma_string_from_number (ecma_number_t num);
ecma_string_t *ecma_get_magic_string (lit_magic_string_id_t id);
ecma_string_t *ecma_new_ecma_string_from_magic_string_ex_id (lit_magic_string_ex_id_t id);
ecma_string_t *ecma_append_chars_to_string (ecma_string_t *string1_p,
const lit_utf8_byte_t *cesu8_string2_p,
lit_utf8_size_t cesu8_string2_size,
@@ -268,10 +267,6 @@ bool ecma_number_is_nan (ecma_number_t num);
bool ecma_number_is_negative (ecma_number_t num);
bool ecma_number_is_zero (ecma_number_t num);
bool ecma_number_is_infinity (ecma_number_t num);
int32_t
ecma_number_get_fraction_and_exponent (ecma_number_t num, uint64_t *out_fraction_p, int32_t *out_exponent_p);
ecma_number_t
ecma_number_make_normal_positive_from_fraction_and_exponent (uint64_t fraction, int32_t exponent);
ecma_number_t
ecma_number_make_from_sign_mantissa_and_exponent (bool sign, uint64_t mantissa, int32_t exponent);
ecma_number_t ecma_number_get_prev (ecma_number_t num);