Rework memory statistics to provide useful user information. (#1812)
Obsolote statistics is also removed. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -373,6 +373,10 @@ snapshot_load_compiled_code (const uint8_t *snapshot_data_p, /**< snapshot data
|
||||
{
|
||||
bytecode_p = (ecma_compiled_code_t *) jmem_heap_alloc_block (code_size);
|
||||
|
||||
#ifdef JMEM_STATS
|
||||
jmem_stats_allocate_byte_code_bytes (code_size);
|
||||
#endif /* JMEM_STATS */
|
||||
|
||||
memcpy (bytecode_p, snapshot_data_p + offset, code_size);
|
||||
}
|
||||
else
|
||||
@@ -384,6 +388,10 @@ snapshot_load_compiled_code (const uint8_t *snapshot_data_p, /**< snapshot data
|
||||
|
||||
bytecode_p = (ecma_compiled_code_t *) jmem_heap_alloc_block (total_size);
|
||||
|
||||
#ifdef JMEM_STATS
|
||||
jmem_stats_allocate_byte_code_bytes (total_size);
|
||||
#endif /* JMEM_STATS */
|
||||
|
||||
memcpy (bytecode_p, snapshot_data_p + offset, code_size);
|
||||
|
||||
bytecode_p->size = (uint16_t) (total_size >> JMEM_ALIGNMENT_LOG);
|
||||
|
||||
@@ -52,7 +52,6 @@ JERRY_STATIC_ASSERT ((int) ECMA_INIT_EMPTY == (int) JERRY_INIT_EMPTY
|
||||
&& (int) ECMA_INIT_SHOW_OPCODES == (int) JERRY_INIT_SHOW_OPCODES
|
||||
&& (int) ECMA_INIT_SHOW_REGEXP_OPCODES == (int) JERRY_INIT_SHOW_REGEXP_OPCODES
|
||||
&& (int) ECMA_INIT_MEM_STATS == (int) JERRY_INIT_MEM_STATS
|
||||
&& (int) ECMA_INIT_MEM_STATS_SEPARATE == (int) JERRY_INIT_MEM_STATS_SEPARATE
|
||||
&& (int) ECMA_INIT_DEBUGGER == (int) JERRY_INIT_DEBUGGER,
|
||||
ecma_init_flag_t_must_be_equal_to_jerry_init_flag_t);
|
||||
|
||||
@@ -152,11 +151,6 @@ jerry_init (jerry_init_flag_t flags) /**< combination of Jerry flags */
|
||||
/* Zero out all members. */
|
||||
memset (&JERRY_CONTEXT (JERRY_CONTEXT_FIRST_MEMBER), 0, sizeof (jerry_context_t));
|
||||
|
||||
if (flags & JERRY_INIT_MEM_STATS_SEPARATE)
|
||||
{
|
||||
flags |= JERRY_INIT_MEM_STATS;
|
||||
}
|
||||
|
||||
JERRY_CONTEXT (jerry_init_flags) = flags;
|
||||
|
||||
jerry_make_api_available ();
|
||||
@@ -327,14 +321,6 @@ jerry_parse (const jerry_char_t *source_p, /**< script source */
|
||||
|
||||
ecma_free_value (parse_status);
|
||||
|
||||
#ifdef JMEM_STATS
|
||||
if (JERRY_CONTEXT (jerry_init_flags) & JERRY_INIT_MEM_STATS_SEPARATE)
|
||||
{
|
||||
jmem_stats_print ();
|
||||
jmem_stats_reset_peak ();
|
||||
}
|
||||
#endif /* JMEM_STATS */
|
||||
|
||||
is_strict = ((bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE) != 0);
|
||||
ecma_object_t *lex_env_p = ecma_get_global_environment ();
|
||||
ecma_object_t *func_obj_p = ecma_op_create_function_object (lex_env_p,
|
||||
|
||||
Reference in New Issue
Block a user