Move all remaining globals to the global context.

Zero out all globals (and remove unnecessary init() functions).
Move snapshot globals to a temporary stack variable.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2016-08-01 04:25:32 -07:00
parent b14ca4e248
commit d1b0b58729
18 changed files with 200 additions and 290 deletions
-13
View File
@@ -160,19 +160,6 @@ ecma_deref_object (ecma_object_t *object_p) /**< object */
object_p->type_flags_refs = (uint16_t) (object_p->type_flags_refs - ECMA_OBJECT_REF_ONE);
} /* ecma_deref_object */
/**
* Initialize garbage collector
*/
void
ecma_gc_init (void)
{
JERRY_CONTEXT (ecma_gc_objects_lists) [ECMA_GC_COLOR_WHITE_GRAY] = NULL;
JERRY_CONTEXT (ecma_gc_objects_lists) [ECMA_GC_COLOR_BLACK] = NULL;
JERRY_CONTEXT (ecma_gc_visited_flip_flag) = false;
JERRY_CONTEXT (ecma_gc_objects_number) = 0;
JERRY_CONTEXT (ecma_gc_new_objects) = 0;
} /* ecma_gc_init */
/**
* Mark referenced object from property
*/
-1
View File
@@ -26,7 +26,6 @@
* @{
*/
extern void ecma_gc_init (void);
extern void ecma_init_gc_info (ecma_object_t *);
extern void ecma_ref_object (ecma_object_t *);
extern void ecma_deref_object (ecma_object_t *);
@@ -35,10 +35,7 @@
void
ecma_init (void)
{
ecma_gc_init ();
ecma_init_builtins ();
ecma_lcache_init ();
ecma_init_lit_storage ();
ecma_init_global_lex_env ();
jmem_register_free_unused_memory_callback (ecma_free_unused_memory);
@@ -28,16 +28,6 @@
JERRY_STATIC_ASSERT (sizeof (ecma_lit_storage_item_t) <= sizeof (uint64_t),
size_of_ecma_lit_storage_item_t_must_be_less_than_or_equal_to_8_bytes);
/**
* Initialize literal storage
*/
void
ecma_init_lit_storage (void)
{
JERRY_CONTEXT (string_list_first_p) = NULL;
JERRY_CONTEXT (number_list_first_p) = NULL;
} /* ecma_init_lit_storage */
/**
* Free string list
*/
@@ -37,7 +37,6 @@ typedef struct
jmem_cpointer_t literal_offset; /**< literal offset */
} lit_mem_to_snapshot_id_map_entry_t;
extern void ecma_init_lit_storage (void);
extern void ecma_finalize_lit_storage (void);
extern jmem_cpointer_t ecma_find_or_create_literal_string (const lit_utf8_byte_t *, lit_utf8_size_t);