Skip to content

Commit 2903ce8

Browse files
committed
Merge pull request jerryscript-project#20 from sand1k/statements_parse
Remove serializer.
2 parents 1033ec4 + 7200adb commit 2903ce8

22 files changed

+464
-507
lines changed

jerry-core/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ project (JerryCore CXX C ASM)
112112
${CMAKE_SOURCE_DIR}/jerry-core/ecma/base
113113
${CMAKE_SOURCE_DIR}/jerry-core/ecma/operations
114114
${CMAKE_SOURCE_DIR}/jerry-core/parser/js
115+
${CMAKE_SOURCE_DIR}/jerry-core/parser/js/bc
115116
${CMAKE_SOURCE_DIR}/jerry-core/parser/js/collections
116117
${CMAKE_SOURCE_DIR}/jerry-core/parser/regexp
117118
${CMAKE_SOURCE_DIR}/jerry-core/jrt)
@@ -131,6 +132,7 @@ project (JerryCore CXX C ASM)
131132
file(GLOB SOURCE_CORE_ECMA_BASE ecma/base/*.cpp)
132133
file(GLOB SOURCE_CORE_ECMA_OPERATIONS ecma/operations/*.cpp)
133134
file(GLOB SOURCE_CORE_PARSER_JS parser/js/*.cpp)
135+
file(GLOB SOURCE_CORE_PARSER_JS_BC parser/js/bc/*.cpp)
134136
file(GLOB SOURCE_CORE_PARSER_JS_COLLECTIONS parser/js/collections/*.cpp)
135137
file(GLOB SOURCE_CORE_PARSER_REGEXP parser/regexp/*.cpp)
136138
file(GLOB SOURCE_CORE_JRT jrt/*.cpp)
@@ -146,6 +148,7 @@ project (JerryCore CXX C ASM)
146148
${SOURCE_CORE_ECMA_BASE}
147149
${SOURCE_CORE_ECMA_OPERATIONS}
148150
${SOURCE_CORE_PARSER_JS}
151+
${SOURCE_CORE_PARSER_JS_BC}
149152
${SOURCE_CORE_PARSER_JS_COLLECTIONS}
150153
${SOURCE_CORE_PARSER_REGEXP}
151154
${SOURCE_CORE_JRT})

jerry-core/ecma/base/ecma-globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,8 @@ FIXME (Move to library that should define the type (literal.h /* ? */))
795795
typedef rcs_record_t *literal_t;
796796
typedef rcs_cpointer_t lit_cpointer_t;
797797

798+
#define NOT_A_LITERAL (lit_cpointer_t::null_cp ())
799+
798800
/**
799801
* ECMA string-value descriptor
800802
*/

