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
+128 -128
View File
@@ -24,6 +24,134 @@
#define JMEM_ALLOCATOR_INTERNAL
#include "jmem-allocator-internal.h"
#ifdef JMEM_STATS
/**
* Print memory usage statistics
*/
static void
jmem_stats_print (void)
{
jmem_heap_stats_print ();
} /* jmem_stats_print */
/**
* Register byte code allocation.
*/
void
jmem_stats_allocate_byte_code_bytes (size_t byte_code_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
heap_stats->byte_code_bytes += byte_code_size;
if (heap_stats->byte_code_bytes >= heap_stats->peak_byte_code_bytes)
{
heap_stats->peak_byte_code_bytes = heap_stats->byte_code_bytes;
}
} /* jmem_stats_allocate_byte_code_bytes */
/**
* Register byte code free.
*/
void
jmem_stats_free_byte_code_bytes (size_t byte_code_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
JERRY_ASSERT (heap_stats->byte_code_bytes >= byte_code_size);
heap_stats->byte_code_bytes -= byte_code_size;
} /* jmem_stats_free_byte_code_bytes */
/**
* Register string allocation.
*/
void
jmem_stats_allocate_string_bytes (size_t string_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
heap_stats->string_bytes += string_size;
if (heap_stats->string_bytes >= heap_stats->peak_string_bytes)
{
heap_stats->peak_string_bytes = heap_stats->string_bytes;
}
} /* jmem_stats_allocate_string_bytes */
/**
* Register string free.
*/
void
jmem_stats_free_string_bytes (size_t string_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
JERRY_ASSERT (heap_stats->string_bytes >= string_size);
heap_stats->string_bytes -= string_size;
} /* jmem_stats_free_string_bytes */
/**
* Register object allocation.
*/
void
jmem_stats_allocate_object_bytes (size_t object_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
heap_stats->object_bytes += object_size;
if (heap_stats->object_bytes >= heap_stats->peak_object_bytes)
{
heap_stats->peak_object_bytes = heap_stats->object_bytes;
}
} /* jmem_stats_allocate_object_bytes */
/**
* Register object free.
*/
void
jmem_stats_free_object_bytes (size_t object_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
JERRY_ASSERT (heap_stats->object_bytes >= object_size);
heap_stats->object_bytes -= object_size;
} /* jmem_stats_free_object_bytes */
/**
* Register property allocation.
*/
void
jmem_stats_allocate_property_bytes (size_t property_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
heap_stats->property_bytes += property_size;
if (heap_stats->property_bytes >= heap_stats->peak_property_bytes)
{
heap_stats->peak_property_bytes = heap_stats->property_bytes;
}
} /* jmem_stats_allocate_property_bytes */
/**
* Register property free.
*/
void
jmem_stats_free_property_bytes (size_t property_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
JERRY_ASSERT (heap_stats->property_bytes >= property_size);
heap_stats->property_bytes -= property_size;
} /* jmem_stats_free_property_bytes */
#endif /* JMEM_STATS */
/**
* Initialize memory allocators.
*/
@@ -150,131 +278,3 @@ jmem_run_free_unused_memory_callbacks (jmem_free_unused_memory_severity_t severi
jmem_pools_collect_empty ();
} /* jmem_run_free_unused_memory_callbacks */
#ifdef JMEM_STATS
/**
* Print memory usage statistics
*/
void
jmem_stats_print (void)
{
jmem_heap_stats_print ();
} /* jmem_stats_print */
/**
* Register byte code allocation.
*/
void
jmem_stats_allocate_byte_code_bytes (size_t byte_code_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
heap_stats->byte_code_bytes += byte_code_size;
if (heap_stats->byte_code_bytes >= heap_stats->peak_byte_code_bytes)
{
heap_stats->peak_byte_code_bytes = heap_stats->byte_code_bytes;
}
} /* jmem_stats_allocate_byte_code_bytes */
/**
* Register byte code free.
*/
void
jmem_stats_free_byte_code_bytes (size_t byte_code_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
JERRY_ASSERT (heap_stats->byte_code_bytes >= byte_code_size);
heap_stats->byte_code_bytes -= byte_code_size;
} /* jmem_stats_free_byte_code_bytes */
/**
* Register string allocation.
*/
void
jmem_stats_allocate_string_bytes (size_t string_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
heap_stats->string_bytes += string_size;
if (heap_stats->string_bytes >= heap_stats->peak_string_bytes)
{
heap_stats->peak_string_bytes = heap_stats->string_bytes;
}
} /* jmem_stats_allocate_string_bytes */
/**
* Register string free.
*/
void
jmem_stats_free_string_bytes (size_t string_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
JERRY_ASSERT (heap_stats->string_bytes >= string_size);
heap_stats->string_bytes -= string_size;
} /* jmem_stats_free_string_bytes */
/**
* Register object allocation.
*/
void
jmem_stats_allocate_object_bytes (size_t object_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
heap_stats->object_bytes += object_size;
if (heap_stats->object_bytes >= heap_stats->peak_object_bytes)
{
heap_stats->peak_object_bytes = heap_stats->object_bytes;
}
} /* jmem_stats_allocate_object_bytes */
/**
* Register object free.
*/
void
jmem_stats_free_object_bytes (size_t object_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
JERRY_ASSERT (heap_stats->object_bytes >= object_size);
heap_stats->object_bytes -= object_size;
} /* jmem_stats_free_object_bytes */
/**
* Register property allocation.
*/
void
jmem_stats_allocate_property_bytes (size_t property_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
heap_stats->property_bytes += property_size;
if (heap_stats->property_bytes >= heap_stats->peak_property_bytes)
{
heap_stats->peak_property_bytes = heap_stats->property_bytes;
}
} /* jmem_stats_allocate_property_bytes */
/**
* Register property free.
*/
void
jmem_stats_free_property_bytes (size_t property_size)
{
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
JERRY_ASSERT (heap_stats->property_bytes >= property_size);
heap_stats->property_bytes -= property_size;
} /* jmem_stats_free_property_bytes */
#endif /* JMEM_STATS */
-1
View File
@@ -151,7 +151,6 @@ typedef struct
size_t free_iter_count; /**< Number of iterations required for inserting free blocks */
} jmem_heap_stats_t;
void jmem_stats_print (void);
void jmem_stats_allocate_byte_code_bytes (size_t property_size);
void jmem_stats_free_byte_code_bytes (size_t property_size);
void jmem_stats_allocate_string_bytes (size_t string_size);