Rework snapshot execution api. (#2270)

The _at functions replaces the original functions.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2018-04-11 03:39:58 +02:00
committed by yichoi
parent 46309b1502
commit 5c0c21b26a
5 changed files with 125 additions and 219 deletions
+15 -7
View File
@@ -36,6 +36,15 @@ typedef enum
JERRY_SNAPSHOT_SAVE_STRICT = (1u << 1), /**< strict mode code */
} jerry_generate_snapshot_opts_t;
/**
* Flags for jerry_exec_snapshot_at and jerry_load_function_snapshot_at.
*/
typedef enum
{
JERRY_SNAPSHOT_EXEC_COPY_DATA = (1u << 0), /**< copy snashot data */
JERRY_SNAPSHOT_EXEC_ALLOW_STATIC = (1u << 1), /**< static snapshots allowed */
} jerry_exec_snapshot_opts_t;
/**
* Snapshot functions.
*/
@@ -48,17 +57,16 @@ jerry_value_t jerry_generate_function_snapshot (const jerry_char_t *resource_nam
uint32_t generate_snapshot_opts, uint32_t *buffer_p,
size_t buffer_size);
jerry_value_t jerry_exec_snapshot (const uint32_t *snapshot_p, size_t snapshot_size, bool copy_bytecode);
jerry_value_t jerry_exec_snapshot_at (const uint32_t *snapshot_p, size_t snapshot_size,
size_t func_index, bool copy_bytecode);
jerry_value_t jerry_exec_snapshot (const uint32_t *snapshot_p, size_t snapshot_size,
size_t func_index, uint32_t exec_snapshot_opts);
jerry_value_t jerry_load_function_snapshot (const uint32_t *function_snapshot_p,
const size_t function_snapshot_size,
size_t func_index, uint32_t exec_snapshot_opts);
size_t jerry_merge_snapshots (const uint32_t **inp_buffers_p, size_t *inp_buffer_sizes_p, size_t number_of_snapshots,
uint32_t *out_buffer_p, size_t out_buffer_size, const char **error_p);
size_t jerry_parse_and_save_literals (const jerry_char_t *source_p, size_t source_size, bool is_strict,
uint32_t *buffer_p, size_t buffer_size, bool is_c_format);
jerry_value_t jerry_load_function_snapshot_at (const uint32_t *function_snapshot_p,
const size_t function_snapshot_size,
size_t func_index,
bool copy_bytecode);
/**
* @}
*/