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:
Péter Gál 2019-06-19 12:28:21 +02:00 committed by Dániel Bátyai
parent 985de93d04
commit 01ecc7bb7b
77 changed files with 1154 additions and 795 deletions

View File

@ -5763,7 +5763,7 @@ jerry_generate_snapshot (const jerry_char_t *resource_name_p,
- return value
- the size of the generated snapshot in bytes as 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)
current configuration through JERRY_SNAPSHOT_SAVE)
- thrown error, otherwise.
**Example**
@ -5845,7 +5845,7 @@ jerry_generate_function_snapshot (const jerry_char_t *resource_name_p,
- return value
- the size of the generated snapshot in bytes as 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)
current configuration through JERRY_SNAPSHOT_SAVE)
- thrown error, otherwise.
**Example**
@ -6085,7 +6085,7 @@ jerry_get_literals_from_snapshot (const uint32_t *snapshot_p,
- `is_c_format` - the output format would be C-style (true) or a simple list (false).
- return value
- the size of the literal-list, if it was generated succesfully (i.e. the list of literals isn't empty,
and literal-save support is enabled in current configuration through JERRY_ENABLE_SNAPSHOT_SAVE)
and literal-save support is enabled in current configuration through JERRY_SNAPSHOT_SAVE)
- 0 otherwise.
**Example**

View File

@ -253,7 +253,7 @@ system. These "uncompressed pointers" increases the memory consumption by around
There are two possible representation of numbers according to standard IEEE 754:
The default is 8-byte (double),
but the engine supports the 4-byte (single precision) representation by setting CONFIG_ECMA_NUMBER_TYPE as well.
but the engine supports the 4-byte (single precision) representation by setting JERRY_NUMBER_TYPE_FLOAT64 to 0 as well.
![Number](img/number.png)

View File

@ -65,8 +65,8 @@ typedef enum
* vfprintf(logfile), or both, depending on log level.
*
* Note:
* This port function is called by jerry-core when JERRY_ENABLE_LOGGING is
* defined. It is also common practice though to use this function in
* This port function is called by jerry-core when JERRY_LOGGING is
* enabled. It is also common practice though to use this function in
* application code.
*/
void jerry_port_log (jerry_log_level_t level, const char *fmt, ...);
@ -145,7 +145,7 @@ jerry_port_normalize_path (const char *in_path_p, /**< input file path */
*
* Note:
* This port function is called by jerry-core when
* CONFIG_DISABLE_DATE_BUILTIN is _not_ defined. Otherwise this function is
* JERRY_BUILTIN_DATE is set to 1. Otherwise this function is
* not used.
*
* @param unix_ms The unix timestamp we want an offset for, given in
@ -167,7 +167,7 @@ double jerry_port_get_local_time_zone_adjustment (double unix_ms, bool is_utc);
*
* Note:
* This port function is called by jerry-core when
* CONFIG_DISABLE_DATE_BUILTIN is _not_ defined. It is also common practice
* JERRY_BUILTIN_DATE is set to 1. It is also common practice
* in application code to use this function for the initialization of the
* random number generator.
*
@ -189,7 +189,7 @@ simultaneously.
*
* Note:
* This port function is called by jerry-core when
* JERRY_ENABLE_EXTERNAL_CONTEXT is defined. Otherwise this function is not
* JERRY_EXTERNAL_CONTEXT is enabled. Otherwise this function is not
* used.
*
* @return the pointer to the engine context.

View File

@ -17,30 +17,30 @@ set(JERRY_CORE_NAME jerry-core)
project (${JERRY_CORE_NAME} C)
# Optional build settings
set(ENABLE_ALL_IN_ONE OFF CACHE BOOL "Enable all-in-one build?")
set(ENABLE_ALL_IN_ONE OFF CACHE BOOL "Enable all-in-one build?")
# Optional features
set(FEATURE_CPOINTER_32_BIT OFF CACHE BOOL "Enable 32 bit compressed pointers?")
set(FEATURE_DEBUGGER OFF CACHE BOOL "Enable JerryScript debugger?")
set(FEATURE_ERROR_MESSAGES OFF CACHE BOOL "Enable error messages?")
set(FEATURE_EXTERNAL_CONTEXT OFF CACHE BOOL "Enable external context?")
set(FEATURE_JS_PARSER ON CACHE BOOL "Enable js-parser?")
set(FEATURE_LINE_INFO OFF CACHE BOOL "Enable line info?")
set(FEATURE_LOGGING OFF CACHE BOOL "Enable logging?")
set(FEATURE_MEM_STATS OFF CACHE BOOL "Enable memory statistics?")
set(FEATURE_MEM_STRESS_TEST OFF CACHE BOOL "Enable mem-stress test?")
set(FEATURE_PARSER_DUMP OFF CACHE BOOL "Enable parser byte-code dumps?")
set(FEATURE_PROFILE "es5.1" CACHE STRING "Use default or other profile?")
set(FEATURE_REGEXP_STRICT_MODE OFF CACHE BOOL "Enable regexp strict mode?")
set(FEATURE_REGEXP_DUMP OFF CACHE BOOL "Enable regexp byte-code dumps?")
set(FEATURE_SNAPSHOT_EXEC OFF CACHE BOOL "Enable executing snapshot files?")
set(FEATURE_SNAPSHOT_SAVE OFF CACHE BOOL "Enable saving snapshot files?")
set(FEATURE_SYSTEM_ALLOCATOR OFF CACHE BOOL "Enable system allocator?")
set(FEATURE_VALGRIND OFF CACHE BOOL "Enable Valgrind support?")
set(FEATURE_VM_EXEC_STOP OFF CACHE BOOL "Enable VM execution stopping?")
set(MEM_HEAP_SIZE_KB "512" CACHE STRING "Size of memory heap, in kilobytes")
set(REGEXP_RECURSION_LIMIT "0" CACHE STRING "Limit of regexp recursion depth")
set(VM_RECURSION_LIMIT "0" CACHE STRING "Limit of VM recursion depth")
set(FEATURE_CPOINTER_32_BIT OFF CACHE BOOL "Enable 32 bit compressed pointers?")
set(FEATURE_DEBUGGER OFF CACHE BOOL "Enable JerryScript debugger?")
set(FEATURE_ERROR_MESSAGES OFF CACHE BOOL "Enable error messages?")
set(FEATURE_EXTERNAL_CONTEXT OFF CACHE BOOL "Enable external context?")
set(FEATURE_JS_PARSER ON CACHE BOOL "Enable js-parser?")
set(FEATURE_LINE_INFO OFF CACHE BOOL "Enable line info?")
set(FEATURE_LOGGING OFF CACHE BOOL "Enable logging?")
set(FEATURE_MEM_STATS OFF CACHE BOOL "Enable memory statistics?")
set(FEATURE_MEM_STRESS_TEST OFF CACHE BOOL "Enable mem-stress test?")
set(FEATURE_PARSER_DUMP OFF CACHE BOOL "Enable parser byte-code dumps?")
set(FEATURE_PROFILE "es5.1" CACHE STRING "Use default or other profile?")
set(FEATURE_REGEXP_STRICT_MODE OFF CACHE BOOL "Enable regexp strict mode?")
set(FEATURE_REGEXP_DUMP OFF CACHE BOOL "Enable regexp byte-code dumps?")
set(FEATURE_SNAPSHOT_EXEC OFF CACHE BOOL "Enable executing snapshot files?")
set(FEATURE_SNAPSHOT_SAVE OFF CACHE BOOL "Enable saving snapshot files?")
set(FEATURE_SYSTEM_ALLOCATOR OFF CACHE BOOL "Enable system allocator?")
set(FEATURE_VALGRIND OFF CACHE BOOL "Enable Valgrind support?")
set(FEATURE_VM_EXEC_STOP OFF CACHE BOOL "Enable VM execution stopping?")
set(JERRY_GLOBAL_HEAP_SIZE "512" CACHE STRING "Size of memory heap, in kilobytes")
set(JERRY_REGEXP_RECURSION_LIMIT "0" CACHE STRING "Limit of regexp recursion depth")
set(JERRY_VM_RECURSION_LIMIT "0" CACHE STRING "Limit of VM recursion depth")
# Option overrides
if(USING_MSVC)
@ -55,7 +55,7 @@ if(FEATURE_SYSTEM_ALLOCATOR)
set(FEATURE_CPOINTER_32_BIT_MESSAGE " (FORCED BY SYSTEM ALLOCATOR)")
endif()
if (MEM_HEAP_SIZE_KB GREATER 512)
if (JERRY_GLOBAL_HEAP_SIZE GREATER 512)
set(FEATURE_CPOINTER_32_BIT ON)
set(FEATURE_CPOINTER_32_BIT_MESSAGE " (FORCED BY HEAP SIZE)")
@ -82,28 +82,28 @@ if(FEATURE_MEM_STATS OR FEATURE_PARSER_DUMP OR FEATURE_REGEXP_DUMP)
endif()
# Status messages
message(STATUS "ENABLE_ALL_IN_ONE " ${ENABLE_ALL_IN_ONE} ${ENABLE_ALL_IN_ONE_MESSAGE})
message(STATUS "FEATURE_CPOINTER_32_BIT " ${FEATURE_CPOINTER_32_BIT} ${FEATURE_CPOINTER_32_BIT_MESSAGE})
message(STATUS "FEATURE_DEBUGGER " ${FEATURE_DEBUGGER})
message(STATUS "FEATURE_ERROR_MESSAGES " ${FEATURE_ERROR_MESSAGES})
message(STATUS "FEATURE_EXTERNAL_CONTEXT " ${FEATURE_EXTERNAL_CONTEXT})
message(STATUS "FEATURE_JS_PARSER " ${FEATURE_JS_PARSER})
message(STATUS "FEATURE_LINE_INFO " ${FEATURE_LINE_INFO})
message(STATUS "FEATURE_LOGGING " ${FEATURE_LOGGING} ${FEATURE_LOGGING_MESSAGE})
message(STATUS "FEATURE_MEM_STATS " ${FEATURE_MEM_STATS})
message(STATUS "FEATURE_MEM_STRESS_TEST " ${FEATURE_MEM_STRESS_TEST})
message(STATUS "FEATURE_PARSER_DUMP " ${FEATURE_PARSER_DUMP} ${FEATURE_PARSER_DUMP_MESSAGE})
message(STATUS "FEATURE_PROFILE " ${FEATURE_PROFILE})
message(STATUS "FEATURE_REGEXP_STRICT_MODE " ${FEATURE_REGEXP_STRICT_MODE})
message(STATUS "FEATURE_REGEXP_DUMP " ${FEATURE_REGEXP_DUMP})
message(STATUS "FEATURE_SNAPSHOT_EXEC " ${FEATURE_SNAPSHOT_EXEC} ${FEATURE_SNAPSHOT_EXEC_MESSAGE})
message(STATUS "FEATURE_SNAPSHOT_SAVE " ${FEATURE_SNAPSHOT_SAVE} ${FEATURE_SNAPSHOT_SAVE_MESSAGE})
message(STATUS "FEATURE_SYSTEM_ALLOCATOR " ${FEATURE_SYSTEM_ALLOCATOR})
message(STATUS "FEATURE_VALGRIND " ${FEATURE_VALGRIND})
message(STATUS "FEATURE_VM_EXEC_STOP " ${FEATURE_VM_EXEC_STOP})
message(STATUS "MEM_HEAP_SIZE_KB " ${MEM_HEAP_SIZE_KB})
message(STATUS "REGEXP_RECURSION_LIMIT " ${REGEXP_RECURSION_LIMIT})
message(STATUS "VM_RECURSION_LIMIT " ${VM_RECURSION_LIMIT})
message(STATUS "ENABLE_ALL_IN_ONE " ${ENABLE_ALL_IN_ONE} ${ENABLE_ALL_IN_ONE_MESSAGE})
message(STATUS "FEATURE_CPOINTER_32_BIT " ${FEATURE_CPOINTER_32_BIT} ${FEATURE_CPOINTER_32_BIT_MESSAGE})
message(STATUS "FEATURE_DEBUGGER " ${FEATURE_DEBUGGER})
message(STATUS "FEATURE_ERROR_MESSAGES " ${FEATURE_ERROR_MESSAGES})
message(STATUS "FEATURE_EXTERNAL_CONTEXT " ${FEATURE_EXTERNAL_CONTEXT})
message(STATUS "FEATURE_JS_PARSER " ${FEATURE_JS_PARSER})
message(STATUS "FEATURE_LINE_INFO " ${FEATURE_LINE_INFO})
message(STATUS "FEATURE_LOGGING " ${FEATURE_LOGGING} ${FEATURE_LOGGING_MESSAGE})
message(STATUS "FEATURE_MEM_STATS " ${FEATURE_MEM_STATS})
message(STATUS "FEATURE_MEM_STRESS_TEST " ${FEATURE_MEM_STRESS_TEST})
message(STATUS "FEATURE_PARSER_DUMP " ${FEATURE_PARSER_DUMP} ${FEATURE_PARSER_DUMP_MESSAGE})
message(STATUS "FEATURE_PROFILE " ${FEATURE_PROFILE})
message(STATUS "FEATURE_REGEXP_STRICT_MODE " ${FEATURE_REGEXP_STRICT_MODE})
message(STATUS "FEATURE_REGEXP_DUMP " ${FEATURE_REGEXP_DUMP})
message(STATUS "FEATURE_SNAPSHOT_EXEC " ${FEATURE_SNAPSHOT_EXEC} ${FEATURE_SNAPSHOT_EXEC_MESSAGE})
message(STATUS "FEATURE_SNAPSHOT_SAVE " ${FEATURE_SNAPSHOT_SAVE} ${FEATURE_SNAPSHOT_SAVE_MESSAGE})
message(STATUS "FEATURE_SYSTEM_ALLOCATOR " ${FEATURE_SYSTEM_ALLOCATOR})
message(STATUS "FEATURE_VALGRIND " ${FEATURE_VALGRIND})
message(STATUS "FEATURE_VM_EXEC_STOP " ${FEATURE_VM_EXEC_STOP})
message(STATUS "JERRY_GLOBAL_HEAP_SIZE " ${JERRY_GLOBAL_HEAP_SIZE})
message(STATUS "JERRY_REGEXP_RECURSION_LIMIT " ${JERRY_REGEXP_RECURSION_LIMIT})
message(STATUS "JERRY_VM_RECURSION_LIMIT " ${JERRY_VM_RECURSION_LIMIT})
# Include directories
set(INCLUDE_CORE_PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
@ -214,44 +214,44 @@ set(INCLUDE_THIRD_PARTY_VALGRIND "${CMAKE_SOURCE_DIR}/third-party/valgrind")
set(DEFINES_JERRY ${DEFINES_JERRY} $<$<NOT:$<CONFIG:Debug>>:JERRY_NDEBUG>)
# Jerry heap-section
if(DEFINED JERRY_HEAP_SECTION_ATTR)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_HEAP_SECTION_ATTR=${JERRY_HEAP_SECTION_ATTR})
if(DEFINED JERRY_ATTR_GLOBAL_HEAP)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ATTR_GLOBAL_HEAP=${JERRY_ATTR_GLOBAL_HEAP})
endif()
# Checks the optional features
# Enable 32 bit cpointers
if(FEATURE_CPOINTER_32_BIT)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_CPOINTER_32_BIT)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_CPOINTER_32_BIT=1)
endif()
# Fill error messages for builtin error objects
if(FEATURE_ERROR_MESSAGES)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_ERROR_MESSAGES)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ERROR_MESSAGES=1)
endif()
# Use external context instead of static one
if(FEATURE_EXTERNAL_CONTEXT)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_EXTERNAL_CONTEXT)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_EXTERNAL_CONTEXT=1)
endif()
# JS-Parser
if(NOT FEATURE_JS_PARSER)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_DISABLE_JS_PARSER)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_PARSER=0)
endif()
# JS line info
if(FEATURE_LINE_INFO)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_LINE_INFO)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_LINE_INFO=1)
endif()
# Logging
if(FEATURE_LOGGING)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_LOGGING)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_LOGGING=1)
endif()
# Memory statistics
if(FEATURE_MEM_STATS)
set(DEFINES_JERRY ${DEFINES_JERRY} JMEM_STATS)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_MEM_STATS=1)
endif()
# Enable debugger
@ -261,12 +261,12 @@ endif()
# Memory management stress-test mode
if(FEATURE_MEM_STRESS_TEST)
set(DEFINES_JERRY ${DEFINES_JERRY} JMEM_GC_BEFORE_EACH_ALLOC)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_MEM_GC_BEFORE_EACH_ALLOC=1)
endif()
# Parser byte-code dumps
if(FEATURE_PARSER_DUMP)
set(DEFINES_JERRY ${DEFINES_JERRY} PARSER_DUMP_BYTE_CODE)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_PARSER_DUMP_BYTE_CODE=1)
endif()
# Profile
@ -289,49 +289,48 @@ if(FEATURE_REGEXP_STRICT_MODE)
endif()
# RegExp recursion depth limit
if(REGEXP_RECURSION_LIMIT)
set(DEFINES_JERRY ${DEFINES_JERRY} REGEXP_RECURSION_LIMIT=${REGEXP_RECURSION_LIMIT})
if(JERRY_REGEXP_RECURSION_LIMIT)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_REGEXP_RECURSION_LIMIT=${JERRY_REGEXP_RECURSION_LIMIT})
endif()
# VM recursion depth limit
if(VM_RECURSION_LIMIT)
set(DEFINES_JERRY ${DEFINES_JERRY} VM_RECURSION_LIMIT=${VM_RECURSION_LIMIT})
if(JERRY_VM_RECURSION_LIMIT)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_VM_RECURSION_LIMIT=${JERRY_VM_RECURSION_LIMIT})
endif()
# RegExp byte-code dumps
if(FEATURE_REGEXP_DUMP)
set(DEFINES_JERRY ${DEFINES_JERRY} REGEXP_DUMP_BYTE_CODE)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_REGEXP_DUMP_BYTE_CODE=1)
endif()
# Snapshot exec
if(FEATURE_SNAPSHOT_EXEC)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_SNAPSHOT_EXEC)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_SNAPSHOT_EXEC=1)
endif()
# Snapshot save
if(FEATURE_SNAPSHOT_SAVE)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_SNAPSHOT_SAVE)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_SNAPSHOT_SAVE=1)
endif()
# Enable system allocator
if(FEATURE_SYSTEM_ALLOCATOR)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_SYSTEM_ALLOCATOR)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_SYSTEM_ALLOCATOR=1)
endif()
# Valgrind
if(FEATURE_VALGRIND)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_VALGRIND)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_VALGRIND=1)
set(INCLUDE_CORE_PRIVATE ${INCLUDE_CORE_PRIVATE} ${INCLUDE_THIRD_PARTY_VALGRIND})
endif()
# Enable VM execution stopping
if (FEATURE_VM_EXEC_STOP)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_VM_EXEC_STOP)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_VM_EXEC_STOP=1)
endif()
# Size of heap
math(EXPR MEM_HEAP_AREA_SIZE "${MEM_HEAP_SIZE_KB} * 1024")
set(DEFINES_JERRY ${DEFINES_JERRY} CONFIG_MEM_HEAP_AREA_SIZE=${MEM_HEAP_AREA_SIZE})
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_GLOBAL_HEAP_SIZE=${JERRY_GLOBAL_HEAP_SIZE})
add_library(${JERRY_CORE_NAME} ${SOURCE_CORE_FILES})

View File

@ -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 */

View File

