Replace array of literals with literal storage.

JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin e.gavrin@samsung.com
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
This commit is contained in:
Andrey Shitov
2015-06-10 17:28:53 +03:00
parent 340a9ef002
commit 53801e3b41
36 changed files with 460 additions and 1097 deletions
+9 -23
View File
@@ -15,9 +15,6 @@
#include "serializer.h"
#include "bytecode-data.h"
#include "jrt.h"
#include "parser.h"
#include "jrt-libc-includes.h"
#include "pretty-printer.h"
static bytecode_data_t bytecode_data;
@@ -43,16 +40,8 @@ serializer_get_opcode (opcode_counter_t oc)
return bytecode_data.opcodes[oc];
}
literal
serializer_get_literal_by_id (literal_index_t id)
{
JERRY_ASSERT (id != INVALID_LITERAL);
JERRY_ASSERT (id < bytecode_data.literals_count);
return bytecode_data.literals[id];
}
literal_index_t
serializer_get_literal_id_by_uid (uint8_t id, opcode_counter_t oc)
lit_cpointer_t
serializer_get_literal_cp_by_uid (uint8_t id, opcode_counter_t oc)
{
if (bytecode_data.lit_id_hash == null_hash)
{
@@ -91,17 +80,14 @@ serializer_merge_scopes_into_bytecode (void)
}
void
serializer_dump_literals (const literal *literals, literal_index_t literals_count)
serializer_dump_literals (void)
{
#ifdef JERRY_ENABLE_PRETTY_PRINTER
if (print_opcodes)
{
pp_literals (literals, literals_count);
lit_dump_literals ();
}
#endif
bytecode_data.literals_count = literals_count;
bytecode_data.literals = literals;
}
void
@@ -185,9 +171,10 @@ serializer_init ()
print_opcodes = false;
bytecode_data.strings_buffer = NULL;
bytecode_data.literals = NULL;
bytecode_data.opcodes = NULL;
bytecode_data.lit_id_hash = null_hash;
lit_init ();
}
void serializer_set_show_opcodes (bool show_opcodes)
@@ -206,9 +193,8 @@ serializer_free (void)
{
lit_id_hash_table_free (bytecode_data.lit_id_hash);
}
if (bytecode_data.literals != NULL)
{
mem_heap_free_block ((uint8_t *) bytecode_data.literals);
}
mem_heap_free_block ((uint8_t *) bytecode_data.opcodes);
lit_finalize ();
}