jerry-core/ecma/base/ecma-helpers-string.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* @{
2121
*/
2222

23+
#include "bytecode-data.h"
2324
#include "ecma-alloc.h"
2425
#include "ecma-gc.h"
2526
#include "ecma-globals.h"
@@ -29,7 +30,6 @@
2930
#include "jrt-libc-includes.h"
3031
#include "lit-char-helpers.h"
3132
#include "lit-magic-strings.h"
32-
#include "serializer.h"
3333
#include "vm.h"
3434

3535
/**

jerry-core/ecma/builtin-objects/ecma-builtin-function.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "ecma-function-object.h"
2222
#include "ecma-lex-env.h"
2323
#include "ecma-try-catch-macro.h"
24-
#include "serializer.h"
2524
#include "lit-magic-strings.h"
2625
#include "parser.h"
2726

jerry-core/ecma/operations/ecma-eval.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* limitations under the License.
1414
*/
1515

16+
#include "bytecode-data.h"
1617
#include "ecma-builtins.h"
1718
#include "ecma-exceptions.h"
1819
#include "ecma-eval.h"
@@ -21,7 +22,6 @@
2122
#include "ecma-helpers.h"
2223
#include "ecma-lex-env.h"
2324
#include "parser.h"
24-
#include "serializer.h"
2525
#include "vm.h"
2626

2727
/** \addtogroup ecma ECMA
@@ -114,7 +114,7 @@ ecma_op_eval_chars_buffer (const jerry_api_char_t *code_p, /**< code characters
114114

115115
if (!code_contains_functions)
116116
{
117-
serializer_remove_bytecode_data (bytecode_data_p);
117+
bc_remove_bytecode_data (bytecode_data_p);
118118
}
119119
}
120120

jerry-core/jerry.cpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <stdio.h>
1717

18+
#include "bytecode-data.h"
1819
#include "ecma-alloc.h"
1920
#include "ecma-array-object.h"
2021
#include "ecma-builtins.h"
@@ -26,9 +27,9 @@
2627
#include "ecma-init-finalize.h"
2728
#include "ecma-objects.h"
2829
#include "ecma-objects-general.h"
30+
#include "lit-literal.h"
2931
#include "lit-magic-strings.h"
3032
#include "parser.h"
31-
#include "serializer.h"
3233

3334
#define JERRY_INTERNAL
3435
#include "jerry-internal.h"
@@ -1351,7 +1352,7 @@ jerry_init (jerry_flag_t flags) /**< combination of Jerry flags */
13511352
jerry_make_api_available ();
13521353

13531354
mem_init ();
1354-
serializer_init ();
1355+
lit_init ();
13551356
ecma_init ();
13561357
} /* jerry_init */
13571358

@@ -1366,7 +1367,8 @@ jerry_cleanup (void)
13661367
bool is_show_mem_stats = ((jerry_flags & JERRY_FLAG_MEM_STATS) != 0);
13671368

13681369
ecma_finalize ();
1369-
serializer_free ();
1370+
lit_finalize ();
1371+
bc_finalize ();
13701372
mem_finalize (is_show_mem_stats);
13711373
vm_finalize ();
13721374
} /* jerry_cleanup */
@@ -1638,14 +1640,14 @@ jerry_parse_and_save_snapshot (const jerry_api_char_t* source_p, /**< script sou
16381640
size_t bytecode_offset = sizeof (version) + sizeof (jerry_snapshot_header_t) + header.lit_table_size;
16391641
JERRY_ASSERT (JERRY_ALIGNUP (bytecode_offset, MEM_ALIGNMENT) == bytecode_offset);
16401642

1641-
bool is_ok = serializer_dump_bytecode_with_idx_map (buffer_p,
1642-
buffer_size,
1643-
&buffer_write_offset,
1644-
bytecode_data_p,
1645-
lit_map_p,
1646-
literals_num,
1647-
&header.bytecode_size,
1648-
&header.idx_to_lit_map_size);
1643+
bool is_ok = bc_save_bytecode_with_idx_map (buffer_p,
1644+
buffer_size,
1645+
&buffer_write_offset,
1646+
bytecode_data_p,
1647+
lit_map_p,
1648+
literals_num,
1649+
&header.bytecode_size,
1650+
&header.idx_to_lit_map_size);
16491651

16501652
if (lit_map_p != NULL)
16511653
{
@@ -1747,12 +1749,12 @@ jerry_exec_snapshot (const void *snapshot_p, /**< snapshot */
17471749
}
17481750

17491751
const bytecode_data_header_t *bytecode_data_p;
1750-
bytecode_data_p = serializer_load_bytecode_with_idx_map (snapshot_data_p + snapshot_read,
1751-
header_p->bytecode_size,
1752-
header_p->idx_to_lit_map_size,
1753-
lit_map_p,
1754-
literals_num,
1755-
is_copy);
1752+
bytecode_data_p = bc_load_bytecode_with_idx_map (snapshot_data_p + snapshot_read,
1753+
header_p->bytecode_size,
1754+
header_p->idx_to_lit_map_size,
1755+
lit_map_p,
1756+
literals_num,
1757+
is_copy);
17561758

17571759
if (lit_map_p != NULL)
17581760
{

0 commit comments

Comments
 (0)