@ -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 */
/**

View File

@ -16,12 +16,19 @@
#ifndef CONFIG_H
#define CONFIG_H
/**
* Built-in configurations
*
* Allowed values for built-in defines:
* 0: Disable the given built-in.
* 1: Enable the given built-in.
*/
/*
* By default all built-ins are enabled if they are not defined.
*/
#ifndef JERRY_BUILTINS
# define JERRY_BUILTINS 1
#endif
#endif /* !defined (JERRY_BUILTINS) */
#ifndef JERRY_BUILTIN_ANNEXB
# define JERRY_BUILTIN_ANNEXB JERRY_BUILTINS
@ -64,11 +71,11 @@
#endif /* !defined (JERRY_BUILTIN_STRING) */
/**
* ES2015 related features, by default all of them are enabled.
* ES2015 (a.k.a es6) related features, by default all of them are enabled.
*/
#ifndef JERRY_ES2015
# define JERRY_ES2015 1
#endif
#endif /* !defined (JERRY_ES2015) */
#ifndef JERRY_ES2015_BUILTIN
# define JERRY_ES2015_BUILTIN JERRY_ES2015
@ -135,38 +142,124 @@
#endif /* !defined (JERRY_ES2015_TEMPLATE_STRINGS) */
/**
* Enables/disables the RegExp strict mode
* Engine internal and misc configurations.
*/
/**
* Specifies the compressed pointer representation
*
* Allowed values:
* 0: use 16 bit representation
* 1: use 32 bit representation
*
* Default value: 0
* For more details see: jmem/jmem.h
*/
#ifndef JERRY_CPOINTER_32_BIT
# define JERRY_CPOINTER_32_BIT 0
#endif /* !defined (JERRY_CPOINTER_32_BIT) */
/**
* Enable/Disable built-in error messages for error objects.
*
* Allowed values:
* 0: Disable error messages.
* 1: Enable error message.
*
* Default value: 0
*/
#ifndef JERRY_REGEXP_STRICT_MODE
# define JERRY_REGEXP_STRICT_MODE 0
#endif
#ifndef JERRY_ERROR_MESSAGES
# define JERRY_ERROR_MESSAGES 0
#endif /* !defined (JERRY_ERROR_MESSAGES) */
/**
* Enables/disables the unicode case conversion in the engine.
* By default Unicode case conversion is enabled.
* Enable/Disable external context.
*
* Allowed values:
* 0: Disable external context.
* 1: Enable external context support.
*
* Default value: 0
*/
#ifndef JERRY_UNICODE_CASE_CONVERSION
# define JERRY_UNICODE_CASE_CONVERSION 1
#endif /* !defined (JERRY_UNICODE_CASE_CONVERSION) */
#ifndef JERRY_EXTERNAL_CONTEXT
# define JERRY_EXTERNAL_CONTEXT 0
#endif /* !defined (JERRY_EXTERNAL_CONTEXT) */
/**
* Size of heap
* Maximum size of heap in kilobytes
*
* Default value: 512 KiB
*/
#ifndef CONFIG_MEM_HEAP_AREA_SIZE
# define CONFIG_MEM_HEAP_AREA_SIZE (512 * 1024)
#endif /* !CONFIG_MEM_HEAP_AREA_SIZE */
#ifndef JERRY_GLOBAL_HEAP_SIZE
# define JERRY_GLOBAL_HEAP_SIZE (512)
#endif /* !defined (JERRY_GLOBAL_HEAP_SIZE) */
/**
* Max heap usage limit
* Enable/Disable property lookup cache.
*
* Allowed values:
* 0: Disable lookup cache.
* 1: Enable lookup cache.
*
* Default value: 1
*/
#define CONFIG_MEM_HEAP_MAX_LIMIT 8192
#ifndef JERRY_LCACHE
# define JERRY_LCACHE 1
#endif /* !defined (JERRY_LCACHE) */
/**
* Desired limit of heap usage
* Enable/Disable line-info management inside the engine.
*
* Allowed values:
* 0: Disable line-info in the engine.
* 1: Enable line-info management.
*
* Default value: 0
*/
#define CONFIG_MEM_HEAP_DESIRED_LIMIT (JERRY_MIN (CONFIG_MEM_HEAP_AREA_SIZE / 32, CONFIG_MEM_HEAP_MAX_LIMIT))
#ifndef JERRY_LINE_INFO
# define JERRY_LINE_INFO 0
#endif /* !defined (JERRY_LINE_INFO) */
/**
* Enable/Disable logging inside the engine.
*
* Allowed values:
* 0: Disable internal logging.
* 1: Enable internal logging.
*
* Default value: 0
*/
#ifndef JERRY_LOGGING
# define JERRY_LOGGING 0
#endif /* !defined (JERRY_LOGGING) */
/**
* Enable/Disable gc call before every allocation.
*
* Allowed values:
* 0: Disable gc call before each allocation.
* 1: Enable and force gc call before each allocation.
*
* Default value: 0
* Warning!: This is an advanced option and will slow down the engine!
* Only enable it for debugging purposes.
*/
#ifndef JERRY_MEM_GC_BEFORE_EACH_ALLOC
# define JERRY_MEM_GC_BEFORE_EACH_ALLOC 0
#endif /* !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) */
/**
* Enable/Disable the collection if run-time memory statistics.
*
* Allowed values:
* 0: Disable run-time memory information collection.
* 1: Enable run-time memory statistics collection.
*
* Default value: 0
*/
#ifndef JERRY_MEM_STATS
# define JERRY_MEM_STATS 0
#endif /* !defined (JERRY_MEM_STATS) */
/**
* Use 32-bit/64-bit float for ecma-numbers
@ -180,26 +273,204 @@
*/
#ifndef JERRY_NUMBER_TYPE_FLOAT64
# define JERRY_NUMBER_TYPE_FLOAT64 1
#endif
#endif /* !defined (JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Disable ECMA lookup cache
*/
// #define CONFIG_ECMA_LCACHE_DISABLE
/**
* Disable ECMA property hashmap
*/
// #define CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
/**
* Share of newly allocated since last GC objects among all currently allocated objects,
* after achieving which, GC is started upon low severity try-give-memory-back requests.
* Enable/Disable the JavaScript parser.
*
* Share is calculated as the following:
* 1.0 / CONFIG_ECMA_GC_NEW_OBJECTS_SHARE_TO_START_GC
* Allowed values:
* 0: Disable the JavaScript parser and all related functionallity.
* 1: Enable the JavaScript parser.
*
* Default value: 1
*/
#define CONFIG_ECMA_GC_NEW_OBJECTS_SHARE_TO_START_GC (16)
#ifndef JERRY_PARSER
# define JERRY_PARSER 1
#endif /* !defined (JERRY_PARSER) */
/**
* Enable/Disable JerryScript byte code dump functions during parsing.
* To dump the JerryScript byte code the engine must be initialized with opcodes
* display flag. This option does not influence RegExp byte code dumps.
*
* Allowed values:
* 0: Disable all bytecode dump functions.
* 1: Enable bytecode dump functions.
*
* Default value: 0
*/
#ifndef JERRY_PARSER_DUMP_BYTE_CODE
# define JERRY_PARSER_DUMP_BYTE_CODE 0
#endif /* defined (JERRY_PARSER_DUMP_BYTE_CODE) */
/**
* Enable/Disable ECMA property hashmap.
*
* Allowed values:
* 0: Disable property hasmap.
* 1: Enable property hashmap.
*
* Default value: 1
*/
#ifndef JERRY_PROPRETY_HASHMAP
# define JERRY_PROPRETY_HASHMAP 1
#endif /* !defined (JERRY_PROPRETY_HASHMAP) */
/**
* Enable/Disable byte code dump functions for RegExp objects.
* To dump the RegExp byte code the engine must be initialized with
* regexp opcodes display flag. This option does not influence the
* JerryScript byte code dumps.
*
* Allowed values:
* 0: Disable all bytecode dump functions.
* 1: Enable bytecode dump functions.
*
* Default value: 0
*/
#ifndef JERRY_REGEXP_DUMP_BYTE_CODE
# define JERRY_REGEXP_DUMP_BYTE_CODE 0
#endif /* !defined (JERRY_REGEXP_DUMP_BYTE_CODE) */
/**
* Enables/disables the RegExp strict mode
*
* Default value: 0
*/
#ifndef JERRY_REGEXP_STRICT_MODE
# define JERRY_REGEXP_STRICT_MODE 0
#endif /* !defined (JERRY_REGEXP_STRICT_MODE) */
/**
* Set the RegExp parser and execution recursion limit.
*
* Allowed values:
* 0: Disable recursion limit check.
* 1 or greater: Set the recursion limit to the given number.
*
* Note:
* A negative value will cause a static assert compiler error.
*
* Default value: 0
*/
#ifndef JERRY_REGEXP_RECURSION_LIMIT
# define JERRY_REGEXP_RECURSION_LIMIT 0
#endif /* !defined (JERRY_REGEXP_RECURSION_LIMIT) */
/**
* Enable/Disable the snapshot execution functions.
*
* Allowed values:
* 0: Disable snapshot execution.
* 1: Enable snapshot execution.
*
* Default value: 0
*/
#ifndef JERRY_SNAPSHOT_EXEC
# define JERRY_SNAPSHOT_EXEC 0
#endif /* !defined (JERRY_SNAPSHOT_EXEC) */
/**
* Enable/Disable the snapshot save functions.
*
* Allowed values:
* 0: Disable snapshot save functions.
* 1: Enable snapshot save functions.
*/
#ifndef JERRY_SNAPSHOT_SAVE
# define JERRY_SNAPSHOT_SAVE 0
#endif /* !defined (JERRY_SNAPSHOT_SAVE) */
/**
* Enable/Disable usage of system allocator.
*
* Allowed values:
* 0: Disable usage of system allocator.
* 1: Enable usage of system allocator.
*
* Default value: 0
*/
#ifndef JERRY_SYSTEM_ALLOCATOR
# define JERRY_SYSTEM_ALLOCATOR 0
#endif /* !defined (JERRY_SYSTEM_ALLOCATOR) */
/**
* Enables/disables the unicode case conversion in the engine.
* By default Unicode case conversion is enabled.
*/
#ifndef JERRY_UNICODE_CASE_CONVERSION
# define JERRY_UNICODE_CASE_CONVERSION 1
#endif /* !defined (JERRY_UNICODE_CASE_CONVERSION) */
/**
* Configures if the internal memory allocations are exposed to Valgrind or not.
*
* Allowed values:
* 0: Disable the Valgrind specific memory allocation notifications.
* 1: Enable the Valgrind specific allocation notifications.
*/
#ifndef JERRY_VALGRIND
# define JERRY_VALGRIND 0
#endif /* !defined (JERRY_VALGRIND) */
/**
* Enable/Disable the vm execution stop callback function.
*
* Allowed values:
* 0: Disable vm exec stop callbacks.
* 1: Enable vm exec stop callback functionality.
*/
#ifndef JERRY_VM_EXEC_STOP
# define JERRY_VM_EXEC_STOP 0
#endif /* !defined (JERRY_VM_EXEC_STOP) */
/**
* Set the VM execution recursion limit.
*
* Allowed values:
* 0: Disable recursion limit check.
* 1 or greater: Set the recursion limit to the given number.
*
* Note:
* A negative value will cause a static assert compiler error.
*
* Default value: 0
*/
#ifndef JERRY_VM_RECURSION_LIMIT
# define JERRY_VM_RECURSION_LIMIT 0
#endif /* !defined (JERRY_VM_RECURSION_LIMIT) */
/**
* Advanced section configurations.
*/
/**
* Allow configuring attributes on a few constant data inside the engine.
*
* One of the main usages:
* Normally compilers store const(ant)s in ROM. Thus saving RAM.
* But if your compiler does not support it then the directive below can force it.
*
* For the moment it is mainly meant for the following targets:
* - ESP8266
*
* Example configuration for moving (some) constatns into a given section:
* # define JERRY_ATTR_CONST_DATA __attribute__((section(".rodata.const")))
*/
#ifndef JERRY_ATTR_CONST_DATA
# define JERRY_ATTR_CONST_DATA
#endif /* !defined (JERRY_ATTR_CONST_DATA) */
/**
* The JERRY_ATTR_GLOBAL_HEAP allows adding extra attributes for the Jerry global heap.
*
* Example on how to move the global heap into it's own section:
* #define JERRY_ATTR_GLOBAL_HEAP __attribute__((section(".text.globalheap")))
*/
#ifndef JERRY_ATTR_GLOBAL_HEAP
# define JERRY_ATTR_GLOBAL_HEAP
#endif /* !defined (JERRY_ATTR_GLOBAL_HEAP) */
/**
@ -330,14 +601,90 @@
/**
* Internal options.
*/
#if !defined (JERRY_UNICODE_CASE_CONVERSION) \
|| ((JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1))
# error "Invalid value for JERRY_UNICODE_CASE_CONVERSION macro."
#if !defined (JERRY_CPOINTER_32_BIT) \
|| ((JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1))
# error "Invalid value for 'JERRY_CPOINTER_32_BIT' macro."
#endif
#if !defined (JERRY_ERROR_MESSAGES) \
|| ((JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1))
# error "Invalid value for 'JERRY_ERROR_MESSAGES' macro."
#endif
#if !defined (JERRY_EXTERNAL_CONTEXT) \
|| ((JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1))
# error "Invalid value for 'JERRY_EXTERNAL_CONTEXT' macro."
#endif
#if !defined (JERRY_GLOBAL_HEAP_SIZE) || (JERRY_GLOBAL_HEAP_SIZE <= 0)
# error "Invalid value for 'JERRY_GLOBAL_HEAP_SIZE' macro."
#endif
#if !defined (JERRY_LCACHE) \
|| ((JERRY_LCACHE != 0) && (JERRY_LCACHE != 1))
# error "Invalid value for 'JERRY_LCACHE' macro."
#endif
#if !defined (JERRY_LINE_INFO) \
|| ((JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1))
# error "Invalid value for 'JERRY_LINE_INFO' macro."
#endif
#if !defined (JERRY_LOGGING) \
|| ((JERRY_LOGGING != 0) && (JERRY_LOGGING != 1))
# error "Invalid value for 'JERRY_LOGGING' macro."
#endif
#if !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) \
|| ((JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1))
# error "Invalid value for 'JERRY_MEM_GC_BEFORE_EACH_ALLOC' macro."
#endif
#if !defined (JERRY_MEM_STATS) \
|| ((JERRY_MEM_STATS != 0) && (JERRY_MEM_STATS != 1))
# error "Invalid value for 'JERRY_MEM_STATS' macro."
#endif
#if !defined (JERRY_NUMBER_TYPE_FLOAT64) \
|| ((JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1))
# error "Invalid value for JERRY_NUMBER_TYPE_FLOAT64 macro."
# error "Invalid value for 'JERRY_NUMBER_TYPE_FLOAT64' macro."
#endif
#if !defined (JERRY_PARSER) \
|| ((JERRY_PARSER != 0) && (JERRY_PARSER != 1))
# error "Invalid value for 'JERRY_PARSER' macro."
#endif
#if !defined (JERRY_PARSER_DUMP_BYTE_CODE) \
|| ((JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1))
# error "Invalid value for 'JERRY_PARSER_DUMP_BYTE_CODE' macro."
#endif
#if !defined (JERRY_PROPRETY_HASHMAP) \
|| ((JERRY_PROPRETY_HASHMAP != 0) && (JERRY_PROPRETY_HASHMAP != 1))
# error "Invalid value for 'JERRY_PROPRETY_HASHMAP' macro."
#endif
#if !defined (JERRY_REGEXP_DUMP_BYTE_CODE) \
|| ((JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1))
# error "Invalid value for 'JERRY_REGEXP_DUMP_BYTE_CODE' macro."
#endif
#if !defined (JERRY_REGEXP_STRICT_MODE) \
|| ((JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1))
# error "Invalid value for 'JERRY_REGEXP_STRICT_MODE' macro."
#endif
#if !defined (JERRY_SNAPSHOT_EXEC) \
|| ((JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1))
# error "Invalid value for 'JERRY_SNAPSHOT_EXEC' macro."
#endif
#if !defined (JERRY_SNAPSHOT_SAVE) \
|| ((JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1))
# error "Invalid value for 'JERRY_SNAPSHOT_SAVE' macro."
#endif
#if !defined (JERRY_SYSTEM_ALLOCATOR) \
|| ((JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1))
# error "Invalid value for 'JERRY_SYSTEM_ALLOCATOR' macro."
#endif
#if !defined (JERRY_UNICODE_CASE_CONVERSION) \
|| ((JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1))
# error "Invalid value for 'JERRY_UNICODE_CASE_CONVERSION' macro."
#endif
#if !defined (JERRY_VALGRIND) \
|| ((JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1))
# error "Invalid value for 'JERRY_VALGRIND' macro."
#endif
#if !defined (JERRY_VM_EXEC_STOP) \
|| ((JERRY_VM_EXEC_STOP != 0) && (JERRY_VM_EXEC_STOP != 1))
# error "Invalid value for 'JERRY_VM_EXEC_STOP' macro."
#endif
#define ENABLED(FEATURE) ((FEATURE) == 1)
#define DISABLED(FEATURE) ((FEATURE) != 1)

View File

@ -758,9 +758,9 @@ jerry_debugger_process_message (const uint8_t *recv_buffer_p, /**< pointer to th
JERRY_CONTEXT (debugger_byte_code_free_tail) = ECMA_NULL_POINTER;
}
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_free_byte_code_bytes (((size_t) byte_code_free_p->size) << JMEM_ALIGNMENT_LOG);
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
jmem_heap_free_block (byte_code_free_p,
((size_t) byte_code_free_p->size) << JMEM_ALIGNMENT_LOG);
@ -1375,7 +1375,7 @@ jerry_debugger_send_memstats (void)
memstats_p->type = JERRY_DEBUGGER_MEMSTATS_RECEIVE;
#ifdef JMEM_STATS /* if jmem_stats are defined */
#if ENABLED (JERRY_MEM_STATS) /* if memory statistics feature is enabled */
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
uint32_t allocated_bytes = (uint32_t) heap_stats->allocated_bytes;
@ -1388,13 +1388,13 @@ jerry_debugger_send_memstats (void)
memcpy (memstats_p->object_bytes, &object_bytes, sizeof (uint32_t));
uint32_t property_bytes = (uint32_t) heap_stats->property_bytes;
memcpy (memstats_p->property_bytes, &property_bytes, sizeof (uint32_t));
#else /* if not, just put zeros */
#else /* !ENABLED (JERRY_MEM_STATS) if not, just put zeros */
memset (memstats_p->allocated_bytes, 0, sizeof (uint32_t));
memset (memstats_p->byte_code_bytes, 0, sizeof (uint32_t));
memset (memstats_p->string_bytes, 0, sizeof (uint32_t));
memset (memstats_p->object_bytes, 0, sizeof (uint32_t));
memset (memstats_p->property_bytes, 0, sizeof (uint32_t));
#endif
#endif /* ENABLED (JERRY_MEM_STATS) */
jerry_debugger_send (sizeof (jerry_debugger_send_memstats_t));
} /* jerry_debugger_send_memstats */

View File

@ -77,9 +77,9 @@ ecma_dealloc_number (ecma_number_t *number_p) /**< number to be freed */
inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_object (void)
{
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_allocate_object_bytes (sizeof (ecma_object_t));
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
return (ecma_object_t *) jmem_pools_alloc (sizeof (ecma_object_t));
} /* ecma_alloc_object */
@ -90,9 +90,9 @@ ecma_alloc_object (void)
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */
{
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_free_object_bytes (sizeof (ecma_object_t));
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
jmem_pools_free (object_p, sizeof (ecma_object_t));
} /* ecma_dealloc_object */
@ -105,9 +105,9 @@ ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */
inline ecma_extended_object_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_extended_object (size_t size) /**< size of object */
{
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_allocate_object_bytes (size);
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
return jmem_heap_alloc_block (size);
} /* ecma_alloc_extended_object */
@ -119,9 +119,9 @@ inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */
size_t size) /**< size of object */
{
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_free_object_bytes (size);
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
jmem_heap_free_block (object_p, size);
} /* ecma_dealloc_extended_object */
@ -134,9 +134,9 @@ ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */
inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string (void)
{
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_allocate_string_bytes (sizeof (ecma_string_t));
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
return (ecma_string_t *) jmem_pools_alloc (sizeof (ecma_string_t));
} /* ecma_alloc_string */
@ -147,9 +147,9 @@ ecma_alloc_string (void)
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */
{
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_free_string_bytes (sizeof (ecma_string_t));
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
jmem_pools_free (string_p, sizeof (ecma_string_t));
} /* ecma_dealloc_string */
@ -162,9 +162,9 @@ ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */
inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string_buffer (size_t size) /**< size of string */
{
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_allocate_string_bytes (size);
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
return jmem_heap_alloc_block (size);
} /* ecma_alloc_string_buffer */
@ -176,9 +176,9 @@ inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
size_t size) /**< size of string */
{
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_free_string_bytes (size);
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
jmem_heap_free_block (string_p, size);
} /* ecma_dealloc_string_buffer */
@ -191,9 +191,9 @@ ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
inline ecma_property_pair_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_property_pair (void)
{
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_allocate_property_bytes (sizeof (ecma_property_pair_t));
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
return jmem_heap_alloc_block (sizeof (ecma_property_pair_t));
} /* ecma_alloc_property_pair */
@ -204,9 +204,9 @@ ecma_alloc_property_pair (void)
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p) /**< property pair to be freed */
{
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_free_property_bytes (sizeof (ecma_property_pair_t));
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
jmem_heap_free_block (property_pair_p, sizeof (ecma_property_pair_t));
} /* ecma_dealloc_property_pair */

