Change 'mem' namspace to 'jmem'

The 'mem_' prefix is too general, so it might clash with
symbols in other libraries. Renamed the directory, file,
funtion and type names.

Related issue: #1052

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó
2016-05-13 14:09:31 +02:00
parent aaa3d22677
commit 92bb551d45
63 changed files with 1612 additions and 1612 deletions
+5 -5
View File
@@ -19,7 +19,7 @@
#include "ecma-gc.h"
#include "ecma-lcache.h"
#include "jrt.h"
#include "mem-poolman.h"
#include "jmem-poolman.h"
JERRY_STATIC_ASSERT (sizeof (ecma_property_value_t) == sizeof (ecma_value_t),
size_of_ecma_property_value_t_must_be_equal_to_size_of_ecma_value_t);
@@ -65,7 +65,7 @@ JERRY_STATIC_ASSERT (sizeof (ecma_getter_setter_pointers_t) <= sizeof (uint64_t)
#define ALLOC(ecma_type) ecma_ ## ecma_type ## _t * \
ecma_alloc_ ## ecma_type (void) \
{ \
ecma_ ## ecma_type ## _t *p ## ecma_type = (ecma_ ## ecma_type ## _t *) mem_pools_alloc (); \
ecma_ ## ecma_type ## _t *p ## ecma_type = (ecma_ ## ecma_type ## _t *) jmem_pools_alloc (); \
\
JERRY_ASSERT (p ## ecma_type != NULL); \
\
@@ -78,7 +78,7 @@ JERRY_STATIC_ASSERT (sizeof (ecma_getter_setter_pointers_t) <= sizeof (uint64_t)
#define DEALLOC(ecma_type) void \
ecma_dealloc_ ## ecma_type (ecma_ ## ecma_type ## _t *p ## ecma_type) \
{ \
mem_pools_free ((uint8_t *) p ## ecma_type); \
jmem_pools_free ((uint8_t *) p ## ecma_type); \
}
/**
@@ -104,7 +104,7 @@ DECLARE_ROUTINES_FOR (external_pointer)
ecma_property_pair_t *
ecma_alloc_property_pair (void)
{
return mem_heap_alloc_block (sizeof (ecma_property_pair_t));
return jmem_heap_alloc_block (sizeof (ecma_property_pair_t));
} /* ecma_alloc_property_pair */
/**
@@ -113,7 +113,7 @@ ecma_alloc_property_pair (void)
extern void
ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p) /**< property pair to be freed */
{
mem_heap_free_block (property_pair_p, sizeof (ecma_property_pair_t));
jmem_heap_free_block (property_pair_p, sizeof (ecma_property_pair_t));
} /* ecma_dealloc_property_pair */
/**
+4 -4
View File
@@ -564,10 +564,10 @@ ecma_gc_run (void)
* Try to free some memory (depending on severity).
*/
void
ecma_try_to_give_back_some_memory (mem_try_give_memory_back_severity_t severity) /**< severity of
* the request */
ecma_try_to_give_back_some_memory (jmem_try_give_memory_back_severity_t severity) /**< severity of
* the request */
{
if (severity == MEM_TRY_GIVE_MEMORY_BACK_SEVERITY_LOW)
if (severity == JMEM_TRY_GIVE_MEMORY_BACK_SEVERITY_LOW)
{
/*
* If there is enough newly allocated objects since last GC, probably it is worthwhile to start GC now.
@@ -580,7 +580,7 @@ ecma_try_to_give_back_some_memory (mem_try_give_memory_back_severity_t severity)
}
else
{
JERRY_ASSERT (severity == MEM_TRY_GIVE_MEMORY_BACK_SEVERITY_HIGH);
JERRY_ASSERT (severity == JMEM_TRY_GIVE_MEMORY_BACK_SEVERITY_HIGH);
/* Freeing as much memory as we currently can */
ecma_lcache_invalidate_all ();
+2 -2
View File
@@ -17,7 +17,7 @@
#define ECMA_GC_H
#include "ecma-globals.h"
#include "mem-allocator.h"
#include "jmem-allocator.h"
/** \addtogroup ecma ECMA
* @{
@@ -31,7 +31,7 @@ extern void ecma_init_gc_info (ecma_object_t *);
extern void ecma_ref_object (ecma_object_t *);
extern void ecma_deref_object (ecma_object_t *);
extern void ecma_gc_run (void);
extern void ecma_try_to_give_back_some_memory (mem_try_give_memory_back_severity_t);
extern void ecma_try_to_give_back_some_memory (jmem_try_give_memory_back_severity_t);
/**
* @}
+22 -22
View File
@@ -20,7 +20,7 @@
#include "config.h"
#include "jrt.h"
#include "lit-magic-strings.h"
#include "mem-allocator.h"
#include "jmem-allocator.h"
/** \addtogroup ecma ECMA
* @{
@@ -36,15 +36,15 @@
* Ecma-pointer field is used to calculate ecma value's address.
*
* Ecma-pointer contains value's shifted offset from common Ecma-pointers' base.
* The offset is shifted right by MEM_ALIGNMENT_LOG.
* Least significant MEM_ALIGNMENT_LOG bits of non-shifted offset are zeroes.
* The offset is shifted right by JMEM_ALIGNMENT_LOG.
* Least significant JMEM_ALIGNMENT_LOG bits of non-shifted offset are zeroes.
*/
#define ECMA_POINTER_FIELD_WIDTH MEM_CP_WIDTH
#define ECMA_POINTER_FIELD_WIDTH JMEM_CP_WIDTH
/**
* The NULL value for compressed pointers
*/
#define ECMA_NULL_POINTER MEM_CP_NULL
#define ECMA_NULL_POINTER JMEM_CP_NULL
/**
* @}
@@ -98,7 +98,7 @@ typedef int32_t ecma_integer_value_t;
#if UINTPTR_MAX <= UINT32_MAX
/**
* MEM_ALIGNMENT_LOG aligned pointers can be stored directly in ecma_value_t
* JMEM_ALIGNMENT_LOG aligned pointers can be stored directly in ecma_value_t
*/
#define ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
@@ -335,7 +335,7 @@ typedef struct
{
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) */
mem_cpointer_t next_property_cp; /**< next cpointer */
jmem_cpointer_t next_property_cp; /**< next cpointer */
} ecma_property_header_t;
/**
@@ -343,8 +343,8 @@ typedef struct
*/
typedef struct
{
mem_cpointer_t getter_p; /**< pointer to getter object */
mem_cpointer_t setter_p; /**< pointer to setter object */
jmem_cpointer_t getter_p; /**< pointer to getter object */
jmem_cpointer_t setter_p; /**< pointer to setter object */
} ecma_getter_setter_pointers_t;
/**
@@ -363,7 +363,7 @@ typedef struct
{
ecma_property_header_t header; /**< header of the property */
ecma_property_value_t values[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< property value slots */
mem_cpointer_t names_cp[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< property name slots */
jmem_cpointer_t names_cp[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< property name slots */
} ecma_property_pair_t;
/**
@@ -488,13 +488,13 @@ typedef struct ecma_object_t
uint16_t type_flags_refs;
/** next in the object chain maintained by the garbage collector */
mem_cpointer_t gc_next_cp;
jmem_cpointer_t gc_next_cp;
/** compressed pointer to property list or bound object */
mem_cpointer_t property_list_or_bound_object_cp;
jmem_cpointer_t property_list_or_bound_object_cp;
/** object prototype or outer reference */
mem_cpointer_t prototype_or_outer_reference_cp;
jmem_cpointer_t prototype_or_outer_reference_cp;
} ecma_object_t;
/**
@@ -730,10 +730,10 @@ typedef struct
ecma_length_t unit_number;
/** Compressed pointer to first chunk with collection's data */
mem_cpointer_t first_chunk_cp;
jmem_cpointer_t first_chunk_cp;
/** Compressed pointer to last chunk with collection's data */
mem_cpointer_t last_chunk_cp;
jmem_cpointer_t last_chunk_cp;
} ecma_collection_header_t;
/**
@@ -742,10 +742,10 @@ typedef struct
typedef struct
{
/** Characters */
lit_utf8_byte_t data[ sizeof (uint64_t) - sizeof (mem_cpointer_t) ];
lit_utf8_byte_t data[ sizeof (uint64_t) - sizeof (jmem_cpointer_t) ];
/** Compressed pointer to next chunk */
mem_cpointer_t next_chunk_cp;
jmem_cpointer_t next_chunk_cp;
} ecma_collection_chunk_t;
/**
@@ -809,10 +809,10 @@ typedef struct ecma_string_t
union
{
/** Index of string in literal table */
mem_cpointer_t lit_cp;
jmem_cpointer_t lit_cp;
/** Compressed pointer to an ecma_collection_header_t */
mem_cpointer_t utf8_collection_cp;
jmem_cpointer_t utf8_collection_cp;
/**
* Actual data of an ascii string type
@@ -820,13 +820,13 @@ typedef struct ecma_string_t
struct
{
/** Compressed pointer to a raw character array */
mem_cpointer_t ascii_collection_cp;
jmem_cpointer_t ascii_collection_cp;
/** Size of ascii string in bytes */
uint16_t size;
} ascii_string;
/** Compressed pointer to an ecma_number_t */
mem_cpointer_t number_cp;
jmem_cpointer_t number_cp;
/** UInt32-represented number placed locally in the descriptor */
uint32_t uint32_number;
@@ -852,7 +852,7 @@ typedef uintptr_t ecma_external_pointer_t;
*/
typedef struct
{
uint16_t size; /**< real size >> MEM_ALIGNMENT_LOG */
uint16_t size; /**< real size >> JMEM_ALIGNMENT_LOG */
uint16_t refs; /**< reference counter for the byte code */
uint16_t status_flags; /**< various status flags:
* CBC_CODE_FLAGS_FUNCTION flag tells whether
+21 -21
View File
@@ -185,7 +185,7 @@ ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, /**< utf-8 stri
{
string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_HEAP_ASCII_STRING | ECMA_STRING_REF_ONE;
const size_t data_size = string_size;
lit_utf8_byte_t *data_p = (lit_utf8_byte_t *) mem_heap_alloc_block (data_size);
lit_utf8_byte_t *data_p = (lit_utf8_byte_t *) jmem_heap_alloc_block (data_size);
string_desc_p->u.ascii_string.size = (uint16_t) string_size;
memcpy (data_p, string_p, string_size);
ECMA_SET_NON_NULL_POINTER (string_desc_p->u.ascii_string.ascii_collection_cp, data_p);
@@ -194,7 +194,7 @@ ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, /**< utf-8 stri
{
string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_HEAP_UTF8_STRING | ECMA_STRING_REF_ONE;
const size_t data_size = string_size + sizeof (ecma_string_heap_header_t);
ecma_string_heap_header_t *data_p = (ecma_string_heap_header_t *) mem_heap_alloc_block (data_size);
ecma_string_heap_header_t *data_p = (ecma_string_heap_header_t *) jmem_heap_alloc_block (data_size);
JERRY_ASSERT (string_length <= UINT16_MAX);
@@ -370,7 +370,7 @@ ecma_concat_ecma_strings (ecma_string_t *string1_p, /**< first ecma-string */
{
string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_HEAP_ASCII_STRING | ECMA_STRING_REF_ONE;
const size_t data_size = new_size;
lit_utf8_byte_t *data_p = (lit_utf8_byte_t *) mem_heap_alloc_block (data_size);
lit_utf8_byte_t *data_p = (lit_utf8_byte_t *) jmem_heap_alloc_block (data_size);
lit_utf8_size_t bytes_copied = ecma_string_to_utf8_string (string1_p, data_p, str1_size);
JERRY_ASSERT (bytes_copied == str1_size);
bytes_copied = ecma_string_to_utf8_string (string2_p, data_p + str1_size, str2_size);
@@ -386,7 +386,7 @@ ecma_concat_ecma_strings (ecma_string_t *string1_p, /**< first ecma-string */
{
string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_HEAP_UTF8_STRING | ECMA_STRING_REF_ONE;
const size_t data_size = new_size + sizeof (ecma_string_heap_header_t);
ecma_string_heap_header_t *data_p = (ecma_string_heap_header_t *) mem_heap_alloc_block (data_size);
ecma_string_heap_header_t *data_p = (ecma_string_heap_header_t *) jmem_heap_alloc_block (data_size);
lit_utf8_size_t bytes_copied = ecma_string_to_utf8_string (string1_p,
(lit_utf8_byte_t *) (data_p + 1),
str1_size);
@@ -459,7 +459,7 @@ ecma_copy_ecma_string (ecma_string_t *string_desc_p) /**< string descriptor */
string_desc_p->u.utf8_collection_cp);
JERRY_ASSERT (data_p != NULL);
const size_t data_size = data_p->size + sizeof (ecma_string_heap_header_t);
ecma_string_heap_header_t *new_data_p = (ecma_string_heap_header_t *) mem_heap_alloc_block (data_size);
ecma_string_heap_header_t *new_data_p = (ecma_string_heap_header_t *) jmem_heap_alloc_block (data_size);
memcpy (new_data_p, data_p, data_size);
ECMA_SET_NON_NULL_POINTER (new_str_p->u.utf8_collection_cp, new_data_p);
@@ -478,7 +478,7 @@ ecma_copy_ecma_string (ecma_string_t *string_desc_p) /**< string descriptor */
JERRY_ASSERT (data_p != NULL);
const size_t data_size = string_desc_p->u.ascii_string.size;
lit_utf8_byte_t *new_data_p = (lit_utf8_byte_t *) mem_heap_alloc_block (data_size);
lit_utf8_byte_t *new_data_p = (lit_utf8_byte_t *) jmem_heap_alloc_block (data_size);
memcpy (new_data_p, data_p, data_size);
ECMA_SET_NON_NULL_POINTER (new_str_p->u.ascii_string.ascii_collection_cp, new_data_p);
@@ -552,7 +552,7 @@ ecma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */
ecma_string_heap_header_t *const data_p = ECMA_GET_NON_NULL_POINTER (ecma_string_heap_header_t,
string_p->u.utf8_collection_cp);
mem_heap_free_block (data_p, data_p->size + sizeof (ecma_string_heap_header_t));
jmem_heap_free_block (data_p, data_p->size + sizeof (ecma_string_heap_header_t));
break;
}
@@ -561,7 +561,7 @@ ecma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */
lit_utf8_byte_t *const data_p = ECMA_GET_NON_NULL_POINTER (lit_utf8_byte_t,
string_p->u.ascii_string.ascii_collection_cp);
mem_heap_free_block (data_p, string_p->u.ascii_string.size);
jmem_heap_free_block (data_p, string_p->u.ascii_string.size);
break;
}
@@ -802,7 +802,7 @@ ecma_string_get_number_in_desc_size (const uint32_t uint32_number) /**< number i
* @return number of bytes in the buffer
*/
static inline lit_utf8_size_t __attr_always_inline___
ecma_string_get_heap_number_size (mem_cpointer_t number_cp) /**< Compressed pointer to an ecma_number_t */
ecma_string_get_heap_number_size (jmem_cpointer_t number_cp) /**< Compressed pointer to an ecma_number_t */
{
const ecma_number_t *num_p = ECMA_GET_NON_NULL_POINTER (ecma_number_t, number_cp);
lit_utf8_byte_t buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER];
@@ -1052,7 +1052,7 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /* ecma-stri
}
else
{
utf8_string1_p = (lit_utf8_byte_t *) mem_heap_alloc_block ((size_t) strings_size);
utf8_string1_p = (lit_utf8_byte_t *) jmem_heap_alloc_block ((size_t) strings_size);
lit_utf8_size_t bytes_copied = ecma_string_to_utf8_string (string1_p, utf8_string1_p, strings_size);
JERRY_ASSERT (bytes_copied == strings_size);
@@ -1083,7 +1083,7 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /* ecma-stri
}
else
{
utf8_string2_p = (lit_utf8_byte_t *) mem_heap_alloc_block ((size_t) strings_size);
utf8_string2_p = (lit_utf8_byte_t *) jmem_heap_alloc_block ((size_t) strings_size);
lit_utf8_size_t bytes_copied = ecma_string_to_utf8_string (string2_p, utf8_string2_p, strings_size);
JERRY_ASSERT (bytes_copied == strings_size);
@@ -1094,12 +1094,12 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /* ecma-stri
if (is_utf8_string1_on_heap)
{
mem_heap_free_block ((void *) utf8_string1_p, (size_t) strings_size);
jmem_heap_free_block ((void *) utf8_string1_p, (size_t) strings_size);
}
if (is_utf8_string2_on_heap)
{
mem_heap_free_block ((void *) utf8_string2_p, (size_t) strings_size);
jmem_heap_free_block ((void *) utf8_string2_p, (size_t) strings_size);
}
return is_equal;
@@ -1188,7 +1188,7 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-
if (sizeof (utf8_string1_buffer) < utf8_string1_size)
{
utf8_string1_p = (lit_utf8_byte_t *) mem_heap_alloc_block (utf8_string1_size);
utf8_string1_p = (lit_utf8_byte_t *) jmem_heap_alloc_block (utf8_string1_size);
is_utf8_string1_on_heap = true;
}
else
@@ -1230,7 +1230,7 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-
if (sizeof (utf8_string2_buffer) < utf8_string2_size)
{
utf8_string2_p = (lit_utf8_byte_t *) mem_heap_alloc_block (utf8_string2_size);
utf8_string2_p = (lit_utf8_byte_t *) jmem_heap_alloc_block (utf8_string2_size);
is_utf8_string2_on_heap = true;
}
else
@@ -1249,12 +1249,12 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-
if (is_utf8_string1_on_heap)
{
mem_heap_free_block ((void *) utf8_string1_p, (size_t) utf8_string1_size);
jmem_heap_free_block ((void *) utf8_string1_p, (size_t) utf8_string1_size);
}
if (is_utf8_string2_on_heap)
{
mem_heap_free_block ((void *) utf8_string2_p, (size_t) utf8_string2_size);
jmem_heap_free_block ((void *) utf8_string2_p, (size_t) utf8_string2_size);
}
return is_first_less_than_second;
@@ -1387,7 +1387,7 @@ ecma_string_get_char_at_pos (const ecma_string_t *string_p, /**< ecma-string */
ecma_char_t ch;
MEM_DEFINE_LOCAL_ARRAY (utf8_str_p, buffer_size, lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (utf8_str_p, buffer_size, lit_utf8_byte_t);
lit_utf8_size_t sz = ecma_string_to_utf8_string (string_p, utf8_str_p, buffer_size);
JERRY_ASSERT (sz == buffer_size);
@@ -1399,7 +1399,7 @@ ecma_string_get_char_at_pos (const ecma_string_t *string_p, /**< ecma-string */
ch = utf8_str_p[index];
MEM_FINALIZE_LOCAL_ARRAY (utf8_str_p);
JMEM_FINALIZE_LOCAL_ARRAY (utf8_str_p);
return ch;
} /* ecma_string_get_char_at_pos */
@@ -1547,7 +1547,7 @@ ecma_string_substr (const ecma_string_t *string_p, /**< pointer to an ecma strin
*/
ecma_string_t *ecma_string_p;
MEM_DEFINE_LOCAL_ARRAY (utf8_str_p, buffer_size, lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (utf8_str_p, buffer_size, lit_utf8_byte_t);
lit_utf8_size_t sz = ecma_string_to_utf8_string (string_p, utf8_str_p, buffer_size);
JERRY_ASSERT (sz == buffer_size);
@@ -1578,7 +1578,7 @@ ecma_string_substr (const ecma_string_t *string_p, /**< pointer to an ecma strin
ecma_string_p = ecma_new_ecma_string_from_utf8 (start_p, (lit_utf8_size_t) (end_p - start_p));
}
MEM_FINALIZE_LOCAL_ARRAY (utf8_str_p);
JMEM_FINALIZE_LOCAL_ARRAY (utf8_str_p);
return ecma_string_p;
}
+3 -3
View File
@@ -40,11 +40,11 @@ JERRY_STATIC_ASSERT (ECMA_TYPE___MAX <= ECMA_VALUE_TYPE_MASK,
JERRY_STATIC_ASSERT ((ECMA_VALUE_FULL_MASK + 1) == (1 << ECMA_VALUE_SHIFT),
ecma_value_part_must_start_after_flags);
JERRY_STATIC_ASSERT (ECMA_VALUE_SHIFT <= MEM_ALIGNMENT_LOG,
JERRY_STATIC_ASSERT (ECMA_VALUE_SHIFT <= JMEM_ALIGNMENT_LOG,
ecma_value_shift_must_be_less_than_or_equal_than_mem_alignment_log);
JERRY_STATIC_ASSERT ((sizeof (ecma_value_t) * JERRY_BITSINBYTE)
>= (sizeof (mem_cpointer_t) * JERRY_BITSINBYTE + ECMA_VALUE_SHIFT),
>= (sizeof (jmem_cpointer_t) * JERRY_BITSINBYTE + ECMA_VALUE_SHIFT),
ecma_value_must_be_large_enough_to_store_compressed_pointers);
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
@@ -86,7 +86,7 @@ ecma_pointer_to_ecma_value (const void *ptr) /**< pointer */
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
mem_cpointer_t ptr_cp;
jmem_cpointer_t ptr_cp;
ECMA_SET_NON_NULL_POINTER (ptr_cp, ptr);
return ((ecma_value_t) ptr_cp) << ECMA_VALUE_SHIFT;
@@ -45,7 +45,7 @@ ecma_new_values_collection (const ecma_value_t values_buffer[], /**< ecma values
header_p->unit_number = values_number;
mem_cpointer_t *next_chunk_cp_p = &header_p->first_chunk_cp;
jmem_cpointer_t *next_chunk_cp_p = &header_p->first_chunk_cp;
ecma_collection_chunk_t *last_chunk_p = NULL;
ecma_value_t *cur_value_buf_iter_p = NULL;
ecma_value_t *cur_value_buf_end_p = NULL;
@@ -303,7 +303,7 @@ ecma_collection_iterator_init (ecma_collection_iterator_t *iterator_p, /**< cont
ecma_collection_header_t *collection_p) /**< header of collection */
{
iterator_p->header_p = collection_p;
iterator_p->next_chunk_cp = (collection_p != NULL ? collection_p->first_chunk_cp : MEM_CP_NULL);
iterator_p->next_chunk_cp = (collection_p != NULL ? collection_p->first_chunk_cp : JMEM_CP_NULL);
iterator_p->current_index = 0;
iterator_p->current_value_p = NULL;
iterator_p->current_chunk_end_p = NULL;
+6 -6
View File
@@ -106,7 +106,7 @@ ecma_create_object (ecma_object_t *prototype_object_p, /**< pointer to prototybe
ecma_init_gc_info (new_object_p);
new_object_p->property_list_or_bound_object_cp = MEM_CP_NULL;
new_object_p->property_list_or_bound_object_cp = JMEM_CP_NULL;
ECMA_SET_POINTER (new_object_p->prototype_or_outer_reference_cp,
prototype_object_p);
@@ -134,7 +134,7 @@ ecma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p) /**< outer
ecma_init_gc_info (new_lexical_environment_p);
new_lexical_environment_p->property_list_or_bound_object_cp = MEM_CP_NULL;
new_lexical_environment_p->property_list_or_bound_object_cp = JMEM_CP_NULL;
ECMA_SET_POINTER (new_lexical_environment_p->prototype_or_outer_reference_cp,
outer_lexical_environment_p);
@@ -398,7 +398,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
{
JERRY_ASSERT (ECMA_PROPERTY_PAIR_ITEM_COUNT == 2);
mem_cpointer_t *property_list_head_p = &object_p->property_list_or_bound_object_cp;
jmem_cpointer_t *property_list_head_p = &object_p->property_list_or_bound_object_cp;
bool has_hashmap = false;
if (*property_list_head_p != ECMA_NULL_POINTER)
@@ -1468,7 +1468,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
for (uint32_t i = const_literal_end; i < literal_end; i++)
{
mem_cpointer_t bytecode_cpointer = literal_start_p[i];
jmem_cpointer_t bytecode_cpointer = literal_start_p[i];
ecma_compiled_code_t *bytecode_literal_p = ECMA_GET_NON_NULL_POINTER (ecma_compiled_code_t,
bytecode_cpointer);
@@ -1488,8 +1488,8 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN */
}
mem_heap_free_block (bytecode_p,
((size_t) bytecode_p->size) << MEM_ALIGNMENT_LOG);
jmem_heap_free_block (bytecode_p,
((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);
} /* ecma_bytecode_deref */
/**
+9 -9
View File
@@ -18,9 +18,9 @@
#define ECMA_HELPERS_H
#include "ecma-globals.h"
#include "jmem-allocator.h"
#include "lit-cpointer.h"
#include "lit-strings.h"
#include "mem-allocator.h"
/** \addtogroup ecma ECMA
* @{
@@ -32,25 +32,25 @@
/**
* Get value of pointer from specified non-null compressed pointer.
*/
#define ECMA_GET_NON_NULL_POINTER(type, field) MEM_CP_GET_NON_NULL_POINTER (type, field)
#define ECMA_GET_NON_NULL_POINTER(type, field) JMEM_CP_GET_NON_NULL_POINTER (type, field)
/**
* Get value of pointer from specified compressed pointer.
*/
#define ECMA_GET_POINTER(type, field) MEM_CP_GET_POINTER (type, field)
#define ECMA_GET_POINTER(type, field) JMEM_CP_GET_POINTER (type, field)
/**
* Set value of non-null compressed pointer so that it will correspond
* to specified non_compressed_pointer.
*/
#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) MEM_CP_SET_NON_NULL_POINTER (field, \
non_compressed_pointer)
#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) JMEM_CP_SET_NON_NULL_POINTER (field, \
non_compressed_pointer)
/**
* Set value of compressed pointer so that it will correspond
* to specified non_compressed_pointer.
*/
#define ECMA_SET_POINTER(field, non_compressed_pointer) MEM_CP_SET_POINTER (field, non_compressed_pointer)
#define ECMA_SET_POINTER(field, non_compressed_pointer) JMEM_CP_SET_POINTER (field, non_compressed_pointer)
/**
* Convert ecma-string's contents to a cesu-8 string and put it into a buffer.
@@ -65,7 +65,7 @@
\
if (utf8_ptr == NULL) \
{ \
utf8_ptr = (const lit_utf8_byte_t *) (mem_heap_alloc_block (utf8_str_size)); \
utf8_ptr = (const lit_utf8_byte_t *) jmem_heap_alloc_block (utf8_str_size); \
lit_utf8_size_t sz = ecma_string_to_utf8_string (ecma_str_ptr, (lit_utf8_byte_t *) utf8_ptr, utf8_str_size); \
JERRY_ASSERT (sz == utf8_str_size); \
utf8_ptr ## must_be_freed = true; \
@@ -110,7 +110,7 @@
if (utf8_ptr ## must_be_freed) \
{ \
JERRY_ASSERT (utf8_ptr != NULL); \
mem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \
jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \
}
/* ecma-helpers-value.c */
@@ -226,7 +226,7 @@ extern ecma_collection_header_t *ecma_new_strings_collection (ecma_string_t *[],
typedef struct
{
ecma_collection_header_t *header_p; /**< collection header */
mem_cpointer_t next_chunk_cp; /**< compressed pointer to next chunk */
jmem_cpointer_t next_chunk_cp; /**< compressed pointer to next chunk */
ecma_length_t current_index; /**< index of current element */
const ecma_value_t *current_value_p; /**< pointer to current element */
const ecma_value_t *current_chunk_beg_p; /**< pointer to beginning of current chunk's data */
+3 -3
View File
@@ -19,7 +19,7 @@
#include "ecma-init-finalize.h"
#include "ecma-lcache.h"
#include "ecma-lex-env.h"
#include "mem-allocator.h"
#include "jmem-allocator.h"
/** \addtogroup ecma ECMA
* @{
@@ -39,7 +39,7 @@ ecma_init (void)
ecma_lcache_init ();
ecma_init_environment ();
mem_register_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
jmem_register_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
} /* ecma_init */
/**
@@ -48,7 +48,7 @@ ecma_init (void)
void
ecma_finalize (void)
{
mem_unregister_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
jmem_unregister_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
ecma_finalize_environment ();
ecma_lcache_invalidate_all ();
+2 -2
View File
@@ -37,10 +37,10 @@ typedef struct
ecma_property_t *prop_p;
/** Compressed pointer to object (ECMA_NULL_POINTER marks record empty) */
mem_cpointer_t object_cp;
jmem_cpointer_t object_cp;
/** Compressed pointer to property's name */
mem_cpointer_t prop_name_cp;
jmem_cpointer_t prop_name_cp;
} ecma_lcache_hash_entry_t;
/**
+8 -8
View File
@@ -32,7 +32,7 @@
* Compute the total size of the property hashmap.
*/
#define ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE(max_property_count) \
(sizeof (ecma_property_hashmap_t) + (max_property_count * sizeof (mem_cpointer_t)) + (max_property_count >> 3))
(sizeof (ecma_property_hashmap_t) + (max_property_count * sizeof (jmem_cpointer_t)) + (max_property_count >> 3))
/**
* Number of items in the stepping table.
@@ -110,7 +110,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
size_t total_size = ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (max_property_count);
ecma_property_hashmap_t *hashmap_p = (ecma_property_hashmap_t *) mem_heap_alloc_block (total_size);
ecma_property_hashmap_t *hashmap_p = (ecma_property_hashmap_t *) jmem_heap_alloc_block (total_size);
memset (hashmap_p, 0, total_size);
hashmap_p->header.types[0].type_and_flags = ECMA_PROPERTY_TYPE_HASHMAP;
@@ -118,7 +118,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
hashmap_p->max_property_count = max_property_count;
hashmap_p->null_count = max_property_count - named_property_count;
mem_cpointer_t *pair_list_p = (mem_cpointer_t *) (hashmap_p + 1);
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
uint8_t *bits_p = (uint8_t *) (pair_list_p + max_property_count);
uint32_t mask = max_property_count - 1;
@@ -225,8 +225,8 @@ ecma_property_hashmap_free (ecma_object_t *object_p) /**< object */
object_p->property_list_or_bound_object_cp = property_p->next_property_cp;
mem_heap_free_block (hashmap_p,
ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count));
jmem_heap_free_block (hashmap_p,
ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count));
#else /* CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
(void) object_p;
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
@@ -275,7 +275,7 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
uint32_t start_entry_index = entry_index;
#endif /* !JERRY_NDEBUG */
mem_cpointer_t *pair_list_p = (mem_cpointer_t *) (hashmap_p + 1);
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
while (pair_list_p[entry_index] != ECMA_NULL_POINTER)
{
@@ -333,7 +333,7 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
uint32_t entry_index = name_p->hash;
uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];
uint32_t mask = hashmap_p->max_property_count - 1;
mem_cpointer_t *pair_list_p = (mem_cpointer_t *) (hashmap_p + 1);
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
uint8_t *bits_p = (uint8_t *) (pair_list_p + hashmap_p->max_property_count);
if (mask < (1u << LIT_STRING_HASH_BITS))
@@ -442,7 +442,7 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
uint32_t entry_index = name_p->hash;
uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];
uint32_t mask = hashmap_p->max_property_count - 1;
mem_cpointer_t *pair_list_p = (mem_cpointer_t *) (hashmap_p + 1);
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
uint8_t *bits_p = (uint8_t *) (pair_list_p + hashmap_p->max_property_count);
if (mask < (1u << LIT_STRING_HASH_BITS))
@@ -1237,7 +1237,7 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum
}
}
MEM_DEFINE_LOCAL_ARRAY (values_buffer, defined_prop_count, ecma_value_t);
JMEM_DEFINE_LOCAL_ARRAY (values_buffer, defined_prop_count, ecma_value_t);
ecma_collection_iterator_init (&iter, array_index_props_p);
@@ -1296,7 +1296,7 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum
ecma_free_value (values_buffer[index]);
}
MEM_FINALIZE_LOCAL_ARRAY (values_buffer);
JMEM_FINALIZE_LOCAL_ARRAY (values_buffer);
/* Undefined properties should be in the back of the array. */
@@ -139,7 +139,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
const lit_utf8_size_t space_size = lit_get_magic_string_size (LIT_MAGIC_STRING_SPACE_CHAR);
const lit_utf8_size_t size = name_size + msg_size + colon_size + space_size;
MEM_DEFINE_LOCAL_ARRAY (ret_str_buffer, size, lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (ret_str_buffer, size, lit_utf8_byte_t);
lit_utf8_byte_t *ret_str_buffer_p = ret_str_buffer;
lit_utf8_size_t bytes = ecma_string_to_utf8_string (name_string_p, ret_str_buffer_p, name_size);
@@ -165,7 +165,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
ret_str_p = ecma_new_ecma_string_from_utf8 (ret_str_buffer,
size);
MEM_FINALIZE_LOCAL_ARRAY (ret_str_buffer);
JMEM_FINALIZE_LOCAL_ARRAY (ret_str_buffer);
}
ret_value = ecma_make_string_value (ret_str_p);
@@ -125,7 +125,7 @@ ecma_builtin_function_prototype_object_apply (ecma_value_t this_arg, /**< this a
const uint32_t length = ecma_number_to_uint32 (length_number);
/* 6. */
MEM_DEFINE_LOCAL_ARRAY (arguments_list_p, length, ecma_value_t);
JMEM_DEFINE_LOCAL_ARRAY (arguments_list_p, length, ecma_value_t);
uint32_t last_index = 0;
/* 7. */
@@ -160,7 +160,7 @@ ecma_builtin_function_prototype_object_apply (ecma_value_t this_arg, /**< this a
ecma_free_value (arguments_list_p[index]);
}
MEM_FINALIZE_LOCAL_ARRAY (arguments_list_p);
JMEM_FINALIZE_LOCAL_ARRAY (arguments_list_p);
ECMA_OP_TO_NUMBER_FINALIZE (length_number);
ECMA_FINALIZE (length_value);
@@ -81,9 +81,9 @@ ecma_builtin_global_object_print (ecma_value_t this_arg __attr_unused___, /**< t
lit_utf8_size_t utf8_str_size = ecma_string_get_size (str_p);
MEM_DEFINE_LOCAL_ARRAY (utf8_str_p,
utf8_str_size,
lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (utf8_str_p,
utf8_str_size,
lit_utf8_byte_t);
lit_utf8_size_t actual_sz = ecma_string_to_utf8_string (str_p, utf8_str_p, utf8_str_size);
JERRY_ASSERT (actual_sz == utf8_str_size);
@@ -124,7 +124,7 @@ ecma_builtin_global_object_print (ecma_value_t this_arg __attr_unused___, /**< t
printf (" ");
}
MEM_FINALIZE_LOCAL_ARRAY (utf8_str_p);
JMEM_FINALIZE_LOCAL_ARRAY (utf8_str_p);
ECMA_FINALIZE (str_value);
}
@@ -735,9 +735,9 @@ ecma_builtin_global_object_decode_uri_helper (ecma_value_t uri __attr_unused___,
ecma_string_t *input_string_p = ecma_get_string_from_value (string);
lit_utf8_size_t input_size = ecma_string_get_size (input_string_p);
MEM_DEFINE_LOCAL_ARRAY (input_start_p,
input_size + 1,
lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (input_start_p,
input_size + 1,
lit_utf8_byte_t);
lit_utf8_size_t sz = ecma_string_to_utf8_string (input_string_p,
input_start_p,
@@ -807,7 +807,7 @@ ecma_builtin_global_object_decode_uri_helper (ecma_value_t uri __attr_unused___,
if (ecma_is_value_empty (ret_value))
{
MEM_DEFINE_LOCAL_ARRAY (output_start_p,
JMEM_DEFINE_LOCAL_ARRAY (output_start_p,
output_size,
lit_utf8_byte_t);
@@ -934,10 +934,10 @@ ecma_builtin_global_object_decode_uri_helper (ecma_value_t uri __attr_unused___,
}
}
MEM_FINALIZE_LOCAL_ARRAY (output_start_p);
JMEM_FINALIZE_LOCAL_ARRAY (output_start_p);
}
MEM_FINALIZE_LOCAL_ARRAY (input_start_p);
JMEM_FINALIZE_LOCAL_ARRAY (input_start_p);
ECMA_FINALIZE (string);
return ret_value;
@@ -1013,9 +1013,9 @@ ecma_builtin_global_object_encode_uri_helper (ecma_value_t uri, /**< uri argumen
ecma_string_t *input_string_p = ecma_get_string_from_value (string);
lit_utf8_size_t input_size = ecma_string_get_size (input_string_p);
MEM_DEFINE_LOCAL_ARRAY (input_start_p,
input_size,
lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (input_start_p,
input_size,
lit_utf8_byte_t);
lit_utf8_size_t sz = ecma_string_to_utf8_string (input_string_p,
input_start_p,
@@ -1092,9 +1092,9 @@ ecma_builtin_global_object_encode_uri_helper (ecma_value_t uri, /**< uri argumen
if (ecma_is_value_empty (ret_value))
{
MEM_DEFINE_LOCAL_ARRAY (output_start_p,
output_length,
lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (output_start_p,
output_length,
lit_utf8_byte_t);
lit_utf8_byte_t *output_char_p = output_start_p;
input_char_p = input_start_p;
@@ -1147,10 +1147,10 @@ ecma_builtin_global_object_encode_uri_helper (ecma_value_t uri, /**< uri argumen
ret_value = ecma_make_string_value (output_string_p);
MEM_FINALIZE_LOCAL_ARRAY (output_start_p);
JMEM_FINALIZE_LOCAL_ARRAY (output_start_p);
}
MEM_FINALIZE_LOCAL_ARRAY (input_start_p);
JMEM_FINALIZE_LOCAL_ARRAY (input_start_p);
ECMA_FINALIZE (string);
return ret_value;
@@ -1234,9 +1234,9 @@ ecma_builtin_global_object_escape (ecma_value_t this_arg __attr_unused___, /**<
ecma_string_t *input_string_p = ecma_get_string_from_value (string);
lit_utf8_size_t input_size = ecma_string_get_size (input_string_p);
MEM_DEFINE_LOCAL_ARRAY (input_start_p,
input_size,
lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (input_start_p,
input_size,
lit_utf8_byte_t);
lit_utf8_size_t sz = ecma_string_to_utf8_string (input_string_p,
input_start_p,
@@ -1276,9 +1276,9 @@ ecma_builtin_global_object_escape (ecma_value_t this_arg __attr_unused___, /**<
}
}
MEM_DEFINE_LOCAL_ARRAY (output_start_p,
output_length,
lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (output_start_p,
output_length,
lit_utf8_byte_t);
lit_utf8_byte_t *output_char_p = output_start_p;
@@ -1327,9 +1327,9 @@ ecma_builtin_global_object_escape (ecma_value_t this_arg __attr_unused___, /**<
ret_value = ecma_make_string_value (output_string_p);
MEM_FINALIZE_LOCAL_ARRAY (output_start_p);
JMEM_FINALIZE_LOCAL_ARRAY (output_start_p);
MEM_FINALIZE_LOCAL_ARRAY (input_start_p);
JMEM_FINALIZE_LOCAL_ARRAY (input_start_p);
ECMA_FINALIZE (string);
return ret_value;
@@ -1357,7 +1357,7 @@ ecma_builtin_global_object_unescape (ecma_value_t this_arg __attr_unused___, /**
lit_utf8_size_t input_size = ecma_string_get_size (input_string_p);
/* 3. */
MEM_DEFINE_LOCAL_ARRAY (input_start_p, input_size, lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (input_start_p, input_size, lit_utf8_byte_t);
lit_utf8_size_t sz = ecma_string_to_utf8_string (input_string_p, input_start_p, input_size);
JERRY_ASSERT (sz == input_size);
@@ -1426,7 +1426,7 @@ ecma_builtin_global_object_unescape (ecma_value_t this_arg __attr_unused___, /**
ecma_string_t *output_string_p = ecma_new_ecma_string_from_utf8 (input_start_p, output_length);
ret_value = ecma_make_string_value (output_string_p);
MEM_FINALIZE_LOCAL_ARRAY (input_start_p);
JMEM_FINALIZE_LOCAL_ARRAY (input_start_p);
ECMA_FINALIZE (string);
return ret_value;
@@ -272,7 +272,7 @@ ecma_builtin_helper_json_create_hex_digit_ecma_string (uint8_t value) /**< value
/* 2.c.iii */
ecma_string_t *hex_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
MEM_DEFINE_LOCAL_ARRAY (hex_buff, 4, lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (hex_buff, 4, lit_utf8_byte_t);
for (uint32_t i = 0; i < 4; i++)
{
@@ -297,7 +297,7 @@ ecma_builtin_helper_json_create_hex_digit_ecma_string (uint8_t value) /**< value
ecma_deref_ecma_string (hex_str_p);
hex_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) hex_buff, 4);
MEM_FINALIZE_LOCAL_ARRAY (hex_buff);
JMEM_FINALIZE_LOCAL_ARRAY (hex_buff);
JERRY_ASSERT (ecma_string_get_length (hex_str_p));
@@ -85,7 +85,7 @@ ecma_builtin_helper_object_to_string (const ecma_value_t this_arg) /**< this arg
'Null' or one of possible object's classes.
The string with null character is maximum 19 characters long. */
const lit_utf8_size_t buffer_size = 19;
MEM_DEFINE_LOCAL_ARRAY (str_buffer, buffer_size, lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (str_buffer, buffer_size, lit_utf8_byte_t);
lit_utf8_byte_t *buffer_ptr = str_buffer;
@@ -107,7 +107,7 @@ ecma_builtin_helper_object_to_string (const ecma_value_t this_arg) /**< this arg
ret_string_p = ecma_new_ecma_string_from_utf8 (str_buffer, (lit_utf8_size_t) (buffer_ptr - str_buffer));
MEM_FINALIZE_LOCAL_ARRAY (str_buffer);
JMEM_FINALIZE_LOCAL_ARRAY (str_buffer);
return ecma_make_string_value (ret_string_p);
} /* ecma_builtin_helper_object_to_string */
@@ -961,7 +961,7 @@ ecma_builtin_json_stringify (ecma_value_t this_arg __attr_unused___, /**< 'this'
}
else
{
MEM_DEFINE_LOCAL_ARRAY (space_buff, space, char);
JMEM_DEFINE_LOCAL_ARRAY (space_buff, space, char);
for (int32_t i = 0; i < space; i++)
{
@@ -970,7 +970,7 @@ ecma_builtin_json_stringify (ecma_value_t this_arg __attr_unused___, /**< 'this'
context.gap_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff, (lit_utf8_size_t) space);
MEM_FINALIZE_LOCAL_ARRAY (space_buff);
JMEM_FINALIZE_LOCAL_ARRAY (space_buff);
}
ECMA_OP_TO_NUMBER_FINALIZE (array_length_num);
@@ -196,7 +196,7 @@ ecma_builtin_number_prototype_object_to_string (ecma_value_t this_arg, /**< this
should_round = true;
}
MEM_DEFINE_LOCAL_ARRAY (buff, buff_size, lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (buff, buff_size, lit_utf8_byte_t);
int buff_index = 0;
/* Calculate digits for whole part. */
@@ -310,7 +310,7 @@ ecma_builtin_number_prototype_object_to_string (ecma_value_t this_arg, /**< this
JERRY_ASSERT (buff_index <= buff_size);
ecma_string_t *str_p = ecma_new_ecma_string_from_utf8 (buff, (lit_utf8_size_t) buff_index);
ret_value = ecma_make_string_value (str_p);
MEM_FINALIZE_LOCAL_ARRAY (buff);
JMEM_FINALIZE_LOCAL_ARRAY (buff);
}
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
}
@@ -463,7 +463,7 @@ ecma_builtin_number_prototype_object_to_fixed (ecma_value_t this_arg, /**< this
}
JERRY_ASSERT (buffer_size > 0);
MEM_DEFINE_LOCAL_ARRAY (buff, buffer_size, lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (buff, buffer_size, lit_utf8_byte_t);
lit_utf8_byte_t *p = buff;
@@ -559,7 +559,7 @@ ecma_builtin_number_prototype_object_to_fixed (ecma_value_t this_arg, /**< this
ecma_string_t *str = ecma_new_ecma_string_from_utf8 (buff, (lit_utf8_size_t) (p - buff));
ret_value = ecma_make_string_value (str);
MEM_FINALIZE_LOCAL_ARRAY (buff);
JMEM_FINALIZE_LOCAL_ARRAY (buff);
}
}
}
@@ -666,7 +666,7 @@ ecma_builtin_number_prototype_object_to_exponential (ecma_value_t this_arg, /**<
buffer_size++;
}
MEM_DEFINE_LOCAL_ARRAY (buff, buffer_size, lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (buff, buffer_size, lit_utf8_byte_t);
int digit = 0;
uint64_t scale = 1;
@@ -745,7 +745,7 @@ ecma_builtin_number_prototype_object_to_exponential (ecma_value_t this_arg, /**<
*actual_char_p = '\0';
ecma_string_t *str = ecma_new_ecma_string_from_utf8 (buff, (lit_utf8_size_t) (actual_char_p - buff));
ret_value = ecma_make_string_value (str);
MEM_FINALIZE_LOCAL_ARRAY (buff);
JMEM_FINALIZE_LOCAL_ARRAY (buff);
}
}
}
@@ -862,7 +862,7 @@ ecma_builtin_number_prototype_object_to_precision (ecma_value_t this_arg, /**< t
buffer_size++;
}
MEM_DEFINE_LOCAL_ARRAY (buff, buffer_size, lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (buff, buffer_size, lit_utf8_byte_t);
lit_utf8_byte_t *actual_char_p = buff;
uint64_t scale = 1;
@@ -978,7 +978,7 @@ ecma_builtin_number_prototype_object_to_precision (ecma_value_t this_arg, /**< t
ecma_string_t *str_p = ecma_new_ecma_string_from_utf8 (buff, (lit_utf8_size_t) (actual_char_p - buff));
ret_value = ecma_make_string_value (str_p);
MEM_FINALIZE_LOCAL_ARRAY (buff);
JMEM_FINALIZE_LOCAL_ARRAY (buff);
}
}
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
@@ -705,7 +705,7 @@ ecma_builtin_object_object_define_properties (ecma_value_t this_arg __attr_unuse
ecma_collection_iterator_init (&iter, prop_names_p);
// 4.
MEM_DEFINE_LOCAL_ARRAY (property_descriptors, property_number, ecma_property_descriptor_t);
JMEM_DEFINE_LOCAL_ARRAY (property_descriptors, property_number, ecma_property_descriptor_t);
uint32_t property_descriptor_number = 0;
@@ -756,7 +756,7 @@ ecma_builtin_object_object_define_properties (ecma_value_t this_arg __attr_unuse
ecma_free_property_descriptor (&property_descriptors[index]);
}
MEM_FINALIZE_LOCAL_ARRAY (property_descriptors);
JMEM_FINALIZE_LOCAL_ARRAY (property_descriptors);
ecma_free_values_collection (prop_names_p, true);
@@ -794,9 +794,9 @@ ecma_builtin_string_prototype_object_replace_get_string (ecma_builtin_replace_se
if (context_p->is_replace_callable)
{
MEM_DEFINE_LOCAL_ARRAY (arguments_list,
match_length + 2,
ecma_value_t);
JMEM_DEFINE_LOCAL_ARRAY (arguments_list,
match_length + 2,
ecma_value_t);
/* An error might occure during the array copy and
* uninitalized elements must not be freed. */
@@ -847,7 +847,7 @@ ecma_builtin_string_prototype_object_replace_get_string (ecma_builtin_replace_se
ecma_free_value (arguments_list[i]);
}
MEM_FINALIZE_LOCAL_ARRAY (arguments_list);
JMEM_FINALIZE_LOCAL_ARRAY (arguments_list);
}
else
{
@@ -2078,9 +2078,9 @@ ecma_builtin_string_prototype_object_conversion_helper (ecma_value_t this_arg, /
/* Second phase. */
MEM_DEFINE_LOCAL_ARRAY (output_start_p,
output_length,
lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (output_start_p,
output_length,
lit_utf8_byte_t);
lit_utf8_byte_t *output_char_p = output_start_p;
@@ -2120,7 +2120,7 @@ ecma_builtin_string_prototype_object_conversion_helper (ecma_value_t this_arg, /
ret_value = ecma_make_string_value (output_string_p);
MEM_FINALIZE_LOCAL_ARRAY (output_start_p);
JMEM_FINALIZE_LOCAL_ARRAY (output_start_p);
ECMA_FINALIZE_UTF8_STRING (input_start_p, input_start_size);
ECMA_FINALIZE (to_string_val);
@@ -69,9 +69,9 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg __attr_unused__
{
lit_utf8_size_t utf8_buf_size = args_number * LIT_CESU8_MAX_BYTES_IN_CODE_UNIT;
MEM_DEFINE_LOCAL_ARRAY (utf8_buf_p,
utf8_buf_size,
lit_utf8_byte_t);
JMEM_DEFINE_LOCAL_ARRAY (utf8_buf_p,
utf8_buf_size,
lit_utf8_byte_t);
lit_utf8_size_t utf8_buf_used = 0;
@@ -96,7 +96,7 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg __attr_unused__
ret_string_p = ecma_new_ecma_string_from_utf8 (utf8_buf_p, utf8_buf_used);
}
MEM_FINALIZE_LOCAL_ARRAY (utf8_buf_p);
JMEM_FINALIZE_LOCAL_ARRAY (utf8_buf_p);
}
if (ecma_is_value_empty (ret_value))
@@ -276,7 +276,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
ecma_length_t array_index_props_num = array_index_props_p->unit_number;
MEM_DEFINE_LOCAL_ARRAY (array_index_values_p, array_index_props_num, uint32_t);
JMEM_DEFINE_LOCAL_ARRAY (array_index_values_p, array_index_props_num, uint32_t);
ecma_collection_iterator_t iter;
ecma_collection_iterator_init (&iter, array_index_props_p);
@@ -339,7 +339,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
}
}
MEM_FINALIZE_LOCAL_ARRAY (array_index_values_p);
JMEM_FINALIZE_LOCAL_ARRAY (array_index_values_p);
ecma_free_values_collection (array_index_props_p, true);
@@ -701,7 +701,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
ecma_length_t merged_args_list_len = bound_arg_list_p->unit_number + arguments_list_len;
MEM_DEFINE_LOCAL_ARRAY (merged_args_list_p, merged_args_list_len, ecma_value_t);
JMEM_DEFINE_LOCAL_ARRAY (merged_args_list_p, merged_args_list_len, ecma_value_t);
ecma_function_bind_merge_arg_lists (merged_args_list_p,
bound_arg_list_p,
@@ -714,7 +714,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
merged_args_list_p,
merged_args_list_len);
MEM_FINALIZE_LOCAL_ARRAY (merged_args_list_p);
JMEM_FINALIZE_LOCAL_ARRAY (merged_args_list_p);
}
else
{
@@ -892,7 +892,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
ecma_length_t merged_args_list_len = bound_arg_list_p->unit_number + arguments_list_len;
MEM_DEFINE_LOCAL_ARRAY (merged_args_list_p, merged_args_list_len, ecma_value_t);
JMEM_DEFINE_LOCAL_ARRAY (merged_args_list_p, merged_args_list_len, ecma_value_t);
ecma_function_bind_merge_arg_lists (merged_args_list_p,
bound_arg_list_p,
@@ -904,7 +904,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
merged_args_list_p,
merged_args_list_len);
MEM_FINALIZE_LOCAL_ARRAY (merged_args_list_p);
JMEM_FINALIZE_LOCAL_ARRAY (merged_args_list_p);
}
else
{
@@ -134,7 +134,7 @@ ecma_op_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function
indx++)
{
// i.
if (literal_p[indx] == MEM_CP_NULL)
if (literal_p[indx] == JMEM_CP_NULL)
{
continue;
}
+6 -6
View File
@@ -734,10 +734,10 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
}
/* Second pass: collecting properties names into arrays */
MEM_DEFINE_LOCAL_ARRAY (names_p,
array_index_named_properties_count + string_named_properties_count,
ecma_string_t *);
MEM_DEFINE_LOCAL_ARRAY (array_index_names_p, array_index_named_properties_count, uint32_t);
JMEM_DEFINE_LOCAL_ARRAY (names_p,
array_index_named_properties_count + string_named_properties_count,
ecma_string_t *);
JMEM_DEFINE_LOCAL_ARRAY (array_index_names_p, array_index_named_properties_count, uint32_t);
uint32_t name_pos = array_index_named_properties_count + string_named_properties_count;
uint32_t array_index_name_pos = 0;
@@ -803,7 +803,7 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
JERRY_ASSERT (name_pos == 0);
MEM_FINALIZE_LOCAL_ARRAY (array_index_names_p);
JMEM_FINALIZE_LOCAL_ARRAY (array_index_names_p);
ecma_free_values_collection (prop_names_p, true);
@@ -870,7 +870,7 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
ecma_deref_ecma_string (name_p);
}
MEM_FINALIZE_LOCAL_ARRAY (names_p);
JMEM_FINALIZE_LOCAL_ARRAY (names_p);
}
ecma_free_values_collection (skipped_non_enumerable_p, true);
+1 -1
View File
@@ -35,7 +35,7 @@ typedef struct
ecma_value_t base;
/** referenced name */
__extension__ mem_cpointer_t referenced_name_cp : ECMA_POINTER_FIELD_WIDTH;
__extension__ jmem_cpointer_t referenced_name_cp : ECMA_POINTER_FIELD_WIDTH;
/** strict reference flag */
unsigned int is_strict : 1;
@@ -540,7 +540,7 @@ re_match_regexp (re_matcher_ctx_t *re_ctx_p, /**< RegExp matcher context */
const lit_utf8_byte_t *sub_str_p = NULL;
uint32_t array_size = re_ctx_p->num_of_captures + re_ctx_p->num_of_non_captures;
MEM_DEFINE_LOCAL_ARRAY (saved_bck_p, array_size, lit_utf8_byte_t *);
JMEM_DEFINE_LOCAL_ARRAY (saved_bck_p, array_size, lit_utf8_byte_t *);
size_t size = (size_t) (array_size) * sizeof (lit_utf8_byte_t *);
memcpy (saved_bck_p, re_ctx_p->saved_p, size);
@@ -592,7 +592,7 @@ re_match_regexp (re_matcher_ctx_t *re_ctx_p, /**< RegExp matcher context */
}
}
MEM_FINALIZE_LOCAL_ARRAY (saved_bck_p);
JMEM_FINALIZE_LOCAL_ARRAY (saved_bck_p);
return match_value;
}
case RE_OP_CHAR_CLASS:
@@ -1292,7 +1292,7 @@ ecma_regexp_exec_helper (ecma_value_t regexp_value, /**< RegExp object */
JERRY_ASSERT (re_ctx.num_of_captures % 2 == 0);
re_ctx.num_of_non_captures = bc_p->num_of_non_captures;
MEM_DEFINE_LOCAL_ARRAY (saved_p, re_ctx.num_of_captures + re_ctx.num_of_non_captures, const lit_utf8_byte_t *);
JMEM_DEFINE_LOCAL_ARRAY (saved_p, re_ctx.num_of_captures + re_ctx.num_of_non_captures, const lit_utf8_byte_t *);
for (uint32_t i = 0; i < re_ctx.num_of_captures + re_ctx.num_of_non_captures; i++)
{
@@ -1301,7 +1301,7 @@ ecma_regexp_exec_helper (ecma_value_t regexp_value, /**< RegExp object */
re_ctx.saved_p = saved_p;
uint32_t num_of_iter_length = (re_ctx.num_of_captures / 2) + (re_ctx.num_of_non_captures - 1);
MEM_DEFINE_LOCAL_ARRAY (num_of_iter_p, num_of_iter_length, uint32_t);
JMEM_DEFINE_LOCAL_ARRAY (num_of_iter_p, num_of_iter_length, uint32_t);
for (uint32_t i = 0; i < num_of_iter_length; i++)
{
@@ -1466,8 +1466,8 @@ ecma_regexp_exec_helper (ecma_value_t regexp_value, /**< RegExp object */
}
}
MEM_FINALIZE_LOCAL_ARRAY (num_of_iter_p);
MEM_FINALIZE_LOCAL_ARRAY (saved_p);
JMEM_FINALIZE_LOCAL_ARRAY (num_of_iter_p);
JMEM_FINALIZE_LOCAL_ARRAY (saved_p);
ECMA_FINALIZE_UTF8_STRING (input_buffer_p, input_buffer_size);
return ret_value;