Update bytecode header structure so that bytecode could be stored independently from hash table and bytecode header.

JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
This commit is contained in:
Andrey Shitov
2015-09-03 18:11:27 +03:00
committed by Ruben Ayrapetyan
parent 6a6fb3fdfa
commit 443673fc5d
22 changed files with 207 additions and 194 deletions
+21 -14
View File
@@ -3101,13 +3101,13 @@ parser_parse_program (const jerry_api_char_t *source_p, /**< source code buffer
bool in_eval, /**< flag indicating if we are parsing body of eval code */
bool is_strict, /**< flag, indicating whether current code
* inherited strict mode from code of an outer scope */
const vm_instr_t **out_instrs_p, /**< out: generated byte-code array
* (in case there were no syntax errors) */
const bytecode_data_header_t **out_bytecode_data_p, /**< out: generated byte-code array
* (in case there were no syntax errors) */
bool *out_contains_functions_p) /**< out: optional (can be NULL, if the output is not needed)
* flag, indicating whether the compiled byte-code
* contains a function declaration / expression */
{
JERRY_ASSERT (out_instrs_p != NULL);
JERRY_ASSERT (out_bytecode_data_p != NULL);
JERRY_ASSERT (!(in_dyn_constructed_function && in_eval));
@@ -3189,7 +3189,7 @@ parser_parse_program (const jerry_api_char_t *source_p, /**< source code buffer
jsp_early_error_free ();
*out_instrs_p = serializer_merge_scopes_into_bytecode ();
*out_bytecode_data_p = serializer_merge_scopes_into_bytecode ();
dumper_free ();
@@ -3215,7 +3215,7 @@ parser_parse_program (const jerry_api_char_t *source_p, /**< source code buffer
JERRY_ASSERT (!is_parse_finished);
#endif /* !JERRY_NDEBUG */
*out_instrs_p = NULL;
*out_bytecode_data_p = NULL;
jsp_label_remove_all_labels ();
jsp_mm_free_all ();
@@ -3249,10 +3249,10 @@ parser_parse_program (const jerry_api_char_t *source_p, /**< source code buffer
jsp_status_t
parser_parse_script (const jerry_api_char_t *source, /**< source script */
size_t source_size, /**< source script size it bytes */
const vm_instr_t **out_instrs_p) /**< out: generated byte-code array
* (in case there were no syntax errors) */
const bytecode_data_header_t **out_bytecode_data_p) /**< out: generated byte-code array
* (in case there were no syntax errors) */
{
return parser_parse_program (source, source_size, false, false, false, out_instrs_p, NULL);
return parser_parse_program (source, source_size, false, false, false, out_bytecode_data_p, NULL);
} /* parser_parse_script */
/**
@@ -3266,14 +3266,20 @@ parser_parse_eval (const jerry_api_char_t *source, /**< string passed to eval()
size_t source_size, /**< string size in bytes */
bool is_strict, /**< flag, indicating whether eval is called
* from strict code in direct mode */
const vm_instr_t **out_instrs_p, /**< out: generated byte-code array
* (in case there were no syntax errors) */
const bytecode_data_header_t **out_bytecode_data_p, /**< out: generated byte-code array
* (in case there were no syntax errors) */
bool *out_contains_functions_p) /**< out: flag, indicating whether the compiled byte-code
* contains a function declaration / expression */
{
JERRY_ASSERT (out_contains_functions_p != NULL);
return parser_parse_program (source, source_size, false, true, is_strict, out_instrs_p, out_contains_functions_p);
return parser_parse_program (source,
source_size,
false,
true,
is_strict,
out_bytecode_data_p,
out_contains_functions_p);
} /* parser_parse_eval */
/**
@@ -3291,8 +3297,9 @@ parser_parse_new_function (const jerry_api_char_t **params, /**< array of argume
* body) call */
const size_t *params_size, /**< sizes of arguments strings */
size_t params_count, /**< total number of arguments passed to new Function (...) */
const vm_instr_t **out_instrs_p) /**< out: generated byte-code array
* (in case there were no syntax errors) */
const bytecode_data_header_t **out_bytecode_data_p) /**< out: generated byte-code array
* (in case there were no syntax
* errors) */
{
// Process arguments
JERRY_ASSERT (params_count > 0);
@@ -3306,7 +3313,7 @@ parser_parse_new_function (const jerry_api_char_t **params, /**< array of argume
true,
false,
false,
out_instrs_p,
out_bytecode_data_p,
NULL);
} /* parser_parse_new_function */