View File

@ -687,7 +687,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
/* Function with byte-code (not a built-in function). */
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (ext_func_p->u.function.bytecode_cp != ECMA_NULL_POINTER)
{
ecma_bytecode_deref (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
@ -698,11 +698,11 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
{
ecma_dealloc_extended_object (object_p, sizeof (ecma_static_function_t));
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
ecma_bytecode_deref (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
ext_func_p->u.function.bytecode_cp));
ecma_dealloc_extended_object (object_p, sizeof (ecma_extended_object_t));
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
return;
}
@ -713,7 +713,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
ecma_free_value_if_not_object (arrow_func_p->this_binding);
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (arrow_func_p->bytecode_cp != ECMA_NULL_POINTER)
{
ecma_bytecode_deref (ECMA_GET_NON_NULL_POINTER (ecma_compiled_code_t,
@ -724,11 +724,11 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
{
ecma_dealloc_extended_object (object_p, sizeof (ecma_static_arrow_function_t));
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
ecma_bytecode_deref (ECMA_GET_NON_NULL_POINTER (ecma_compiled_code_t,
arrow_func_p->bytecode_cp));
ecma_dealloc_extended_object (object_p, sizeof (ecma_arrow_function_t));
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
return;
}
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
@ -993,13 +993,13 @@ ecma_free_unused_memory (jmem_free_unused_memory_severity_t severity) /**< sever
if (severity == JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW)
{
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
if (JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) > ECMA_PROP_HASHMAP_ALLOC_ON)
{
--JERRY_CONTEXT (ecma_prop_hashmap_alloc_state);
}
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_HIGH_SEV_GC;
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
/*
* If there is enough newly allocated objects since last GC, probably it is worthwhile to start GC now.
@ -1016,7 +1016,7 @@ ecma_free_unused_memory (jmem_free_unused_memory_severity_t severity) /**< sever
{
JERRY_ASSERT (severity == JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH);
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
if (JERRY_CONTEXT (status_flags) & ECMA_STATUS_HIGH_SEV_GC)
{
JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) = ECMA_PROP_HASHMAP_ALLOC_MAX;
@ -1026,7 +1026,7 @@ ecma_free_unused_memory (jmem_free_unused_memory_severity_t severity) /**< sever
++JERRY_CONTEXT (ecma_prop_hashmap_alloc_state);
JERRY_CONTEXT (status_flags) |= ECMA_STATUS_HIGH_SEV_GC;
}
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
/* Freeing as much memory as we currently can */
ecma_gc_run (severity);

View File

@ -58,9 +58,9 @@ typedef enum
{
ECMA_STATUS_API_AVAILABLE = (1u << 0), /**< api available */
ECMA_STATUS_DIRECT_EVAL = (1u << 1), /**< eval is called directly */
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
ECMA_STATUS_HIGH_SEV_GC = (1u << 2), /**< last gc run was a high severity run */
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
ECMA_STATUS_EXCEPTION = (1u << 3), /**< last exception is a normal exception */
} ecma_status_flag_t;
@ -476,16 +476,16 @@ typedef uint8_t ecma_property_t; /**< ecma_property_types_t (3 bit) and ecma_pro
*/
typedef struct
{
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
jmem_cpointer_t next_property_cp; /**< next cpointer */
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
ecma_property_t types[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< two property type slot. The first represent
* the type of this property (e.g. property pair) */
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
uint16_t padding; /**< an unused value */
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
jmem_cpointer_t next_property_cp; /**< next cpointer */
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
} ecma_property_header_t;
/**
@ -503,11 +503,11 @@ typedef struct
typedef union
{
ecma_value_t value; /**< value of a property */
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
jmem_cpointer_t getter_setter_pair_cp; /**< cpointer to getter setter pair */
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
ecma_getter_setter_pointers_t getter_setter_pair; /**< getter setter pair */
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
} ecma_property_value_t;
/**
@ -877,7 +877,7 @@ typedef struct
* If regexp, the other flags must be RE_FLAG... */
} ecma_compiled_code_t;
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
/**
* Description of static function objects.
@ -888,7 +888,7 @@ typedef struct
const ecma_compiled_code_t *bytecode_p; /**< real byte code pointer */
} ecma_static_function_t;
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
@ -903,7 +903,7 @@ typedef struct
jmem_cpointer_t bytecode_cp; /**< function byte code */
} ecma_arrow_function_t;
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
/**
* Description of static arrow function objects.
@ -914,7 +914,7 @@ typedef struct
const ecma_compiled_code_t *bytecode_p;
} ecma_static_arrow_function_t;
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */
@ -1233,11 +1233,11 @@ typedef enum
* Maximum value of the immediate part of a direct magic string.
* Must be compatible with the immediate property name.
*/
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
#define ECMA_DIRECT_STRING_MAX_IMM 0x07ffffff
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#define ECMA_DIRECT_STRING_MAX_IMM 0x0000ffff
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
/**
* Shift for direct string value part in ecma_value_t.
@ -1409,7 +1409,7 @@ typedef struct
ecma_value_t value; /**< referenced value */
} ecma_error_reference_t;
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
/**
* The lowest state of the ecma_prop_hashmap_alloc_state counter.
@ -1423,7 +1423,7 @@ typedef struct
*/
#define ECMA_PROP_HASHMAP_ALLOC_MAX 4
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
/**
* Number of values in a literal storage item
@ -1439,15 +1439,15 @@ typedef struct
jmem_cpointer_t values[ECMA_LIT_STORAGE_VALUE_COUNT]; /**< list of values */
} ecma_lit_storage_item_t;
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
/**
* Container of an LCache entry identifier
*/
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
typedef uint64_t ecma_lcache_hash_entry_id_t;
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
typedef uint32_t ecma_lcache_hash_entry_id_t;
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
/**
* Entry of LCache hash table
@ -1471,7 +1471,7 @@ typedef struct
*/
#define ECMA_LCACHE_HASH_ROW_LENGTH 2
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY)

View File

@ -564,16 +564,16 @@ ecma_create_named_accessor_property (ecma_object_t *object_p, /**< object */
uint8_t type_and_flags = ECMA_PROPERTY_TYPE_NAMEDACCESSOR | prop_attributes;
ecma_property_value_t value;
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));
ECMA_SET_POINTER (getter_setter_pair_p->getter_p, get_p);
ECMA_SET_POINTER (getter_setter_pair_p->setter_p, set_p);
ECMA_SET_POINTER (value.getter_setter_pair_cp, getter_setter_pair_p);
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
ECMA_SET_POINTER (value.getter_setter_pair.getter_p, get_p);
ECMA_SET_POINTER (value.getter_setter_pair.setter_p, set_p);
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
return ecma_create_property (object_p, name_p, type_and_flags, value, out_prop_p);
} /* ecma_create_named_accessor_property */
@ -593,17 +593,17 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
ecma_property_t *property_p = NULL;
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
property_p = ecma_lcache_lookup (obj_p, name_p);
if (property_p != NULL)
{
return property_p;
}
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
ecma_property_header_t *prop_iter_p = ecma_get_property_list (obj_p);
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
if (prop_iter_p != NULL && prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)
{
jmem_cpointer_t property_real_name_cp;
@ -611,17 +611,17 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
name_p,
&property_real_name_cp);
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
if (property_p != NULL
&& !ecma_is_property_lcached (property_p))
{
ecma_lcache_insert (obj_p, property_real_name_cp, property_p);
}
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
return property_p;
}
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
JERRY_ASSERT (ECMA_PROPERTY_PAIR_ITEM_COUNT == 2);
@ -709,13 +709,13 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
ecma_property_hashmap_create (obj_p);
}
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
if (property_p != NULL
&& !ecma_is_property_lcached (property_p))
{
ecma_lcache_insert (obj_p, property_name_cp, property_p);
}
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
return property_p;
} /* ecma_find_named_property */
@ -763,12 +763,12 @@ ecma_free_property (ecma_object_t *object_p, /**< object the property belongs to
}
case ECMA_PROPERTY_TYPE_NAMEDACCESSOR:
{
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_POINTER (ecma_getter_setter_pointers_t,
ECMA_PROPERTY_VALUE_PTR (property_p)->getter_setter_pair_cp);
jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
break;
}
default:
@ -782,12 +782,12 @@ ecma_free_property (ecma_object_t *object_p, /**< object the property belongs to
}
}
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
if (ecma_is_property_lcached (property_p))
{
ecma_lcache_invalidate (object_p, name_cp, property_p);
}
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
if (ECMA_PROPERTY_GET_NAME_TYPE (*property_p) == ECMA_DIRECT_STRING_PTR)
{
@ -1089,14 +1089,14 @@ ecma_named_data_property_assign_value (ecma_object_t *obj_p, /**< object */
ecma_object_t *
ecma_get_named_accessor_property_getter (const ecma_property_value_t *prop_value_p) /**< property value reference */
{
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_POINTER (ecma_getter_setter_pointers_t,
prop_value_p->getter_setter_pair_cp);
return ECMA_GET_POINTER (ecma_object_t, getter_setter_pair_p->getter_p);
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
return ECMA_GET_POINTER (ecma_object_t, prop_value_p->getter_setter_pair.getter_p);
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
} /* ecma_get_named_accessor_property_getter */
/**
@ -1107,14 +1107,14 @@ ecma_get_named_accessor_property_getter (const ecma_property_value_t *prop_value
ecma_object_t *
ecma_get_named_accessor_property_setter (const ecma_property_value_t *prop_value_p) /**< property value reference */
{
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_POINTER (ecma_getter_setter_pointers_t,
prop_value_p->getter_setter_pair_cp);
return ECMA_GET_POINTER (ecma_object_t, getter_setter_pair_p->setter_p);
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
return ECMA_GET_POINTER (ecma_object_t, prop_value_p->getter_setter_pair.setter_p);
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
} /* ecma_get_named_accessor_property_setter */
/**
@ -1127,14 +1127,14 @@ ecma_set_named_accessor_property_getter (ecma_object_t *object_p, /**< the prope
{
ecma_assert_object_contains_the_property (object_p, prop_value_p, ECMA_PROPERTY_TYPE_NAMEDACCESSOR);
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_POINTER (ecma_getter_setter_pointers_t,
prop_value_p->getter_setter_pair_cp);
ECMA_SET_POINTER (getter_setter_pair_p->getter_p, getter_p);
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_p, getter_p);
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
} /* ecma_set_named_accessor_property_getter */
/**
@ -1147,14 +1147,14 @@ ecma_set_named_accessor_property_setter (ecma_object_t *object_p, /**< the prope
{
ecma_assert_object_contains_the_property (object_p, prop_value_p, ECMA_PROPERTY_TYPE_NAMEDACCESSOR);
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_POINTER (ecma_getter_setter_pointers_t,
prop_value_p->getter_setter_pair_cp);
ECMA_SET_POINTER (getter_setter_pair_p->setter_p, setter_p);
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_p, setter_p);
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
} /* ecma_set_named_accessor_property_setter */
/**
@ -1263,7 +1263,7 @@ ecma_set_property_configurable_attr (ecma_property_t *property_p, /**< [in,out]
}
} /* ecma_set_property_configurable_attr */
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
/**
* Check whether the property is registered in LCache
@ -1301,7 +1301,7 @@ ecma_set_property_lcached (ecma_property_t *property_p, /**< property */
}
} /* ecma_set_property_lcached */
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
/**
* Construct empty property descriptor, i.e.:
@ -1582,9 +1582,9 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
}
#endif /* JERRY_DEBUGGER */
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_free_byte_code_bytes (((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
}
else
{

View File

@ -376,10 +376,10 @@ void ecma_set_property_enumerable_attr (ecma_property_t *property_p, bool is_enu
bool ecma_is_property_configurable (ecma_property_t property);
void ecma_set_property_configurable_attr (ecma_property_t *property_p, bool is_configurable);
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
bool ecma_is_property_lcached (ecma_property_t *property_p);
void ecma_set_property_lcached (ecma_property_t *property_p, bool is_lcached);
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
ecma_property_descriptor_t ecma_make_empty_property_descriptor (void);
void ecma_free_property_descriptor (ecma_property_descriptor_t *prop_desc_p);

View File

@ -39,14 +39,14 @@ ecma_init (void)
jmem_register_free_unused_memory_callback (ecma_free_unused_memory);
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) = ECMA_PROP_HASHMAP_ALLOC_ON;
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_HIGH_SEV_GC;
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#ifdef VM_RECURSION_LIMIT
JERRY_CONTEXT (vm_recursion_counter) = VM_RECURSION_LIMIT;
#endif /* VM_RECURSION_LIMIT */
#if defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0)
JERRY_CONTEXT (vm_recursion_counter) = JERRY_VM_RECURSION_LIMIT;
#endif /* defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0) */
#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE)
ecma_job_queue_init ();

View File

@ -26,7 +26,7 @@
* @{
*/
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
/**
* Mask for hash bits
@ -208,7 +208,7 @@ ecma_lcache_invalidate (ecma_object_t *object_p, /**< object */
}
} /* ecma_lcache_invalidate */
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
/**
* @}

View File

@ -23,13 +23,13 @@
* @{
*/
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
void ecma_lcache_insert (ecma_object_t *object_p, jmem_cpointer_t name_cp, ecma_property_t *prop_p);
ecma_property_t *ecma_lcache_lookup (ecma_object_t *object_p, const ecma_string_t *prop_name_p);
void ecma_lcache_invalidate (ecma_object_t *object_p, jmem_cpointer_t name_cp, ecma_property_t *prop_p);
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
/**
* @}

View File

@ -233,7 +233,7 @@ ecma_find_or_create_literal_number (ecma_number_t number_arg) /**< number to be
*/
#define JERRY_SNAPSHOT_LITERAL_IS_NUMBER (1u << ECMA_VALUE_SHIFT)
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
#if ENABLED (JERRY_SNAPSHOT_SAVE)
/**
* Append the value at the end of the appropriate list if it is not present there.
@ -463,9 +463,9 @@ ecma_save_literals_for_snapshot (ecma_collection_header_t *lit_pool_p, /**< list
return true;
} /* ecma_save_literals_for_snapshot */
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
#if defined JERRY_ENABLE_SNAPSHOT_EXEC || defined JERRY_ENABLE_SNAPSHOT_SAVE
#if ENABLED (JERRY_SNAPSHOT_EXEC) || ENABLED (JERRY_SNAPSHOT_SAVE)
/**
* Get the compressed pointer of a given literal.
@ -492,7 +492,7 @@ ecma_snapshot_get_literal (const uint8_t *literal_base_p, /**< literal start */
return ecma_find_or_create_literal_string (literal_p + sizeof (uint16_t), length);
} /* ecma_snapshot_get_literal */
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC || JERRY_ENABLE_SNAPSHOT_SAVE */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) || ENABLED (JERRY_SNAPSHOT_SAVE) */
/**
* @}

View File

@ -27,7 +27,7 @@
* @{
*/
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
#if ENABLED (JERRY_SNAPSHOT_SAVE)
/**
* Snapshot literal - offset map
*/
@ -36,26 +36,26 @@ typedef struct
ecma_value_t literal_id; /**< literal id */
ecma_value_t literal_offset; /**< literal offset */
} lit_mem_to_snapshot_id_map_entry_t;
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
void ecma_finalize_lit_storage (void);
ecma_value_t ecma_find_or_create_literal_string (const lit_utf8_byte_t *chars_p, lit_utf8_size_t size);
ecma_value_t ecma_find_or_create_literal_number (ecma_number_t number_arg);
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
#if ENABLED (JERRY_SNAPSHOT_SAVE)
void ecma_save_literals_append_value (ecma_value_t value, ecma_collection_header_t *lit_pool_p);
void ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_p,
ecma_collection_header_t *lit_pool_p);
bool ecma_save_literals_for_snapshot (ecma_collection_header_t *lit_pool_p, uint32_t *buffer_p, size_t buffer_size,
size_t *in_out_buffer_offset_p, lit_mem_to_snapshot_id_map_entry_t **out_map_p,
uint32_t *out_map_len_p);
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
#if defined JERRY_ENABLE_SNAPSHOT_EXEC || defined JERRY_ENABLE_SNAPSHOT_SAVE
#if ENABLED (JERRY_SNAPSHOT_EXEC) || ENABLED (JERRY_SNAPSHOT_SAVE)
ecma_value_t
ecma_snapshot_get_literal (const uint8_t *literal_base_p, ecma_value_t literal_value);
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC || JERRY_ENABLE_SNAPSHOT_SAVE */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) || ENABLED (JERRY_SNAPSHOT_SAVE) */
/**
* @}

View File

@ -26,7 +26,7 @@
* @{
*/
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
/**
* Compute the total size of the property hashmap.
@ -42,7 +42,7 @@
/**
* Stepping values for searching items in the hashmap.
*/
static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS] JERRY_CONST_DATA =
static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS] JERRY_ATTR_CONST_DATA =
{
3, 5, 7, 11, 13, 17, 19, 23
};
@ -65,7 +65,7 @@ static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF
#define ECMA_PROPERTY_HASHMAP_SET_BIT(byte_p, index) \
((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] | (1 << ((index) & 0x7))))
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
/**
* Create a new property hashmap for the object.
@ -74,7 +74,7 @@ static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF
void
ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
{
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
if (JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) != ECMA_PROP_HASHMAP_ALLOC_ON)
{
return;
@ -214,9 +214,9 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
prop_iter_p = ECMA_GET_POINTER (ecma_property_header_t,
prop_iter_p->next_property_cp);
}
#else /* CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#else /* !ENABLED (JERRY_PROPRETY_HASHMAP) */
JERRY_UNUSED (object_p);
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
} /* ecma_property_hashmap_create */
/**
@ -226,7 +226,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
void
ecma_property_hashmap_free (ecma_object_t *object_p) /**< object */
{
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
/* Property hash must be exists and must be the first property. */
ecma_property_header_t *property_p = ecma_get_property_list (object_p);
@ -238,9 +238,9 @@ ecma_property_hashmap_free (ecma_object_t *object_p) /**< object */
jmem_heap_free_block (hashmap_p,
ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count));
#else /* CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#else /* !ENABLED (JERRY_PROPRETY_HASHMAP) */
JERRY_UNUSED (object_p);
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
} /* ecma_property_hashmap_free */
/**
@ -252,7 +252,7 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
ecma_property_pair_t *property_pair_p, /**< property pair */
int property_index) /**< property index in the pair (0 or 1) */
{
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
ecma_property_hashmap_t *hashmap_p = ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t,
object_p->property_list_or_bound_object_cp);
@ -322,12 +322,12 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
{
*bits_p = (uint8_t) ((*bits_p) | mask);
}
#else /* CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#else /* !ENABLED (JERRY_PROPRETY_HASHMAP) */
JERRY_UNUSED (object_p);
JERRY_UNUSED (name_p);
JERRY_UNUSED (property_pair_p);
JERRY_UNUSED (property_index);
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
} /* ecma_property_hashmap_insert */
/**
@ -341,7 +341,7 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
jmem_cpointer_t name_cp, /**< property name */
ecma_property_t *property_p) /**< property */
{
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
ecma_property_hashmap_t *hashmap_p = ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t,
object_p->property_list_or_bound_object_cp);
@ -411,16 +411,16 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
JERRY_ASSERT (entry_index != start_entry_index);
#endif /* !JERRY_NDEBUG */
}
#else /* CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#else /* !ENABLED (JERRY_PROPRETY_HASHMAP) */
JERRY_UNUSED (object_p);
JERRY_UNUSED (name_cp);
JERRY_UNUSED (property_p);
return ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP;
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
} /* ecma_property_hashmap_delete */
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
/**
* Find a named property.
*
@ -594,7 +594,7 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
#endif /* !JERRY_NDEBUG */
}
} /* ecma_property_hashmap_find */
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
/**
* @}

View File

@ -70,10 +70,10 @@ void ecma_property_hashmap_insert (ecma_object_t *object_p, ecma_string_t *name_
ecma_property_hashmap_delete_status ecma_property_hashmap_delete (ecma_object_t *object_p, jmem_cpointer_t name_cp,
ecma_property_t *property_p);
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
ecma_property_t *ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, ecma_string_t *name_p,
jmem_cpointer_t *property_real_name_cp);
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
/**
* @}

View File

@ -24,9 +24,9 @@
#include "js-parser.h"
#include "lit-magic-strings.h"
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
#include "jcontext.h"
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@ -159,9 +159,9 @@ ecma_builtin_function_dispatch_construct (const ecma_value_t *arguments_list_p,
ECMA_STRING_TO_UTF8_STRING (arguments_str_p, arguments_buffer_p, arguments_buffer_size);
ECMA_STRING_TO_UTF8_STRING (function_body_str_p, function_body_buffer_p, function_body_buffer_size);
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
JERRY_CONTEXT (resource_name) = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
ecma_compiled_code_t *bytecode_data_p = NULL;

View File

@ -79,7 +79,7 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
size_t code_buffer_size, /**< size of the buffer */
uint32_t parse_opts) /**< ecma_parse_opts_t option bits */
{
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
JERRY_ASSERT (code_p != NULL);
ecma_compiled_code_t *bytecode_data_p;
@ -91,9 +91,9 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
parse_opts &= (uint32_t) ~ECMA_PARSE_STRICT_MODE;
}
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
JERRY_CONTEXT (resource_name) = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
#if ENABLED (JERRY_ES2015_CLASS)
ECMA_CLEAR_SUPER_EVAL_PARSER_OPTS ();
@ -112,13 +112,13 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
}
return vm_run_eval (bytecode_data_p, parse_opts);
#else /* JERRY_DISABLE_JS_PARSER */
#else /* !ENABLED (JERRY_PARSER) */
JERRY_UNUSED (code_p);
JERRY_UNUSED (code_buffer_size);
JERRY_UNUSED (parse_opts);
return ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."));
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */
} /* ecma_op_eval_chars_buffer */
/**

View File

@ -25,9 +25,9 @@
#include "jcontext.h"
#include "jrt.h"
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
#include "vm.h"
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
/** \addtogroup ecma ECMA
* @{
@ -140,7 +140,7 @@ ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error typ
((ecma_extended_object_t *) new_error_obj_p)->u.class_prop.class_id = LIT_MAGIC_STRING_ERROR_UL;
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
/* The "stack" identifier is not a magic string. */
const char * const stack_id_p = "stack";
@ -156,7 +156,7 @@ ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error typ
prop_value_p->value = backtrace_value;
ecma_deref_object (ecma_get_object_from_value (backtrace_value));
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
return new_error_obj_p;
} /* ecma_new_standard_error */
@ -240,7 +240,7 @@ ecma_raise_standard_error (ecma_standard_error_t error_type, /**< error type */
return ECMA_VALUE_ERROR;
} /* ecma_raise_standard_error */
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
/**
* Raise a standard ecma-error with the given format string and arguments.
@ -335,7 +335,7 @@ ecma_raise_standard_error_with_format (ecma_standard_error_t error_type, /**< er
return ECMA_VALUE_ERROR;
} /* ecma_raise_standard_error_with_format */
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
/**
* Raise a common error with the given message.

View File

@ -26,11 +26,11 @@
* @{
*/
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
#define ECMA_ERR_MSG(msg) msg
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
#define ECMA_ERR_MSG(msg) NULL
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
/**
* Native errors.
@ -53,9 +53,9 @@ typedef enum
ecma_standard_error_t ecma_get_error_type (ecma_object_t *error_object);
ecma_object_t *ecma_new_standard_error (ecma_standard_error_t error_type);
ecma_object_t *ecma_new_standard_error_with_message (ecma_standard_error_t error_type, ecma_string_t *message_string_p);
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
ecma_value_t ecma_raise_standard_error_with_format (ecma_standard_error_t error_type, const char *msg_p, ...);
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
ecma_value_t ecma_raise_common_error (const char *msg_p);
ecma_value_t ecma_raise_range_error (const char *msg_p);
ecma_value_t ecma_raise_reference_error (const char *msg_p);

View File

@ -128,12 +128,12 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
size_t function_object_size = sizeof (ecma_extended_object_t);
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)
{
function_object_size = sizeof (ecma_static_function_t);
}
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
function_object_size,
@ -160,7 +160,7 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
/* 10., 11., 12. */
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
{
ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_p->u.function.bytecode_cp, bytecode_data_p);
@ -171,10 +171,10 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
ext_func_p->u.function.bytecode_cp = ECMA_NULL_POINTER;
((ecma_static_function_t *) func_p)->bytecode_p = bytecode_data_p;
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_p->u.function.bytecode_cp, bytecode_data_p);
ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
/* 14., 15., 16., 17., 18. */
/*
@ -204,12 +204,12 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
size_t arrow_function_object_size = sizeof (ecma_arrow_function_t);
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)
{
arrow_function_object_size = sizeof (ecma_static_arrow_function_t);
}
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
arrow_function_object_size,
@ -219,7 +219,7 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
ECMA_SET_NON_NULL_POINTER (arrow_func_p->scope_cp, scope_p);
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
{
ECMA_SET_NON_NULL_POINTER (arrow_func_p->bytecode_cp, bytecode_data_p);
@ -230,10 +230,10 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
arrow_func_p->bytecode_cp = ECMA_NULL_POINTER;
((ecma_static_arrow_function_t *) func_p)->bytecode_p = bytecode_data_p;
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
ECMA_SET_NON_NULL_POINTER (arrow_func_p->bytecode_cp, bytecode_data_p);
ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
arrow_func_p->this_binding = ecma_copy_value_if_not_object (this_binding);
return func_p;
@ -280,7 +280,7 @@ ecma_op_create_external_function_object (ecma_external_handler_t handler_cb) /**
inline const ecma_compiled_code_t * JERRY_ATTR_ALWAYS_INLINE
ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< function pointer */
{
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (function_p->u.function.bytecode_cp != ECMA_NULL_POINTER)
{
return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
@ -290,10 +290,10 @@ ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< fun
{
return ((ecma_static_function_t *) function_p)->bytecode_p;
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
function_p->u.function.bytecode_cp);
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
} /* ecma_op_function_get_compiled_code */
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
@ -306,7 +306,7 @@ ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< fun
inline const ecma_compiled_code_t * JERRY_ATTR_ALWAYS_INLINE
ecma_op_arrow_function_get_compiled_code (ecma_arrow_function_t *arrow_function_p) /**< arrow function pointer */
{
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (arrow_function_p->bytecode_cp != ECMA_NULL_POINTER)
{
return ECMA_GET_NON_NULL_POINTER (const ecma_compiled_code_t,
@ -316,10 +316,10 @@ ecma_op_arrow_function_get_compiled_code (ecma_arrow_function_t *arrow_function_
{
return ((ecma_static_arrow_function_t *) arrow_function_p)->bytecode_p;
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
return ECMA_GET_NON_NULL_POINTER (const ecma_compiled_code_t,
arrow_function_p->bytecode_cp);
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
} /* ecma_op_arrow_function_get_compiled_code */
#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */

View File

@ -93,13 +93,13 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
}
*ref_base_lex_env_p = NULL;
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
return ecma_raise_standard_error_with_format (ECMA_ERROR_REFERENCE,
"% is not defined",
ecma_make_string_value (name_p));
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* ENABLED (JERRY_ERROR_MESSAGES) */
return ecma_raise_reference_error (NULL);
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
} /* ecma_op_get_value_lex_env_base */
@ -250,13 +250,13 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
if (is_strict)
{
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
return ecma_raise_standard_error_with_format (ECMA_ERROR_REFERENCE,
"% is not defined",
ecma_make_string_value (name_p));
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
return ecma_raise_reference_error (NULL);
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
}
ecma_value_t completion = ecma_op_object_put (ecma_builtin_get_global (),

View File

@ -475,26 +475,26 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
JERRY_ASSERT (current_property_type == ECMA_PROPERTY_TYPE_NAMEDDATA);
ecma_free_value_if_not_object (value_p->value);
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));
getter_setter_pair_p->getter_p = JMEM_CP_NULL;
getter_setter_pair_p->setter_p = JMEM_CP_NULL;
ECMA_SET_POINTER (value_p->getter_setter_pair_cp, getter_setter_pair_p);
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
value_p->getter_setter_pair.getter_p = JMEM_CP_NULL;
value_p->getter_setter_pair.setter_p = JMEM_CP_NULL;
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
}
else
{
JERRY_ASSERT (current_property_type == ECMA_PROPERTY_TYPE_NAMEDACCESSOR);
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_POINTER (ecma_getter_setter_pointers_t,
value_p->getter_setter_pair_cp);
jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
value_p->value = ECMA_VALUE_UNDEFINED;
}

View File

@ -118,7 +118,7 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
{
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
ecma_property_t *property_p = ecma_lcache_lookup (binding_obj_p, name_p);
if (property_p != NULL)
@ -142,7 +142,7 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
ecma_value_t base_value = ecma_make_object_value (binding_obj_p);
return ecma_op_function_call (getter_p, base_value, NULL, 0);
}
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
ecma_value_t prop_value = ecma_op_object_find (binding_obj_p, name_p);
@ -163,14 +163,14 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
lex_env_p = ecma_get_lex_env_outer_reference (lex_env_p);
}
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
ecma_value_t name_val = ecma_make_string_value (name_p);
ecma_value_t error_value = ecma_raise_standard_error_with_format (ECMA_ERROR_REFERENCE,
"% is not defined",
name_val);
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* ENABLED (JERRY_ERROR_MESSAGES) */
ecma_value_t error_value = ecma_raise_reference_error (NULL);
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* !ENABLED (JERRY_ERROR_MESSAGES) */
return error_value;
} /* ecma_op_resolve_reference_value */

