Remove the ENABLED/DISABLED macros (#4515)

The removal of these macros enabled cppcheck to reveal new errors.
These errors are also fixed by the patch.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2021-02-04 23:47:05 +01:00
committed by GitHub
parent e01c2549d7
commit 0628ae1e7b
337 changed files with 5186 additions and 5191 deletions
+28 -28
View File
@@ -74,9 +74,9 @@ ecma_dealloc_number (ecma_number_t *number_p) /**< number to be freed */
extern inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_object (void)
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_object_bytes (sizeof (ecma_object_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
return (ecma_object_t *) jmem_pools_alloc (sizeof (ecma_object_t));
} /* ecma_alloc_object */
@@ -87,9 +87,9 @@ ecma_alloc_object (void)
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_object_bytes (sizeof (ecma_object_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
jmem_pools_free (object_p, sizeof (ecma_object_t));
} /* ecma_dealloc_object */
@@ -102,9 +102,9 @@ ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */
extern inline ecma_extended_object_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_extended_object (size_t size) /**< size of object */
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_object_bytes (size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
return jmem_heap_alloc_block (size);
} /* ecma_alloc_extended_object */
@@ -116,9 +116,9 @@ extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */
size_t size) /**< size of object */
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_object_bytes (size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
jmem_heap_free_block (object_p, size);
} /* ecma_dealloc_extended_object */
@@ -131,9 +131,9 @@ ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */
extern inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string (void)
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (sizeof (ecma_string_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
return (ecma_string_t *) jmem_pools_alloc (sizeof (ecma_string_t));
} /* ecma_alloc_string */
@@ -144,9 +144,9 @@ ecma_alloc_string (void)
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (sizeof (ecma_string_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
jmem_pools_free (string_p, sizeof (ecma_string_t));
} /* ecma_dealloc_string */
@@ -159,9 +159,9 @@ ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */
extern inline ecma_extended_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_extended_string (void)
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (sizeof (ecma_extended_string_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
return (ecma_extended_string_t *) jmem_heap_alloc_block (sizeof (ecma_extended_string_t));
} /* ecma_alloc_extended_string */
@@ -172,9 +172,9 @@ ecma_alloc_extended_string (void)
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_extended_string (ecma_extended_string_t *ext_string_p) /**< extended string to be freed */
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (sizeof (ecma_extended_string_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
jmem_heap_free_block (ext_string_p, sizeof (ecma_extended_string_t));
} /* ecma_dealloc_extended_string */
@@ -187,9 +187,9 @@ ecma_dealloc_extended_string (ecma_extended_string_t *ext_string_p) /**< extende
extern inline ecma_external_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_external_string (void)
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (sizeof (ecma_external_string_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
return (ecma_external_string_t *) jmem_heap_alloc_block (sizeof (ecma_external_string_t));
} /* ecma_alloc_external_string */
@@ -200,9 +200,9 @@ ecma_alloc_external_string (void)
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_external_string (ecma_external_string_t *ext_string_p) /**< external string to be freed */
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (sizeof (ecma_external_string_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
jmem_heap_free_block (ext_string_p, sizeof (ecma_external_string_t));
} /* ecma_dealloc_external_string */
@@ -215,9 +215,9 @@ ecma_dealloc_external_string (ecma_external_string_t *ext_string_p) /**< externa
extern inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string_buffer (size_t size) /**< size of string */
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
return jmem_heap_alloc_block (size);
} /* ecma_alloc_string_buffer */
@@ -229,9 +229,9 @@ extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
size_t size) /**< size of string */
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
jmem_heap_free_block (string_p, size);
} /* ecma_dealloc_string_buffer */
@@ -244,9 +244,9 @@ ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
extern inline ecma_property_pair_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_property_pair (void)
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_property_bytes (sizeof (ecma_property_pair_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
return jmem_heap_alloc_block (sizeof (ecma_property_pair_t));
} /* ecma_alloc_property_pair */
@@ -257,9 +257,9 @@ ecma_alloc_property_pair (void)
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p) /**< property pair to be freed */
{
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_property_bytes (sizeof (ecma_property_pair_t));
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
jmem_heap_free_block (property_pair_p, sizeof (ecma_property_pair_t));
} /* ecma_dealloc_property_pair */
+134 -134
View File
@@ -37,12 +37,12 @@
#include "vm-defines.h"
#include "vm-stack.h"
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
#include "ecma-typedarray-object.h"
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#if ENABLED (JERRY_BUILTIN_PROMISE)
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_PROMISE
#include "ecma-promise-object.h"
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
#endif /* JERRY_BUILTIN_PROMISE */
/* TODO: Extract GC to a separate component */
@@ -160,16 +160,16 @@ ecma_gc_mark_global_object (ecma_global_object_t *global_object_p) /**< global o
ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER (ecma_object_t, global_object_p->global_env_cp));
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_gc_set_object_visited (ecma_get_object_from_value (global_object_p->this_binding));
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (global_object_p->global_scope_cp != global_object_p->global_env_cp)
{
ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER (ecma_object_t, global_object_p->global_scope_cp));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
jmem_cpointer_t *builtin_objects_p = global_object_p->builtin_objects;
@@ -264,7 +264,7 @@ ecma_gc_mark_properties (ecma_property_pair_t *property_pair_p) /**< property pa
JERRY_ASSERT (property_pair_p->names_cp[index] >= LIT_INTERNAL_MAGIC_STRING_FIRST_DATA
&& property_pair_p->names_cp[index] < LIT_MAGIC_STRING__COUNT);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (property_pair_p->names_cp[index] == LIT_INTERNAL_MAGIC_STRING_ENVIRONMENT_RECORD)
{
ecma_environment_record_t *environment_record_p;
@@ -280,7 +280,7 @@ ecma_gc_mark_properties (ecma_property_pair_t *property_pair_p) /**< property pa
JERRY_ASSERT (ecma_is_value_object (environment_record_p->function_object));
ecma_gc_set_object_visited (ecma_get_object_from_value (environment_record_p->function_object));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
} /* ecma_gc_mark_properties */
@@ -326,7 +326,7 @@ ecma_gc_mark_bound_function_object (ecma_object_t *object_p) /**< bound function
}
} /* ecma_gc_mark_bound_function_object */
#if ENABLED (JERRY_BUILTIN_PROMISE)
#if JERRY_BUILTIN_PROMISE
/**
* Mark objects referenced by Promise built-in.
*/
@@ -378,9 +378,9 @@ ecma_gc_mark_promise_object (ecma_extended_object_t *ext_object_p) /**< extended
}
} /* ecma_gc_mark_promise_object */
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
#endif /* JERRY_BUILTIN_PROMISE */
#if ENABLED (JERRY_BUILTIN_MAP)
#if JERRY_BUILTIN_MAP
/**
* Mark objects referenced by Map built-in.
*/
@@ -415,9 +415,9 @@ ecma_gc_mark_map_object (ecma_object_t *object_p) /**< object */
}
}
} /* ecma_gc_mark_map_object */
#endif /* ENABLED (JERRY_BUILTIN_MAP) */
#endif /* JERRY_BUILTIN_MAP */
#if ENABLED (JERRY_BUILTIN_WEAKMAP)
#if JERRY_BUILTIN_WEAKMAP
/**
* Mark objects referenced by WeakMap built-in.
*/
@@ -447,9 +447,9 @@ ecma_gc_mark_weakmap_object (ecma_object_t *object_p) /**< object */
}
}
} /* ecma_gc_mark_weakmap_object */
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) */
#endif /* JERRY_BUILTIN_WEAKMAP */
#if ENABLED (JERRY_BUILTIN_SET)
#if JERRY_BUILTIN_SET
/**
* Mark objects referenced by Set built-in.
*/
@@ -479,9 +479,9 @@ ecma_gc_mark_set_object (ecma_object_t *object_p) /**< object */
}
}
} /* ecma_gc_mark_set_object */
#endif /* ENABLED (JERRY_BUILTIN_SET) */
#endif /* JERRY_BUILTIN_SET */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Mark objects referenced by inactive generator functions, async functions, etc.
*/
@@ -615,9 +615,9 @@ ecma_gc_mark_executable_object (ecma_object_t *object_p) /**< object */
}
} /* ecma_gc_mark_executable_object */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
/**
* Mark the objects referenced by a proxy object
*/
@@ -638,7 +638,7 @@ ecma_gc_mark_proxy_object (ecma_object_t *object_p) /**< proxy object */
ecma_gc_set_object_visited (ecma_get_object_from_value (proxy_p->handler));
}
} /* ecma_gc_mark_proxy_object */
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
/**
* Mark objects as visited starting from specified object as root
@@ -669,7 +669,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
{
ecma_object_type_t object_type = ecma_get_object_type (object_p);
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
if (JERRY_UNLIKELY (ecma_get_object_is_builtin (object_p)))
{
ecma_value_t realm_value;
@@ -693,7 +693,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, realm_value));
}
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
/**
* Have the object's prototype here so the object could set it to JMEM_CP_NULL
@@ -703,7 +703,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
switch (object_type)
{
#if !ENABLED (JERRY_BUILTIN_REALMS)
#if !JERRY_BUILTIN_REALMS
case ECMA_OBJECT_TYPE_GENERAL:
{
if (JERRY_UNLIKELY (ecma_get_object_is_builtin (object_p))
@@ -713,58 +713,58 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
}
break;
}
#endif /* !ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* !JERRY_BUILTIN_REALMS */
case ECMA_OBJECT_TYPE_CLASS:
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
switch (ext_object_p->u.class_prop.class_id)
{
#if ENABLED (JERRY_BUILTIN_PROMISE)
#if JERRY_BUILTIN_PROMISE
case LIT_MAGIC_STRING_PROMISE_UL:
{
ecma_gc_mark_promise_object (ext_object_p);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
#if ENABLED (JERRY_BUILTIN_DATAVIEW)
#endif /* JERRY_BUILTIN_PROMISE */
#if JERRY_BUILTIN_DATAVIEW
case LIT_MAGIC_STRING_DATAVIEW_UL:
{
ecma_dataview_object_t *dataview_p = (ecma_dataview_object_t *) object_p;
ecma_gc_set_object_visited (dataview_p->buffer_p);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW) */
#if ENABLED (JERRY_BUILTIN_CONTAINER)
#if ENABLED (JERRY_BUILTIN_WEAKSET)
#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_CONTAINER
#if JERRY_BUILTIN_WEAKSET
case LIT_MAGIC_STRING_WEAKSET_UL:
{
break;
}
#endif /* ENABLED (JERRY_BUILTIN_WEAKSET) */
#if ENABLED (JERRY_BUILTIN_SET)
#endif /* JERRY_BUILTIN_WEAKSET */
#if JERRY_BUILTIN_SET
case LIT_MAGIC_STRING_SET_UL:
{
ecma_gc_mark_set_object (object_p);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_SET) */
#if ENABLED (JERRY_BUILTIN_WEAKMAP)
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_WEAKMAP
case LIT_MAGIC_STRING_WEAKMAP_UL:
{
ecma_gc_mark_weakmap_object (object_p);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) */
#if ENABLED (JERRY_BUILTIN_MAP)
#endif /* JERRY_BUILTIN_WEAKMAP */
#if JERRY_BUILTIN_MAP
case LIT_MAGIC_STRING_MAP_UL:
{
ecma_gc_mark_map_object (object_p);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_MAP) */
#endif /* ENABLED (JERRY_BUILTIN_CONTAINER) */
#if ENABLED (JERRY_ESNEXT)
#endif /* JERRY_BUILTIN_MAP */
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_ESNEXT
case LIT_MAGIC_STRING_GENERATOR_UL:
case LIT_MAGIC_STRING_ASYNC_GENERATOR_UL:
{
@@ -789,7 +789,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
}
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
break;
@@ -804,15 +804,15 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
switch (ext_object_p->u.pseudo_array.type)
{
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
case ECMA_PSEUDO_ARRAY_TYPEDARRAY:
case ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO:
{
ecma_gc_set_object_visited (ecma_typedarray_get_arraybuffer (object_p));
break;
}
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#if ENABLED (JERRY_ESNEXT)
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_ESNEXT
case ECMA_PSEUDO_ARRAY_ITERATOR:
case ECMA_PSEUDO_SET_ITERATOR:
case ECMA_PSEUDO_MAP_ITERATOR:
@@ -835,7 +835,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
ecma_gc_set_object_visited (ecma_get_object_from_value (regexp));
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
JERRY_ASSERT (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS);
@@ -851,14 +851,14 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (ext_object_p->u.array.length_prop_and_hole_count & ECMA_ARRAY_TEMPLATE_LITERAL))
{
/* Template objects are never marked. */
JERRY_ASSERT (object_p->type_flags_refs >= ECMA_OBJECT_REF_ONE);
return;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (ecma_op_array_is_fast_array (ext_object_p))
{
@@ -883,7 +883,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
}
break;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
case ECMA_OBJECT_TYPE_PROXY:
{
ecma_gc_mark_proxy_object (object_p);
@@ -891,7 +891,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
proto_cp = JMEM_CP_NULL;
break;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
case ECMA_OBJECT_TYPE_BOUND_FUNCTION:
{
ecma_gc_mark_bound_function_object (object_p);
@@ -905,11 +905,11 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
ext_func_p->u.function.scope_cp));
#if ENABLED (JERRY_ESNEXT) || ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_ESNEXT || JERRY_BUILTIN_REALMS
const ecma_compiled_code_t *byte_code_p = ecma_op_function_get_compiled_code (ext_func_p);
#endif /* ENABLED (JERRY_ESNEXT) || ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_ESNEXT || JERRY_BUILTIN_REALMS */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (CBC_FUNCTION_IS_ARROW (byte_code_p->status_flags))
{
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) object_p;
@@ -924,16 +924,16 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
ecma_gc_set_object_visited (ecma_get_object_from_value (arrow_func_p->new_target));
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_BUILTIN_REALMS)
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_BUILTIN_REALMS
#if JERRY_SNAPSHOT_EXEC
if (ext_func_p->u.function.bytecode_cp == JMEM_CP_NULL)
{
/* Static snapshot functions have a global realm */
break;
}
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
ecma_object_t *realm_p;
@@ -949,25 +949,25 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
}
ecma_gc_set_object_visited (realm_p);
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
break;
}
#if ENABLED (JERRY_ESNEXT) || ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_ESNEXT || JERRY_BUILTIN_REALMS
case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:
{
#endif /* ENABLED (JERRY_ESNEXT) || ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_ESNEXT || JERRY_BUILTIN_REALMS */
if (!ecma_get_object_is_builtin (object_p))
{
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_native_function_t *native_function_p = (ecma_native_function_t *) object_p;
ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t,
native_function_p->realm_value));
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
if (ext_func_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER)
@@ -1003,7 +1003,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
ecma_gc_set_object_visited (ecma_get_object_from_value (executor_p->remaining_elements));
break;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
case ECMA_NATIVE_HANDLER_PROXY_REVOKE:
{
ecma_revocable_proxy_object_t *rev_proxy_p = (ecma_revocable_proxy_object_t *) object_p;
@@ -1015,7 +1015,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
break;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
case ECMA_NATIVE_HANDLER_VALUE_THUNK:
case ECMA_NATIVE_HANDLER_VALUE_THROWER:
{
@@ -1033,12 +1033,12 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
}
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_ESNEXT) || ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_ESNEXT || JERRY_BUILTIN_REALMS
break;
}
#endif /* ENABLED (JERRY_ESNEXT) || ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_ESNEXT || JERRY_BUILTIN_REALMS */
default:
{
break;
@@ -1053,7 +1053,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
jmem_cpointer_t prop_iter_cp = object_p->u1.property_list_cp;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
if (prop_iter_cp != JMEM_CP_NULL)
{
ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
@@ -1062,7 +1062,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
prop_iter_cp = prop_iter_p->next_property_cp;
}
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
while (prop_iter_cp != JMEM_CP_NULL)
{
@@ -1126,9 +1126,9 @@ ecma_free_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments
ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;
object_size = sizeof (ecma_mapped_arguments_t);
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
if (!(mapped_arguments_p->unmapped.header.u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE))
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
{
ecma_compiled_code_t *byte_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
mapped_arguments_p->u.byte_code);
@@ -1178,7 +1178,7 @@ ecma_free_fast_access_array (ecma_object_t *object_p) /**< fast access mode arra
ecma_dealloc_extended_object (object_p, sizeof (ecma_extended_object_t));
} /* ecma_free_fast_access_array */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Free non-objects referenced by inactive generator functions, async functions, etc.
@@ -1302,7 +1302,7 @@ ecma_gc_free_executable_object (ecma_object_t *object_p) /**< object */
return size;
} /* ecma_gc_free_executable_object */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Free properties of an object
@@ -1312,7 +1312,7 @@ ecma_gc_free_properties (ecma_object_t *object_p) /**< object */
{
jmem_cpointer_t prop_iter_cp = object_p->u1.property_list_cp;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
if (prop_iter_cp != JMEM_CP_NULL)
{
ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
@@ -1323,7 +1323,7 @@ ecma_gc_free_properties (ecma_object_t *object_p) /**< object */
prop_iter_cp = object_p->u1.property_list_cp;
}
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
while (prop_iter_cp != JMEM_CP_NULL)
{
@@ -1355,7 +1355,7 @@ ecma_gc_free_properties (ecma_object_t *object_p) /**< object */
/* Call the native's free callback. */
switch (name_cp)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case LIT_INTERNAL_MAGIC_STRING_ENVIRONMENT_RECORD:
{
ecma_environment_record_t *environment_record_p;
@@ -1372,8 +1372,8 @@ ecma_gc_free_properties (ecma_object_t *object_p) /**< object */
ecma_compact_collection_free (compact_collection_p);
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_WEAKMAP) || ENABLED (JERRY_BUILTIN_WEAKSET)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET
case LIT_INTERNAL_MAGIC_STRING_WEAK_REFS:
{
ecma_collection_t *refs_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
@@ -1393,7 +1393,7 @@ ecma_gc_free_properties (ecma_object_t *object_p) /**< object */
ecma_collection_destroy (refs_p);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) || ENABLED (JERRY_BUILTIN_WEAKSET) */
#endif /* JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET */
default:
{
JERRY_ASSERT (name_cp == LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER);
@@ -1402,12 +1402,12 @@ ecma_gc_free_properties (ecma_object_t *object_p) /**< object */
}
}
#if ENABLED (JERRY_LCACHE)
#if JERRY_LCACHE
if (ecma_is_property_lcached (property_p))
{
ecma_lcache_invalidate (object_p, name_cp, property_p);
}
#endif /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
}
prop_iter_cp = prop_iter_p->next_property_cp;
@@ -1460,7 +1460,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
{
JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (extended_object_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER)
{
switch (extended_object_p->u.built_in.routine_id)
@@ -1487,13 +1487,13 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
ext_object_size = sizeof (ecma_promise_all_executor_t);
break;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
case ECMA_NATIVE_HANDLER_PROXY_REVOKE:
{
ext_object_size = sizeof (ecma_revocable_proxy_object_t);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
case ECMA_NATIVE_HANDLER_VALUE_THUNK:
case ECMA_NATIVE_HANDLER_VALUE_THROWER:
{
@@ -1507,7 +1507,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
}
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
else if (extended_object_p->u.built_in.id == ECMA_BUILTIN_ID_GLOBAL)
{
@@ -1556,12 +1556,12 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
{
case LIT_MAGIC_STRING_STRING_UL:
case LIT_MAGIC_STRING_NUMBER_UL:
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case LIT_MAGIC_STRING_SYMBOL_UL:
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_BIGINT
case LIT_MAGIC_STRING_BIGINT_UL:
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
{
ecma_free_value (ext_object_p->u.class_prop.u.value);
break;
@@ -1583,7 +1583,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
break;
}
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
case LIT_MAGIC_STRING_ARRAY_BUFFER_UL:
{
uint32_t arraybuffer_length = ext_object_p->u.class_prop.u.length;
@@ -1607,8 +1607,8 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
break;
}
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#if ENABLED (JERRY_BUILTIN_PROMISE)
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_PROMISE
case LIT_MAGIC_STRING_PROMISE_UL:
{
ecma_free_value_if_not_object (ext_object_p->u.class_prop.u.value);
@@ -1619,20 +1619,20 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
ext_object_size = sizeof (ecma_promise_object_t);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
#if ENABLED (JERRY_BUILTIN_CONTAINER)
#if ENABLED (JERRY_BUILTIN_MAP)
#endif /* JERRY_BUILTIN_PROMISE */
#if JERRY_BUILTIN_CONTAINER
#if JERRY_BUILTIN_MAP
case LIT_MAGIC_STRING_MAP_UL:
#endif /* ENABLED (JERRY_BUILTIN_MAP) */
#if ENABLED (JERRY_BUILTIN_SET)
#endif /* JERRY_BUILTIN_MAP */
#if JERRY_BUILTIN_SET
case LIT_MAGIC_STRING_SET_UL:
#endif /* ENABLED (JERRY_BUILTIN_SET) */
#if ENABLED (JERRY_BUILTIN_WEAKMAP)
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_WEAKMAP
case LIT_MAGIC_STRING_WEAKMAP_UL:
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) */
#if ENABLED (JERRY_BUILTIN_WEAKSET)
#endif /* JERRY_BUILTIN_WEAKMAP */
#if JERRY_BUILTIN_WEAKSET
case LIT_MAGIC_STRING_WEAKSET_UL:
#endif /* ENABLED (JERRY_BUILTIN_WEAKSET) */
#endif /* JERRY_BUILTIN_WEAKSET */
{
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
@@ -1642,15 +1642,15 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
break;
}
#endif /* ENABLED (JERRY_BUILTIN_CONTAINER) */
#if ENABLED (JERRY_BUILTIN_DATAVIEW)
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_DATAVIEW
case LIT_MAGIC_STRING_DATAVIEW_UL:
{
ext_object_size = sizeof (ecma_dataview_object_t);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW) */
#if ENABLED (JERRY_ESNEXT)
#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_ESNEXT
case LIT_MAGIC_STRING_GENERATOR_UL:
case LIT_MAGIC_STRING_ASYNC_GENERATOR_UL:
{
@@ -1662,8 +1662,8 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
ext_object_size = sizeof (ecma_promise_capabality_t);
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_MODULE_SYSTEM)
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
case LIT_MAGIC_STRING_RUNNABLE_UL:
{
ecma_extended_object_t *wrapper_p = (ecma_extended_object_t *) object_p;
@@ -1676,7 +1676,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
ecma_module_cleanup (root_module_p);
break;
}
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
default:
{
/* The undefined id represents an uninitialized class. */
@@ -1691,42 +1691,42 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
break;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
case ECMA_OBJECT_TYPE_PROXY:
{
ext_object_size = sizeof (ecma_proxy_object_t);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
case ECMA_OBJECT_TYPE_FUNCTION:
{
/* Function with byte-code (not a built-in function). */
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
if (ext_func_p->u.function.bytecode_cp != ECMA_NULL_POINTER)
{
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
ecma_compiled_code_t *byte_code_p = (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
ext_func_p->u.function.bytecode_cp));
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (CBC_FUNCTION_IS_ARROW (byte_code_p->status_flags))
{
ecma_free_value_if_not_object (((ecma_arrow_function_t *) object_p)->this_binding);
ecma_free_value_if_not_object (((ecma_arrow_function_t *) object_p)->new_target);
ext_object_size = sizeof (ecma_arrow_function_t);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_bytecode_deref (byte_code_p);
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
}
else
{
ext_object_size = sizeof (ecma_static_function_t);
}
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
break;
}
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
@@ -1740,14 +1740,14 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
ext_object_size = ecma_free_arguments_object (ext_object_p);
break;
}
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
case ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO:
{
ext_object_size = sizeof (ecma_extended_typedarray_object_t);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#if ENABLED (JERRY_ESNEXT)
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_ESNEXT
case ECMA_PSEUDO_STRING_ITERATOR:
{
ecma_value_t iterated_value = ext_object_p->u.pseudo_array.u2.iterated_value;
@@ -1772,7 +1772,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
ext_object_size = sizeof (ecma_regexp_string_iterator_t);
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
JERRY_ASSERT (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_TYPEDARRAY
@@ -1792,9 +1792,9 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
ecma_value_t args_len_or_this = bound_func_p->header.u.bound_function.args_len_or_this;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_free_value (bound_func_p->target_length);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (!ecma_is_value_integer_number (args_len_or_this))
{
@@ -1953,10 +1953,10 @@ ecma_gc_run (void)
obj_iter_cp = obj_next_cp;
}
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
/* Free RegExp bytecodes stored in cache */
re_cache_gc ();
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
} /* ecma_gc_run */
/**
@@ -1967,24 +1967,24 @@ ecma_gc_run (void)
void
ecma_free_unused_memory (jmem_pressure_t pressure) /**< current pressure */
{
#if ENABLED (JERRY_DEBUGGER)
#if JERRY_DEBUGGER
while ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& JERRY_CONTEXT (debugger_byte_code_free_tail) != ECMA_NULL_POINTER)
{
/* Wait until all byte code is freed or the connection is aborted. */
jerry_debugger_receive (NULL);
}
#endif /* ENABLED (JERRY_DEBUGGER) */
#endif /* JERRY_DEBUGGER */
if (JERRY_LIKELY (pressure == JMEM_PRESSURE_LOW))
{
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if 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_PRESSURE_GC;
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
/*
* If there is enough newly allocated objects since last GC, probably it is worthwhile to start GC now.
* Otherwise, probability to free sufficient space is considered to be low.
@@ -2001,7 +2001,7 @@ ecma_free_unused_memory (jmem_pressure_t pressure) /**< current pressure */
else if (pressure == JMEM_PRESSURE_HIGH)
{
/* Freeing as much memory as we currently can */
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
if (JERRY_CONTEXT (status_flags) & ECMA_STATUS_HIGH_PRESSURE_GC)
{
JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) = ECMA_PROP_HASHMAP_ALLOC_MAX;
@@ -2011,11 +2011,11 @@ ecma_free_unused_memory (jmem_pressure_t pressure) /**< current pressure */
++JERRY_CONTEXT (ecma_prop_hashmap_alloc_state);
JERRY_CONTEXT (status_flags) |= ECMA_STATUS_HIGH_PRESSURE_GC;
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
ecma_gc_run ();
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
/* Free hashmaps of remaining objects. */
jmem_cpointer_t obj_iter_cp = JERRY_CONTEXT (ecma_gc_objects_cp);
@@ -2049,7 +2049,7 @@ ecma_free_unused_memory (jmem_pressure_t pressure) /**< current pressure */
obj_iter_cp = obj_iter_p->gc_next_cp;
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
jmem_pools_collect_empty ();
return;
+90 -90
View File
@@ -67,9 +67,9 @@ typedef enum
{
ECMA_STATUS_API_AVAILABLE = (1u << 0), /**< api available */
ECMA_STATUS_DIRECT_EVAL = (1u << 1), /**< eval is called directly */
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
ECMA_STATUS_HIGH_PRESSURE_GC = (1u << 2), /**< last gc was under high pressure */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
ECMA_STATUS_EXCEPTION = (1u << 3), /**< last exception is a normal exception */
ECMA_STATUS_ABORT = (1u << 4), /**< last exception is an abort */
ECMA_STATUS_ERROR_UPDATE = (1u << 5), /**< the error_object_created_callback_p is called */
@@ -92,12 +92,12 @@ typedef enum
ECMA_TYPE___MAX = ECMA_TYPE_ERROR /** highest value for ecma types */
} ecma_type_t;
#if ENABLED (JERRY_DEBUGGER)
#if JERRY_DEBUGGER
/**
* Shift for scope chain index part in ecma_parse_opts
*/
#define ECMA_PARSE_CHAIN_INDEX_SHIFT 16
#endif /* ENABLED (JERRY_DEBUGGER) */
#endif /* JERRY_DEBUGGER */
/**
* Option flags for parser_parse_script and internal flags for global_status_flags in parser context.
@@ -126,9 +126,9 @@ typedef enum
ECMA_PARSE_ASYNC_FUNCTION = (1u << 11), /**< async function is parsed */
/* These flags are internally used by the parser. */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ECMA_PARSE_INTERNAL_PRE_SCANNING = (1u << 12),
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#ifndef JERRY_NDEBUG
/**
* This flag represents an error in for in/of statements, which cannot be set
@@ -217,14 +217,14 @@ enum
* or function call argument list */
/* Other values */
ECMA_VALUE_INITIALIZED = ECMA_MAKE_VALUE (12), /**< represents initialized mapped arguments formal parameter */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ECMA_VALUE_SYNC_ITERATOR = ECMA_MAKE_VALUE (13), /**< option for ecma_op_get_iterator: sync iterator is requested */
ECMA_VALUE_ASYNC_ITERATOR = ECMA_MAKE_VALUE (14), /**< option for ecma_op_get_iterator: async iterator is requested */
ECMA_VALUE_GLOBAL_THIS = ECMA_MAKE_VALUE (15), /**< globalThis built-in */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
};
#if !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if !JERRY_NUMBER_TYPE_FLOAT64
/**
* Maximum integer number for an ecma value
*/
@@ -233,7 +233,7 @@ enum
* Maximum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT)
*/
#define ECMA_INTEGER_NUMBER_MAX_SHIFTED 0x7fffff0
#else /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#else /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Maximum integer number for an ecma value
*/
@@ -242,9 +242,9 @@ enum
* Maximum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT)
*/
#define ECMA_INTEGER_NUMBER_MAX_SHIFTED 0x7ffffff0
#endif /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
#if !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if !JERRY_NUMBER_TYPE_FLOAT64
/**
* Minimum integer number for an ecma value
*/
@@ -253,7 +253,7 @@ enum
* Minimum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT)
*/
#define ECMA_INTEGER_NUMBER_MIN_SHIFTED -0x7fffff0
#else /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#else /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Minimum integer number for an ecma value
*/
@@ -262,7 +262,7 @@ enum
* Minimum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT)
*/
#define ECMA_INTEGER_NUMBER_MIN_SHIFTED (-0x7fffffff - 1) /* -0x80000000 */
#endif /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
#if ECMA_DIRECT_SHIFT != 4
#error "Please update ECMA_INTEGER_NUMBER_MIN/MAX_SHIFTED according to the new value of ECMA_DIRECT_SHIFT."
@@ -277,11 +277,11 @@ enum
/**
* Maximum integer number, which if squared, still fits in ecma_integer_value_t
*/
#if !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if !JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_INTEGER_MULTIPLY_MAX 0xb50
#else /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#else /* JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_INTEGER_MULTIPLY_MAX 0x2d41
#endif /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Checks whether the error flag is set.
@@ -325,7 +325,7 @@ typedef struct ecma_native_pointer_t
struct ecma_native_pointer_t *next_p; /**< points to the next ecma_native_pointer_t element */
} ecma_native_pointer_t;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Representation for class constructor environment record.
@@ -336,7 +336,7 @@ typedef struct
ecma_value_t function_object; /**< function object */
} ecma_environment_record_t;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Property list:
@@ -360,10 +360,10 @@ typedef enum
* that are not indices */
ECMA_LIST_ENUMERABLE = (1 << 1), /**< exclude non-enumerable properties */
ECMA_LIST_PROTOTYPE = (1 << 2), /**< list properties from prototype chain */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ECMA_LIST_SYMBOLS = (1 << 3), /**< list symbol properties */
ECMA_LIST_SYMBOLS_ONLY = (1 << 4), /**< list symbol properties only */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ECMA_LIST_CONVERT_FAST_ARRAYS = (1 << 5), /**< after listing the properties convert
* the fast access mode array back to normal array */
} ecma_list_properties_options_t;
@@ -393,9 +393,9 @@ typedef enum
ECMA_PROPERTY_FLAG_DELETED = 1u << 0, /**< property is deleted */
ECMA_FAST_ARRAY_FLAG = 1u << 0, /**< array is fast array */
ECMA_PROPERTY_FLAG_LCACHED = 1u << 1, /**< property is lcached */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ECMA_ARRAY_TEMPLATE_LITERAL = 1u << 1, /**< array is a template literal constructed by the parser */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ECMA_PROPERTY_FLAG_CONFIGURABLE = 1u << 2, /**< property is configurable */
ECMA_PROPERTY_FLAG_ENUMERABLE = 1u << 3, /**< property is enumerable */
ECMA_PROPERTY_FLAG_WRITABLE = 1u << 4, /**< property is writable */
@@ -434,11 +434,11 @@ typedef enum
/**
* Default flag of length property.
*/
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
#define ECMA_PROPERTY_FLAG_DEFAULT_LENGTH ECMA_PROPERTY_FLAG_CONFIGURABLE
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
#define ECMA_PROPERTY_FLAG_DEFAULT_LENGTH ECMA_PROPERTY_FIXED
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Shift for property name part.
@@ -499,16 +499,16 @@ typedef uint8_t ecma_property_t; /**< ecma_property_types_t (3 bit) and ecma_pro
*/
typedef struct
{
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
jmem_cpointer_t next_property_cp; /**< next cpointer */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* 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) */
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
uint16_t padding; /**< an unused value */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
jmem_cpointer_t next_property_cp; /**< next cpointer */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
} ecma_property_header_t;
/**
@@ -526,11 +526,11 @@ typedef struct
typedef union
{
ecma_value_t value; /**< value of a property */
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
jmem_cpointer_t getter_setter_pair_cp; /**< cpointer to getter setter pair */
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
ecma_getter_setter_pointers_t getter_setter_pair; /**< getter setter pair */
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
} ecma_property_value_t;
/**
@@ -707,7 +707,7 @@ typedef enum
ECMA_LEXICAL_ENVIRONMENT_TYPE__MAX = ECMA_LEXICAL_ENVIRONMENT_HOME_OBJECT_BOUND /**< maximum value */
} ecma_lexical_environment_type_t;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Types of array iterators.
@@ -720,7 +720,7 @@ typedef enum
ECMA_ITERATOR__COUNT, /**< number of iterator kinds */
} ecma_iterator_kind_t;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Offset for JERRY_CONTEXT (status_flags) top 8 bits.
@@ -783,7 +783,7 @@ typedef enum
*/
#define ECMA_OBJECT_REF_ONE (1u << ECMA_OBJECT_REF_SHIFT)
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
/**
* Bitmask for an ecma-object reference count field
@@ -795,7 +795,7 @@ typedef enum
*/
typedef uint32_t ecma_object_descriptor_t;
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
/**
* Bitmask for an ecma-object reference count field
@@ -807,7 +807,7 @@ typedef uint32_t ecma_object_descriptor_t;
*/
typedef uint16_t ecma_object_descriptor_t;
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
/**
* Represents non-visited white object
@@ -872,28 +872,28 @@ typedef struct
uint8_t routine_flags; /**< flags for built-in routines */
} u2;
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_value_t realm_value; /**< realm value */
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
#else /* !JERRY_BUILTIN_REALMS */
uint32_t continue_instantiated_bitset[1]; /**< bit set for instantiated properties */
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
} ecma_built_in_props_t;
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
/**
* Number of bits available in the instantiated bitset without allocation
*/
#define ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE (8)
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
#else /* !JERRY_BUILTIN_REALMS */
/**
* Number of bits available in the instantiated bitset without allocation
*/
#define ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE (8 + 32)
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
/**
* Builtin routine function object status flags
@@ -1025,9 +1025,9 @@ typedef struct
typedef struct
{
ecma_extended_object_t extended_object; /**< extended object part */
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_value_t realm_value; /**< realm value */
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
ecma_native_handler_t native_handler_cb; /**< external function */
} ecma_native_function_t;
@@ -1063,12 +1063,12 @@ typedef struct
typedef struct
{
ecma_extended_object_t header; /**< extended object header */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t target_length; /**< length of target function */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} ecma_bound_function_t;
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
/**
* Description of static function objects.
@@ -1079,9 +1079,9 @@ typedef struct
const ecma_compiled_code_t *bytecode_p; /**< real byte code pointer */
} ecma_static_function_t;
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Flags for runnable objects.
*/
@@ -1101,7 +1101,7 @@ typedef struct
ecma_value_t new_target; /**< value of new.target */
} ecma_arrow_function_t;
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
/**
* Description of static arrow function objects.
@@ -1112,11 +1112,11 @@ typedef struct
const ecma_compiled_code_t *bytecode_p;
} ecma_static_arrow_function_t;
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_BUILTIN_CONTAINER)
#if JERRY_BUILTIN_CONTAINER
/**
* Flags for container objects
*/
@@ -1169,7 +1169,7 @@ typedef struct
#define ECMA_CONTAINER_START(collection_p) \
(collection_p->buffer_p + 1)
#endif /* ENABLED (JERRY_BUILTIN_CONTAINER) */
#endif /* JERRY_BUILTIN_CONTAINER */
typedef enum
{
@@ -1242,7 +1242,7 @@ typedef struct
*/
#define ECMA_IS_THROW ((uint8_t) ECMA_PROP_IS_THROW)
#if !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if !JERRY_NUMBER_TYPE_FLOAT64
/**
* Description of an ecma-number
*/
@@ -1287,7 +1287,7 @@ typedef union
* IEEE-754 2008, 3.6, Table 3.5
*/
#define ECMA_NUMBER_FRACTION_WIDTH (23)
#elif ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#elif JERRY_NUMBER_TYPE_FLOAT64
/**
* Description of an ecma-number
*/
@@ -1332,7 +1332,7 @@ typedef union
* IEEE-754 2008, 3.6, Table 3.5
*/
#define ECMA_NUMBER_FRACTION_WIDTH (52)
#endif /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Value '0' of ecma_number_t
@@ -1359,7 +1359,7 @@ typedef union
*/
#define ECMA_NUMBER_MINUS_ONE ((ecma_number_t) -1)
#if !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if !JERRY_NUMBER_TYPE_FLOAT64
/**
* Number.MIN_VALUE (i.e., the smallest positive value of ecma-number)
*
@@ -1392,7 +1392,7 @@ typedef union
* See also: ECMA_262 v6, 20.1.2.8
*/
# define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0xFFFFFF)
#elif ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#elif JERRY_NUMBER_TYPE_FLOAT64
/**
* Number.MAX_VALUE (i.e., the maximum value of ecma-number)
*
@@ -1427,7 +1427,7 @@ typedef union
* See also: ECMA_262 v6, 20.1.2.8
*/
# define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0x1FFFFFFFFFFFFF)
#endif /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Euler number
@@ -1541,11 +1541,11 @@ typedef enum
* Maximum value of the immediate part of a direct magic string.
* Must be compatible with the immediate property name.
*/
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
#define ECMA_DIRECT_STRING_MAX_IMM 0x07ffffff
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
#define ECMA_DIRECT_STRING_MAX_IMM 0x0000ffff
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
/**
* Shift for direct string value part in ecma_value_t.
@@ -1843,7 +1843,7 @@ typedef struct
*/
#define ECMA_EXTENDED_PRIMITIVE_MAX_REF (UINT32_MAX - (ECMA_EXTENDED_PRIMITIVE_REF_ONE - 1))
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
/**
* The lowest state of the ecma_prop_hashmap_alloc_state counter.
@@ -1857,7 +1857,7 @@ typedef struct
*/
#define ECMA_PROP_HASHMAP_ALLOC_MAX 4
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
/**
* Number of values in a literal storage item
@@ -1873,15 +1873,15 @@ typedef struct
jmem_cpointer_t values[ECMA_LIT_STORAGE_VALUE_COUNT]; /**< list of values */
} ecma_lit_storage_item_t;
#if ENABLED (JERRY_LCACHE)
#if JERRY_LCACHE
/**
* Container of an LCache entry identifier
*/
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
typedef uint64_t ecma_lcache_hash_entry_id_t;
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
typedef uint32_t ecma_lcache_hash_entry_id_t;
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
/**
* Entry of LCache hash table
@@ -1905,9 +1905,9 @@ typedef struct
*/
#define ECMA_LCACHE_HASH_ROW_LENGTH 2
#endif /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
/**
* Function callback descriptor of a %TypedArray% object getter
@@ -1998,17 +1998,17 @@ typedef struct
uint8_t element_size; /**< element size based on [[TypedArrayName]] in Table 49 */
} ecma_typedarray_info_t;
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Checks whether a given typedarray is BigInt type or not.
**/
#define ECMA_TYPEDARRAY_IS_BIGINT_TYPE(id) \
((id) >= ECMA_BIGINT64_ARRAY)
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_BIGINT */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Executable (e.g. generator, async) object flags.
@@ -2113,9 +2113,9 @@ typedef struct
* real index + 1 in the [[Values]] list - otherwise */
} ecma_promise_all_executor_t;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_BUILTIN_DATAVIEW)
#if JERRY_BUILTIN_DATAVIEW
/**
* Description of DataView objects.
*/
@@ -2125,7 +2125,7 @@ typedef struct
ecma_object_t *buffer_p; /**< [[ViewedArrayBuffer]] internal slot */
uint32_t byte_offset; /**< [[ByteOffset]] internal slot */
} ecma_dataview_object_t;
#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW) */
#endif /* JERRY_BUILTIN_DATAVIEW */
/**
* Flag for indicating whether the symbol is a well known symbol
@@ -2175,7 +2175,7 @@ do \
*/
#define ECMA_PROPERTY_POINTER_ERROR ((ecma_property_t *) 0x01)
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
/**
* Proxy object flags.
@@ -2210,25 +2210,25 @@ typedef struct
ecma_extended_object_t header; /**< header part */
ecma_value_t proxy; /**< [[RevocableProxy]] internal slot */
} ecma_revocable_proxy_object_t;
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Type to repesent the maximum property index
*
* For ES6+ the maximum valid property index is 2**53 - 1
*/
typedef uint64_t ecma_length_t;
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
/**
* Type to repesent the maximum property index
*
* For ES5+ the maximum valid property index is 2**32 - 1
*/
typedef uint32_t ecma_length_t;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* BigUInt data is a sequence of uint32_t numbers.
@@ -2258,7 +2258,7 @@ typedef uint32_t ecma_bigint_digit_t;
#define ECMA_BIGINT_GET_BYTE_SIZE(size) \
(size_t) (((size) + sizeof (ecma_bigint_digit_t)) & ~(2 * sizeof (ecma_bigint_digit_t) - 1))
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
/**
* Struct for counting the different types properties in objects
@@ -2305,9 +2305,9 @@ typedef struct
union
{
ecma_value_t byte_code; /**< callee's compiled code */
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
ecma_compiled_code_t *byte_code_p; /**< real byte code pointer */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
} u;
} ecma_mapped_arguments_t;
@@ -79,7 +79,7 @@ ecma_collection_free_objects (ecma_collection_t *collection_p) /**< value collec
ecma_collection_destroy (collection_p);
} /* ecma_collection_free_objects */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Free the template literal objects and deallocate the collection
@@ -117,7 +117,7 @@ ecma_collection_free_template_literal (ecma_collection_t *collection_p) /**< val
ecma_collection_destroy (collection_p);
} /* ecma_collection_free_template_literal */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Free the non-object collection elements and deallocate the collection
+16 -16
View File
@@ -28,7 +28,7 @@
* @{
*/
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
/**
* \addtogroup ecmahelpersbigintegers Helpers for operations intermediate 128-bit integers
@@ -262,7 +262,7 @@ static const uint8_t ecma_uint4_clz[] = { 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0,
*/
#define NUMBER_MIN_DECIMAL_EXPONENT -324
#elif !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#elif !JERRY_NUMBER_TYPE_FLOAT64
/**
* Number.MAX_VALUE exponent part when using 32 bit float representation.
@@ -273,7 +273,7 @@ static const uint8_t ecma_uint4_clz[] = { 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0,
*/
#define NUMBER_MIN_DECIMAL_EXPONENT -45
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Value of epsilon
@@ -295,15 +295,15 @@ ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 st
const lit_utf8_byte_t *end_p, /**< end of utf-8 string */
uint32_t radix) /**< radix */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
bool allow_underscore = (radix & ECMA_CONVERSION_ALLOW_UNDERSCORE);
radix &= (uint32_t) ~ECMA_CONVERSION_ALLOW_UNDERSCORE;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
JERRY_ASSERT (radix == 2 || radix == 8 || radix == 16);
ecma_number_t num = ECMA_NUMBER_ZERO;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (radix <= 8)
{
lit_code_point_t upper_limit = LIT_CHAR_0 + radix;
@@ -326,7 +326,7 @@ ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 st
return num;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
for (const lit_utf8_byte_t * iter_p = str_p; iter_p <= end_p; iter_p++)
{
@@ -347,12 +347,12 @@ ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 st
{
digit_value = 10 + (*iter_p - LIT_CHAR_UPPERCASE_A);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (*iter_p == LIT_CHAR_UNDERSCORE && allow_underscore)
{
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else
{
return ecma_number_make_nan ();
@@ -461,13 +461,13 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
digit_seen = true;
digit_value = (*str_p - LIT_CHAR_0);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (*str_p == LIT_CHAR_UNDERSCORE && (options & ECMA_CONVERSION_ALLOW_UNDERSCORE))
{
str_p++;
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else
{
break;
@@ -574,13 +574,13 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
{
digit_value = (*str_p - LIT_CHAR_0);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (*str_p == LIT_CHAR_UNDERSCORE && (options & ECMA_CONVERSION_ALLOW_UNDERSCORE))
{
str_p++;
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else
{
return ecma_number_make_nan ();
@@ -636,7 +636,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
return sign ? -ECMA_NUMBER_ZERO : ECMA_NUMBER_ZERO;
}
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
/*
* 128-bit mantissa storage
*
@@ -721,7 +721,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
fraction_uint64 = ecma_round_high_to_uint64 (&fraction_uint128);
return ecma_number_make_from_sign_mantissa_and_exponent (sign, fraction_uint64, binary_exponent);
#elif !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#elif !JERRY_NUMBER_TYPE_FLOAT64
/* Less precise conversion */
ecma_number_t num = (ecma_number_t) (uint32_t) fraction_uint64;
@@ -739,7 +739,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
}
return num;
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
} /* ecma_utf8_string_to_number */
/**
+9 -9
View File
@@ -39,7 +39,7 @@ JERRY_STATIC_ASSERT (((1 << (ECMA_DIRECT_SHIFT - 1)) | ECMA_TYPE_DIRECT) == ECMA
#define ECMA_NUMBER_SIGN_POS (ECMA_NUMBER_FRACTION_WIDTH + \
ECMA_NUMBER_BIASED_EXP_WIDTH)
#if !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if !JERRY_NUMBER_TYPE_FLOAT64
JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint32_t),
size_of_ecma_number_t_must_be_equal_to_4_bytes);
@@ -102,7 +102,7 @@ ecma_number_unpack (ecma_number_t num, /**< ecma-number */
*/
const int32_t ecma_number_exponent_bias = 127;
#elif ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#elif JERRY_NUMBER_TYPE_FLOAT64
JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint64_t),
size_of_ecma_number_t_must_be_equal_to_8_bytes);
@@ -165,7 +165,7 @@ ecma_number_unpack (ecma_number_t num, /**< ecma-number */
*/
const int32_t ecma_number_exponent_bias = 1023;
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Get fraction of number
@@ -248,11 +248,11 @@ ecma_number_make_nan (void)
{
/* IEEE754 QNaN = sign bit: 0, exponent: all 1 bits, fraction: 1....0 */
ecma_number_accessor_t f;
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
f.as_uint64_t = 0x7ff8000000000000ull; /* double QNaN, same as the C99 nan("") returns. */
#else /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
f.as_uint32_t = 0x7fc00000u; /* float QNaN, same as the C99 nanf("") returns. */
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
return f.as_ecma_number_t;
} /* ecma_number_make_nan */
@@ -268,11 +268,11 @@ ecma_number_make_infinity (bool sign) /**< true - for negative Infinity,
{
/* IEEE754 INF = sign bit: sign, exponent: all 1 bits, fraction: 0....0 */
ecma_number_accessor_t f;
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
f.as_uint64_t = sign ? 0xfff0000000000000ull : 0x7ff0000000000000ull;
#else /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
f.as_uint32_t = sign ? 0xff800000u : 0x7f800000u;
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
return f.as_ecma_number_t;
} /* ecma_number_make_infinity */
+28 -30
View File
@@ -206,7 +206,7 @@ ecma_new_ecma_string_from_magic_string_ex_id (lit_magic_string_ex_id_t id) /**<
return string_desc_p;
} /* ecma_new_ecma_string_from_magic_string_ex_id */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Allocate new ecma-string and fill it with reference to the symbol descriptor
*
@@ -243,7 +243,7 @@ ecma_prop_name_is_symbol (ecma_string_t *string_p) /**< ecma-string */
return (!ECMA_IS_DIRECT_STRING (string_p)
&& ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_SYMBOL);
} /* ecma_prop_name_is_symbol */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Allocate new UTF8 ecma-string and fill it with characters from the given utf8 buffer
@@ -510,7 +510,7 @@ ecma_new_ecma_string_from_code_unit (ecma_char_t code_unit) /**< code unit */
return ecma_new_ecma_string_from_utf8 (lit_utf8_bytes, bytes_size);
} /* ecma_new_ecma_string_from_code_unit */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Allocate new ecma-string and fill it with cesu-8 character which represents specified code units
@@ -528,7 +528,7 @@ ecma_new_ecma_string_from_code_units (ecma_char_t first_code_unit, /**< code uni
return ecma_new_ecma_string_from_utf8 (lit_utf8_bytes, bytes_size);
} /* ecma_new_ecma_string_from_code_units */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Allocate new ecma-string and fill it with ecma-number
@@ -563,14 +563,14 @@ ecma_new_ecma_string_from_length (ecma_length_t number) /**< property length */
return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT, (uintptr_t) number);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_ASSERT ((ecma_number_t) number <= ECMA_NUMBER_MAX_SAFE_INTEGER);
if (JERRY_UNLIKELY (number > UINT32_MAX))
{
return ecma_new_ecma_string_from_number ((ecma_number_t) number);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_new_non_direct_string_from_uint32 ((uint32_t) number);
} /* ecma_new_ecma_string_from_length */
@@ -951,7 +951,7 @@ ecma_destroy_ecma_string (ecma_string_t *string_p) /**< ecma-string */
ecma_dealloc_string_buffer (string_p, ECMA_ASCII_STRING_GET_SIZE (string_p) + ECMA_ASCII_STRING_HEADER_SIZE);
return;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case ECMA_STRING_CONTAINER_SYMBOL:
{
ecma_extended_string_t *symbol_p = (ecma_extended_string_t *) string_p;
@@ -959,7 +959,7 @@ ecma_destroy_ecma_string (ecma_string_t *string_p) /**< ecma-string */
ecma_dealloc_extended_string (symbol_p);
return;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC
@@ -2553,7 +2553,7 @@ ecma_string_trim (const ecma_string_t *string_p) /**< pointer to an ecma string
return ret_string_p;
} /* ecma_string_trim */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Pad the beginning or the end of string with parameter given in fill_string to the length of max_length.
@@ -2624,16 +2624,14 @@ ecma_string_pad (ecma_value_t original_string_p, /**< Input ecma string */
ecma_stringbuilder_append (&builder, filler_p);
}
lit_utf8_size_t read_size;
ecma_char_t ch;
uint32_t remaining = fill_len - (prepend_count * filler_length);
ECMA_STRING_TO_UTF8_STRING (filler_p, start_p, utf8_str_size);
const lit_utf8_byte_t *temp_start_p = start_p;
while (remaining > 0)
{
read_size = lit_read_code_unit_from_utf8 (temp_start_p, &ch);
ecma_char_t ch;
lit_utf8_size_t read_size = lit_read_code_unit_from_utf8 (temp_start_p, &ch);
ecma_stringbuilder_append_char (&builder, ch);
temp_start_p += read_size;
remaining--;
@@ -2649,7 +2647,7 @@ ecma_string_pad (ecma_value_t original_string_p, /**< Input ecma string */
return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));
} /* ecma_string_pad */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Create an empty string builder
@@ -2662,9 +2660,9 @@ ecma_stringbuilder_create (void)
const lit_utf8_size_t initial_size = ECMA_ASCII_STRING_HEADER_SIZE;
ecma_stringbuilder_header_t *header_p = (ecma_stringbuilder_header_t *) jmem_heap_alloc_block (initial_size);
header_p->current_size = initial_size;
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (initial_size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
ecma_stringbuilder_t ret = {.header_p = header_p};
return ret;
@@ -2683,9 +2681,9 @@ ecma_stringbuilder_create_from (ecma_string_t *string_p) /**< ecma string */
ecma_stringbuilder_header_t *header_p = (ecma_stringbuilder_header_t *) jmem_heap_alloc_block (initial_size);
header_p->current_size = initial_size;
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (initial_size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
size_t copied_size = ecma_string_copy_to_cesu8_buffer (string_p,
ECMA_STRINGBUILDER_STRING_PTR (header_p),
@@ -2709,9 +2707,9 @@ ecma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p, /**< pointer to da
ecma_stringbuilder_header_t *header_p = (ecma_stringbuilder_header_t *) jmem_heap_alloc_block (initial_size);
header_p->current_size = initial_size;
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (initial_size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
memcpy (ECMA_STRINGBUILDER_STRING_PTR (header_p), data_p, data_size);
@@ -2736,9 +2734,9 @@ ecma_stringbuilder_grow (ecma_stringbuilder_t *builder_p, /**< string builder */
header_p->current_size = new_size;
builder_p->header_p = header_p;
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (required_size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
return ((lit_utf8_byte_t *) header_p) + header_p->current_size - required_size;
} /* ecma_stringbuilder_grow */
@@ -2784,9 +2782,9 @@ ecma_stringbuilder_revert (ecma_stringbuilder_t *builder_p, /**< string builder
const lit_utf8_size_t new_size = size + ECMA_ASCII_STRING_HEADER_SIZE;
JERRY_ASSERT (new_size <= header_p->current_size);
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (header_p->current_size - new_size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
header_p = jmem_heap_realloc_block (header_p, header_p->current_size, new_size);
header_p->current_size = new_size;
@@ -2925,9 +2923,9 @@ ecma_stringbuilder_finalize (ecma_stringbuilder_t *builder_p) /**< string builde
ECMA_STRINGBUILDER_STRING_PTR (header_p),
string_size);
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (container_size - ECMA_ASCII_STRING_HEADER_SIZE);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
if (JERRY_LIKELY (string_size <= UINT16_MAX))
{
@@ -2966,12 +2964,12 @@ ecma_stringbuilder_destroy (ecma_stringbuilder_t *builder_p) /**< string builder
builder_p->header_p = NULL;
#endif
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (size);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
} /* ecma_stringbuilder_destroy */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* AdvanceStringIndex operation
*
@@ -3018,7 +3016,7 @@ ecma_op_advance_string_index (ecma_string_t *str_p, /**< input string */
return next_index + 1;
} /* ecma_op_advance_string_index */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
+40 -40
View File
@@ -56,12 +56,12 @@ JERRY_STATIC_ASSERT ((ECMA_VALUE_FALSE | (1 << ECMA_DIRECT_SHIFT)) == ECMA_VALUE
&& ECMA_VALUE_FALSE != ECMA_VALUE_TRUE,
only_the_lowest_bit_must_be_different_for_simple_value_true_and_false);
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
JERRY_STATIC_ASSERT (ECMA_NULL_POINTER == (ECMA_BIGINT_ZERO & ~(ecma_value_t) ECMA_VALUE_TYPE_MASK),
ecma_bigint_zero_must_be_encoded_as_null_pointer);
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
/** \addtogroup ecma ECMA
* @{
@@ -332,12 +332,12 @@ ecma_is_value_string (ecma_value_t value) /**< ecma value */
extern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_symbol (ecma_value_t value) /**< ecma value */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
return (ecma_get_value_type_field (value) == ECMA_TYPE_SYMBOL);
#else /* ENABLED (JERRY_ESNEXT) */
#else /* JERRY_ESNEXT */
JERRY_UNUSED (value);
return false;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} /* ecma_is_value_symbol */
/**
@@ -362,12 +362,12 @@ ecma_is_value_magic_string (ecma_value_t value, /**< ecma value */
extern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_bigint (ecma_value_t value) /**< ecma value */
{
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
return (ecma_get_value_type_field (value) == ECMA_TYPE_BIGINT);
#else /* !ENABLED (JERRY_BUILTIN_BIGINT) */
#else /* !JERRY_BUILTIN_BIGINT */
JERRY_UNUSED (value);
return false;
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
} /* ecma_is_value_bigint */
/**
@@ -379,11 +379,11 @@ ecma_is_value_bigint (ecma_value_t value) /**< ecma value */
extern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_prop_name (ecma_value_t value) /**< ecma value */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
return ecma_is_value_string (value) || ecma_is_value_symbol (value);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
return ecma_is_value_string (value);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} /* ecma_is_value_prop_name */
/**
@@ -472,7 +472,7 @@ ecma_is_value_array (ecma_value_t arg) /**< argument */
return ECMA_VALUE_TRUE;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (arg_obj_p))
{
ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) arg_obj_p;
@@ -484,7 +484,7 @@ ecma_is_value_array (ecma_value_t arg) /**< argument */
return ecma_is_value_array (proxy_obj_p->target);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
return ECMA_VALUE_FALSE;
} /* ecma_is_value_array */
@@ -563,11 +563,11 @@ ecma_is_number_equal_to_positive_zero (ecma_number_t ecma_number) /**< number */
{
ecma_number_accessor_t u;
u.as_ecma_number_t = ecma_number;
#if !ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if !JERRY_NUMBER_TYPE_FLOAT64
return u.as_uint32_t == 0;
#else /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#else /* JERRY_NUMBER_TYPE_FLOAT64 */
return u.as_uint64_t == 0;
#endif /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
} /* ecma_is_number_equal_to_positive_zero */
/**
@@ -647,9 +647,9 @@ extern inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_make_string_value (const ecma_string_t *ecma_string_p) /**< string to reference in value */
{
JERRY_ASSERT (ecma_string_p != NULL);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_ASSERT (!ecma_prop_name_is_symbol ((ecma_string_t *) ecma_string_p));
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if ((((uintptr_t) ecma_string_p) & ECMA_VALUE_TYPE_MASK) != 0)
{
@@ -659,7 +659,7 @@ ecma_make_string_value (const ecma_string_t *ecma_string_p) /**< string to refer
return ecma_pointer_to_ecma_value (ecma_string_p) | ECMA_TYPE_STRING;
} /* ecma_make_string_value */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Symbol value constructor
*
@@ -673,7 +673,7 @@ ecma_make_symbol_value (const ecma_string_t *ecma_symbol_p) /**< symbol to refer
return ecma_pointer_to_ecma_value (ecma_symbol_p) | ECMA_TYPE_SYMBOL;
} /* ecma_make_symbol_value */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Property-name value constructor
@@ -685,12 +685,12 @@ ecma_make_prop_name_value (const ecma_string_t *ecma_prop_name_p) /**< property
{
JERRY_ASSERT (ecma_prop_name_p != NULL);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ecma_prop_name_is_symbol ((ecma_string_t *) ecma_prop_name_p))
{
return ecma_make_symbol_value (ecma_prop_name_p);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_make_string_value (ecma_prop_name_p);
} /* ecma_make_prop_name_value */
@@ -729,9 +729,9 @@ ecma_make_extended_primitive_value (const ecma_extended_primitive_t *primitve_p,
uint32_t type) /**< ecma type of extended primitve value */
{
JERRY_ASSERT (primitve_p != NULL);
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
JERRY_ASSERT (primitve_p != ECMA_BIGINT_POINTER_TO_ZERO);
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
JERRY_ASSERT (type == ECMA_TYPE_BIGINT || type == ECMA_TYPE_ERROR);
return ecma_pointer_to_ecma_value (primitve_p) | type;
@@ -810,7 +810,7 @@ ecma_get_string_from_value (ecma_value_t value) /**< ecma value */
return (ecma_string_t *) ecma_get_pointer_from_ecma_value (value);
} /* ecma_get_string_from_value */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Get pointer to ecma-string from ecma value
*
@@ -823,7 +823,7 @@ ecma_get_symbol_from_value (ecma_value_t value) /**< ecma value */
return (ecma_string_t *) ecma_get_pointer_from_ecma_value (value);
} /* ecma_get_symbol_from_value */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Get pointer to a property name from ecma value
@@ -864,9 +864,9 @@ ecma_get_object_from_value (ecma_value_t value) /**< ecma value */
extern inline ecma_extended_primitive_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_extended_primitive_from_value (ecma_value_t value) /**< ecma value */
{
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
JERRY_ASSERT (value != ECMA_BIGINT_ZERO);
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_BIGINT
|| ecma_get_value_type_field (value) == ECMA_TYPE_ERROR);
@@ -907,14 +907,14 @@ ecma_copy_value (ecma_value_t value) /**< value description */
ecma_ref_ecma_string (ecma_get_string_from_value (value));
return value;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case ECMA_TYPE_SYMBOL:
{
ecma_ref_ecma_string (ecma_get_symbol_from_value (value));
return value;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_BIGINT
case ECMA_TYPE_BIGINT:
{
if (value != ECMA_BIGINT_ZERO)
@@ -923,7 +923,7 @@ ecma_copy_value (ecma_value_t value) /**< value description */
}
return value;
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
case ECMA_TYPE_OBJECT:
{
ecma_ref_object (ecma_get_object_from_value (value));
@@ -1138,20 +1138,20 @@ ecma_free_value (ecma_value_t value) /**< value description */
ecma_deref_ecma_string (string_p);
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case ECMA_TYPE_SYMBOL:
{
ecma_deref_ecma_string (ecma_get_symbol_from_value (value));
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
case ECMA_TYPE_OBJECT:
{
ecma_deref_object (ecma_get_object_from_value (value));
break;
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
case ECMA_TYPE_BIGINT:
{
if (value != ECMA_BIGINT_ZERO)
@@ -1160,7 +1160,7 @@ ecma_free_value (ecma_value_t value) /**< value description */
}
break;
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
default:
{
@@ -1264,18 +1264,18 @@ ecma_get_typeof_lit_id (ecma_value_t value) /**< input ecma value */
{
ret_value = LIT_MAGIC_STRING_STRING;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (ecma_is_value_symbol (value))
{
ret_value = LIT_MAGIC_STRING_SYMBOL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_BIGINT
else if (ecma_is_value_bigint (value))
{
ret_value = LIT_MAGIC_STRING_BIGINT;
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
else
{
JERRY_ASSERT (ecma_is_value_object (value));
+76 -76
View File
@@ -26,9 +26,9 @@
#include "re-compiler.h"
#include "ecma-builtins.h"
#if ENABLED (JERRY_DEBUGGER)
#if JERRY_DEBUGGER
#include "debugger.h"
#endif /* ENABLED (JERRY_DEBUGGER) */
#endif /* JERRY_DEBUGGER */
/** \addtogroup ecma ECMA
* @{
@@ -136,12 +136,12 @@ ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< out
ecma_object_t *binding_obj_p, /**< binding object */
ecma_lexical_environment_type_t type) /**< type of the new lexical environment */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_ASSERT (type == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND
|| type == ECMA_LEXICAL_ENVIRONMENT_HOME_OBJECT_BOUND);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
JERRY_ASSERT (type == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
JERRY_ASSERT (binding_obj_p != NULL
&& !ecma_is_lexical_environment (binding_obj_p));
@@ -284,12 +284,12 @@ ecma_get_lex_env_binding_object (const ecma_object_t *object_p) /**< object-boun
{
JERRY_ASSERT (object_p != NULL);
JERRY_ASSERT (ecma_is_lexical_environment (object_p));
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_ASSERT (ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND
|| ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_HOME_OBJECT_BOUND);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
JERRY_ASSERT (ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ECMA_GET_NON_NULL_POINTER (ecma_object_t, object_p->u1.bound_object_cp);
} /* ecma_get_lex_env_binding_object */
@@ -390,7 +390,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
ecma_property_header_t *first_property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
*property_list_head_p);
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
bool has_hashmap = false;
if (first_property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)
@@ -400,7 +400,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
*property_list_head_p);
has_hashmap = true;
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (first_property_p));
@@ -424,7 +424,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
first_property_pair_p->values[0] = value;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
/* The property must be fully initialized before ecma_property_hashmap_insert
* is called, because the insert operation may reallocate the hashmap, and
* that triggers garbage collection which scans all properties of all objects.
@@ -437,7 +437,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
first_property_pair_p,
0);
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
return first_property_pair_p->values + 0;
}
@@ -449,7 +449,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
/* Need to query property_list_head_p again and recheck the existennce
* of property hasmap, because ecma_alloc_property_pair may delete them. */
property_list_head_p = &object_p->u1.property_list_cp;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
bool has_hashmap = false;
if (*property_list_head_p != ECMA_NULL_POINTER)
@@ -463,7 +463,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
has_hashmap = true;
}
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
/* Just copy the previous value (no need to decompress, compress). */
first_property_pair_p->header.next_property_cp = *property_list_head_p;
@@ -489,7 +489,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
first_property_pair_p->values[1] = value;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
/* See the comment before the other ecma_property_hashmap_insert above. */
if (has_hashmap)
@@ -499,7 +499,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
first_property_pair_p,
1);
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
return first_property_pair_p->values + 1;
} /* ecma_create_property */
@@ -554,16 +554,16 @@ ecma_create_named_accessor_property (ecma_object_t *object_p, /**< object */
uint8_t type_and_flags = prop_attributes;
ecma_property_value_t value;
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if 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_cp, get_p);
ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, set_p);
ECMA_SET_NON_NULL_POINTER (value.getter_setter_pair_cp, getter_setter_pair_p);
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
ECMA_SET_POINTER (value.getter_setter_pair.getter_cp, get_p);
ECMA_SET_POINTER (value.getter_setter_pair.setter_cp, set_p);
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
return ecma_create_property (object_p, name_p, type_and_flags, value, out_prop_p);
} /* ecma_create_named_accessor_property */
@@ -583,19 +583,19 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
JERRY_ASSERT (ecma_is_lexical_environment (obj_p)
|| !ecma_op_object_is_fast_array (obj_p));
ecma_property_t *property_p = NULL;
#if ENABLED (JERRY_LCACHE)
property_p = ecma_lcache_lookup (obj_p, name_p);
#if JERRY_LCACHE
ecma_property_t *property_p = ecma_lcache_lookup (obj_p, name_p);
if (property_p != NULL)
{
return property_p;
}
#endif /* ENABLED (JERRY_LCACHE) */
#else /* !JERRY_LCACHE */
ecma_property_t *property_p = NULL;
#endif /* JERRY_LCACHE */
jmem_cpointer_t prop_iter_cp = obj_p->u1.property_list_cp;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
if (prop_iter_cp != JMEM_CP_NULL)
{
ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
@@ -606,21 +606,21 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
property_p = ecma_property_hashmap_find ((ecma_property_hashmap_t *) prop_iter_p,
name_p,
&property_real_name_cp);
#if ENABLED (JERRY_LCACHE)
#if JERRY_LCACHE
if (property_p != NULL
&& !ecma_is_property_lcached (property_p))
{
ecma_lcache_insert (obj_p, property_real_name_cp, property_p);
}
#endif /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
return property_p;
}
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
uint32_t steps = 0;
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
jmem_cpointer_t property_name_cp = ECMA_NULL_POINTER;
if (ECMA_IS_DIRECT_STRING (name_p))
@@ -657,9 +657,9 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
break;
}
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
steps++;
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
prop_iter_cp = prop_iter_p->next_property_cp;
}
}
@@ -698,27 +698,27 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
}
}
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
steps++;
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
prop_iter_cp = prop_iter_p->next_property_cp;
}
}
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
if (steps >= (ECMA_PROPERTY_HASMAP_MINIMUM_SIZE / 2))
{
ecma_property_hashmap_create (obj_p);
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
#if ENABLED (JERRY_LCACHE)
#if JERRY_LCACHE
if (property_p != NULL
&& !ecma_is_property_lcached (property_p))
{
ecma_lcache_insert (obj_p, property_name_cp, property_p);
}
#endif /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
return property_p;
} /* ecma_find_named_property */
@@ -768,20 +768,20 @@ ecma_free_property (ecma_object_t *object_p, /**< object the property belongs to
}
else
{
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_NON_NULL_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 /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
}
#if ENABLED (JERRY_LCACHE)
#if JERRY_LCACHE
if (ecma_is_property_lcached (property_p))
{
ecma_lcache_invalidate (object_p, name_cp, property_p);
}
#endif /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
if (ECMA_PROPERTY_GET_NAME_TYPE (*property_p) == ECMA_DIRECT_STRING_PTR)
{
@@ -803,7 +803,7 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */
ecma_property_header_t *prev_prop_p = NULL;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
ecma_property_hashmap_delete_status hashmap_status = ECMA_PROPERTY_HASHMAP_DELETE_NO_HASHMAP;
if (cur_prop_cp != JMEM_CP_NULL)
@@ -818,7 +818,7 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */
hashmap_status = ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP;
}
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
while (cur_prop_cp != JMEM_CP_NULL)
{
@@ -835,14 +835,14 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */
{
JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (cur_prop_p->types[i]));
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP)
{
hashmap_status = ecma_property_hashmap_delete (object_p,
prop_pair_p->names_cp[i],
cur_prop_p->types + i);
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
ecma_free_property (object_p, prop_pair_p->names_cp[i], cur_prop_p->types + i);
cur_prop_p->types[i] = ECMA_PROPERTY_TYPE_DELETED;
@@ -852,14 +852,14 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */
if (cur_prop_p->types[1 - i] != ECMA_PROPERTY_TYPE_DELETED)
{
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
/* The other property is still valid. */
if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP)
{
ecma_property_hashmap_free (object_p);
ecma_property_hashmap_create (object_p);
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
return;
}
@@ -876,13 +876,13 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */
ecma_dealloc_property_pair ((ecma_property_pair_t *) cur_prop_p);
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP)
{
ecma_property_hashmap_free (object_p);
ecma_property_hashmap_create (object_p);
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
return;
}
}
@@ -961,11 +961,11 @@ ecma_named_data_property_assign_value (ecma_object_t *obj_p, /**< object */
ecma_getter_setter_pointers_t *
ecma_get_named_accessor_property (const ecma_property_value_t *prop_value_p) /**< property value reference */
{
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
return ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp);
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
return (ecma_getter_setter_pointers_t *) &prop_value_p->getter_setter_pair;
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
} /* ecma_get_named_accessor_property */
/**
@@ -978,14 +978,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, false);
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t,
prop_value_p->getter_setter_pair_cp);
ECMA_SET_POINTER (getter_setter_pair_p->getter_cp, getter_p);
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_cp, getter_p);
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
} /* ecma_set_named_accessor_property_getter */
/**
@@ -998,14 +998,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, false);
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t,
prop_value_p->getter_setter_pair_cp);
ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, setter_p);
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_cp, setter_p);
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
} /* ecma_set_named_accessor_property_setter */
/**
@@ -1107,7 +1107,7 @@ ecma_set_property_configurable_attr (ecma_property_t *property_p, /**< [in,out]
}
} /* ecma_set_property_configurable_attr */
#if ENABLED (JERRY_LCACHE)
#if JERRY_LCACHE
/**
* Check whether the property is registered in LCache
@@ -1141,7 +1141,7 @@ ecma_set_property_lcached (ecma_property_t *property_p, /**< property */
}
} /* ecma_set_property_lcached */
#endif /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
/**
* Construct empty property descriptor, i.e.:
@@ -1228,7 +1228,7 @@ ecma_deref_error_reference (ecma_extended_primitive_t *error_ref_p) /**< error r
}
} /* ecma_deref_error_reference */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Decrease ref count of a bigint value.
@@ -1253,7 +1253,7 @@ ecma_deref_bigint (ecma_extended_primitive_t *bigint_p) /**< bigint value */
jmem_heap_free_block (bigint_p, mem_size);
} /* ecma_deref_bigint */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
/**
* Create an error reference from a given value.
@@ -1410,7 +1410,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
}
}
#if ENABLED (JERRY_DEBUGGER)
#if JERRY_DEBUGGER
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(bytecode_p->status_flags & CBC_CODE_FLAGS_DEBUGGER_IGNORE)
&& jerry_debugger_send_function_cp (JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP, bytecode_p))
@@ -1442,9 +1442,9 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
JERRY_CONTEXT (debugger_byte_code_free_head) = byte_code_free_cp;
return;
}
#endif /* ENABLED (JERRY_DEBUGGER) */
#endif /* JERRY_DEBUGGER */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (bytecode_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)
{
ecma_collection_t *collection_p = ecma_compiled_code_get_tagged_template_collection (bytecode_p);
@@ -1454,19 +1454,19 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
JERRY_CONTEXT (ecma_gc_new_objects) += collection_p->item_count * 2;
ecma_collection_free_template_literal (collection_p);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_MEM_STATS)
#if JERRY_MEM_STATS
jmem_stats_free_byte_code_bytes (((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);
#endif /* ENABLED (JERRY_MEM_STATS) */
#endif /* JERRY_MEM_STATS */
}
else
{
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
re_compiled_code_t *re_bytecode_p = (re_compiled_code_t *) bytecode_p;
ecma_deref_ecma_string (ecma_get_string_from_value (re_bytecode_p->source));
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
}
jmem_heap_free_block (bytecode_p,
@@ -1499,7 +1499,7 @@ ecma_compiled_code_resolve_arguments_start (const ecma_compiled_code_t *bytecode
return ((ecma_value_t *) byte_p) - ((cbc_uint16_arguments_t *) bytecode_header_p)->argument_end;
} /* ecma_compiled_code_resolve_arguments_start */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Resolve the position of the function name of the compiled code
@@ -1552,7 +1552,7 @@ ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *b
return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, base_p[offset]);
} /* ecma_compiled_code_get_tagged_template_collection */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Get the resource name of a compiled code.
@@ -1562,7 +1562,7 @@ ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *b
ecma_value_t
ecma_get_resource_name (const ecma_compiled_code_t *bytecode_p) /**< compiled code */
{
#if ENABLED (JERRY_RESOURCE_NAME)
#if JERRY_RESOURCE_NAME
if (bytecode_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)
{
cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_p;
@@ -1573,10 +1573,10 @@ ecma_get_resource_name (const ecma_compiled_code_t *bytecode_p) /**< compiled co
cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_p;
ecma_value_t *lit_pool_p = (ecma_value_t *) ((uint8_t *) bytecode_p + sizeof (cbc_uint8_arguments_t));
return lit_pool_p[args_p->const_literal_end - args_p->register_end - 1];
#else /* !ENABLED (JERRY_RESOURCE_NAME) */
#else /* !JERRY_RESOURCE_NAME */
JERRY_UNUSED (bytecode_p);
return ecma_make_magic_string_value (LIT_MAGIC_STRING_RESOURCE_ANON);
#endif /* !ENABLED (JERRY_RESOURCE_NAME) */
#endif /* !JERRY_RESOURCE_NAME */
} /* ecma_get_resource_name */
#if (JERRY_STACK_LIMIT != 0)
+23 -23
View File
@@ -209,11 +209,11 @@ typedef enum
*
* @param obj_p ecma-object
*/
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
#define ECMA_OBJECT_IS_PROXY(obj_p) (ECMA_OBJECT_TYPE_IS_PROXY (ecma_get_object_type ((obj_p))))
#else /* !ENABLED (JERRY_BUILTIN_PROXY) */
#else /* !JERRY_BUILTIN_PROXY */
#define ECMA_OBJECT_IS_PROXY(obj_p) (false)
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
/* ecma-helpers-value.c */
ecma_type_t JERRY_ATTR_CONST ecma_get_value_type_field (ecma_value_t value);
@@ -254,9 +254,9 @@ ecma_value_t ecma_make_number_value (ecma_number_t ecma_number);
ecma_value_t ecma_make_int32_value (int32_t int32_number);
ecma_value_t ecma_make_uint32_value (uint32_t uint32_number);
ecma_value_t JERRY_ATTR_PURE ecma_make_string_value (const ecma_string_t *ecma_string_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t JERRY_ATTR_PURE ecma_make_symbol_value (const ecma_string_t *ecma_symbol_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t JERRY_ATTR_PURE ecma_make_prop_name_value (const ecma_string_t *ecma_prop_name_p);
ecma_value_t JERRY_ATTR_PURE ecma_make_magic_string_value (lit_magic_string_id_t id);
ecma_value_t JERRY_ATTR_PURE ecma_make_object_value (const ecma_object_t *object_p);
@@ -267,9 +267,9 @@ ecma_number_t JERRY_ATTR_PURE ecma_get_float_from_value (ecma_value_t value);
ecma_number_t * ecma_get_pointer_from_float_value (ecma_value_t value);
ecma_number_t JERRY_ATTR_PURE ecma_get_number_from_value (ecma_value_t value);
ecma_string_t JERRY_ATTR_PURE *ecma_get_string_from_value (ecma_value_t value);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_string_t JERRY_ATTR_PURE *ecma_get_symbol_from_value (ecma_value_t value);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_string_t JERRY_ATTR_PURE *ecma_get_prop_name_from_value (ecma_value_t value);
ecma_object_t JERRY_ATTR_PURE *ecma_get_object_from_value (ecma_value_t value);
ecma_extended_primitive_t JERRY_ATTR_PURE *ecma_get_extended_primitive_from_value (ecma_value_t value);
@@ -290,24 +290,24 @@ void ecma_free_number (ecma_value_t value);
lit_magic_string_id_t ecma_get_typeof_lit_id (ecma_value_t value);
/* ecma-helpers-string.c */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_string_t *ecma_new_symbol_from_descriptor_string (ecma_value_t string_desc);
bool ecma_prop_name_is_symbol (ecma_string_t *string_p);
ecma_length_t ecma_op_advance_string_index (ecma_string_t *str_p, ecma_length_t index_num, bool is_unicode);
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_MAP) || ENABLED (JERRY_BUILTIN_SET)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_MAP || JERRY_BUILTIN_SET
ecma_string_t *ecma_new_map_key_string (ecma_value_t value);
bool ecma_prop_name_is_map_key (ecma_string_t *string_p);
#endif /* ENABLED (JERRY_BUILTIN_MAP) || ENABLED (JERRY_BUILTIN_SET) */
#endif /* JERRY_BUILTIN_MAP || JERRY_BUILTIN_SET */
ecma_string_t *ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);
ecma_string_t *ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string_p,
lit_utf8_size_t string_size);
ecma_string_t *ecma_new_ecma_external_string_from_cesu8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size,
ecma_object_native_free_callback_t free_cb);
ecma_string_t *ecma_new_ecma_string_from_code_unit (ecma_char_t code_unit);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_string_t *ecma_new_ecma_string_from_code_units (ecma_char_t first_code_unit, ecma_char_t second_code_unit);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_string_t *ecma_new_ecma_string_from_length (ecma_length_t index);
ecma_string_t *ecma_new_ecma_string_from_uint32 (uint32_t uint32_number);
ecma_string_t *ecma_new_non_direct_string_from_uint32 (uint32_t uint32_number);
@@ -382,12 +382,12 @@ const lit_utf8_byte_t *ecma_string_trim_back (const lit_utf8_byte_t *start_p, co
void ecma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p,
lit_utf8_size_t *utf8_str_size);
ecma_string_t *ecma_string_trim (const ecma_string_t *string_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t ecma_string_pad (ecma_value_t original_string_p,
ecma_value_t max_length,
ecma_value_t fill_string,
bool pad_on_start);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_stringbuilder_t ecma_stringbuilder_create (void);
ecma_stringbuilder_t ecma_stringbuilder_create_from (ecma_string_t *string_p);
@@ -441,9 +441,9 @@ void ecma_collection_destroy (ecma_collection_t *collection_p);
void ecma_collection_free (ecma_collection_t *collection_p);
void ecma_collection_free_if_not_object (ecma_collection_t *collection_p);
void ecma_collection_free_objects (ecma_collection_t *collection_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void ecma_collection_free_template_literal (ecma_collection_t *collection_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
bool ecma_collection_check_duplicated_entries (ecma_collection_t *collection_p);
bool ecma_collection_has_string_value (ecma_collection_t *collection_p, ecma_string_t *string_p);
@@ -498,19 +498,19 @@ 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);
#if ENABLED (JERRY_LCACHE)
#if 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 /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
ecma_property_descriptor_t ecma_make_empty_property_descriptor (void);
void ecma_free_property_descriptor (ecma_property_descriptor_t *prop_desc_p);
void ecma_ref_extended_primitive (ecma_extended_primitive_t *primitve_p);
void ecma_deref_error_reference (ecma_extended_primitive_t *error_ref_p);
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
void ecma_deref_bigint (ecma_extended_primitive_t *bigint_p);
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
ecma_value_t ecma_create_error_reference (ecma_value_t value, bool is_exception);
ecma_value_t ecma_create_error_reference_from_context (void);
@@ -520,11 +520,11 @@ void ecma_raise_error_from_error_reference (ecma_value_t value);
void ecma_bytecode_ref (ecma_compiled_code_t *bytecode_p);
void ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p);
ecma_value_t *ecma_compiled_code_resolve_arguments_start (const ecma_compiled_code_t *bytecode_header_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t *ecma_compiled_code_resolve_function_name (const ecma_compiled_code_t *bytecode_header_p);
uint32_t ecma_compiled_code_resolve_extended_info (const ecma_compiled_code_t *bytecode_header_p);
ecma_collection_t *ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *bytecode_header_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t ecma_get_resource_name (const ecma_compiled_code_t *bytecode_p);
#if (JERRY_STACK_LIMIT != 0)
uintptr_t ecma_get_current_stack_usage (void);
+10 -10
View File
@@ -46,23 +46,23 @@ ecma_init (void)
ecma_init_global_environment ();
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) = ECMA_PROP_HASHMAP_ALLOC_ON;
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_HIGH_PRESSURE_GC;
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
#if (JERRY_STACK_LIMIT != 0)
volatile int sp;
JERRY_CONTEXT (stack_base) = (uintptr_t) &sp;
#endif /* (JERRY_STACK_LIMIT != 0) */
#if ENABLED (JERRY_BUILTIN_PROMISE)
#if JERRY_BUILTIN_PROMISE
ecma_job_queue_init ();
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
#endif /* JERRY_BUILTIN_PROMISE */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_CONTEXT (current_new_target_p) = NULL;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} /* ecma_init */
/**
@@ -71,9 +71,9 @@ ecma_init (void)
void
ecma_finalize (void)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) == NULL);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_finalize_global_environment ();
uint8_t runs = 0;
@@ -88,7 +88,7 @@ ecma_finalize (void)
}
while (JERRY_CONTEXT (ecma_gc_new_objects) != 0);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
jmem_cpointer_t *global_symbols_cp = JERRY_CONTEXT (global_symbols_cp);
for (uint32_t i = 0; i < ECMA_BUILTIN_GLOBAL_SYMBOL_COUNT; i++)
@@ -98,7 +98,7 @@ ecma_finalize (void)
ecma_deref_ecma_string (ECMA_GET_NON_NULL_POINTER (ecma_string_t, global_symbols_cp[i]));
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_finalize_lit_storage ();
} /* ecma_finalize */
+5 -5
View File
@@ -26,16 +26,16 @@
* @{
*/
#if ENABLED (JERRY_LCACHE)
#if JERRY_LCACHE
/**
* Bitshift index for calculating hash.
*/
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
#define ECMA_LCACHE_HASH_BITSHIFT_INDEX (2 * JMEM_ALIGNMENT_LOG)
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
#define ECMA_LCACHE_HASH_BITSHIFT_INDEX 0
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
/**
* Mask for hash bits
@@ -213,7 +213,7 @@ ecma_lcache_invalidate (const ecma_object_t *object_p, /**< object */
}
} /* ecma_lcache_invalidate */
#endif /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
/**
* @}
+2 -2
View File
@@ -23,12 +23,12 @@
* @{
*/
#if ENABLED (JERRY_LCACHE)
#if JERRY_LCACHE
void ecma_lcache_insert (const ecma_object_t *object_p, const jmem_cpointer_t name_cp, ecma_property_t *prop_p);
ecma_property_t *ecma_lcache_lookup (const ecma_object_t *object_p, const ecma_string_t *prop_name_p);
void ecma_lcache_invalidate (const ecma_object_t *object_p, const jmem_cpointer_t name_cp, ecma_property_t *prop_p);
#endif /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
/**
* @}
+26 -26
View File
@@ -27,7 +27,7 @@
* @{
*/
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Free symbol list
*/
@@ -55,7 +55,7 @@ ecma_free_symbol_list (jmem_cpointer_t symbol_list_cp) /**< symbol list */
symbol_list_cp = next_item_cp;
}
} /* ecma_free_symbol_list */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Free string list
@@ -110,7 +110,7 @@ ecma_free_number_list (jmem_cpointer_t number_list_cp) /**< number list */
}
} /* ecma_free_number_list */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Free bigint list
@@ -140,7 +140,7 @@ ecma_free_bigint_list (jmem_cpointer_t bigint_list_cp) /**< bigint list */
}
} /* ecma_free_bigint_list */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
/**
* Finalize literal storage
@@ -148,14 +148,14 @@ ecma_free_bigint_list (jmem_cpointer_t bigint_list_cp) /**< bigint list */
void
ecma_finalize_lit_storage (void)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_free_symbol_list (JERRY_CONTEXT (symbol_list_first_cp));
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_free_string_list (JERRY_CONTEXT (string_list_first_cp));
ecma_free_number_list (JERRY_CONTEXT (number_list_first_cp));
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
ecma_free_bigint_list (JERRY_CONTEXT (bigint_list_first_cp));
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
} /* ecma_finalize_lit_storage */
/**
@@ -306,7 +306,7 @@ ecma_find_or_create_literal_number (ecma_number_t number_arg) /**< number to be
return num;
} /* ecma_find_or_create_literal_number */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Find or create a literal BigInt.
@@ -381,7 +381,7 @@ ecma_find_or_create_literal_bigint (ecma_value_t bigint) /**< bigint to be searc
return bigint;
} /* ecma_find_or_create_literal_bigint */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
/**
* Log2 of snapshot literal alignment.
@@ -403,14 +403,14 @@ ecma_find_or_create_literal_bigint (ecma_value_t bigint) /**< bigint to be searc
*/
#define JERRY_SNAPSHOT_LITERAL_IS_NUMBER (1u << ECMA_VALUE_SHIFT)
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Literal value is BigInt.
*/
#define JERRY_SNAPSHOT_LITERAL_IS_BIGINT (2u << ECMA_VALUE_SHIFT)
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
#if ENABLED (JERRY_SNAPSHOT_SAVE)
#if JERRY_SNAPSHOT_SAVE
/**
* Append the value at the end of the appropriate list if it is not present there.
@@ -420,9 +420,9 @@ void ecma_save_literals_append_value (ecma_value_t value, /**< value to be appen
{
/* Unlike direct numbers, direct strings are converted to character literals. */
if (!ecma_is_value_string (value)
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
&& (!ecma_is_value_bigint (value) || value == ECMA_BIGINT_ZERO)
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
&& !ecma_is_value_float_number (value))
{
return;
@@ -558,7 +558,7 @@ ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p, /**< list of kno
{
lit_table_size += (uint32_t) sizeof (ecma_number_t);
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
else if (ecma_is_value_bigint (lit_buffer_p[i]))
{
ecma_extended_primitive_t *bigint_p = ecma_get_extended_primitive_from_value (lit_buffer_p[i]);
@@ -566,7 +566,7 @@ ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p, /**< list of kno
lit_table_size += (uint32_t) JERRY_ALIGNUP (sizeof (uint32_t) + ECMA_BIGINT_GET_SIZE (bigint_p),
JERRY_SNAPSHOT_LITERAL_ALIGNMENT);
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
else
{
ecma_string_t *string_p = ecma_get_string_from_value (lit_buffer_p[i]);
@@ -617,7 +617,7 @@ ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p, /**< list of kno
length = JERRY_ALIGNUP (sizeof (ecma_number_t), JERRY_SNAPSHOT_LITERAL_ALIGNMENT);
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
else if (ecma_is_value_bigint (lit_buffer_p[i]))
{
map_p->literal_offset |= JERRY_SNAPSHOT_LITERAL_IS_BIGINT;
@@ -630,7 +630,7 @@ ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p, /**< list of kno
length = JERRY_ALIGNUP (sizeof (uint32_t) + size, JERRY_SNAPSHOT_LITERAL_ALIGNMENT);
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
else
{
ecma_string_t *string_p = ecma_get_string_from_value (lit_buffer_p[i]);
@@ -654,9 +654,9 @@ ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p, /**< list of kno
return true;
} /* ecma_save_literals_for_snapshot */
#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */
#endif /* JERRY_SNAPSHOT_SAVE */
#if ENABLED (JERRY_SNAPSHOT_EXEC) || ENABLED (JERRY_SNAPSHOT_SAVE)
#if JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE
/**
* Get the compressed pointer of a given literal.
@@ -678,7 +678,7 @@ ecma_snapshot_get_literal (const uint8_t *literal_base_p, /**< literal start */
return ecma_find_or_create_literal_number (num);
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (literal_value & JERRY_SNAPSHOT_LITERAL_IS_BIGINT)
{
uint32_t bigint_sign_and_size = *(uint32_t *) literal_p;
@@ -698,7 +698,7 @@ ecma_snapshot_get_literal (const uint8_t *literal_base_p, /**< literal start */
memcpy (ECMA_BIGINT_GET_DIGITS (bigint_p, 0), literal_p + sizeof (uint32_t), size);
return ecma_find_or_create_literal_bigint (ecma_make_extended_primitive_value (bigint_p, ECMA_TYPE_BIGINT));
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
uint16_t length = *(const uint16_t *) literal_p;
@@ -734,17 +734,17 @@ ecma_snapshot_resolve_serializable_values (ecma_compiled_code_t *compiled_code_p
base_p -= argument_end;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* function name */
if (CBC_FUNCTION_GET_TYPE (compiled_code_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)
{
base_p--;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return base_p;
} /* ecma_snapshot_resolve_serializable_values */
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) || ENABLED (JERRY_SNAPSHOT_SAVE) */
#endif /* JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE */
/**
* @}
+8 -8
View File
@@ -27,7 +27,7 @@
* @{
*/
#if ENABLED (JERRY_SNAPSHOT_SAVE)
#if JERRY_SNAPSHOT_SAVE
/**
* Snapshot literal - offset map
*/
@@ -36,31 +36,31 @@ 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 /* ENABLED (JERRY_SNAPSHOT_SAVE) */
#endif /* 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);
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
ecma_value_t ecma_find_or_create_literal_bigint (ecma_value_t bigint);
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
#if ENABLED (JERRY_SNAPSHOT_SAVE)
#if JERRY_SNAPSHOT_SAVE
void ecma_save_literals_append_value (ecma_value_t value, ecma_collection_t *lit_pool_p);
void ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_p,
ecma_collection_t *lit_pool_p);
bool ecma_save_literals_for_snapshot (ecma_collection_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 /* ENABLED (JERRY_SNAPSHOT_SAVE) */
#endif /* JERRY_SNAPSHOT_SAVE */
#if ENABLED (JERRY_SNAPSHOT_EXEC) || ENABLED (JERRY_SNAPSHOT_SAVE)
#if JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE
ecma_value_t
ecma_snapshot_get_literal (const uint8_t *literal_base_p, ecma_value_t literal_value);
ecma_value_t *
ecma_snapshot_resolve_serializable_values (ecma_compiled_code_t *compiled_code_p, uint8_t *byte_code_end_p);
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) || ENABLED (JERRY_SNAPSHOT_SAVE) */
#endif /* JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE */
/**
* @}
+9 -9
View File
@@ -27,7 +27,7 @@
#include "lit-char-helpers.h"
#include "vm.h"
#if ENABLED (JERRY_MODULE_SYSTEM)
#if JERRY_MODULE_SYSTEM
/**
* Takes a ModuleSpecifier and applies path normalization to it.
@@ -551,11 +551,11 @@ ecma_module_evaluate (ecma_module_t *module_p) /**< module */
return ECMA_VALUE_EMPTY;
}
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_object_t *global_object_p = (ecma_object_t *) ecma_op_function_get_realm (module_p->compiled_code_p);
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
#else /* !JERRY_BUILTIN_REALMS */
ecma_object_t *global_object_p = ecma_builtin_get_global ();
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
module_p->state = ECMA_MODULE_STATE_EVALUATING;
module_p->scope_p = ecma_create_decl_lex_env (ecma_get_global_environment (global_object_p));
@@ -771,12 +771,12 @@ ecma_module_connect_imports (ecma_module_t *module_p)
ecma_value_t status = ecma_op_has_binding (lex_env_p, import_names_p->local_name_p);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_IS_VALUE_ERROR (status))
{
return status;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
if (ecma_is_value_true (status))
{
@@ -1010,7 +1010,7 @@ ecma_module_parse (ecma_module_t *module_p) /**< module */
ecma_module_t *prev_module_p = JERRY_CONTEXT (module_current_p);
JERRY_CONTEXT (module_current_p) = module_p;
#if ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER)
#if JERRY_DEBUGGER && JERRY_PARSER
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_SOURCE_CODE_NAME,
@@ -1018,7 +1018,7 @@ ecma_module_parse (ecma_module_t *module_p) /**< module */
module_path_p,
module_path_size - 1);
}
#endif /* ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER) */
#endif /* JERRY_DEBUGGER && JERRY_PARSER */
ecma_compiled_code_t *bytecode_p = parser_parse_script (NULL,
0,
@@ -1156,4 +1156,4 @@ ecma_module_cleanup (ecma_module_t *head_p) /**< module */
head_p = next_p;
}
} /* ecma_module_cleanup */
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
+2 -2
View File
@@ -19,7 +19,7 @@
#include "common.h"
#include "ecma-globals.h"
#if ENABLED (JERRY_MODULE_SYSTEM)
#if JERRY_MODULE_SYSTEM
#define ECMA_MODULE_MAX_PATH 255u
@@ -131,6 +131,6 @@ void ecma_module_cleanup_context (void);
void ecma_module_release_module_nodes (ecma_module_node_t *module_node_p);
void ecma_module_cleanup (ecma_module_t *head_p);
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
#endif /* !ECMA_MODULE_H */
+2 -2
View File
@@ -26,7 +26,7 @@
* @{
*/
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
/**
* Compute the total size of the property hashmap.
@@ -528,7 +528,7 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
#endif /* !JERRY_NDEBUG */
}
} /* ecma_property_hashmap_find */
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
/**
* @}
+2 -2
View File
@@ -53,7 +53,7 @@ typedef struct
*/
} ecma_property_hashmap_t;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
/**
* Simple ecma values
@@ -74,7 +74,7 @@ ecma_property_hashmap_delete_status ecma_property_hashmap_delete (ecma_object_t
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 /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
/**
* @}