Rework usages/naming of configuration macros [part 2] (#2903)
There are quite a few configuration macros in the project. As discussed in the #2520 issue there are a few awkward constructs. Main changes: * The following macros are now 0/1 switches: ** Renamed CONFIG_ECMA_LCACHE_DISABLE to JERRY_LCACHE. ** Renamed CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE to JERRY_PROPERTY_HASHMAP. ** Renamed CONFIG_DISABLE_UNICODE_CASE_CONVERSION to JERRY_UNICODE_CASE_CONVERSION. ** Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE. ** Renamed JERRY_DISABLE_JS_PARSER to JERRY_PARSER. ** Renamed JERRY_ENABLE_ERROR_MESSAGES to JERRY_ERROR_MESSAGES. ** Renamed JERRY_ENABLE_EXTERNAL_CONTEXT to JERRY_EXTERNAL_CONTEXT. ** Renamed JERRY_ENABLE_LINE_INFO to JERRY_LINE_INFO. ** Renamed JERRY_ENABLE_LOGGING to JERRY_LOGGING. ** Renamed JERRY_ENABLE_SNAPSHOT_EXEC to JERRY_SNAPSHOT_EXEC. ** Renamed JERRY_ENABLE_SNAPSHOT_SAVE to JERRY_SNAPSHOT_SAVE. ** Renamed JERRY_SYSTEM_ALLOCATOR to JERRY_SYSTEM_ALLOCATOR. ** Renamed JERRY_VM_EXEC_STOP to JERRY_VM_EXEC_STOP. ** Renamed JMEM_GC_BEFORE_EACH_ALLOC to JERRY_MEM_GC_BEFORE_EACH_ALLOC. ** Renamed JMEM_STATS to JERRY_MEM_STATS. ** Renamed PARSER_DUMP_BYTE_CODE to JERRY_PARSER_DUMP_BYTE_CODE. ** Renamed REGEXP_DUMP_BYTE_CODE to JERRY_REGEXP_DUMP_BYTE_CODE. * Recursion check changes: ** Renamed REGEXP_RECURSION_LIMIT to JERRY_REGEXP_RECURSION_LIMIT. ** Renamed VM_RECURSION_LIMIT to JERRY_VM_RECURSION_LIMIT. * Attribute macro changes: ** Renamed JERRY_CONST_DATA to JERRY_ATTR_CONST_DATA. ** Renamed JERRY_HEAP_SECTION_ATTR to JERRY_ATTR_GLOBAL_HEAP. Now the macro can specify any attribute for the global heap object. * Other macro changes: ** Renamed CONFIG_MEM_HEAP_AREA_SIZE to JERRY_GLOBAL_HEAP_SIZE. Then new macro now specify the global heap size in kilobytes. * Updated documentations to reflect the new macro names. For more deatils please see jerry-core/config.h. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#include "lit-char-helpers.h"
|
||||
#include "re-compiler.h"
|
||||
|
||||
#if defined JERRY_ENABLE_SNAPSHOT_SAVE || defined JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE) || ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
|
||||
/**
|
||||
* Get snapshot configuration flags.
|
||||
@@ -70,9 +70,9 @@ snapshot_check_global_flags (uint32_t global_flags) /**< global flags */
|
||||
return global_flags == snapshot_get_global_flags (false, false);
|
||||
} /* snapshot_check_global_flags */
|
||||
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE || JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) || ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
|
||||
/**
|
||||
* Variables required to take a snapshot.
|
||||
@@ -523,9 +523,9 @@ jerry_snapshot_set_offsets (uint32_t *buffer_p, /**< buffer */
|
||||
while (size > 0);
|
||||
} /* jerry_snapshot_set_offsets */
|
||||
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
|
||||
/**
|
||||
* Byte code blocks shorter than this threshold are always copied into the memory.
|
||||
@@ -610,9 +610,9 @@ snapshot_load_compiled_code (const uint8_t *base_addr_p, /**< base address of th
|
||||
{
|
||||
bytecode_p = (ecma_compiled_code_t *) jmem_heap_alloc_block (code_size);
|
||||
|
||||
#ifdef JMEM_STATS
|
||||
#if ENABLED (JERRY_MEM_STATS)
|
||||
jmem_stats_allocate_byte_code_bytes (code_size);
|
||||
#endif /* JMEM_STATS */
|
||||
#endif /* ENABLED (JERRY_MEM_STATS) */
|
||||
|
||||
memcpy (bytecode_p, base_addr_p, code_size);
|
||||
}
|
||||
@@ -632,9 +632,9 @@ snapshot_load_compiled_code (const uint8_t *base_addr_p, /**< base address of th
|
||||
|
||||
bytecode_p = (ecma_compiled_code_t *) jmem_heap_alloc_block (new_code_size);
|
||||
|
||||
#ifdef JMEM_STATS
|
||||
#if ENABLED (JERRY_MEM_STATS)
|
||||
jmem_stats_allocate_byte_code_bytes (new_code_size);
|
||||
#endif /* JMEM_STATS */
|
||||
#endif /* ENABLED (JERRY_MEM_STATS) */
|
||||
|
||||
memcpy (bytecode_p, base_addr_p, start_offset);
|
||||
|
||||
@@ -711,16 +711,16 @@ snapshot_load_compiled_code (const uint8_t *base_addr_p, /**< base address of th
|
||||
return bytecode_p;
|
||||
} /* snapshot_load_compiled_code */
|
||||
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
|
||||
/**
|
||||
* Generate snapshot from specified source and arguments
|
||||
*
|
||||
* @return size of snapshot (a number value), if it was generated succesfully
|
||||
* (i.e. there are no syntax errors in source code, buffer size is sufficient,
|
||||
* and snapshot support is enabled in current configuration through JERRY_ENABLE_SNAPSHOT_SAVE),
|
||||
* and snapshot support is enabled in current configuration through JERRY_SNAPSHOT_SAVE),
|
||||
* error object otherwise
|
||||
*/
|
||||
static jerry_value_t
|
||||
@@ -738,9 +738,9 @@ jerry_generate_snapshot_with_args (const jerry_char_t *resource_name_p, /**< scr
|
||||
JERRY_UNUSED (resource_name_p);
|
||||
JERRY_UNUSED (resource_name_length);
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
JERRY_CONTEXT (resource_name) = ECMA_VALUE_UNDEFINED;
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
snapshot_globals_t globals;
|
||||
ecma_value_t parse_status;
|
||||
@@ -835,14 +835,14 @@ jerry_generate_snapshot_with_args (const jerry_char_t *resource_name_p, /**< scr
|
||||
return ecma_make_number_value ((ecma_number_t) globals.snapshot_buffer_write_offset);
|
||||
} /* jerry_generate_snapshot_with_args */
|
||||
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
|
||||
/**
|
||||
* Generate snapshot from specified source and arguments
|
||||
*
|
||||
* @return size of snapshot (a number value), if it was generated succesfully
|
||||
* (i.e. there are no syntax errors in source code, buffer size is sufficient,
|
||||
* and snapshot support is enabled in current configuration through JERRY_ENABLE_SNAPSHOT_SAVE),
|
||||
* and snapshot support is enabled in current configuration through JERRY_SNAPSHOT_SAVE),
|
||||
* error object otherwise
|
||||
*/
|
||||
jerry_value_t
|
||||
@@ -854,7 +854,7 @@ jerry_generate_snapshot (const jerry_char_t *resource_name_p, /**< script resour
|
||||
uint32_t *buffer_p, /**< buffer to save snapshot to */
|
||||
size_t buffer_size) /**< the buffer's size */
|
||||
{
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
uint32_t allowed_opts = (JERRY_SNAPSHOT_SAVE_STATIC | JERRY_SNAPSHOT_SAVE_STRICT);
|
||||
|
||||
if ((generate_snapshot_opts & ~(allowed_opts)) != 0)
|
||||
@@ -872,7 +872,7 @@ jerry_generate_snapshot (const jerry_char_t *resource_name_p, /**< script resour
|
||||
generate_snapshot_opts,
|
||||
buffer_p,
|
||||
buffer_size);
|
||||
#else /* !JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#else /* !ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
JERRY_UNUSED (resource_name_p);
|
||||
JERRY_UNUSED (resource_name_length);
|
||||
JERRY_UNUSED (source_p);
|
||||
@@ -882,10 +882,10 @@ jerry_generate_snapshot (const jerry_char_t *resource_name_p, /**< script resour
|
||||
JERRY_UNUSED (buffer_size);
|
||||
|
||||
return 0;
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
} /* jerry_generate_snapshot */
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
/**
|
||||
* Execute/load snapshot from specified buffer
|
||||
*
|
||||
@@ -1007,7 +1007,7 @@ jerry_snapshot_result (const uint32_t *snapshot_p, /**< snapshot */
|
||||
|
||||
return ret_val;
|
||||
} /* jerry_snapshot_result */
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
|
||||
/**
|
||||
* Execute snapshot from specified buffer
|
||||
@@ -1024,23 +1024,23 @@ jerry_exec_snapshot (const uint32_t *snapshot_p, /**< snapshot */
|
||||
size_t func_index, /**< index of primary function */
|
||||
uint32_t exec_snapshot_opts) /**< jerry_exec_snapshot_opts_t option bits */
|
||||
{
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
return jerry_snapshot_result (snapshot_p, snapshot_size, func_index, exec_snapshot_opts, false);
|
||||
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
JERRY_UNUSED (snapshot_p);
|
||||
JERRY_UNUSED (snapshot_size);
|
||||
JERRY_UNUSED (func_index);
|
||||
JERRY_UNUSED (exec_snapshot_opts);
|
||||
|
||||
return ECMA_VALUE_FALSE;
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
} /* jerry_exec_snapshot */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
|
||||
/**
|
||||
* Collect all literals from a snapshot file.
|
||||
@@ -1198,7 +1198,7 @@ update_literal_offsets (uint8_t *buffer_p, /**< [in,out] snapshot buffer start *
|
||||
while (buffer_p < buffer_end_p);
|
||||
} /* update_literal_offsets */
|
||||
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
|
||||
/**
|
||||
* Merge multiple snapshots into a single buffer
|
||||
@@ -1214,7 +1214,7 @@ jerry_merge_snapshots (const uint32_t **inp_buffers_p, /**< array of (pointers t
|
||||
size_t out_buffer_size, /**< output buffer size */
|
||||
const char **error_p) /**< error description */
|
||||
{
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
uint32_t number_of_funcs = 0;
|
||||
uint32_t merged_global_flags = 0;
|
||||
size_t functions_size = sizeof (jerry_snapshot_header_t);
|
||||
@@ -1337,7 +1337,7 @@ jerry_merge_snapshots (const uint32_t **inp_buffers_p, /**< array of (pointers t
|
||||
|
||||
*error_p = NULL;
|
||||
return functions_size;
|
||||
#else /* !JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#else /* !ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
JERRY_UNUSED (inp_buffers_p);
|
||||
JERRY_UNUSED (inp_buffer_sizes_p);
|
||||
JERRY_UNUSED (number_of_snapshots);
|
||||
@@ -1347,10 +1347,10 @@ jerry_merge_snapshots (const uint32_t **inp_buffers_p, /**< array of (pointers t
|
||||
|
||||
*error_p = "snapshot merge not supported";
|
||||
return 0;
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
} /* jerry_merge_snapshots */
|
||||
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
|
||||
/**
|
||||
* ====================== Functions for literal saving ==========================
|
||||
@@ -1579,7 +1579,7 @@ ecma_string_is_valid_identifier (const ecma_string_t *string_p)
|
||||
return result;
|
||||
} /* ecma_string_is_valid_identifier */
|
||||
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
|
||||
/**
|
||||
* Get the literals from a snapshot. Copies certain string literals into the given
|
||||
@@ -1599,7 +1599,7 @@ jerry_get_literals_from_snapshot (const uint32_t *snapshot_p, /**< input snapsho
|
||||
size_t lit_buf_size, /**< the buffer's size */
|
||||
bool is_c_format) /**< format-flag */
|
||||
{
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
const uint8_t *snapshot_data_p = (uint8_t *) snapshot_p;
|
||||
const jerry_snapshot_header_t *header_p = (const jerry_snapshot_header_t *) snapshot_data_p;
|
||||
|
||||
@@ -1771,7 +1771,7 @@ jerry_get_literals_from_snapshot (const uint32_t *snapshot_p, /**< input snapsho
|
||||
JMEM_FINALIZE_LOCAL_ARRAY (literal_array);
|
||||
|
||||
return lit_buf_p <= buffer_end_p ? (size_t) (lit_buf_p - buffer_start_p) : 0;
|
||||
#else /* !JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#else /* !ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
JERRY_UNUSED (snapshot_p);
|
||||
JERRY_UNUSED (snapshot_size);
|
||||
JERRY_UNUSED (lit_buf_p);
|
||||
@@ -1779,7 +1779,7 @@ jerry_get_literals_from_snapshot (const uint32_t *snapshot_p, /**< input snapsho
|
||||
JERRY_UNUSED (is_c_format);
|
||||
|
||||
return 0;
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
} /* jerry_get_literals_from_snapshot */
|
||||
|
||||
|
||||
@@ -1788,7 +1788,7 @@ jerry_get_literals_from_snapshot (const uint32_t *snapshot_p, /**< input snapsho
|
||||
*
|
||||
* @return size of snapshot (a number value), if it was generated succesfully
|
||||
* (i.e. there are no syntax errors in source code, buffer size is sufficient,
|
||||
* and snapshot support is enabled in current configuration through JERRY_ENABLE_SNAPSHOT_SAVE),
|
||||
* and snapshot support is enabled in current configuration through JERRY_SNAPSHOT_SAVE),
|
||||
* error object otherwise
|
||||
*/
|
||||
jerry_value_t
|
||||
@@ -1802,7 +1802,7 @@ jerry_generate_function_snapshot (const jerry_char_t *resource_name_p, /**< scri
|
||||
uint32_t *buffer_p, /**< buffer to save snapshot to */
|
||||
size_t buffer_size) /**< the buffer's size */
|
||||
{
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
uint32_t allowed_opts = (JERRY_SNAPSHOT_SAVE_STATIC | JERRY_SNAPSHOT_SAVE_STRICT);
|
||||
|
||||
if ((generate_snapshot_opts & ~(allowed_opts)) != 0)
|
||||
@@ -1820,7 +1820,7 @@ jerry_generate_function_snapshot (const jerry_char_t *resource_name_p, /**< scri
|
||||
generate_snapshot_opts,
|
||||
buffer_p,
|
||||
buffer_size);
|
||||
#else /* !JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#else /* !ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
JERRY_UNUSED (resource_name_p);
|
||||
JERRY_UNUSED (resource_name_length);
|
||||
JERRY_UNUSED (source_p);
|
||||
@@ -1832,7 +1832,7 @@ jerry_generate_function_snapshot (const jerry_char_t *resource_name_p, /**< scri
|
||||
JERRY_UNUSED (buffer_size);
|
||||
|
||||
return 0;
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
} /* jerry_generate_function_snapshot */
|
||||
|
||||
/**
|
||||
@@ -1850,14 +1850,14 @@ jerry_load_function_snapshot (const uint32_t *function_snapshot_p, /**< snapshot
|
||||
size_t func_index, /**< index of the function to load */
|
||||
uint32_t exec_snapshot_opts) /**< jerry_exec_snapshot_opts_t option bits */
|
||||
{
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
return jerry_snapshot_result (function_snapshot_p, function_snapshot_size, func_index, exec_snapshot_opts, true);
|
||||
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
JERRY_UNUSED (function_snapshot_p);
|
||||
JERRY_UNUSED (function_snapshot_size);
|
||||
JERRY_UNUSED (func_index);
|
||||
JERRY_UNUSED (exec_snapshot_opts);
|
||||
|
||||
return ECMA_VALUE_FALSE;
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
} /* jerry_load_function_snapshot */
|
||||
|
||||
+57
-57
@@ -71,11 +71,11 @@ JERRY_STATIC_ASSERT ((int) RE_FLAG_GLOBAL == (int) JERRY_REGEXP_FLAG_GLOBAL
|
||||
re_flags_t_must_be_equal_to_jerry_regexp_flags_t);
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
|
||||
|
||||
#if defined JERRY_DISABLE_JS_PARSER && !defined JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#error JERRY_ENABLE_SNAPSHOT_EXEC must be defined if JERRY_DISABLE_JS_PARSER is defined!
|
||||
#endif /* JERRY_DISABLE_JS_PARSER && !JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#if !ENABLED (JERRY_PARSER) && !ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
#error "JERRY_SNAPSHOT_EXEC must be enabled if JERRY_PARSER is disabled!"
|
||||
#endif /* !ENABLED (JERRY_PARSER) && !ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
|
||||
#ifdef JERRY_ENABLE_ERROR_MESSAGES
|
||||
#if ENABLED (JERRY_ERROR_MESSAGES)
|
||||
|
||||
/**
|
||||
* Error message, if an argument is has an error flag
|
||||
@@ -87,7 +87,7 @@ static const char * const error_value_msg_p = "argument cannot have an error fla
|
||||
*/
|
||||
static const char * const wrong_args_msg_p = "wrong type of argument";
|
||||
|
||||
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
|
||||
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
|
||||
/** \addtogroup jerry Jerry engine interface
|
||||
* @{
|
||||
@@ -305,7 +305,7 @@ jerry_gc (jerry_gc_mode_t mode) /**< operational mode */
|
||||
bool
|
||||
jerry_get_memory_stats (jerry_heap_stats_t *out_stats_p) /**< [out] heap memory stats */
|
||||
{
|
||||
#ifdef JMEM_STATS
|
||||
#if ENABLED (JERRY_MEM_STATS)
|
||||
if (out_stats_p == NULL)
|
||||
{
|
||||
return false;
|
||||
@@ -324,10 +324,10 @@ jerry_get_memory_stats (jerry_heap_stats_t *out_stats_p) /**< [out] heap memory
|
||||
};
|
||||
|
||||
return true;
|
||||
#else
|
||||
#else /* !ENABLED (JERRY_MEM_STATS) */
|
||||
JERRY_UNUSED (out_stats_p);
|
||||
return false;
|
||||
#endif
|
||||
#endif /* ENABLED (JERRY_MEM_STATS) */
|
||||
} /* jerry_get_memory_stats */
|
||||
|
||||
/**
|
||||
@@ -379,7 +379,7 @@ jerry_parse (const jerry_char_t *resource_name_p, /**< resource name (usually a
|
||||
size_t source_size, /**< script source size */
|
||||
uint32_t parse_opts) /**< jerry_parse_opts_t option bits */
|
||||
{
|
||||
#if defined JERRY_DEBUGGER && !defined JERRY_DISABLE_JS_PARSER
|
||||
#if defined JERRY_DEBUGGER && ENABLED (JERRY_PARSER)
|
||||
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
&& resource_name_length > 0)
|
||||
{
|
||||
@@ -388,18 +388,18 @@ jerry_parse (const jerry_char_t *resource_name_p, /**< resource name (usually a
|
||||
resource_name_p,
|
||||
resource_name_length);
|
||||
}
|
||||
#else /* !(JERRY_DEBUGGER && !JERRY_DISABLE_JS_PARSER) */
|
||||
#else /* !(JERRY_DEBUGGER && ENABLED (JERRY_PARSER)) */
|
||||
JERRY_UNUSED (resource_name_p);
|
||||
JERRY_UNUSED (resource_name_length);
|
||||
#endif /* JERRY_DEBUGGER && !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* JERRY_DEBUGGER && ENABLED (JERRY_PARSER) */
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
jerry_assert_api_available ();
|
||||
|
||||
#if defined JERRY_ENABLE_LINE_INFO && !defined JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
JERRY_CONTEXT (resource_name) = ecma_find_or_create_literal_string (resource_name_p,
|
||||
(lit_utf8_size_t) resource_name_length);
|
||||
#endif /* JERRY_ENABLE_LINE_INFO && !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
ecma_compiled_code_t *bytecode_data_p;
|
||||
ecma_value_t parse_status;
|
||||
@@ -424,13 +424,13 @@ jerry_parse (const jerry_char_t *resource_name_p, /**< resource name (usually a
|
||||
ecma_bytecode_deref (bytecode_data_p);
|
||||
|
||||
return ecma_make_object_value (func_obj_p);
|
||||
#else /* JERRY_DISABLE_JS_PARSER */
|
||||
#else /* !ENABLED (JERRY_PARSER) */
|
||||
JERRY_UNUSED (source_p);
|
||||
JERRY_UNUSED (source_size);
|
||||
JERRY_UNUSED (parse_opts);
|
||||
|
||||
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled.")));
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
} /* jerry_parse */
|
||||
|
||||
/**
|
||||
@@ -449,7 +449,7 @@ jerry_parse_function (const jerry_char_t *resource_name_p, /**< resource name (u
|
||||
size_t source_size, /**< script source size */
|
||||
uint32_t parse_opts) /**< jerry_parse_opts_t option bits */
|
||||
{
|
||||
#if defined JERRY_DEBUGGER && !defined JERRY_DISABLE_JS_PARSER
|
||||
#if defined JERRY_DEBUGGER && ENABLED (JERRY_PARSER)
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
{
|
||||
jerry_debugger_send_string (JERRY_DEBUGGER_SOURCE_CODE_NAME,
|
||||
@@ -457,21 +457,21 @@ jerry_parse_function (const jerry_char_t *resource_name_p, /**< resource name (u
|
||||
resource_name_p,
|
||||
resource_name_length);
|
||||
}
|
||||
#else /* !(JERRY_DEBUGGER && !JERRY_DISABLE_JS_PARSER) */
|
||||
#else /* !(JERRY_DEBUGGER && ENABLED (JERRY_PARSER)) */
|
||||
JERRY_UNUSED (resource_name_p);
|
||||
JERRY_UNUSED (resource_name_length);
|
||||
#endif /* JERRY_DEBUGGER && !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* JERRY_DEBUGGER && ENABLED (JERRY_PARSER) */
|
||||
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
jerry_assert_api_available ();
|
||||
|
||||
ecma_compiled_code_t *bytecode_data_p;
|
||||
ecma_value_t parse_status;
|
||||
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
JERRY_CONTEXT (resource_name) = ecma_find_or_create_literal_string (resource_name_p,
|
||||
(lit_utf8_size_t) resource_name_length);
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
|
||||
if (arg_list_p == NULL)
|
||||
{
|
||||
@@ -499,7 +499,7 @@ jerry_parse_function (const jerry_char_t *resource_name_p, /**< resource name (u
|
||||
ecma_bytecode_deref (bytecode_data_p);
|
||||
|
||||
return ecma_make_object_value (func_obj_p);
|
||||
#else /* JERRY_DISABLE_JS_PARSER */
|
||||
#else /* !ENABLED (JERRY_PARSER) */
|
||||
JERRY_UNUSED (arg_list_p);
|
||||
JERRY_UNUSED (arg_list_size);
|
||||
JERRY_UNUSED (source_p);
|
||||
@@ -507,7 +507,7 @@ jerry_parse_function (const jerry_char_t *resource_name_p, /**< resource name (u
|
||||
JERRY_UNUSED (parse_opts);
|
||||
|
||||
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled.")));
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
} /* jerry_parse_function */
|
||||
|
||||
/**
|
||||
@@ -878,36 +878,36 @@ jerry_is_feature_enabled (const jerry_feature_t feature) /**< feature to check *
|
||||
JERRY_ASSERT (feature < JERRY_FEATURE__COUNT);
|
||||
|
||||
return (false
|
||||
#ifdef JERRY_CPOINTER_32_BIT
|
||||
#if ENABLED (JERRY_CPOINTER_32_BIT)
|
||||
|| feature == JERRY_FEATURE_CPOINTER_32_BIT
|
||||
#endif /* JERRY_CPOINTER_32_BIT */
|
||||
#ifdef JERRY_ENABLE_ERROR_MESSAGES
|
||||
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
|
||||
#if ENABLED (JERRY_ERROR_MESSAGES)
|
||||
|| feature == JERRY_FEATURE_ERROR_MESSAGES
|
||||
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
|
||||
#ifndef JERRY_DISABLE_JS_PARSER
|
||||
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
|| feature == JERRY_FEATURE_JS_PARSER
|
||||
#endif /* !JERRY_DISABLE_JS_PARSER */
|
||||
#ifdef JMEM_STATS
|
||||
#endif /* ENABLED (JERRY_PARSER) */
|
||||
#if ENABLED (JERRY_MEM_STATS)
|
||||
|| feature == JERRY_FEATURE_MEM_STATS
|
||||
#endif /* JMEM_STATS */
|
||||
#ifdef PARSER_DUMP_BYTE_CODE
|
||||
#endif /* ENABLED (JERRY_MEM_STATS) */
|
||||
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
|
||||
|| feature == JERRY_FEATURE_PARSER_DUMP
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
#ifdef REGEXP_DUMP_BYTE_CODE
|
||||
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
|
||||
#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE)
|
||||
|| feature == JERRY_FEATURE_REGEXP_DUMP
|
||||
#endif /* REGEXP_DUMP_BYTE_CODE */
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
|
||||
#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */
|
||||
#if ENABLED (JERRY_SNAPSHOT_SAVE)
|
||||
|| feature == JERRY_FEATURE_SNAPSHOT_SAVE
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
|
||||
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
|
||||
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|
||||
|| feature == JERRY_FEATURE_SNAPSHOT_EXEC
|
||||
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
|
||||
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
|
||||
#ifdef JERRY_DEBUGGER
|
||||
|| feature == JERRY_FEATURE_DEBUGGER
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
#ifdef JERRY_VM_EXEC_STOP
|
||||
#if ENABLED (JERRY_VM_EXEC_STOP)
|
||||
|| feature == JERRY_FEATURE_VM_EXEC_STOP
|
||||
#endif /* JERRY_VM_EXEC_STOP */
|
||||
#endif /* ENABLED (JERRY_VM_EXEC_STOP) */
|
||||
#if ENABLED (JERRY_BUILTIN_JSON)
|
||||
|| feature == JERRY_FEATURE_JSON
|
||||
#endif /* ENABLED (JERRY_BUILTIN_JSON) */
|
||||
@@ -929,12 +929,12 @@ jerry_is_feature_enabled (const jerry_feature_t feature) /**< feature to check *
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
|| feature == JERRY_FEATURE_REGEXP
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
|
||||
#ifdef JERRY_ENABLE_LINE_INFO
|
||||
#if ENABLED (JERRY_LINE_INFO)
|
||||
|| feature == JERRY_FEATURE_LINE_INFO
|
||||
#endif /* JERRY_ENABLE_LINE_INFO */
|
||||
#ifdef JERRY_ENABLE_LOGGING
|
||||
#endif /* ENABLED (JERRY_LINE_INFO) */
|
||||
#if ENABLED (JERRY_LOGGING)
|
||||
|| feature == JERRY_FEATURE_LOGGING
|
||||
#endif /* JERRY_ENABLE_LOGGING */
|
||||
#endif /* ENABLED (JERRY_LOGGING) */
|
||||
);
|
||||
} /* jerry_is_feature_enabled */
|
||||
|
||||
@@ -2900,11 +2900,11 @@ jerry_create_context (uint32_t heap_size, /**< the size of heap */
|
||||
{
|
||||
JERRY_UNUSED (heap_size);
|
||||
|
||||
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
|
||||
#if ENABLED (JERRY_EXTERNAL_CONTEXT)
|
||||
|
||||
size_t total_size = sizeof (jerry_context_t) + JMEM_ALIGNMENT;
|
||||
|
||||
#ifndef JERRY_SYSTEM_ALLOCATOR
|
||||
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
|
||||
heap_size = JERRY_ALIGNUP (heap_size, JMEM_ALIGNMENT);
|
||||
|
||||
/* Minimum heap size is 1Kbyte. */
|
||||
@@ -2914,7 +2914,7 @@ jerry_create_context (uint32_t heap_size, /**< the size of heap */
|
||||
}
|
||||
|
||||
total_size += heap_size;
|
||||
#endif /* !JERRY_SYSTEM_ALLOCATOR */
|
||||
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
|
||||
|
||||
total_size = JERRY_ALIGNUP (total_size, JMEM_ALIGNMENT);
|
||||
|
||||
@@ -2932,29 +2932,29 @@ jerry_create_context (uint32_t heap_size, /**< the size of heap */
|
||||
|
||||
uint8_t *byte_p = (uint8_t *) context_ptr;
|
||||
|
||||
#ifndef JERRY_SYSTEM_ALLOCATOR
|
||||
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
|
||||
context_p->heap_p = (jmem_heap_t *) byte_p;
|
||||
context_p->heap_size = heap_size;
|
||||
byte_p += heap_size;
|
||||
#endif /* !JERRY_SYSTEM_ALLOCATOR */
|
||||
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
|
||||
|
||||
JERRY_ASSERT (byte_p <= ((uint8_t *) context_p) + total_size);
|
||||
|
||||
JERRY_UNUSED (byte_p);
|
||||
return context_p;
|
||||
|
||||
#else /* !JERRY_ENABLE_EXTERNAL_CONTEXT */
|
||||
#else /* !ENABLED (JERRY_EXTERNAL_CONTEXT) */
|
||||
|
||||
JERRY_UNUSED (alloc);
|
||||
JERRY_UNUSED (cb_data_p);
|
||||
|
||||
return NULL;
|
||||
|
||||
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
|
||||
#endif /* ENABLED (JERRY_EXTERNAL_CONTEXT) */
|
||||
} /* jerry_create_context */
|
||||
|
||||
/**
|
||||
* If JERRY_VM_EXEC_STOP is defined the callback passed to this function is
|
||||
* If JERRY_VM_EXEC_STOP is enabled the callback passed to this function is
|
||||
* periodically called with the user_p argument. If frequency is greater
|
||||
* than 1, the callback is only called at every frequency ticks.
|
||||
*/
|
||||
@@ -2963,7 +2963,7 @@ jerry_set_vm_exec_stop_callback (jerry_vm_exec_stop_callback_t stop_cb, /**< per
|
||||
void *user_p, /**< pointer passed to the function */
|
||||
uint32_t frequency) /**< frequency of the function call */
|
||||
{
|
||||
#ifdef JERRY_VM_EXEC_STOP
|
||||
#if ENABLED (JERRY_VM_EXEC_STOP)
|
||||
if (frequency == 0)
|
||||
{
|
||||
frequency = 1;
|
||||
@@ -2973,11 +2973,11 @@ jerry_set_vm_exec_stop_callback (jerry_vm_exec_stop_callback_t stop_cb, /**< per
|
||||
JERRY_CONTEXT (vm_exec_stop_counter) = frequency;
|
||||
JERRY_CONTEXT (vm_exec_stop_user_p) = user_p;
|
||||
JERRY_CONTEXT (vm_exec_stop_cb) = stop_cb;
|
||||
#else /* !JERRY_VM_EXEC_STOP */
|
||||
#else /* !ENABLED (JERRY_VM_EXEC_STOP) */
|
||||
JERRY_UNUSED (stop_cb);
|
||||
JERRY_UNUSED (user_p);
|
||||
JERRY_UNUSED (frequency);
|
||||
#endif /* JERRY_VM_EXEC_STOP */
|
||||
#endif /* ENABLED (JERRY_VM_EXEC_STOP) */
|
||||
} /* jerry_set_vm_exec_stop_callback */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user