View File

@ -66,9 +66,9 @@
/*
* Check RegExp recursion depth limit
*/
#ifdef REGEXP_RECURSION_LIMIT
JERRY_STATIC_ASSERT (REGEXP_RECURSION_LIMIT > 0, regexp_recursion_limit_must_be_greater_than_zero);
#endif /* REGEXP_RECURSION_LIMIT */
#if defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0)
JERRY_STATIC_ASSERT (JERRY_REGEXP_RECURSION_LIMIT > 0, regexp_recursion_limit_must_be_greater_than_zero);
#endif /* defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT) != 0) */
/**
* Parse RegExp flags (global, ignoreCase, multiline)

View File

@ -28,7 +28,7 @@
* @{
*/
#ifdef REGEXP_RECURSION_LIMIT
#if defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0)
/**
* Decrease the recursion counter and test it.
* If the counter reaches the limit of the recursion depth
@ -50,8 +50,8 @@
/**
* Set the recursion counter to the max depth of the recursion.
*/
#define REGEXP_RECURSION_COUNTER_INIT() (re_ctx.recursion_counter = REGEXP_RECURSION_LIMIT)
#else /* !REGEXP_RECURSION_LIMIT */
#define REGEXP_RECURSION_COUNTER_INIT() (re_ctx.recursion_counter = JERRY_REGEXP_RECURSION_LIMIT)
#else /* !(defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0)) */
/**
* Decrease the recursion counter and test it.
* If the counter reaches the limit of the recursion depth
@ -66,7 +66,7 @@
* Set the recursion counter to the max depth of the recursion.
*/
#define REGEXP_RECURSION_COUNTER_INIT()
#endif /* REGEXP_RECURSION_LIMIT */
#endif /* defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0) */
/**
* RegExp flags
@ -88,9 +88,9 @@ typedef struct
const lit_utf8_byte_t **saved_p; /**< saved result string pointers, ECMA 262 v5, 15.10.2.1, State */
const lit_utf8_byte_t *input_start_p; /**< start of input pattern string */
const lit_utf8_byte_t *input_end_p; /**< end of input pattern string */
#ifdef REGEXP_RECURSION_LIMIT
#if defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0)
uint32_t recursion_counter; /**< RegExp recursion counter */
#endif /* REGEXP_RECURSION_LIMIT */
#endif /* defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0) */
uint32_t num_of_captures; /**< number of capture groups */
uint32_t num_of_non_captures; /**< number of non-capture groups */
uint32_t *num_of_iterations_p; /**< number of iterations */

View File

@ -39,7 +39,6 @@ extern "C"
#define JERRY_ATTR_NOINLINE __attribute__((noinline))
#define JERRY_ATTR_NORETURN __attribute__((noreturn))
#define JERRY_ATTR_PURE __attribute__((pure))
#define JERRY_ATTR_SECTION(SECTION) __attribute__((section(SECTION)))
#define JERRY_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#define JERRY_LIKELY(x) __builtin_expect(!!(x), 1)

View File

@ -99,8 +99,8 @@ typedef enum
* vfprintf(logfile), or both, depending on log level.
*
* Note:
* This port function is called by jerry-core when JERRY_ENABLE_LOGGING is
* defined. It is also common practice though to use this function in
* This port function is called by jerry-core when JERRY_LOGGING is
* enabled. It is also common practice though to use this function in
* application code.
*/
void JERRY_ATTR_FORMAT (printf, 2, 3) jerry_port_log (jerry_log_level_t level, const char *format, ...);
@ -161,7 +161,7 @@ double jerry_port_get_current_time (void);
*
* Note:
* This port function is called by jerry-core when
* JERRY_ENABLE_EXTERNAL_CONTEXT is defined. Otherwise this function is not
* JERRY_EXTERNAL_CONTEXT is enabled. Otherwise this function is not
* used.
*
* @return the pointer to the engine context.

View File

@ -19,14 +19,14 @@
* @{
*/
#ifndef JERRY_ENABLE_EXTERNAL_CONTEXT
#if !ENABLED (JERRY_EXTERNAL_CONTEXT)
/**
* Global context.
*/
jerry_context_t jerry_global_context;
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
/**
* Check size of heap is corresponding to configuration
@ -34,23 +34,14 @@ jerry_context_t jerry_global_context;
JERRY_STATIC_ASSERT (sizeof (jmem_heap_t) <= JMEM_HEAP_SIZE,
size_of_mem_heap_must_be_less_than_or_equal_to_JMEM_HEAP_SIZE);
/**
* Jerry global heap section attribute.
*/
#ifndef JERRY_HEAP_SECTION_ATTR
#define JERRY_GLOBAL_HEAP_SECTION
#else /* JERRY_HEAP_SECTION_ATTR */
#define JERRY_GLOBAL_HEAP_SECTION JERRY_ATTR_SECTION (JERRY_HEAP_SECTION_ATTR)
#endif /* !JERRY_HEAP_SECTION_ATTR */
/**
* Global heap.
*/
jmem_heap_t jerry_global_heap JERRY_ATTR_ALIGNED (JMEM_ALIGNMENT) JERRY_GLOBAL_HEAP_SECTION;
jmem_heap_t jerry_global_heap JERRY_ATTR_ALIGNED (JMEM_ALIGNMENT) JERRY_ATTR_GLOBAL_HEAP;
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
#endif /* !JERRY_ENABLE_EXTERNAL_CONTEXT */
#endif /* !ENABLED (JERRY_EXTERNAL_CONTEXT) */
/**
* @}

View File

@ -34,7 +34,34 @@
* @{
*/
#ifndef JERRY_SYSTEM_ALLOCATOR
/**
* Advanced allocator configurations.
*/
/**
* Maximum global heap size in bytes
*/
#define CONFIG_MEM_HEAP_SIZE (JERRY_GLOBAL_HEAP_SIZE * 1024)
/**
* Max heap usage limit
*/
#define CONFIG_MEM_HEAP_MAX_LIMIT 8192
/**
* Desired limit of heap usage
*/
#define CONFIG_MEM_HEAP_DESIRED_LIMIT (JERRY_MIN (CONFIG_MEM_HEAP_SIZE / 32, CONFIG_MEM_HEAP_MAX_LIMIT))
/**
* Share of newly allocated since last GC objects among all currently allocated objects,
* after achieving which, GC is started upon low severity try-give-memory-back requests.
*
* Share is calculated as the following:
* 1.0 / CONFIG_ECMA_GC_NEW_OBJECTS_SHARE_TO_START_GC
*/
#define CONFIG_ECMA_GC_NEW_OBJECTS_SHARE_TO_START_GC (16)
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
/**
* Heap structure
*
@ -48,7 +75,7 @@
* there.
*/
typedef struct jmem_heap_t jmem_heap_t;
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
/**
* User context item
@ -76,12 +103,12 @@ typedef struct jerry_context_data_header
struct jerry_context_t
{
/* The value of external context members must be preserved across initializations and cleanups. */
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
#ifndef JERRY_SYSTEM_ALLOCATOR
#if ENABLED (JERRY_EXTERNAL_CONTEXT)
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
jmem_heap_t *heap_p; /**< point to the heap aligned to JMEM_ALIGNMENT. */
uint32_t heap_size; /**< size of the heap */
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
#endif /* ENABLED (JERRY_EXTERNAL_CONTEXT) */
/* Update JERRY_CONTEXT_FIRST_MEMBER if the first non-external member changes */
ecma_object_t *ecma_builtin_objects[ECMA_BUILTIN_ID__COUNT]; /**< pointer to instances of built-in objects */
@ -91,9 +118,9 @@ struct jerry_context_t
ecma_object_t *ecma_gc_objects_p; /**< List of currently alive objects. */
jmem_heap_free_t *jmem_heap_list_skip_p; /**< This is used to speed up deallocation. */
jmem_pools_chunk_t *jmem_free_8_byte_chunk_p; /**< list of free eight byte pool chunks */
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
jmem_pools_chunk_t *jmem_free_16_byte_chunk_p; /**< list of free sixteen byte pool chunks */
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
jmem_free_unused_memory_callback_t jmem_free_unused_memory_callback; /**< Callback for freeing up memory. */
const lit_utf8_byte_t * const *lit_magic_string_ex_array; /**< array of external magic strings */
const lit_utf8_size_t *lit_magic_string_ex_sizes; /**< external magic string lengths */
@ -121,10 +148,10 @@ struct jerry_context_t
uint32_t jerry_init_flags; /**< run-time configuration flags */
uint32_t status_flags; /**< run-time flags (the top 8 bits are used for passing class parsing options) */
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if ENABLED (JERRY_PROPRETY_HASHMAP)
uint8_t ecma_prop_hashmap_alloc_state; /**< property hashmap allocation state: 0-4,
* if !0 property hashmap allocation is disabled */
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#if ENABLED (JERRY_BUILTIN_REGEXP)
uint8_t re_cache_idx; /**< evicted item index when regex cache is full (round-robin) */
@ -135,17 +162,17 @@ struct jerry_context_t
ecma_job_queueitem_t *job_queue_tail_p; /**< points to the tail item of the jobqueue*/
#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */
#ifdef JERRY_VM_EXEC_STOP
#if ENABLED (JERRY_VM_EXEC_STOP)
uint32_t vm_exec_stop_frequency; /**< reset value for vm_exec_stop_counter */
uint32_t vm_exec_stop_counter; /**< down counter for reducing the calls of vm_exec_stop_cb */
void *vm_exec_stop_user_p; /**< user pointer for vm_exec_stop_cb */
ecma_vm_exec_stop_callback_t vm_exec_stop_cb; /**< user function which returns whether the
* ECMAScript execution should be stopped */
#endif /* JERRY_VM_EXEC_STOP */
#endif /* ENABLED (JERRY_VM_EXEC_STOP) */
#ifdef VM_RECURSION_LIMIT
#if defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0)
uint32_t vm_recursion_counter; /**< VM recursion counter */
#endif /* VM_RECURSION_LIMIT */
#endif /* defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0) */
#ifdef JERRY_DEBUGGER
uint8_t debugger_send_buffer[JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE]; /**< buffer for sending messages */
@ -164,23 +191,23 @@ struct jerry_context_t
uint8_t debugger_max_receive_size; /**< maximum amount of data that can be received */
#endif /* JERRY_DEBUGGER */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
ecma_value_t resource_name; /**< resource name (usually a file name) */
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_heap_stats_t jmem_heap_stats; /**< heap's memory usage statistics */
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
/* This must be at the end of the context for performance reasons */
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
/** hash table for caching the last access of properties */
ecma_lcache_hash_entry_t lcache[ECMA_LCACHE_HASH_ROWS_COUNT][ECMA_LCACHE_HASH_ROW_LENGTH];
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
};
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
#if ENABLED (JERRY_EXTERNAL_CONTEXT)
/*
* This part is for JerryScript which uses external context.
@ -188,7 +215,7 @@ struct jerry_context_t
#define JERRY_CONTEXT(field) (jerry_port_get_current_context ()->field)
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
#define JMEM_HEAP_SIZE (JERRY_CONTEXT (heap_size))
@ -202,9 +229,9 @@ struct jmem_heap_t
#define JERRY_HEAP_CONTEXT(field) (JERRY_CONTEXT (heap_p)->field)
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
#else /* !JERRY_ENABLE_EXTERNAL_CONTEXT */
#else /* !ENABLED (JERRY_EXTERNAL_CONTEXT) */
/*
* This part is for JerryScript which uses default context.
@ -220,12 +247,12 @@ extern jerry_context_t jerry_global_context;
*/
#define JERRY_CONTEXT(field) (jerry_global_context.field)
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
/**
* Size of heap
*/
#define JMEM_HEAP_SIZE ((size_t) (CONFIG_MEM_HEAP_AREA_SIZE))
#define JMEM_HEAP_SIZE ((size_t) (CONFIG_MEM_HEAP_SIZE))
/**
* Calculate heap area size, leaving space for a pointer to the free list
@ -248,9 +275,9 @@ extern jmem_heap_t jerry_global_heap;
*/
#define JERRY_HEAP_CONTEXT(field) (jerry_global_heap.field)
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
#endif /* ENABLED (JERRY_EXTERNAL_CONTEXT) */
/**
* @}

View File

@ -28,7 +28,7 @@
* @{
* Valgrind-related options and headers
*/
#ifdef JERRY_VALGRIND
#if ENABLED (JERRY_VALGRIND)
# include "memcheck.h"
# define JMEM_VALGRIND_NOACCESS_SPACE(p, s) VALGRIND_MAKE_MEM_NOACCESS((p), (s))
@ -36,19 +36,19 @@
# define JMEM_VALGRIND_DEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_DEFINED((p), (s))
# define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s) VALGRIND_MALLOCLIKE_BLOCK((p), (s), 0, 0)
# define JMEM_VALGRIND_FREELIKE_SPACE(p) VALGRIND_FREELIKE_BLOCK((p), 0)
#else /* !JERRY_VALGRIND */
#else /* !ENABLED (JERRY_VALGRIND) */
# define JMEM_VALGRIND_NOACCESS_SPACE(p, s)
# define JMEM_VALGRIND_UNDEFINED_SPACE(p, s)
# define JMEM_VALGRIND_DEFINED_SPACE(p, s)
# define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s)
# define JMEM_VALGRIND_FREELIKE_SPACE(p)
#endif /* JERRY_VALGRIND */
#endif /* ENABLED (JERRY_VALGRIND) */
/** @} */
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
void jmem_heap_stats_reset_peak (void);
void jmem_heap_stats_print (void);
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
void jmem_heap_init (void);
void jmem_heap_finalize (void);

