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
+20 -20
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 */
+10 -10
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);
+24 -24
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)
+31 -31
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
{
+2 -2
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);
+5 -5
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 ();
+2 -2
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) */
/**
* @}
+2 -2
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) */
/**
* @}
+4 -4
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) */
/**
* @}
+6 -6
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) */
/**
* @}
+17 -17
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) */
/**
* @}
+2 -2
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) */
/**
* @}