View File

@ -24,7 +24,7 @@
#define JMEM_ALLOCATOR_INTERNAL
#include "jmem-allocator-internal.h"
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
/**
* Register byte code allocation.
*/
@ -141,7 +141,7 @@ jmem_stats_free_property_bytes (size_t property_size)
heap_stats->property_bytes -= property_size;
} /* jmem_stats_free_property_bytes */
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
/**
* Initialize memory allocators.
@ -160,12 +160,12 @@ jmem_finalize (void)
{
jmem_pools_finalize ();
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
if (JERRY_CONTEXT (jerry_init_flags) & ECMA_INIT_MEM_STATS)
{
jmem_heap_stats_print ();
}
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
jmem_heap_finalize ();
} /* jmem_finalize */
@ -185,21 +185,21 @@ jmem_compress_pointer (const void *pointer_p) /**< pointer to compress */
JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);
#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && defined (JERRY_CPOINTER_32_BIT)
#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && ENABLED (JERRY_CPOINTER_32_BIT)
JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !ENABLED (JERRY_CPOINTER_32_BIT) */
const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
uint_ptr -= heap_start;
uint_ptr >>= JMEM_ALIGNMENT_LOG;
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
JERRY_ASSERT (uint_ptr <= UINT32_MAX);
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
JERRY_ASSERT (uint_ptr <= UINT16_MAX);
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
JERRY_ASSERT (uint_ptr != JMEM_CP_NULL);
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && JERRY_CPOINTER_32_BIT */
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && ENABLED (JERRY_CPOINTER_32_BIT) */
return (jmem_cpointer_t) uint_ptr;
} /* jmem_compress_pointer */
@ -218,16 +218,16 @@ jmem_decompress_pointer (uintptr_t compressed_pointer) /**< pointer to decompres
JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);
#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && defined (JERRY_CPOINTER_32_BIT)
#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && ENABLED (JERRY_CPOINTER_32_BIT)
JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !ENABLED (JERRY_CPOINTER_32_BIT) */
const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
uint_ptr <<= JMEM_ALIGNMENT_LOG;
uint_ptr += heap_start;
JERRY_ASSERT (jmem_is_heap_pointer ((void *) uint_ptr));
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && JERRY_CPOINTER_32_BIT */
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && ENABLED (JERRY_CPOINTER_32_BIT) */
return (void *) uint_ptr;
} /* jmem_decompress_pointer */

View File

@ -32,7 +32,7 @@
* @{
*/
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
/**
* End of list marker.
*/
@ -63,13 +63,13 @@ jmem_heap_get_region_end (jmem_heap_free_t *curr_p) /**< current region */
{
return (jmem_heap_free_t *)((uint8_t *) curr_p + curr_p->size);
} /* jmem_heap_get_region_end */
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
/**
* @{
* JMEM_HEAP_STAT_xxx definitions
*/
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
static void jmem_heap_stat_init (void);
static void jmem_heap_stat_alloc (size_t num);
static void jmem_heap_stat_free (size_t num);
@ -78,7 +78,7 @@ static void jmem_heap_stat_free (size_t num);
#define JMEM_HEAP_STAT_ALLOC(v1) jmem_heap_stat_alloc (v1)
#define JMEM_HEAP_STAT_FREE(v1) jmem_heap_stat_free (v1)
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
static void jmem_heap_stat_skip (void);
static void jmem_heap_stat_nonskip (void);
static void jmem_heap_stat_alloc_iter (void);
@ -88,19 +88,19 @@ static void jmem_heap_stat_free_iter (void);
#define JMEM_HEAP_STAT_NONSKIP() jmem_heap_stat_nonskip ()
#define JMEM_HEAP_STAT_ALLOC_ITER() jmem_heap_stat_alloc_iter ()
#define JMEM_HEAP_STAT_FREE_ITER() jmem_heap_stat_free_iter ()
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#else /* !JMEM_STATS */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
#else /* !ENABLED (JERRY_MEM_STATS) */
#define JMEM_HEAP_STAT_INIT()
#define JMEM_HEAP_STAT_ALLOC(v1) JERRY_UNUSED (v1)
#define JMEM_HEAP_STAT_FREE(v1) JERRY_UNUSED (v1)
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
#define JMEM_HEAP_STAT_SKIP()
#define JMEM_HEAP_STAT_NONSKIP()
#define JMEM_HEAP_STAT_ALLOC_ITER()
#define JMEM_HEAP_STAT_FREE_ITER()
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* JMEM_STATS */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
#endif /* ENABLED (JERRY_MEM_STATS) */
/** @} */
/**
@ -109,11 +109,11 @@ static void jmem_heap_stat_free_iter (void);
void
jmem_heap_init (void)
{
#ifndef JERRY_SYSTEM_ALLOCATOR
#ifndef JERRY_CPOINTER_32_BIT
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
#if !ENABLED (JERRY_CPOINTER_32_BIT)
/* the maximum heap size for 16bit compressed pointers should be 512K */
JERRY_ASSERT (((UINT16_MAX + 1) << JMEM_ALIGNMENT_LOG) >= JMEM_HEAP_SIZE);
#endif /* !JERRY_CPOINTER_32_BIT */
#endif /* !ENABLED (JERRY_CPOINTER_32_BIT) */
JERRY_ASSERT ((uintptr_t) JERRY_HEAP_CONTEXT (area) % JMEM_ALIGNMENT == 0);
JERRY_CONTEXT (jmem_heap_limit) = CONFIG_MEM_HEAP_DESIRED_LIMIT;
@ -130,7 +130,7 @@ jmem_heap_init (void)
JMEM_VALGRIND_NOACCESS_SPACE (JERRY_HEAP_CONTEXT (area), JMEM_HEAP_AREA_SIZE);
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
JMEM_HEAP_STAT_INIT ();
} /* jmem_heap_init */
@ -141,9 +141,9 @@ void
jmem_heap_finalize (void)
{
JERRY_ASSERT (JERRY_CONTEXT (jmem_heap_allocated_size) == 0);
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
JMEM_VALGRIND_NOACCESS_SPACE (&JERRY_HEAP_CONTEXT (first), JMEM_HEAP_SIZE);
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
} /* jmem_heap_finalize */
/**
@ -158,7 +158,7 @@ jmem_heap_finalize (void)
static void * JERRY_ATTR_HOT
jmem_heap_alloc_block_internal (const size_t size) /**< size of requested block */
{
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
/* Align size. */
const size_t required_size = ((size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT) * JMEM_ALIGNMENT;
jmem_heap_free_t *data_space_p = NULL;
@ -281,7 +281,7 @@ jmem_heap_alloc_block_internal (const size_t size) /**< size of requested block
JMEM_HEAP_STAT_ALLOC (size);
return (void *) data_space_p;
#else /* JERRY_SYSTEM_ALLOCATOR */
#else /* ENABLED (JERRY_SYSTEM_ALLOCATOR) */
JMEM_HEAP_STAT_ALLOC (size);
JERRY_CONTEXT (jmem_heap_allocated_size) += size;
@ -291,7 +291,7 @@ jmem_heap_alloc_block_internal (const size_t size) /**< size of requested block
}
return malloc (size);
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
} /* jmem_heap_alloc_block_internal */
/**
@ -315,9 +315,9 @@ jmem_heap_gc_and_alloc_block (const size_t size, /**< required memory size
return NULL;
}
#ifdef JMEM_GC_BEFORE_EACH_ALLOC
#if ENABLED (JERRY_MEM_GC_BEFORE_EACH_ALLOC)
jmem_run_free_unused_memory_callbacks (JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH);
#endif /* JMEM_GC_BEFORE_EACH_ALLOC */
#endif /* ENABLED (JERRY_MEM_GC_BEFORE_EACH_ALLOC) */
if (JERRY_CONTEXT (jmem_heap_allocated_size) + size >= JERRY_CONTEXT (jmem_heap_limit))
{
@ -396,7 +396,7 @@ void JERRY_ATTR_HOT
jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the block */
const size_t size) /**< size of allocated region */
{
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
/* checking that ptr points to the heap */
JERRY_ASSERT (jmem_is_heap_pointer (ptr));
JERRY_ASSERT (size > 0);
@ -492,7 +492,7 @@ jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the
JMEM_VALGRIND_NOACCESS_SPACE (&JERRY_HEAP_CONTEXT (first), sizeof (jmem_heap_free_t));
JERRY_ASSERT (JERRY_CONTEXT (jmem_heap_limit) >= JERRY_CONTEXT (jmem_heap_allocated_size));
JMEM_HEAP_STAT_FREE (size);
#else /* JERRY_SYSTEM_ALLOCATOR */
#else /* ENABLED (JERRY_SYSTEM_ALLOCATOR) */
JMEM_HEAP_STAT_FREE (size);
JERRY_CONTEXT (jmem_heap_allocated_size) -= size;
@ -502,7 +502,7 @@ jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the
}
free (ptr);
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
} /* jmem_heap_free_block */
#ifndef JERRY_NDEBUG
@ -518,17 +518,17 @@ jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the
bool
jmem_is_heap_pointer (const void *pointer) /**< pointer */
{
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
return ((uint8_t *) pointer >= JERRY_HEAP_CONTEXT (area)
&& (uint8_t *) pointer <= (JERRY_HEAP_CONTEXT (area) + JMEM_HEAP_AREA_SIZE));
#else /* JERRY_SYSTEM_ALLOCATOR */
#else /* ENABLED (JERRY_SYSTEM_ALLOCATOR) */
JERRY_UNUSED (pointer);
return true;
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
} /* jmem_is_heap_pointer */
#endif /* !JERRY_NDEBUG */
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
/**
* Get heap memory usage statistics
*/
@ -549,10 +549,10 @@ jmem_heap_stats_print (void)
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
JERRY_DEBUG_MSG ("Heap stats:\n");
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
JERRY_DEBUG_MSG (" Heap size = %zu bytes\n",
heap_stats->size);
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
JERRY_DEBUG_MSG (" Allocated = %zu bytes\n"
" Peak allocated = %zu bytes\n"
" Waste = %zu bytes\n"
@ -577,7 +577,7 @@ jmem_heap_stats_print (void)
heap_stats->peak_object_bytes,
heap_stats->property_bytes,
heap_stats->peak_property_bytes);
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
JERRY_DEBUG_MSG (" Skip-ahead ratio = %zu.%04zu\n"
" Average alloc iteration = %zu.%04zu\n"
" Average free iteration = %zu.%04zu\n",
@ -587,7 +587,7 @@ jmem_heap_stats_print (void)
heap_stats->alloc_iter_count % heap_stats->alloc_count * 10000 / heap_stats->alloc_count,
heap_stats->free_iter_count / heap_stats->free_count,
heap_stats->free_iter_count % heap_stats->free_count * 10000 / heap_stats->free_count);
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
} /* jmem_heap_stats_print */
/**
@ -596,9 +596,9 @@ jmem_heap_stats_print (void)
static void
jmem_heap_stat_init (void)
{
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
JERRY_CONTEXT (jmem_heap_stats).size = JMEM_HEAP_AREA_SIZE;
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
} /* jmem_heap_stat_init */
/**
@ -643,7 +643,7 @@ jmem_heap_stat_free (size_t size) /**< Size of freed block */
heap_stats->waste_bytes -= waste_bytes;
} /* jmem_heap_stat_free */
#ifndef JERRY_SYSTEM_ALLOCATOR
#if !ENABLED (JERRY_SYSTEM_ALLOCATOR)
/**
* Counts number of skip-aheads during insertion of free block
*/
@ -679,8 +679,8 @@ jmem_heap_stat_free_iter (void)
{
JERRY_CONTEXT (jmem_heap_stats).free_iter_count++;
} /* jmem_heap_stat_free_iter */
#endif /* !JERRY_SYSTEM_ALLOCATOR */
#endif /* JMEM_STATS */
#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */
#endif /* ENABLED (JERRY_MEM_STATS) */
/**
* @}

View File

@ -40,9 +40,9 @@ jmem_pools_finalize (void)
jmem_pools_collect_empty ();
JERRY_ASSERT (JERRY_CONTEXT (jmem_free_8_byte_chunk_p) == NULL);
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
JERRY_ASSERT (JERRY_CONTEXT (jmem_free_16_byte_chunk_p) == NULL);
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
} /* jmem_pools_finalize */
/**
@ -54,16 +54,16 @@ jmem_pools_finalize (void)
inline void * JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
jmem_pools_alloc (size_t size) /**< size of the chunk */
{
#ifdef JMEM_GC_BEFORE_EACH_ALLOC
#if ENABLED (JERRY_MEM_GC_BEFORE_EACH_ALLOC)
jmem_run_free_unused_memory_callbacks (JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH);
#endif /* JMEM_GC_BEFORE_EACH_ALLOC */
#endif /* ENABLED (JERRY_MEM_GC_BEFORE_EACH_ALLOC) */
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
if (size <= 8)
{
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
JERRY_ASSERT (size <= 8);
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
if (JERRY_CONTEXT (jmem_free_8_byte_chunk_p) != NULL)
{
@ -82,7 +82,7 @@ jmem_pools_alloc (size_t size) /**< size of the chunk */
return (void *) jmem_heap_alloc_block (8);
}
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
}
JERRY_ASSERT (size <= 16);
@ -103,7 +103,7 @@ jmem_pools_alloc (size_t size) /**< size of the chunk */
{
return (void *) jmem_heap_alloc_block (16);
}
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
} /* jmem_pools_alloc */
/**
@ -119,17 +119,17 @@ jmem_pools_free (void *chunk_p, /**< pointer to the chunk */
JMEM_VALGRIND_DEFINED_SPACE (chunk_to_free_p, size);
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
if (size <= 8)
{
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
JERRY_ASSERT (size <= 8);
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
chunk_to_free_p->next_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p);
JERRY_CONTEXT (jmem_free_8_byte_chunk_p) = chunk_to_free_p;
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
}
else
{
@ -138,7 +138,7 @@ jmem_pools_free (void *chunk_p, /**< pointer to the chunk */
chunk_to_free_p->next_p = JERRY_CONTEXT (jmem_free_16_byte_chunk_p);
JERRY_CONTEXT (jmem_free_16_byte_chunk_p) = chunk_to_free_p;
}
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
JMEM_VALGRIND_NOACCESS_SPACE (chunk_to_free_p, size);
} /* jmem_pools_free */
@ -162,7 +162,7 @@ jmem_pools_collect_empty (void)
chunk_p = next_p;
}
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
chunk_p = JERRY_CONTEXT (jmem_free_16_byte_chunk_p);
JERRY_CONTEXT (jmem_free_16_byte_chunk_p) = NULL;
@ -175,7 +175,7 @@ jmem_pools_collect_empty (void)
jmem_heap_free_block (chunk_p, 16);
chunk_p = next_p;
}
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
} /* jmem_pools_collect_empty */
/**

View File

@ -63,11 +63,11 @@
/**
* Compressed pointer
*/
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
typedef uint32_t jmem_cpointer_t;
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
typedef uint16_t jmem_cpointer_t;
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
/**
* Severity of a 'try give memory back' request
@ -108,7 +108,7 @@ void *jmem_heap_alloc_block (const size_t size);
void *jmem_heap_alloc_block_null_on_error (const size_t size);
void jmem_heap_free_block (void *ptr, const size_t size);
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
/**
* Heap memory usage statistics
*/
@ -154,7 +154,7 @@ void jmem_stats_allocate_property_bytes (size_t property_size);
void jmem_stats_free_property_bytes (size_t property_size);
void jmem_heap_get_stats (jmem_heap_stats_t *);
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
jmem_cpointer_t JERRY_ATTR_PURE jmem_compress_pointer (const void *pointer_p);
void * JERRY_ATTR_PURE jmem_decompress_pointer (uintptr_t compressed_pointer);

View File

@ -19,20 +19,10 @@
#include <stdio.h>
#include <string.h>
#include "config.h"
#include "jerryscript-port.h"
#include "jrt-types.h"
/*
* Normally compilers store const(ant)s in ROM. Thus saving RAM.
* But if your compiler does not support it then the directive below can force it.
*
* For the moment it is mainly meant for the following targets:
* - ESP8266
*/
#ifndef JERRY_CONST_DATA
# define JERRY_CONST_DATA
#endif /* JERRY_CONST_DATA */
/*
* Constants
*/
@ -121,17 +111,17 @@ void JERRY_ATTR_NORETURN jerry_fatal (jerry_fatal_code_t code);
/*
* Logging
*/
#ifdef JERRY_ENABLE_LOGGING
#if ENABLED (JERRY_LOGGING)
#define JERRY_ERROR_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__)
#define JERRY_WARNING_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_WARNING, __VA_ARGS__)
#define JERRY_DEBUG_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__)
#define JERRY_TRACE_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__)
#else /* !JERRY_ENABLE_LOGGING */
#else /* !ENABLED (JERRY_LOGGING) */
#define JERRY_ERROR_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
#define JERRY_WARNING_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
#define JERRY_DEBUG_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
#define JERRY_TRACE_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
#endif /* JERRY_ENABLE_LOGGING */
#endif /* ENABLED (JERRY_LOGGING) */
/**
* Size of struct member

View File

@ -42,7 +42,7 @@ lit_get_magic_string_ex_count (void)
const lit_utf8_byte_t *
lit_get_magic_string_utf8 (uint32_t id) /**< magic string id */
{
static const lit_utf8_byte_t * const lit_magic_strings[] JERRY_CONST_DATA =
static const lit_utf8_byte_t * const lit_magic_strings[] JERRY_ATTR_CONST_DATA =
{
/** @cond doxygen_suppress */
#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id)
@ -67,7 +67,7 @@ lit_get_magic_string_utf8 (uint32_t id) /**< magic string id */
lit_utf8_size_t
lit_get_magic_string_size (uint32_t id) /**< magic string id */
{
static const lit_magic_size_t lit_magic_string_sizes[] JERRY_CONST_DATA =
static const lit_magic_size_t lit_magic_string_sizes[] JERRY_ATTR_CONST_DATA =
{
/** @cond doxygen_suppress */
#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id)
@ -93,7 +93,7 @@ lit_get_magic_string_size (uint32_t id) /**< magic string id */
static lit_magic_string_id_t
lit_get_magic_string_size_block_start (lit_utf8_size_t size) /**< magic string size */
{
static const lit_magic_string_id_t lit_magic_string_size_block_starts[] JERRY_CONST_DATA =
static const lit_magic_string_id_t lit_magic_string_size_block_starts[] JERRY_ATTR_CONST_DATA =
{
/** @cond doxygen_suppress */
#define LIT_MAGIC_STRING_DEF(id, utf8_string)

View File

@ -17,7 +17,7 @@
* from UnicodeData-9.0.0.txt and SpecialCasing-9.0.0.txt files. Do not edit! */
/* Contains start points of character case ranges (these are bidirectional conversions). */
static const uint16_t lit_character_case_ranges[] JERRY_CONST_DATA =
static const uint16_t lit_character_case_ranges[] JERRY_ATTR_CONST_DATA =
{
0x00c0, 0x00e0, 0x00d8, 0x00f8, 0x0189, 0x0256, 0x01b1, 0x028a, 0x0388, 0x03ad,
0x038e, 0x03cd, 0x0391, 0x03b1, 0x03a3, 0x03c3, 0x03fd, 0x037b, 0x0400, 0x0450,
@ -29,7 +29,7 @@ static const uint16_t lit_character_case_ranges[] JERRY_CONST_DATA =
};
/* Interval lengths of start points in `character_case_ranges` table. */
static const uint8_t lit_character_case_range_lengths[] JERRY_CONST_DATA =
static const uint8_t lit_character_case_range_lengths[] JERRY_ATTR_CONST_DATA =
{
0x0017, 0x0007, 0x0002, 0x0002, 0x0003, 0x0002, 0x0011, 0x0009, 0x0003, 0x0010,
0x0020, 0x0026, 0x0026, 0x0050, 0x0006, 0x0008, 0x0006, 0x0008, 0x0008, 0x0006,
@ -38,7 +38,7 @@ static const uint8_t lit_character_case_range_lengths[] JERRY_CONST_DATA =
};
/* Contains the start points of bidirectional conversion ranges. */
static const uint16_t lit_character_pair_ranges[] JERRY_CONST_DATA =
static const uint16_t lit_character_pair_ranges[] JERRY_ATTR_CONST_DATA =
{
0x0100, 0x0132, 0x0139, 0x014a, 0x0179, 0x0182, 0x0187, 0x018b, 0x0191, 0x0198,
0x01a0, 0x01a7, 0x01ac, 0x01af, 0x01b3, 0x01b8, 0x01bc, 0x01cd, 0x01de, 0x01f4,
@ -49,7 +49,7 @@ static const uint16_t lit_character_pair_ranges[] JERRY_CONST_DATA =
};
/* Interval lengths of start points in `character_pair_ranges` table. */
static const uint8_t lit_character_pair_range_lengths[] JERRY_CONST_DATA =
static const uint8_t lit_character_pair_range_lengths[] JERRY_ATTR_CONST_DATA =
{
0x0030, 0x0006, 0x0010, 0x002e, 0x0006, 0x0004, 0x0002, 0x0002, 0x0002, 0x0002,
0x0006, 0x0002, 0x0002, 0x0002, 0x0004, 0x0002, 0x0002, 0x0010, 0x0012, 0x0002,
@ -60,7 +60,7 @@ static const uint8_t lit_character_pair_range_lengths[] JERRY_CONST_DATA =
};
/* Contains lower/upper case bidirectional conversion pairs. */
static const uint16_t lit_character_pairs[] JERRY_CONST_DATA =
static const uint16_t lit_character_pairs[] JERRY_ATTR_CONST_DATA =
{
0x0178, 0x00ff, 0x0181, 0x0253, 0x0186, 0x0254, 0x018e, 0x01dd, 0x018f, 0x0259,
0x0190, 0x025b, 0x0193, 0x0260, 0x0194, 0x0263, 0x0196, 0x0269, 0x0197, 0x0268,
@ -80,20 +80,20 @@ static const uint16_t lit_character_pairs[] JERRY_CONST_DATA =
/* Contains start points of one-to-two uppercase ranges where the second character
* is always the same.
*/
static const uint16_t lit_upper_case_special_ranges[] JERRY_CONST_DATA =
static const uint16_t lit_upper_case_special_ranges[] JERRY_ATTR_CONST_DATA =
{
0x1f80, 0x1f08, 0x0399, 0x1f88, 0x1f08, 0x0399, 0x1f90, 0x1f28, 0x0399, 0x1f98,
0x1f28, 0x0399, 0x1fa0, 0x1f68, 0x0399, 0x1fa8, 0x1f68, 0x0399
};
/* Interval lengths for start points in `upper_case_special_ranges` table. */
static const uint8_t lit_upper_case_special_range_lengths[] JERRY_CONST_DATA =
static const uint8_t lit_upper_case_special_range_lengths[] JERRY_ATTR_CONST_DATA =
{
0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007
};
/* Contains start points of lowercase ranges. */
static const uint16_t lit_lower_case_ranges[] JERRY_CONST_DATA =
static const uint16_t lit_lower_case_ranges[] JERRY_ATTR_CONST_DATA =
{
0x1e96, 0x1e96, 0x1f80, 0x1f80, 0x1f88, 0x1f80, 0x1f90, 0x1f90, 0x1f98, 0x1f90,
0x1fa0, 0x1fa0, 0x1fa8, 0x1fa0, 0x1fb2, 0x1fb2, 0x1fb6, 0x1fb6, 0x1fc2, 0x1fc2,
@ -102,14 +102,14 @@ static const uint16_t lit_lower_case_ranges[] JERRY_CONST_DATA =
};
/* Interval lengths for start points in `lower_case_ranges` table. */
static const uint8_t lit_lower_case_range_lengths[] JERRY_CONST_DATA =
static const uint8_t lit_lower_case_range_lengths[] JERRY_ATTR_CONST_DATA =
{
0x0005, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0003, 0x0002, 0x0003,
0x0002, 0x0002, 0x0002, 0x0003, 0x0002, 0x0003, 0x0002, 0x0007, 0x0005
};
/* The remaining lowercase conversions. The lowercase variant can be one-to-three character long. */
static const uint16_t lit_lower_case_conversions[] JERRY_CONST_DATA =
static const uint16_t lit_lower_case_conversions[] JERRY_ATTR_CONST_DATA =
{
0x00df, 0x00df, 0x0149, 0x0149, 0x01c5, 0x01c6, 0x01c8, 0x01c9, 0x01cb, 0x01cc,
0x01f0, 0x01f0, 0x01f2, 0x01f3, 0x0390, 0x0390, 0x03b0, 0x03b0, 0x03f4, 0x03b8,
@ -119,13 +119,13 @@ static const uint16_t lit_lower_case_conversions[] JERRY_CONST_DATA =
};
/* Number of one-to-one, one-to-two, and one-to-three lowercase conversions. */
static const uint8_t lit_lower_case_conversion_counters[] JERRY_CONST_DATA =
static const uint8_t lit_lower_case_conversion_counters[] JERRY_ATTR_CONST_DATA =
{
0x0016, 0x0001, 0x0000
};
/* The remaining uppercase conversions. The uppercase variant can be one-to-three character long. */
static const uint16_t lit_upper_case_conversions[] JERRY_CONST_DATA =
static const uint16_t lit_upper_case_conversions[] JERRY_ATTR_CONST_DATA =
{
0x00b5, 0x039c, 0x0130, 0x0130, 0x0131, 0x0049, 0x017f, 0x0053, 0x01c5, 0x01c4,
0x01c8, 0x01c7, 0x01cb, 0x01ca, 0x01f2, 0x01f1, 0x0345, 0x0399, 0x03c2, 0x03a3,
@ -156,7 +156,7 @@ static const uint16_t lit_upper_case_conversions[] JERRY_CONST_DATA =
};
/* Number of one-to-one, one-to-two, and one-to-three uppercase conversions. */
static const uint8_t lit_upper_case_conversion_counters[] JERRY_CONST_DATA =
static const uint8_t lit_upper_case_conversion_counters[] JERRY_ATTR_CONST_DATA =
{
0x001c, 0x002c, 0x0010
};

View File

@ -22,7 +22,7 @@
* The characters covered by these intervals are from
* the following Unicode categories: Lu, Ll, Lt, Lm, Lo, Nl
*/
static const uint16_t lit_unicode_letter_interval_sps[] JERRY_CONST_DATA =
static const uint16_t lit_unicode_letter_interval_sps[] JERRY_ATTR_CONST_DATA =
{
0x00c0, 0x00d8, 0x00f8, 0x01f8, 0x02c6, 0x02e0, 0x0370, 0x0376, 0x037a, 0x0388,
0x038e, 0x03a3, 0x03f7, 0x048a, 0x0531, 0x0561, 0x05d0, 0x05f0, 0x0620, 0x066e,
@ -63,7 +63,7 @@ static const uint16_t lit_unicode_letter_interval_sps[] JERRY_CONST_DATA =
* The characters covered by these intervals are from
* the following Unicode categories: Lu, Ll, Lt, Lm, Lo, Nl
*/
static const uint8_t lit_unicode_letter_interval_lengths[] JERRY_CONST_DATA =
static const uint8_t lit_unicode_letter_interval_lengths[] JERRY_ATTR_CONST_DATA =
{
0x0016, 0x001e, 0x00ff, 0x00c9, 0x000b, 0x0004, 0x0004, 0x0001, 0x0003, 0x0002,
0x0013, 0x0052, 0x008a, 0x00a5, 0x0025, 0x0026, 0x001a, 0x0002, 0x002a, 0x0001,
@ -105,7 +105,7 @@ static const uint8_t lit_unicode_letter_interval_lengths[] JERRY_CONST_DATA =
* The characters are from the following Unicode categories:
* Lu, Ll, Lt, Lm, Lo, Nl
*/
static const uint16_t lit_unicode_letter_chars[] JERRY_CONST_DATA =
static const uint16_t lit_unicode_letter_chars[] JERRY_ATTR_CONST_DATA =
{
0x00aa, 0x00b5, 0x00ba, 0x02ec, 0x02ee, 0x037f, 0x0386, 0x038c, 0x0559, 0x06d5,
0x06ff, 0x0710, 0x07b1, 0x07fa, 0x081a, 0x0824, 0x0828, 0x093d, 0x0950, 0x09b2,
@ -125,7 +125,7 @@ static const uint16_t lit_unicode_letter_chars[] JERRY_CONST_DATA =
* The characters covered by these intervals are from
* the following Unicode categories: Nd, Mn, Mc, Pc
*/
static const uint16_t lit_unicode_non_letter_ident_part_interval_sps[] JERRY_CONST_DATA =
static const uint16_t lit_unicode_non_letter_ident_part_interval_sps[] JERRY_ATTR_CONST_DATA =
{
0x0300, 0x0483, 0x0591, 0x05c1, 0x05c4, 0x0610, 0x064b, 0x06d6, 0x06df, 0x06e7,
0x06ea, 0x06f0, 0x0730, 0x07a6, 0x07c0, 0x07eb, 0x0816, 0x081b, 0x0825, 0x0829,
@ -155,7 +155,7 @@ static const uint16_t lit_unicode_non_letter_ident_part_interval_sps[] JERRY_CON
* The characters covered by these intervals are from
* the following Unicode categories: Nd, Mn, Mc, Pc
*/
static const uint8_t lit_unicode_non_letter_ident_part_interval_lengths[] JERRY_CONST_DATA =
static const uint8_t lit_unicode_non_letter_ident_part_interval_lengths[] JERRY_ATTR_CONST_DATA =
{
0x006f, 0x0004, 0x002c, 0x0001, 0x0001, 0x000a, 0x001e, 0x0006, 0x0005, 0x0001,
0x0003, 0x0009, 0x001a, 0x000a, 0x0009, 0x0008, 0x0003, 0x0008, 0x0002, 0x0004,
@ -186,7 +186,7 @@ static const uint8_t lit_unicode_non_letter_ident_part_interval_lengths[] JERRY_
* The characters are from the following Unicode categories:
* Nd, Mn, Mc, Pc
*/
static const uint16_t lit_unicode_non_letter_ident_part_chars[] JERRY_CONST_DATA =
static const uint16_t lit_unicode_non_letter_ident_part_chars[] JERRY_ATTR_CONST_DATA =
{
0x05bf, 0x05c7, 0x0670, 0x0711, 0x09bc, 0x09d7, 0x0a3c, 0x0a51, 0x0a75, 0x0abc,
0x0b3c, 0x0b82, 0x0bd7, 0x0cbc, 0x0d57, 0x0dca, 0x0dd6, 0x0e31, 0x0eb1, 0x0f35,
@ -197,7 +197,7 @@ static const uint16_t lit_unicode_non_letter_ident_part_chars[] JERRY_CONST_DATA
/**
* Unicode separator character interval starting points from Unicode category: Zs
*/
static const uint16_t lit_unicode_separator_char_interval_sps[] JERRY_CONST_DATA =
static const uint16_t lit_unicode_separator_char_interval_sps[] JERRY_ATTR_CONST_DATA =
{
0x2000
};
@ -205,7 +205,7 @@ static const uint16_t lit_unicode_separator_char_interval_sps[] JERRY_CONST_DATA
/**
* Unicode separator character interval lengths from Unicode category: Zs
*/
static const uint8_t lit_unicode_separator_char_interval_lengths[] JERRY_CONST_DATA =
static const uint8_t lit_unicode_separator_char_interval_lengths[] JERRY_ATTR_CONST_DATA =
{
0x000b
};
@ -216,7 +216,7 @@ static const uint8_t lit_unicode_separator_char_interval_lengths[] JERRY_CONST_D
*
* Unicode category: Zs
*/
static const uint16_t lit_unicode_separator_chars[] JERRY_CONST_DATA =
static const uint16_t lit_unicode_separator_chars[] JERRY_ATTR_CONST_DATA =
{
0x1680, 0x180e, 0x202f, 0x205f, 0x3000
};

View File

@ -21,7 +21,7 @@ JERRY_STATIC_ASSERT ((sizeof (cbc_uint8_arguments_t) % sizeof (jmem_cpointer_t))
JERRY_STATIC_ASSERT ((sizeof (cbc_uint16_arguments_t) % sizeof (jmem_cpointer_t)) == 0,
sizeof_cbc_uint16_arguments_t_must_be_divisible_by_sizeof_jmem_cpointer_t);
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
/** \addtogroup parser Parser
* @{
@ -42,7 +42,7 @@ JERRY_STATIC_ASSERT ((sizeof (cbc_uint16_arguments_t) % sizeof (jmem_cpointer_t)
/**
* Flags of the opcodes.
*/
const uint8_t cbc_flags[] JERRY_CONST_DATA =
const uint8_t cbc_flags[] JERRY_ATTR_CONST_DATA =
{
CBC_OPCODE_LIST
};
@ -57,7 +57,7 @@ const uint8_t cbc_ext_flags[] =
#undef CBC_OPCODE
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#define CBC_OPCODE(arg1, arg2, arg3, arg4) #arg1,
@ -79,7 +79,7 @@ const char * const cbc_ext_names[] =
#undef CBC_OPCODE
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
/**
* @}
@ -87,4 +87,4 @@ const char * const cbc_ext_names[] =
* @}
*/
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */

View File

@ -692,7 +692,7 @@ typedef enum
extern const uint8_t cbc_flags[];
extern const uint8_t cbc_ext_flags[];
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
/**
* Opcode names for debugging.
@ -700,7 +700,7 @@ extern const uint8_t cbc_ext_flags[];
extern const char * const cbc_names[];
extern const char * const cbc_ext_names[];
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
/**
* @}

View File

@ -16,7 +16,7 @@
#include "common.h"
#include "ecma-helpers.h"
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
/** \addtogroup parser Parser
* @{
@ -49,7 +49,7 @@ util_free_literal (lexer_literal_t *literal_p) /**< literal */
}
} /* util_free_literal */
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
/**
* Debug utility to print a character sequence.
@ -124,7 +124,7 @@ util_print_literal (lexer_literal_t *literal_p) /**< literal */
JERRY_DEBUG_MSG (")");
} /* util_print_literal */
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
/**
* @}
@ -132,4 +132,4 @@ util_print_literal (lexer_literal_t *literal_p) /**< literal */
* @}
*/
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */

View File

@ -32,6 +32,7 @@
* @{
*/
#include "config.h"
#include "ecma-globals.h"
#include "ecma-regexp-object.h"
#include "jmem.h"
@ -74,11 +75,11 @@ typedef enum
/**
* Type of property length.
*/
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
typedef uint32_t prop_length_t;
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
typedef uint16_t prop_length_t;
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
/**
* Literal data.
@ -93,11 +94,11 @@ typedef struct
uint32_t source_data; /**< encoded source literal */
} u;
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
struct
#else /* !PARSER_DUMP_BYTE_CODE */
#else /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
union
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
{
prop_length_t length; /**< length of ident / string literal */
uint16_t index; /**< real index during post processing */
@ -109,9 +110,9 @@ typedef struct
void util_free_literal (lexer_literal_t *literal_p);
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
void util_print_literal (lexer_literal_t *);
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
/* TRY/CATCH block */

View File

@ -21,7 +21,7 @@
#include "lit-char-helpers.h"
#include "jcontext.h"
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
/** \addtogroup parser Parser
* @{
@ -2642,4 +2642,4 @@ lexer_convert_binary_lvalue_token_to_binary (uint8_t token) /**< binary lvalue t
* @}
*/
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */

View File

@ -15,7 +15,7 @@
#include "js-parser-internal.h"
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
#include "jcontext.h"
#include "ecma-helpers.h"
@ -2352,4 +2352,4 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
* @}
*/
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */

View File

@ -383,10 +383,10 @@ typedef struct
uint16_t context_stack_depth; /**< current context stack depth */
#endif /* !JERRY_NDEBUG */
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
int is_show_opcodes; /**< show opcodes */
uint32_t total_byte_code_size; /**< total byte code size */
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#ifdef JERRY_DEBUGGER
parser_breakpoint_info_t breakpoint_info[PARSER_MAX_BREAKPOINT_INFO_COUNT]; /**< breakpoint info list */
@ -394,9 +394,9 @@ typedef struct
parser_line_counter_t last_breakpoint_line; /**< last line where breakpoint has been inserted */
#endif /* JERRY_DEBUGGER */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
parser_line_counter_t last_line_info_line; /**< last line where line info has been inserted */
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
} parser_context_t;
/**
@ -611,11 +611,11 @@ void parser_append_breakpoint_info (parser_context_t *context_p, jerry_debugger_
#endif /* JERRY_DEBUGGER */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
void parser_emit_line_info (parser_context_t *context_p, uint32_t line, bool flush_cbc);
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
/**
* @}

View File

@ -38,11 +38,11 @@
* Maximum string limit.
* Limit: 2147483647 / 65535.
*/
#ifdef JERRY_CPOINTER_32_BIT
#if ENABLED (JERRY_CPOINTER_32_BIT)
#define PARSER_MAXIMUM_STRING_LIMIT 2147483647
#else /* !JERRY_CPOINTER_32_BIT */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#define PARSER_MAXIMUM_STRING_LIMIT 65535
#endif /* JERRY_CPOINTER_32_BIT */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
/**
* Maximum string length.

View File

@ -15,7 +15,7 @@
#include "js-parser-internal.h"
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
/** \addtogroup mem Memory allocation
* @{
@ -678,4 +678,4 @@ parser_stack_iterator_write (parser_stack_iterator_t *iterator, /**< iterator */
* @}
*/
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */

View File

@ -16,7 +16,7 @@
#include "js-parser-internal.h"
#include "lit-char-helpers.h"
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
/** \addtogroup parser Parser
* @{
@ -1027,4 +1027,4 @@ parser_scan_until (parser_context_t *context_p, /**< context */
* @}
*/
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */

View File

@ -15,7 +15,7 @@
#include "js-parser-internal.h"
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
#include "jcontext.h"
#include "ecma-helpers.h"
@ -344,9 +344,9 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
#if defined (JERRY_DEBUGGER) || defined (JERRY_ENABLE_LINE_INFO)
#if defined (JERRY_DEBUGGER) || ENABLED (JERRY_LINE_INFO)
parser_line_counter_t ident_line_counter = context_p->token.line;
#endif /* JERRY_DEBUGGER || JERRY_ENABLE_LINE_INFO */
#endif /* JERRY_DEBUGGER || ENABLED (JERRY_LINE_INFO) */
context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_VAR;
@ -375,12 +375,12 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
}
#endif /* JERRY_DEBUGGER */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
if (ident_line_counter != context_p->last_line_info_line)
{
parser_emit_line_info (context_p, ident_line_counter, false);
}
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
parser_parse_expression (context_p,
@ -1307,9 +1307,9 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
switch_case_was_found = false;
default_case_was_found = false;
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
uint32_t last_line_info_line = context_p->last_line_info_line;
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
while (true)
{
@ -1365,12 +1365,12 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
lexer_next_token (context_p);
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
if (context_p->token.line != context_p->last_line_info_line)
{
parser_emit_line_info (context_p, context_p->token.line, true);
}
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
parser_parse_expression (context_p, PARSE_EXPR);
@ -1386,9 +1386,9 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
JERRY_ASSERT (switch_case_was_found || default_case_was_found);
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
context_p->last_line_info_line = last_line_info_line;
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
if (!switch_case_was_found)
{
@ -2190,14 +2190,14 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
}
#endif /* JERRY_DEBUGGER */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
if (JERRY_CONTEXT (resource_name) != ECMA_VALUE_UNDEFINED)
{
parser_emit_cbc_ext (context_p, CBC_EXT_RESOURCE_NAME);
parser_flush_cbc (context_p);
}
context_p->last_line_info_line = 0;
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
while (context_p->token.type == LEXER_LITERAL
&& context_p->token.lit_location.type == LEXER_STRING_LITERAL)
@ -2242,9 +2242,9 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
context_p->last_breakpoint_line = context_p->token.line;
}
#endif /* JERRY_DEBUGGER */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
parser_emit_line_info (context_p, context_p->token.line, false);
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
lexer_construct_literal_object (context_p, &lit_location, LEXER_STRING_LITERAL);
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
@ -2254,14 +2254,14 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
break;
}
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes
&& !(status_flags & PARSER_IS_STRICT)
&& (context_p->status_flags & PARSER_IS_STRICT))
{
JERRY_DEBUG_MSG (" Note: switch to strict mode\n\n");
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
if (context_p->token.type == LEXER_SEMICOLON)
{
@ -2313,7 +2313,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
}
#endif /* JERRY_DEBUGGER */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
if (context_p->token.line != context_p->last_line_info_line
&& context_p->token.type != LEXER_SEMICOLON
&& context_p->token.type != LEXER_LEFT_BRACE
@ -2325,7 +2325,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
{
parser_emit_line_info (context_p, context_p->token.line, true);
}
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
switch (context_p->token.type)
{
@ -2932,4 +2932,4 @@ parser_free_jumps (parser_stack_iterator_t iterator) /**< iterator position */
* @}
*/
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */

View File

@ -15,11 +15,11 @@
#include "js-parser-internal.h"
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
#include "jcontext.h"
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
/** \addtogroup parser Parser
* @{
@ -171,7 +171,7 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
context_p->byte_code_size++;
}
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes)
{
JERRY_DEBUG_MSG (" [%3d] %s",
@ -224,7 +224,7 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
JERRY_DEBUG_MSG ("\n");
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
if (context_p->stack_depth > context_p->stack_limit)
{
@ -386,7 +386,7 @@ parser_emit_cbc_push_number (parser_context_t *context_p, /**< context */
context_p->last_cbc.value = (uint16_t) (value - 1);
} /* parser_emit_cbc_push_number */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
/**
* Append a line info data
@ -406,12 +406,12 @@ parser_emit_line_info (parser_context_t *context_p, /**< context */
parser_flush_cbc (context_p);
}
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes)
{
JERRY_DEBUG_MSG (" [%3d] CBC_EXT_LINE %d\n", (int) context_p->stack_depth, line);
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
parser_emit_two_bytes (context_p, CBC_EXT_OPCODE, CBC_EXT_LINE);
context_p->byte_code_size += 2;
@ -443,7 +443,7 @@ parser_emit_line_info (parser_context_t *context_p, /**< context */
while (shift > 0);
} /* parser_emit_line_info */
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
/**
* Append a byte code with a branch argument
@ -488,14 +488,14 @@ parser_emit_cbc_forward_branch (parser_context_t *context_p, /**< context */
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes)
{
JERRY_DEBUG_MSG (" [%3d] %s\n",
(int) context_p->stack_depth,
extra_byte_code_increase == 0 ? cbc_names[opcode] : cbc_ext_names[opcode]);
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#if PARSER_MAXIMUM_CODE_SIZE <= 65535
opcode++;
@ -559,9 +559,9 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
uint32_t offset) /**< destination offset */
{
uint8_t flags;
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
const char *name;
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)
{
@ -576,9 +576,9 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
JERRY_ASSERT (opcode < CBC_END);
flags = cbc_flags[opcode];
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
name = cbc_names[opcode];
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
}
else
{
@ -589,9 +589,9 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
flags = cbc_ext_flags[opcode];
context_p->byte_code_size++;
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
name = cbc_ext_names[opcode];
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
}
JERRY_ASSERT (flags & CBC_HAS_BRANCH_ARG);
@ -604,12 +604,12 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes)
{
JERRY_DEBUG_MSG (" [%3d] %s\n", (int) context_p->stack_depth, name);
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
context_p->byte_code_size += 2;
#if PARSER_MAXIMUM_CODE_SIZE <= 65535
@ -737,7 +737,7 @@ parser_set_continues_to_current_position (parser_context_t *context_p, /**< cont
}
} /* parser_set_continues_to_current_position */
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
/**
* Returns with the string representation of the error
*/
@ -1125,7 +1125,7 @@ parser_error_to_string (parser_error_t error) /**< error code */
}
}
} /* parser_error_to_string */
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
/**
* @}
@ -1133,4 +1133,4 @@ parser_error_to_string (parser_error_t error) /**< error code */
* @}
*/
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */

View File

@ -21,7 +21,7 @@
#include "jcontext.h"
#include "js-parser-internal.h"
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
JERRY_STATIC_ASSERT ((int) ECMA_PARSE_STRICT_MODE == (int) PARSER_IS_STRICT,
ecma_parse_strict_mode_must_be_equal_to_parser_is_strict);
@ -173,18 +173,18 @@ parser_compute_indicies (parser_context_t *context_p, /**< context */
{
if (literal_p->status_flags & LEXER_FLAG_UNUSED_IDENT)
{
#ifndef PARSER_DUMP_BYTE_CODE
#if !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (!(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))
{
jmem_heap_free_block ((void *) literal_p->u.char_p, literal_p->prop.length);
}
#endif /* !PARSER_DUMP_BYTE_CODE */
#endif /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
context_p->literal_count--;
continue;
}
#ifndef PARSER_DUMP_BYTE_CODE
#if !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (literal_p->type == LEXER_IDENT_LITERAL
|| literal_p->type == LEXER_STRING_LITERAL)
{
@ -218,7 +218,7 @@ parser_compute_indicies (parser_context_t *context_p, /**< context */
}
}
}
#endif /* !PARSER_DUMP_BYTE_CODE */
#endif /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
switch (literal_p->type)
{
@ -631,28 +631,26 @@ parser_generate_initializers (parser_context_t *context_p, /**< context */
{
if (literal_p->prop.index >= register_count)
{
#ifdef PARSER_DUMP_BYTE_CODE
if (!(literal_p->status_flags & LEXER_FLAG_UNUSED_IDENT))
{
ecma_value_t lit_value = ecma_find_or_create_literal_string (literal_p->u.char_p,
literal_p->prop.length);
ecma_value_t lit_value;
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
lit_value = ecma_find_or_create_literal_string (literal_p->u.char_p,
literal_p->prop.length);
#else /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
lit_value = literal_p->u.value;
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
literal_pool_p[literal_p->prop.index] = lit_value;
}
#else /* !PARSER_DUMP_BYTE_CODE */
if (!(literal_p->status_flags & LEXER_FLAG_UNUSED_IDENT))
{
literal_pool_p[literal_p->prop.index] = literal_p->u.value;
}
#endif /* PARSER_DUMP_BYTE_CODE */
}
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (!context_p->is_show_opcodes
&& !(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))
{
jmem_heap_free_block ((void *) literal_p->u.char_p, literal_p->prop.length);
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
}
else if ((literal_p->type == LEXER_FUNCTION_LITERAL)
|| (literal_p->type == LEXER_REGEXP_LITERAL))
@ -961,7 +959,7 @@ parse_update_branches (parser_context_t *context_p, /**< context */
context_p->byte_code.first_p = last_page_p;
} /* parse_update_branches */
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
/**
* Print literal.
@ -1291,7 +1289,7 @@ parse_print_final_cbc (ecma_compiled_code_t *compiled_code_p, /**< compiled code
JERRY_DEBUG_MSG (" %3d : %s", (int) cbc_offset, cbc_ext_names[ext_opcode]);
byte_code_p += 2;
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
if (ext_opcode == CBC_EXT_LINE)
{
uint32_t value = 0;
@ -1307,7 +1305,7 @@ parse_print_final_cbc (ecma_compiled_code_t *compiled_code_p, /**< compiled code
JERRY_DEBUG_MSG (" %d\n", (int) value);
continue;
}
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
}
if (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))
@ -1374,7 +1372,7 @@ parse_print_final_cbc (ecma_compiled_code_t *compiled_code_p, /**< compiled code
#undef PARSER_READ_IDENTIFIER_INDEX
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#ifdef JERRY_DEBUGGER
@ -1471,9 +1469,9 @@ parser_post_processing (parser_context_t *context_p) /**< context */
size_t length;
size_t literal_length;
size_t total_size;
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
#if ENABLED (JERRY_SNAPSHOT_SAVE)
size_t total_size_used;
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
size_t initializers_length;
uint8_t real_offset;
uint8_t *byte_code_p;
@ -1571,7 +1569,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
}
#endif /* ENABLED (JERRY_ES2015_CLASS) */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
if (ext_opcode == CBC_EXT_LINE)
{
uint8_t last_byte = 0;
@ -1586,7 +1584,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
continue;
}
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
}
while (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))
@ -1738,31 +1736,31 @@ parser_post_processing (parser_context_t *context_p) /**< context */
total_size += context_p->argument_count * sizeof (ecma_value_t);
}
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
if (JERRY_CONTEXT (resource_name) != ECMA_VALUE_UNDEFINED)
{
total_size += sizeof (ecma_value_t);
}
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
#if ENABLED (JERRY_SNAPSHOT_SAVE)
total_size_used = total_size;
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
total_size = JERRY_ALIGNUP (total_size, JMEM_ALIGNMENT);
compiled_code_p = (ecma_compiled_code_t *) parser_malloc (context_p, total_size);
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
#if ENABLED (JERRY_SNAPSHOT_SAVE)
// Avoid getting junk bytes at the end when bytes at the end remain unused:
if (total_size_used < total_size)
{
memset (((uint8_t *) compiled_code_p) + total_size_used, 0, total_size - total_size_used);
}
#endif
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
#ifdef JMEM_STATS
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_allocate_byte_code_bytes (total_size);
#endif /* JMEM_STATS */
#endif /* ENABLED (JERRY_MEM_STATS) */
byte_code_p = (uint8_t *) compiled_code_p;
compiled_code_p->size = (uint16_t) (total_size >> JMEM_ALIGNMENT_LOG);
@ -1925,7 +1923,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
real_offset++;
PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
if (ext_opcode == CBC_EXT_LINE)
{
uint8_t last_byte = 0;
@ -1942,7 +1940,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
continue;
}
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
}
if (flags & CBC_HAS_BRANCH_ARG)
@ -2045,7 +2043,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
parser_cbc_stream_free (&context_p->byte_code);
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes)
{
parser_list_iterator_t literal_iterator;
@ -2065,7 +2063,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
}
}
}
#else /* !PARSER_DUMP_BYTE_CODE */
#else /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
if (context_p->status_flags & PARSER_HAS_LATE_LIT_INIT)
{
parser_list_iterator_t literal_iterator;
@ -2086,7 +2084,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
}
}
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
if ((context_p->status_flags & PARSER_ARGUMENTS_NEEDED)
&& !(context_p->status_flags & PARSER_IS_STRICT))
@ -2135,7 +2133,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
}
}
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
if (JERRY_CONTEXT (resource_name) != ECMA_VALUE_UNDEFINED)
{
ecma_value_t *resource_name_p = (ecma_value_t *) (((uint8_t *) compiled_code_p) + total_size);
@ -2148,7 +2146,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
resource_name_p[-1] = JERRY_CONTEXT (resource_name);
}
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
#ifdef JERRY_DEBUGGER
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
@ -2427,7 +2425,7 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
context.context_stack_depth = 0;
#endif /* !JERRY_NDEBUG */
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
context.is_show_opcodes = (JERRY_CONTEXT (jerry_init_flags) & ECMA_INIT_SHOW_OPCODES);
context.total_byte_code_size = 0;
@ -2437,7 +2435,7 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
(arg_list_p == NULL) ? "Script"
: "Function");
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#ifdef JERRY_DEBUGGER
context.breakpoint_info_count = 0;
@ -2482,7 +2480,7 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
compiled_code_p = parser_post_processing (&context);
parser_list_free (&context.literal_pool);
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context.is_show_opcodes)
{
JERRY_DEBUG_MSG ("\n%s parsing successfully completed. Total byte code size: %d bytes\n",
@ -2490,7 +2488,7 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
: "Function",
(int) context.total_byte_code_size);
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
}
PARSER_CATCH
{
@ -2526,14 +2524,14 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
}
PARSER_TRY_END
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context.is_show_opcodes)
{
JERRY_DEBUG_MSG ("\n--- %s parsing end ---\n\n",
(arg_list_p == NULL) ? "Script"
: "Function");
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
parser_stack_free (&context);
@ -2647,7 +2645,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
parser_save_context (context_p, &saved_context);
context_p->status_flags |= status_flags;
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes)
{
#if ENABLED (JERRY_ES2015_CLASS)
@ -2658,7 +2656,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
JERRY_DEBUG_MSG ("\n--- Function parsing start ---\n\n");
#endif /* ENABLED (JERRY_ES2015_CLASS) */
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#ifdef JERRY_DEBUGGER
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
@ -2694,13 +2692,13 @@ parser_parse_function (parser_context_t *context_p, /**< context */
parser_raise_error (context_p, PARSER_ERR_ONE_ARGUMENT_EXPECTED);
}
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes
&& (context_p->status_flags & PARSER_HAS_NON_STRICT_ARG))
{
JERRY_DEBUG_MSG (" Note: legacy (non-strict) argument definition\n\n");
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
if (context_p->token.type != LEXER_LEFT_BRACE)
{
@ -2718,7 +2716,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
parser_parse_statements (context_p);
compiled_code_p = parser_post_processing (context_p);
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes)
{
#if ENABLED (JERRY_ES2015_CLASS)
@ -2729,7 +2727,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
JERRY_DEBUG_MSG ("\n--- Function parsing end ---\n\n");
#endif /* ENABLED (JERRY_ES2015_CLASS) */
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
parser_restore_context (context_p, &saved_context);
@ -2758,12 +2756,12 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
context_p->status_flags |= saved_context.status_flags & PARSER_CLASS_HAS_SUPER;
#endif /* ENABLED (JERRY_ES2015_CLASS) */
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes)
{
JERRY_DEBUG_MSG ("\n--- Arrow function parsing start ---\n\n");
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#ifdef JERRY_DEBUGGER
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
@ -2842,12 +2840,12 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
compiled_code_p = parser_post_processing (context_p);
#ifdef PARSER_DUMP_BYTE_CODE
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
if (context_p->is_show_opcodes)
{
JERRY_DEBUG_MSG ("\n--- Arrow function parsing end ---\n\n");
}
#endif /* PARSER_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
parser_restore_context (context_p, &saved_context);
@ -2891,7 +2889,7 @@ parser_raise_error (parser_context_t *context_p, /**< context */
JERRY_ASSERT (0);
} /* parser_raise_error */
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */
/**
* Parse EcmaScript source code
@ -2911,7 +2909,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
uint32_t parse_opts, /**< ecma_parse_opts_t option bits */
ecma_compiled_code_t **bytecode_data_p) /**< [out] JS bytecode */
{
#ifndef JERRY_DISABLE_JS_PARSER
#if ENABLED (JERRY_PARSER)
parser_error_location_t parser_error;
#ifdef JERRY_DEBUGGER
@ -2954,7 +2952,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
JERRY_CONTEXT (status_flags) |= ECMA_STATUS_EXCEPTION;
return ECMA_VALUE_ERROR;
}
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
const lit_utf8_byte_t *err_bytes_p = (const lit_utf8_byte_t *) parser_error_to_string (parser_error.error);
lit_utf8_size_t err_bytes_size = lit_zt_utf8_string_size (err_bytes_p);
@ -2974,9 +2972,9 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
ecma_free_value (err_str_val);
return error_value;
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
return ecma_raise_syntax_error ("");
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
}
#if ENABLED (JERRY_ES2015_MODULE_SYSTEM)
@ -3017,7 +3015,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
#endif /* JERRY_DEBUGGER */
return ECMA_VALUE_TRUE;
#else /* JERRY_DISABLE_JS_PARSER */
#else /* !ENABLED (JERRY_PARSER) */
JERRY_UNUSED (arg_list_p);
JERRY_UNUSED (arg_list_size);
JERRY_UNUSED (source_p);
@ -3026,7 +3024,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
JERRY_UNUSED (bytecode_data_p);
return ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."));
#endif /* !JERRY_DISABLE_JS_PARSER */
#endif /* ENABLED (JERRY_PARSER) */
} /* parser_parse_script */
/**

View File

@ -169,9 +169,9 @@ ecma_value_t parser_parse_script (const uint8_t *arg_list_p, size_t arg_list_siz
const uint8_t *source_p, size_t source_size,
uint32_t parse_opts, ecma_compiled_code_t **bytecode_data_p);
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
const char *parser_error_to_string (parser_error_t);
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
/**
* @}

View File

@ -233,7 +233,7 @@ re_insert_u32 (re_bytecode_ctx_t *bc_ctx_p, /**< RegExp bytecode context */
re_bytecode_list_insert (bc_ctx_p, offset, (uint8_t *) &value, sizeof (uint32_t));
} /* re_insert_u32 */
#ifdef REGEXP_DUMP_BYTE_CODE
#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE)
/**
* RegExp bytecode dumper
*/
@ -435,7 +435,7 @@ re_dump_bytecode (re_bytecode_ctx_t *bc_ctx_p) /**< RegExp bytecode context */
}
JERRY_DEBUG_MSG ("EOF\n");
} /* re_dump_bytecode */
#endif /* REGEXP_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */
/**
* @}

View File

@ -114,9 +114,9 @@ void re_insert_opcode (re_bytecode_ctx_t *bc_ctx_p, uint32_t offset, re_opcode_t
void re_insert_u32 (re_bytecode_ctx_t *bc_ctx_p, uint32_t offset, uint32_t value);
void re_bytecode_list_insert (re_bytecode_ctx_t *bc_ctx_p, size_t offset, uint8_t *bytecode_p, size_t length);
#ifdef REGEXP_DUMP_BYTE_CODE
#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE)
void re_dump_bytecode (re_bytecode_ctx_t *bc_ctx);
#endif /* REGEXP_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */
/**
* @}

View File

@ -629,12 +629,12 @@ re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, /**< [out] point
}
else
{
#ifdef REGEXP_DUMP_BYTE_CODE
#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE)
if (JERRY_CONTEXT (jerry_init_flags) & ECMA_INIT_SHOW_REGEXP_OPCODES)
{
re_dump_bytecode (&bc_ctx);
}
#endif /* REGEXP_DUMP_BYTE_CODE */
#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */
/* The RegExp bytecode contains at least a RE_OP_SAVE_AT_START opdoce, so it cannot be NULL. */
JERRY_ASSERT (bc_ctx.block_start_p != NULL);

View File

@ -41,9 +41,9 @@ typedef struct
uint32_t num_of_captures; /**< number of capture groups */
uint32_t num_of_non_captures; /**< number of non-capture groups */
uint32_t highest_backref; /**< highest backreference */
#ifdef REGEXP_RECURSION_LIMIT
#if defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0)
uint32_t recursion_counter; /**< RegExp recursion counter */
#endif /* REGEXP_RECURSION_LIMIT */
#endif /* defined (JERRY_REGEXP_RECURSION_LIMIT) && (JERRY_REGEXP_RECURSION_LIMIT != 0) */
re_bytecode_ctx_t *bytecode_ctx_p; /**< pointer of RegExp bytecode context */
re_token_t current_token; /**< current token */
re_parser_ctx_t *parser_ctx_p; /**< pointer of RegExp parser context */

View File

@ -50,10 +50,10 @@ typedef struct vm_frame_ctx_t
struct vm_frame_ctx_t *prev_context_p; /**< previous context */
ecma_value_t this_binding; /**< this binding */
ecma_value_t block_result; /**< block result */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
ecma_value_t resource_name; /**< current resource name (usually a file name) */
uint32_t current_line; /**< currently executed line */
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
uint16_t context_depth; /**< current context depth */
uint8_t is_eval_code; /**< eval mode flag */
uint8_t call_operation; /**< perform a call or construct operation */

View File

@ -60,7 +60,7 @@ vm_is_direct_eval_form_call (void)
ecma_value_t
vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimited */
{
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
ecma_value_t result_array = ecma_op_create_array_object (NULL, 0, false);
if (max_depth == 0)
@ -124,9 +124,9 @@ vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimite
}
return result_array;
#else /* !JERRY_ENABLE_LINE_INFO */
#else /* !ENABLED (JERRY_LINE_INFO) */
JERRY_UNUSED (max_depth);
return ecma_op_create_array_object (NULL, 0, false);
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
} /* vm_get_backtrace */

View File

@ -46,9 +46,9 @@
/*
* Check VM recursion depth limit
*/
#ifdef VM_RECURSION_LIMIT
JERRY_STATIC_ASSERT (VM_RECURSION_LIMIT > 0, vm_recursion_limit_must_be_greater_than_zero);
#endif /* VM_RECURSION_LIMIT */
#if defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0)
JERRY_STATIC_ASSERT (JERRY_VM_RECURSION_LIMIT > 0, vm_recursion_limit_must_be_greater_than_zero);
#endif /* defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0) */
/**
* Get the value of object[property].
@ -87,7 +87,7 @@ vm_op_get_value (ecma_value_t object, /**< base object */
if (property_name_p != NULL)
{
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if ENABLED (JERRY_LCACHE)
ecma_object_t *object_p = ecma_get_object_from_value (object);
ecma_property_t *property_p = ecma_lcache_lookup (object_p, property_name_p);
@ -96,7 +96,7 @@ vm_op_get_value (ecma_value_t object, /**< base object */
{
return ecma_fast_copy_value (ECMA_PROPERTY_VALUE_PTR (property_p)->value);
}
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#endif /* ENABLED (JERRY_LCACHE) */
/* There is no need to free the name. */
return ecma_op_object_get (ecma_get_object_from_value (object), property_name_p);
@ -105,14 +105,14 @@ vm_op_get_value (ecma_value_t object, /**< base object */
if (JERRY_UNLIKELY (ecma_is_value_undefined (object) || ecma_is_value_null (object)))
{
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
ecma_value_t error_value = ecma_raise_standard_error_with_format (ECMA_ERROR_TYPE,
"Cannot read property '%' of %",
property,
object);
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
ecma_value_t error_value = ecma_raise_type_error (NULL);
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
return error_value;
}
@ -151,7 +151,7 @@ vm_op_set_value (ecma_value_t object, /**< base object */
if (ECMA_IS_VALUE_ERROR (to_object))
{
#ifdef JERRY_ENABLE_ERROR_MESSAGES
#if ENABLED (JERRY_ERROR_MESSAGES)
ecma_free_value (to_object);
ecma_free_value (JERRY_CONTEXT (error_value));
@ -162,10 +162,10 @@ vm_op_set_value (ecma_value_t object, /**< base object */
ecma_free_value (property);
return error_value;
#else /* !JERRY_ENABLE_ERROR_MESSAGES */
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
ecma_free_value (property);
return to_object;
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
}
object = to_object;
@ -219,7 +219,7 @@ vm_op_set_value (ecma_value_t object, /**< base object */
/**
* Decode table for both opcodes and extended opcodes.
*/
static const uint16_t vm_decode_table[] JERRY_CONST_DATA =
static const uint16_t vm_decode_table[] JERRY_ATTR_CONST_DATA =
{
CBC_OPCODE_LIST
CBC_EXT_OPCODE_LIST
@ -338,14 +338,14 @@ vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
ecma_deref_object (lex_env_p);
ecma_free_value (this_binding);
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
{
ecma_bytecode_deref (bytecode_data_p);
}
#else /* !JERRY_ENABLE_SNAPSHOT_EXEC */
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
ecma_bytecode_deref (bytecode_data_p);
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
return completion_value;
} /* vm_run_eval */
@ -361,20 +361,20 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
{
ecma_compiled_code_t *bytecode_p;
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
if (JERRY_LIKELY (!(frame_ctx_p->bytecode_header_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)))
{
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
lit_value);
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
}
else
{
uint8_t *byte_p = ((uint8_t *) frame_ctx_p->bytecode_header_p) + lit_value;
bytecode_p = (ecma_compiled_code_t *) byte_p;
}
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#if ENABLED (JERRY_BUILTIN_REGEXP)
if (!(bytecode_p->status_flags & CBC_CODE_FLAGS_FUNCTION))
@ -870,14 +870,14 @@ vm_init_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
break;
}
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
#if ENABLED (JERRY_SNAPSHOT_EXEC)
case CBC_SET_BYTECODE_PTR:
{
memcpy (&byte_code_p, byte_code_p + 1, sizeof (uint8_t *));
frame_ctx_p->byte_code_start_p = byte_code_p;
break;
}
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
default:
{
@ -1036,7 +1036,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (opcode_data & VM_OC_BACKWARD_BRANCH)
{
#ifdef JERRY_VM_EXEC_STOP
#if ENABLED (JERRY_VM_EXEC_STOP)
if (JERRY_CONTEXT (vm_exec_stop_cb) != NULL
&& --JERRY_CONTEXT (vm_exec_stop_counter) == 0)
{
@ -1064,7 +1064,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
goto error;
}
}
#endif /* JERRY_VM_EXEC_STOP */
#endif /* ENABLED (JERRY_VM_EXEC_STOP) */
branch_offset = -branch_offset;
}
@ -2572,7 +2572,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (ecma_are_values_integer_numbers (left_value, right_value))
{
bool is_less = (ecma_integer_value_t) left_value < (ecma_integer_value_t) right_value;
#ifndef JERRY_VM_EXEC_STOP
#if !ENABLED (JERRY_VM_EXEC_STOP)
/* This is a lookahead to the next opcode to improve performance.
* If it is CBC_BRANCH_IF_TRUE_BACKWARD, execute it. */
if (*byte_code_p <= CBC_BRANCH_IF_TRUE_BACKWARD_3 && *byte_code_p >= CBC_BRANCH_IF_TRUE_BACKWARD)
@ -2606,7 +2606,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
#endif /* !JERRY_VM_EXEC_STOP */
#endif /* !ENABLED (JERRY_VM_EXEC_STOP) */
*stack_top_p++ = ecma_make_boolean_value (is_less);
continue;
}
@ -3178,7 +3178,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
#endif /* JERRY_DEBUGGER */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
case VM_OC_RESOURCE_NAME:
{
ecma_length_t formal_params_number = 0;
@ -3223,7 +3223,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
frame_ctx_p->current_line = value;
continue;
}
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
default:
{
JERRY_ASSERT (VM_OC_GROUP_GET_INDEX (opcode_data) == VM_OC_NONE);
@ -3598,9 +3598,9 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
}
#endif /* JERRY_DEBUGGER */
#ifdef VM_RECURSION_LIMIT
#if defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0)
JERRY_CONTEXT (vm_recursion_counter)++;
#endif /* VM_RECURSION_LIMIT */
#endif /* defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0) */
JERRY_CONTEXT (vm_top_context_p) = frame_ctx_p->prev_context_p;
return completion_value;
@ -3622,7 +3622,7 @@ vm_run (const ecma_compiled_code_t *bytecode_header_p, /**< byte-code data heade
const ecma_value_t *arg_list_p, /**< arguments list */
ecma_length_t arg_list_len) /**< length of arguments list */
{
#ifdef VM_RECURSION_LIMIT
#if defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0)
if (JERRY_UNLIKELY (JERRY_CONTEXT (vm_recursion_counter) == 0))
{
return ecma_raise_range_error (ECMA_ERR_MSG ("VM recursion limit is exceeded."));
@ -3631,7 +3631,7 @@ vm_run (const ecma_compiled_code_t *bytecode_header_p, /**< byte-code data heade
{
JERRY_CONTEXT (vm_recursion_counter)--;
}
#endif /* VM_RECURSION_LIMIT */
#endif /* defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0) */
ecma_value_t *literal_p;
vm_frame_ctx_t frame_ctx;
@ -3665,10 +3665,10 @@ vm_run (const ecma_compiled_code_t *bytecode_header_p, /**< byte-code data heade
frame_ctx.prev_context_p = JERRY_CONTEXT (vm_top_context_p);
frame_ctx.this_binding = this_binding_value;
frame_ctx.block_result = ECMA_VALUE_UNDEFINED;
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
frame_ctx.resource_name = ECMA_VALUE_UNDEFINED;
frame_ctx.current_line = 0;
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
frame_ctx.context_depth = 0;
frame_ctx.is_eval_code = parse_opts & ECMA_PARSE_DIRECT_EVAL;

View File

@ -236,10 +236,10 @@ typedef enum
VM_OC_BREAKPOINT_ENABLED, /**< enabled breakpoint for debugger */
VM_OC_BREAKPOINT_DISABLED, /**< disabled breakpoint for debugger */
#endif /* JERRY_DEBUGGER */
#ifdef JERRY_ENABLE_LINE_INFO
#if ENABLED (JERRY_LINE_INFO)
VM_OC_RESOURCE_NAME, /**< resource name of the current function */
VM_OC_LINE, /**< line number of the next statement */
#endif /* JERRY_ENABLE_LINE_INFO */
#endif /* ENABLED (JERRY_LINE_INFO) */
VM_OC_NONE, /**< a special opcode for unsupported byte codes */
} vm_oc_types;
@ -255,10 +255,10 @@ typedef enum
VM_OC_BREAKPOINT_ENABLED = VM_OC_NONE, /**< enabled breakpoint for debugger is unused */
VM_OC_BREAKPOINT_DISABLED = VM_OC_NONE, /**< disabled breakpoint for debugger is unused */
#endif /* !JERRY_DEBUGGER */
#ifndef JERRY_ENABLE_LINE_INFO
#if !ENABLED (JERRY_LINE_INFO)
VM_OC_RESOURCE_NAME = VM_OC_NONE, /**< resource name of the current function is unused */
VM_OC_LINE = VM_OC_NONE, /**< line number of the next statement is unused */
#endif /* !JERRY_ENABLE_LINE_INFO */
#endif /* !ENABLED (JERRY_LINE_INFO) */
#if !ENABLED (JERRY_ES2015_CLASS)
VM_OC_CLASS_HERITAGE = VM_OC_NONE, /**< create a super class context */
VM_OC_CLASS_INHERITANCE = VM_OC_NONE, /**< inherit properties from the 'super' class */

View File

@ -46,7 +46,7 @@ static const char *output_file_name_p = "js.snapshot";
static jerry_length_t magic_string_lengths[JERRY_LITERAL_LENGTH];
static const jerry_char_t *magic_string_items[JERRY_LITERAL_LENGTH];
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
/**
* The alloc function passed to jerry_create_context
*/
@ -58,7 +58,17 @@ context_alloc (size_t size,
return malloc (size);
} /* context_alloc */
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
/**
* Create and set the default external context.
*/
static void
context_init (void)
{
jerry_context_t *context_p = jerry_create_context (JERRY_GLOBAL_HEAP_SIZE * 1024, context_alloc, NULL);
jerry_port_default_set_current_context (context_p);
} /* context_init */
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
/**
* Check whether JerryScript has a requested feature enabled or not. If not,
@ -308,10 +318,9 @@ process_generate (cli_state_t *cli_state_p, /**< cli state */
return JERRY_STANDALONE_EXIT_CODE_FAIL;
}
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
jerry_context_t *context_p = jerry_create_context (CONFIG_MEM_HEAP_AREA_SIZE, context_alloc, NULL);
jerry_port_default_set_current_context (context_p);
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
context_init ();
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
jerry_init (flags);
@ -516,10 +525,9 @@ process_literal_dump (cli_state_t *cli_state_p, /**< cli state */
return JERRY_STANDALONE_EXIT_CODE_FAIL;
}
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
jerry_context_t *context_p = jerry_create_context (CONFIG_MEM_HEAP_AREA_SIZE, context_alloc, NULL);
jerry_port_default_set_current_context (context_p);
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
context_init ();
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
jerry_init (JERRY_INIT_EMPTY);
@ -685,10 +693,9 @@ process_merge (cli_state_t *cli_state_p, /**< cli state */
return JERRY_STANDALONE_EXIT_CODE_FAIL;
}
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
jerry_context_t *context_p = jerry_create_context (CONFIG_MEM_HEAP_AREA_SIZE, context_alloc, NULL);
jerry_port_default_set_current_context (context_p);
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
context_init ();
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
jerry_init (JERRY_INIT_EMPTY);

View File

@ -407,7 +407,7 @@ check_usage (bool condition, /**< the condition that must hold */
}
} /* check_usage */
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
/**
* The alloc function passed to jerry_create_context
@ -420,7 +420,7 @@ context_alloc (size_t size,
return malloc (size);
} /* context_alloc */
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
/**
* Inits the engine and the debugger
@ -666,12 +666,12 @@ main (int argc,
is_repl_mode = true;
}
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
jerry_context_t *context_p = jerry_create_context (CONFIG_MEM_HEAP_AREA_SIZE, context_alloc, NULL);
jerry_context_t *context_p = jerry_create_context (JERRY_GLOBAL_HEAP_SIZE * 1024, context_alloc, NULL);
jerry_port_default_set_current_context (context_p);
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
if (!start_debug_server)
{
@ -938,8 +938,8 @@ main (int argc,
jerry_release_value (ret_value);
jerry_cleanup ();
#ifdef JERRY_ENABLE_EXTERNAL_CONTEXT
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
free (context_p);
#endif /* JERRY_ENABLE_EXTERNAL_CONTEXT */
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
return ret_code;
} /* main */

View File

@ -83,7 +83,7 @@ def build_jerry_data(jerry_path):
jerry_dirs.add(os.path.split(path)[0])
jerry_cflags = [
'-DCONFIG_MEM_HEAP_AREA_SIZE=10*1024',
'-DJERRY_GLOBAL_HEAP_SIZE=10',
'-DJERRY_NDEBUG',
'-DJERRY_DISABLE_HEAVY_DEBUG',
'-DJERRY_BUILTIN_NUMBER=0',
@ -97,8 +97,8 @@ def build_jerry_data(jerry_path):
'-DJERRY_BUILTIN_REGEXP=0',
'-DJERRY_BUILTIN_ANNEXB=0',
'-DJERRY_ES2015=0',
'-DCONFIG_ECMA_LCACHE_DISABLE',
'-DCONFIG_ECMA_PROPERTY_HASHMAP_DISABLE',
'-DJERRY_LCACHE=0',
'-DJERRY_PROPRETY_HASHMAP=0',
]
return {

View File

@ -28,7 +28,7 @@ MFORCE32 = $(shell xtensa-lx106-elf-gcc --help=target | grep mforce-l32)
ifneq ($(MFORCE32),)
# Your compiler supports the -mforce-l32 flag which means that
# constants can be placed in ROM to free additional RAM
ESP_CFLAGS += -DJERRY_CONST_DATA="__attribute__((aligned(4))) __attribute__((section(\".irom.text\")))"
ESP_CFLAGS += -DJERRY_ATTR_CONST_DATA="__attribute__((aligned(4))) __attribute__((section(\".irom.text\")))"
ESP_CFLAGS += -mforce-l32
endif
@ -52,7 +52,7 @@ jerry:
-DENABLE_ALL_IN_ONE=ON \
-DJERRY_CMDLINE=OFF \
-DEXTERNAL_COMPILE_FLAGS="$(ESP_CFLAGS)" \
-DMEM_HEAP_SIZE_KB=$(JERRYHEAP)
-DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP)
make -C$(BUILD_DIR) jerry-core jerry-libm
cp $(BUILD_DIR)/lib/libjerry-core.a $(COPYTARGET)/

View File

@ -63,7 +63,7 @@ The existing open source gcc compiler with Xtensa support stores const(ants) in
the same limited RAM where our code needs to run.
It is possible to force the compiler to store a constant into ROM and also read it from there thus saving RAM.
The only requirement is to add `JERRY_CONST_DATA` attribute to your constant.
The only requirement is to add `JERRY_ATTR_CONST_DATA` attribute to your constant.
For example:
@ -74,7 +74,7 @@ static const lit_magic_size_t lit_magic_string_sizes[] =
can be modified to
```C
static const lit_magic_size_t lit_magic_string_sizes[] JERRY_CONST_DATA =
static const lit_magic_size_t lit_magic_string_sizes[] JERRY_ATTR_CONST_DATA =
```
That is already done to some constants in jerry-core. E.g.:

View File

@ -48,7 +48,7 @@ else ifeq ($(MBED_VERBOSE), 2)
MBED_CLI_FLAGS += -vv
endif
MBED_CLI_FLAGS += -D "CONFIG_MEM_HEAP_AREA_SIZE=(1024*$(HEAPSIZE))"
MBED_CLI_FLAGS += -D "JERRY_GLOBAL_HEAP_SIZE=$(HEAPSIZE)"
MBED_CLI_FLAGS += -t GCC_ARM
.PHONY: all js2c getlibs rebuild library

View File

@ -50,7 +50,7 @@ jerrycore:
-DFEATURE_PROFILE=minimal \
-DENABLE_STRIP=OFF \
-DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \
-DMEM_HEAP_SIZE_KB=$(JERRYHEAP)
-DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP)
make -C$(BUILD_DIR) jerry-core

View File

@ -50,7 +50,7 @@ libjerry:
-DJERRY_LIBM=OFF \
-DJERRY_CMDLINE=OFF \
-DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \
-DMEM_HEAP_SIZE_KB=$(JERRYHEAP)
-DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP)
make -C$(BUILD_DIR) jerry-core jerry-port-default-minimal jerry-ext
mkdir -p $(COPYTARGET)

View File

@ -27,7 +27,7 @@ libjerry:
-DENABLE_ALL_IN_ONE=OFF \
-DJERRY_CMDLINE=OFF \
-DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \
-DMEM_HEAP_SIZE_KB=$(JERRYHEAP) \
-DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP) \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain_mcu_artik053.cmake

View File

@ -88,7 +88,7 @@ endif
-DFEATURE_ERROR_MESSAGES=ON \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_VERBOSE_MAKEFILE=$(V) \
-DMEM_HEAP_SIZE_KB=$(JERRYHEAP) \
-DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP) \
-DEXTERNAL_COMPILE_FLAGS="$(EXT_CFLAGS)" \
$(EXT_JERRY_FLAGS)

View File

@ -201,13 +201,13 @@ def generate_build_options(arguments):
build_options_append('FEATURE_JS_PARSER', arguments.js_parser)
build_options_append('FEATURE_LINE_INFO', arguments.line_info)
build_options_append('FEATURE_LOGGING', arguments.logging)
build_options_append('MEM_HEAP_SIZE_KB', arguments.mem_heap)
build_options_append('JERRY_GLOBAL_HEAP_SIZE', arguments.mem_heap)
build_options_append('FEATURE_MEM_STATS', arguments.mem_stats)
build_options_append('FEATURE_MEM_STRESS_TEST', arguments.mem_stress_test)
build_options_append('FEATURE_PROFILE', arguments.profile)
build_options_append('FEATURE_REGEXP_STRICT_MODE', arguments.regexp_strict_mode)
build_options_append('REGEXP_RECURSION_LIMIT', arguments.regexp_recursion_limit)
build_options_append('VM_RECURSION_LIMIT', arguments.vm_recursion_limit)
build_options_append('JERRY_REGEXP_RECURSION_LIMIT', arguments.regexp_recursion_limit)
build_options_append('JERRY_VM_RECURSION_LIMIT', arguments.vm_recursion_limit)
build_options_append('FEATURE_PARSER_DUMP', arguments.show_opcodes)
build_options_append('FEATURE_REGEXP_DUMP', arguments.show_regexp_opcodes)
build_options_append('FEATURE_SNAPSHOT_EXEC', arguments.snapshot_exec)

View File

@ -46,7 +46,7 @@ class UniCodeSource(object):
def add_table(self, table, table_name, table_type, table_descr):
self.__data.append(table_descr)
self.__data.append("static const %s lit_%s[] JERRY_CONST_DATA =" % (table_type, table_name))
self.__data.append("static const %s lit_%s[] JERRY_ATTR_CONST_DATA =" % (table_type, table_name))
self.__data.append("{")
self.__data.append(format_code(table, 1))
self.__data.append("};")