Add new coding style rules and fix appeared issues.

JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
This commit is contained in:
Andrey Shitov
2015-05-12 19:17:07 +03:00
parent ca12c16607
commit 9763a93df3
89 changed files with 1152 additions and 626 deletions
+2 -2
View File
@@ -78,8 +78,8 @@ JERRY_STATIC_ASSERT (sizeof (ecma_getter_setter_pointers_t) <= sizeof (uint64_t)
* Declaration of alloc/free routine for specified ecma-type.
*/
#define DECLARE_ROUTINES_FOR(ecma_type) \
ALLOC(ecma_type) \
DEALLOC(ecma_type)
ALLOC (ecma_type) \
DEALLOC (ecma_type)
DECLARE_ROUTINES_FOR (object)
DECLARE_ROUTINES_FOR (property)
+24 -23
View File
@@ -55,7 +55,7 @@ typedef enum
/**
* List of marked (visited during current GC session) and umarked objects
*/
static ecma_object_t *ecma_gc_objects_lists [ECMA_GC_COLOR__COUNT];
static ecma_object_t *ecma_gc_objects_lists[ECMA_GC_COLOR__COUNT];
/**
* Current state of an object's visited flag that indicates whether the object is in visited state:
@@ -177,8 +177,8 @@ ecma_init_gc_info (ecma_object_t *object_p) /**< object */
{
ecma_gc_set_object_refs (object_p, 1);
ecma_gc_set_object_next (object_p, ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY]);
ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY] = object_p;
ecma_gc_set_object_next (object_p, ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY]);
ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY] = object_p;
/* Should be set to false at the beginning of garbage collection */
ecma_gc_set_object_visited (object_p, false);
@@ -199,7 +199,7 @@ ecma_ref_object (ecma_object_t *object_p) /**< object */
void
ecma_deref_object (ecma_object_t *object_p) /**< object */
{
JERRY_ASSERT(ecma_gc_get_object_refs (object_p) > 0);
JERRY_ASSERT (ecma_gc_get_object_refs (object_p) > 0);
ecma_gc_set_object_refs (object_p, ecma_gc_get_object_refs (object_p) - 1);
} /* ecma_deref_object */
@@ -209,8 +209,8 @@ ecma_deref_object (ecma_object_t *object_p) /**< object */
void
ecma_gc_init (void)
{
ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY] = NULL;
ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK] = NULL;
ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY] = NULL;
ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK] = NULL;
} /* ecma_gc_init */
/**
@@ -219,7 +219,7 @@ ecma_gc_init (void)
void
ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
{
JERRY_ASSERT(object_p != NULL);
JERRY_ASSERT (object_p != NULL);
JERRY_ASSERT (ecma_gc_is_object_visited (object_p));
bool traverse_properties = true;
@@ -302,7 +302,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
case ECMA_INTERNAL_PROPERTY_NUMBER_INDEXED_ARRAY_VALUES: /* a collection of ecma-values */
case ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES: /* a collection of ecma-values */
{
JERRY_UNIMPLEMENTED("Indexed array storage is not implemented yet.");
JERRY_UNIMPLEMENTED ("Indexed array storage is not implemented yet.");
}
case ECMA_INTERNAL_PROPERTY_PROTOTYPE: /* the property's value is located in ecma_object_t
@@ -312,7 +312,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
case ECMA_INTERNAL_PROPERTY__COUNT: /* not a real internal property type,
* but number of the real internal property types */
{
JERRY_UNREACHABLE();
JERRY_UNREACHABLE ();
}
case ECMA_INTERNAL_PROPERTY_FORMAL_PARAMETERS: /* a collection of strings */
@@ -336,7 +336,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
case ECMA_INTERNAL_PROPERTY_SCOPE: /* a lexical environment */
case ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP: /* an object */
{
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER(ecma_object_t, property_value);
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, property_value);
ecma_gc_set_object_visited (obj_p, true);
@@ -357,9 +357,9 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
void
ecma_gc_sweep (ecma_object_t *object_p) /**< object to free */
{
JERRY_ASSERT(object_p != NULL
&& !ecma_gc_is_object_visited (object_p)
&& ecma_gc_get_object_refs (object_p) == 0);
JERRY_ASSERT (object_p != NULL
&& !ecma_gc_is_object_visited (object_p)
&& ecma_gc_get_object_refs (object_p) == 0);
if (!ecma_is_lexical_environment (object_p))
{
@@ -405,10 +405,10 @@ ecma_gc_sweep (ecma_object_t *object_p) /**< object to free */
void
ecma_gc_run (void)
{
JERRY_ASSERT (ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK] == NULL);
JERRY_ASSERT (ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK] == NULL);
/* if some object is referenced from stack or globals (i.e. it is root), mark it */
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY];
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY];
obj_iter_p != NULL;
obj_iter_p = ecma_gc_get_object_next (obj_iter_p))
{
@@ -445,7 +445,7 @@ ecma_gc_run (void)
{
marked_anything_during_current_iteration = false;
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY], *obj_prev_p = NULL, *obj_next_p;
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY], *obj_prev_p = NULL, *obj_next_p;
obj_iter_p != NULL;
obj_iter_p = obj_next_p)
{
@@ -454,8 +454,8 @@ ecma_gc_run (void)
if (ecma_gc_is_object_visited (obj_iter_p))
{
/* Moving the object to list of marked objects */
ecma_gc_set_object_next (obj_iter_p, ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK]);
ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK] = obj_iter_p;
ecma_gc_set_object_next (obj_iter_p, ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK]);
ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK] = obj_iter_p;
if (likely (obj_prev_p != NULL))
{
@@ -465,7 +465,7 @@ ecma_gc_run (void)
}
else
{
ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY] = obj_next_p;
ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY] = obj_next_p;
}
ecma_gc_mark (obj_iter_p);
@@ -476,10 +476,11 @@ ecma_gc_run (void)
obj_prev_p = obj_iter_p;
}
}
} while (marked_anything_during_current_iteration);
}
while (marked_anything_during_current_iteration);
/* Sweeping objects that are currently unmarked */
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY], *obj_next_p;
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY], *obj_next_p;
obj_iter_p != NULL;
obj_iter_p = obj_next_p)
{
@@ -491,8 +492,8 @@ ecma_gc_run (void)
}
/* Unmarking all objects */
ecma_gc_objects_lists [ECMA_GC_COLOR_WHITE_GRAY] = ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK];
ecma_gc_objects_lists [ECMA_GC_COLOR_BLACK] = NULL;
ecma_gc_objects_lists[ECMA_GC_COLOR_WHITE_GRAY] = ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK];
ecma_gc_objects_lists[ECMA_GC_COLOR_BLACK] = NULL;
ecma_gc_visited_flip_flag = !ecma_gc_visited_flip_flag;
} /* ecma_gc_run */
@@ -71,10 +71,10 @@
ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_copy_to); \
ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_copy_from); \
\
name_copy_to[0] = name_copy_from [0]; \
name_copy_to[1] = name_copy_from [1]; \
name_copy_to[2] = name_copy_from [2]; \
name_copy_to[3] = name_copy_from [3]; \
name_copy_to[0] = name_copy_from[0]; \
name_copy_to[1] = name_copy_from[1]; \
name_copy_to[2] = name_copy_from[2]; \
name_copy_to[3] = name_copy_from[3]; \
}
/**
@@ -176,13 +176,13 @@
{ \
ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name); \
\
name [0] += 1ull; \
name [1] += (name [0] >> 32u); \
name [0] = (uint32_t) name [0]; \
name [2] += (name [1] >> 32u); \
name [1] = (uint32_t) name [1]; \
name [3] += (name [2] >> 32u); \
name [2] = (uint32_t) name [2]; \
name[0] += 1ull; \
name[1] += (name[0] >> 32u); \
name[0] = (uint32_t) name[0]; \
name[2] += (name[1] >> 32u); \
name[1] = (uint32_t) name[1]; \
name[3] += (name[2] >> 32u); \
name[2] = (uint32_t) name[2]; \
\
ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name); \
}
@@ -195,17 +195,17 @@
ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_add_to); \
ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_to_add); \
\
name_add_to [0] += name_to_add [0]; \
name_add_to [1] += name_to_add [1]; \
name_add_to [2] += name_to_add [2]; \
name_add_to [3] += name_to_add [3]; \
name_add_to[0] += name_to_add[0]; \
name_add_to[1] += name_to_add[1]; \
name_add_to[2] += name_to_add[2]; \
name_add_to[3] += name_to_add[3]; \
\
name_add_to [1] += (name_add_to [0] >> 32u); \
name_add_to [0] = (uint32_t) name_add_to [0]; \
name_add_to [2] += (name_add_to [1] >> 32u); \
name_add_to [1] = (uint32_t) name_add_to [1]; \
name_add_to [3] += (name_add_to [2] >> 32u); \
name_add_to [2] = (uint32_t) name_add_to [2]; \
name_add_to[1] += (name_add_to[0] >> 32u); \
name_add_to[0] = (uint32_t) name_add_to[0]; \
name_add_to[2] += (name_add_to[1] >> 32u); \
name_add_to[1] = (uint32_t) name_add_to[1]; \
name_add_to[3] += (name_add_to[2] >> 32u); \
name_add_to[2] = (uint32_t) name_add_to[2]; \
\
ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_add_to); \
ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name_to_add); \
@@ -244,7 +244,7 @@
const uint64_t div10_p_mid = 0x99999999ul; \
const uint64_t div10_p_high = 0x19999999ul; \
\
uint64_t intermediate [8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; \
uint64_t intermediate[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; \
uint64_t l0, l1, l2, l3, m0, m1, m2, m3, h0, h1, h2, h3; \
l0 = name[0] * div10_p_low; \
l1 = name[1] * div10_p_low; \
@@ -297,25 +297,25 @@
intermediate[6] += (uint32_t) h3; \
intermediate[7] += h3 >> 32u; \
\
intermediate [1] += intermediate[0] >> 32u; \
intermediate [0] = (uint32_t) intermediate[0]; \
intermediate [2] += intermediate[1] >> 32u; \
intermediate [1] = (uint32_t) intermediate[1]; \
intermediate [3] += intermediate[2] >> 32u; \
intermediate [2] = (uint32_t) intermediate[2]; \
intermediate [4] += intermediate[3] >> 32u; \
intermediate [3] = (uint32_t) intermediate[3]; \
intermediate [5] += intermediate[4] >> 32u; \
intermediate [4] = (uint32_t) intermediate[4]; \
intermediate [6] += intermediate[5] >> 32u; \
intermediate [5] = (uint32_t) intermediate[5]; \
intermediate [7] += intermediate[6] >> 32u; \
intermediate [6] = (uint32_t) intermediate[6]; \
intermediate[1] += intermediate[0] >> 32u; \
intermediate[0] = (uint32_t) intermediate[0]; \
intermediate[2] += intermediate[1] >> 32u; \
intermediate[1] = (uint32_t) intermediate[1]; \
intermediate[3] += intermediate[2] >> 32u; \
intermediate[2] = (uint32_t) intermediate[2]; \
intermediate[4] += intermediate[3] >> 32u; \
intermediate[3] = (uint32_t) intermediate[3]; \
intermediate[5] += intermediate[4] >> 32u; \
intermediate[4] = (uint32_t) intermediate[4]; \
intermediate[6] += intermediate[5] >> 32u; \
intermediate[5] = (uint32_t) intermediate[5]; \
intermediate[7] += intermediate[6] >> 32u; \
intermediate[6] = (uint32_t) intermediate[6]; \
\
name[0] = intermediate [4]; \
name[1] = intermediate [5]; \
name[2] = intermediate [6]; \
name[3] = intermediate [7]; \
name[0] = intermediate[4]; \
name[1] = intermediate[5]; \
name[2] = intermediate[6]; \
name[3] = intermediate[7]; \
\
ECMA_NUMBER_CONVERSION_128BIT_INTEGER_CHECK_PARTS_ARE_32BIT (name); \
}
@@ -342,7 +342,7 @@ ecma_zt_string_to_number (const ecma_char_t *str_p) /**< zero-terminated string
const ecma_char_t hex_upper_digits_range[10] = { 'A', 'F' };
const ecma_char_t hex_x_chars[2] = { 'x', 'X' };
const ecma_char_t white_space[2] = { ' ', '\n' };
const ecma_char_t e_chars [2] = { 'e', 'E' };
const ecma_char_t e_chars[2] = { 'e', 'E' };
const ecma_char_t plus_char = '+';
const ecma_char_t minus_char = '-';
const ecma_char_t dot_char = '.';
@@ -393,8 +393,8 @@ ecma_zt_string_to_number (const ecma_char_t *str_p) /**< zero-terminated string
{
int32_t digit_value;
if (*iter_p >= dec_digits_range [0]
&& *iter_p <= dec_digits_range [1])
if (*iter_p >= dec_digits_range[0]
&& *iter_p <= dec_digits_range[1])
{
digit_value = (*iter_p - dec_digits_range[0]);
}
@@ -464,8 +464,8 @@ ecma_zt_string_to_number (const ecma_char_t *str_p) /**< zero-terminated string
{
int32_t digit_value;
if (*begin_p >= dec_digits_range [0]
&& *begin_p <= dec_digits_range [1])
if (*begin_p >= dec_digits_range[0]
&& *begin_p <= dec_digits_range[1])
{
digit_value = (*begin_p - dec_digits_range[0]);
}
@@ -502,8 +502,8 @@ ecma_zt_string_to_number (const ecma_char_t *str_p) /**< zero-terminated string
{
int32_t digit_value;
if (*begin_p >= dec_digits_range [0]
&& *begin_p <= dec_digits_range [1])
if (*begin_p >= dec_digits_range[0]
&& *begin_p <= dec_digits_range[1])
{
digit_value = (*begin_p - dec_digits_range[0]);
}
@@ -556,8 +556,8 @@ ecma_zt_string_to_number (const ecma_char_t *str_p) /**< zero-terminated string
{
int32_t digit_value;
if (*begin_p >= dec_digits_range [0]
&& *begin_p <= dec_digits_range [1])
if (*begin_p >= dec_digits_range[0]
&& *begin_p <= dec_digits_range[1])
{
digit_value = (*begin_p - dec_digits_range[0]);
}
@@ -1120,7 +1120,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */
ssize_t buffer_size) /**< size of buffer */
{
const ecma_char_t digits[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
const ecma_char_t e_chars [2] = { 'e', 'E' };
const ecma_char_t e_chars[2] = { 'e', 'E' };
const ecma_char_t plus_char = '+';
const ecma_char_t minus_char = '-';
const ecma_char_t dot_char = '.';
@@ -1324,12 +1324,12 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */
for (int32_t i = 0; i < n - k; i++)
{
*--dst_p = digits [0];
*--dst_p = digits[0];
}
for (int32_t i = 0; i < k; i++)
{
*--dst_p = digits [s % 10];
*--dst_p = digits[s % 10];
s /= 10;
}
}
@@ -1343,7 +1343,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */
for (int32_t i = 0; i < k - n; i++)
{
*--dst_p = digits [s % 10];
*--dst_p = digits[s % 10];
s /= 10;
}
@@ -1351,7 +1351,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */
for (int32_t i = 0; i < n; i++)
{
*--dst_p = digits [s % 10];
*--dst_p = digits[s % 10];
s /= 10;
}
}
@@ -1365,13 +1365,13 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */
for (int32_t i = 0; i < k; i++)
{
*--dst_p = digits [s % 10];
*--dst_p = digits[s % 10];
s /= 10;
}
for (int32_t i = 0; i < -n; i++)
{
*--dst_p = digits [0];
*--dst_p = digits[0];
}
*--dst_p = dot_char;
@@ -1384,7 +1384,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */
// 9.
JERRY_ASSERT ((ssize_t) sizeof (ecma_char_t) <= buffer_size);
*dst_p++ = digits [s % 10];
*dst_p++ = digits[s % 10];
s /= 10;
}
else
@@ -1395,7 +1395,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */
for (int32_t i = 0; i < k - 1; i++)
{
*--dst_p = digits [s % 10];
*--dst_p = digits[s % 10];
s /= 10;
}
@@ -1415,7 +1415,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */
if (t == 0)
{
JERRY_ASSERT ((ssize_t) sizeof (ecma_char_t) * (dst_p - buffer_p + 1) <= buffer_size);
*dst_p++ = digits [0];
*dst_p++ = digits[0];
}
else
{
@@ -1431,7 +1431,7 @@ ecma_number_to_zt_string (ecma_number_t num, /**< ecma-number */
while (t_mod != 0)
{
JERRY_ASSERT ((ssize_t) sizeof (ecma_char_t) * (dst_p - buffer_p + 1) <= buffer_size);
*dst_p++ = digits [t / t_mod];
*dst_p++ = digits[t / t_mod];
t -= (t / t_mod) * t_mod;
t_mod /= 10;
+17 -17
View File
@@ -49,7 +49,7 @@ JERRY_STATIC_ASSERT ((uint32_t) ((int32_t) ECMA_STRING_MAX_CONCATENATION_LENGTH)
/**
* Lengths of magic strings
*/
static ecma_length_t ecma_magic_string_lengths [ECMA_MAGIC_STRING__COUNT];
static ecma_length_t ecma_magic_string_lengths[ECMA_MAGIC_STRING__COUNT];
#ifndef JERRY_NDEBUG
/**
@@ -286,10 +286,10 @@ ecma_strings_init (void)
id < ECMA_MAGIC_STRING__COUNT;
id = (ecma_magic_string_id_t) (id + 1))
{
ecma_magic_string_lengths [id] = ecma_zt_string_length (ecma_get_magic_string_zt (id));
ecma_magic_string_lengths[id] = ecma_zt_string_length (ecma_get_magic_string_zt (id));
#ifndef JERRY_NDEBUG
ecma_magic_string_max_length = JERRY_MAX (ecma_magic_string_max_length, ecma_magic_string_lengths [id]);
ecma_magic_string_max_length = JERRY_MAX (ecma_magic_string_max_length, ecma_magic_string_lengths[id]);
JERRY_ASSERT (ecma_magic_string_max_length <= ECMA_STRING_MAGIC_STRING_LENGTH_LIMIT);
#endif /* !JERRY_NDEBUG */
@@ -348,7 +348,7 @@ ecma_init_ecma_string_from_magic_string_id (ecma_string_t *string_p, /**< descri
string_p->is_stack_var = (is_stack_var != 0);
string_p->container = ECMA_STRING_CONTAINER_MAGIC_STRING;
string_p->hash = ecma_chars_buffer_calc_hash_last_chars (ecma_get_magic_string_zt (magic_string_id),
ecma_magic_string_lengths [magic_string_id]);
ecma_magic_string_lengths[magic_string_id]);
string_p->u.common_field = 0;
string_p->u.magic_string_id = magic_string_id;
@@ -413,10 +413,10 @@ ecma_new_ecma_string_from_uint32 (uint32_t uint32_number) /**< UInt32-represente
FIXME (/* Use digit to char conversion routine */);
const ecma_char_t digits[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
const bool is_one_char_or_more = (uint32_number >= 10);
const ecma_char_t last_chars [ECMA_STRING_HASH_LAST_CHARS_COUNT] =
const ecma_char_t last_chars[ECMA_STRING_HASH_LAST_CHARS_COUNT] =
{
is_one_char_or_more ? digits [digit_pl] : digits[digit_l],
is_one_char_or_more ? digits [digit_l] : ECMA_CHAR_NULL
is_one_char_or_more ? digits[digit_pl] : digits[digit_l],
is_one_char_or_more ? digits[digit_l] : ECMA_CHAR_NULL
};
/* Only last two chars are really used for hash calculation */
@@ -424,7 +424,7 @@ ecma_new_ecma_string_from_uint32 (uint32_t uint32_number) /**< UInt32-represente
is_one_char_or_more ? 2 : 1);
#ifndef JERRY_NDEBUG
ecma_char_t char_buf [ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];
ecma_char_t char_buf[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];
ssize_t chars_copied = ecma_uint32_to_string (uint32_number,
char_buf,
ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);
@@ -962,7 +962,7 @@ ecma_string_to_zt_string (const ecma_string_t *string_desc_p, /**< ecma-string d
case ECMA_STRING_CONTAINER_MAGIC_STRING:
{
const ecma_magic_string_id_t id = string_desc_p->u.magic_string_id;
const size_t length = ecma_magic_string_lengths [id];
const size_t length = ecma_magic_string_lengths[id];
size_t bytes_to_copy = (length + 1) * sizeof (ecma_char_t);
@@ -1184,8 +1184,8 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-
const ecma_char_t *zt_string1_p, *zt_string2_p;
bool is_zt_string1_on_heap = false, is_zt_string2_on_heap = false;
ecma_char_t zt_string1_buffer [ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER + 1];
ecma_char_t zt_string2_buffer [ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER + 1];
ecma_char_t zt_string1_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER + 1];
ecma_char_t zt_string2_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER + 1];
if (string1_p->container == ECMA_STRING_CONTAINER_LIT_TABLE)
{
@@ -1292,7 +1292,7 @@ ecma_string_get_length (const ecma_string_t *string_p) /**< ecma-string */
}
else if (container == ECMA_STRING_CONTAINER_MAGIC_STRING)
{
return ecma_magic_string_lengths [string_p->u.magic_string_id];
return ecma_magic_string_lengths[string_p->u.magic_string_id];
}
else if (container == ECMA_STRING_CONTAINER_UINT32_IN_DESC)
{
@@ -1315,7 +1315,7 @@ ecma_string_get_length (const ecma_string_t *string_p) /**< ecma-string */
int32_t length = 1;
while (length < max_uint32_len
&& uint32_number >= nums_with_ascending_length [length])
&& uint32_number >= nums_with_ascending_length[length])
{
length++;
}
@@ -1376,7 +1376,7 @@ ecma_string_get_char_at_pos (const ecma_string_t *string_p, /**< ecma-string */
ecma_string_to_zt_string (string_p, zt_str_p, (ssize_t) buffer_size);
ecma_char_t ch = zt_str_p [index];
ecma_char_t ch = zt_str_p[index];
mem_heap_free_block (zt_str_p);
@@ -1586,7 +1586,7 @@ ecma_zt_string_length (const ecma_char_t *string_p) /**< zero-terminated string
const ecma_char_t*
ecma_get_magic_string_zt (ecma_magic_string_id_t id) /**< magic string id */
{
TODO(Support UTF-16);
TODO (Support UTF-16);
switch (id)
{
@@ -1598,7 +1598,7 @@ ecma_get_magic_string_zt (ecma_magic_string_id_t id) /**< magic string id */
case ECMA_MAGIC_STRING__COUNT: break;
}
JERRY_UNREACHABLE();
JERRY_UNREACHABLE ();
} /* ecma_get_magic_string_zt */
/**
@@ -1655,7 +1655,7 @@ static bool
ecma_is_string_magic_longpath (const ecma_string_t *string_p, /**< ecma-string */
ecma_magic_string_id_t *out_id_p) /**< out: magic string's id */
{
ecma_char_t zt_string_buffer [ECMA_STRING_MAGIC_STRING_LENGTH_LIMIT + 1];
ecma_char_t zt_string_buffer[ECMA_STRING_MAGIC_STRING_LENGTH_LIMIT + 1];
ssize_t copied = ecma_string_to_zt_string (string_p, zt_string_buffer, (ssize_t) sizeof (zt_string_buffer));
JERRY_ASSERT (copied > 0);
+10 -10
View File
@@ -226,7 +226,7 @@ ecma_make_simple_value (const ecma_simple_value_t value) /**< simple value */
ecma_value_t __attr_const___
ecma_make_number_value (const ecma_number_t* num_p) /**< number to reference in value */
{
JERRY_ASSERT(num_p != NULL);
JERRY_ASSERT (num_p != NULL);
mem_cpointer_t num_cp;
ECMA_SET_NON_NULL_POINTER (num_cp, num_p);
@@ -245,7 +245,7 @@ ecma_make_number_value (const ecma_number_t* num_p) /**< number to reference in
ecma_value_t __attr_const___
ecma_make_string_value (const ecma_string_t* ecma_string_p) /**< string to reference in value */
{
JERRY_ASSERT(ecma_string_p != NULL);
JERRY_ASSERT (ecma_string_p != NULL);
mem_cpointer_t string_cp;
ECMA_SET_NON_NULL_POINTER (string_cp, ecma_string_p);
@@ -264,7 +264,7 @@ ecma_make_string_value (const ecma_string_t* ecma_string_p) /**< string to refer
ecma_value_t __attr_const___
ecma_make_object_value (const ecma_object_t* object_p) /**< object to reference in value */
{
JERRY_ASSERT(object_p != NULL);
JERRY_ASSERT (object_p != NULL);
mem_cpointer_t object_cp;
ECMA_SET_NON_NULL_POINTER (object_cp, object_p);
@@ -591,10 +591,10 @@ ecma_make_label_completion_value (ecma_completion_type_t type, /**< type */
ecma_completion_value_t __attr_const___ __attr_always_inline___
ecma_make_simple_completion_value (ecma_simple_value_t simple_value) /**< simple ecma-value */
{
JERRY_ASSERT(simple_value == ECMA_SIMPLE_VALUE_UNDEFINED
|| simple_value == ECMA_SIMPLE_VALUE_NULL
|| simple_value == ECMA_SIMPLE_VALUE_FALSE
|| simple_value == ECMA_SIMPLE_VALUE_TRUE);
JERRY_ASSERT (simple_value == ECMA_SIMPLE_VALUE_UNDEFINED
|| simple_value == ECMA_SIMPLE_VALUE_NULL
|| simple_value == ECMA_SIMPLE_VALUE_FALSE
|| simple_value == ECMA_SIMPLE_VALUE_TRUE);
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL,
ecma_make_simple_value (simple_value));
@@ -630,8 +630,8 @@ ecma_make_throw_completion_value (ecma_value_t value) /**< value */
ecma_completion_value_t __attr_const___
ecma_make_throw_obj_completion_value (ecma_object_t *exception_p) /**< an object */
{
JERRY_ASSERT(exception_p != NULL
&& !ecma_is_lexical_environment (exception_p));
JERRY_ASSERT (exception_p != NULL
&& !ecma_is_lexical_environment (exception_p));
ecma_value_t exception = ecma_make_object_value (exception_p);
@@ -781,7 +781,7 @@ ecma_free_completion_value (ecma_completion_value_t completion_value) /**< compl
case ECMA_COMPLETION_TYPE_EXIT:
{
ecma_value_t v = ecma_get_completion_value_value_field (completion_value);
JERRY_ASSERT(ecma_get_value_type_field (v) == ECMA_TYPE_SIMPLE);
JERRY_ASSERT (ecma_get_value_type_field (v) == ECMA_TYPE_SIMPLE);
break;
}
case ECMA_COMPLETION_TYPE_CONTINUE:
+25 -25
View File
@@ -140,8 +140,8 @@ ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< out
ecma_object_t *binding_obj_p, /**< binding object */
bool provide_this) /**< provideThis flag */
{
JERRY_ASSERT(binding_obj_p != NULL
&& !ecma_is_lexical_environment (binding_obj_p));
JERRY_ASSERT (binding_obj_p != NULL
&& !ecma_is_lexical_environment (binding_obj_p));
ecma_object_t *new_lexical_environment_p = ecma_alloc_object ();
@@ -432,7 +432,7 @@ ecma_create_internal_property (ecma_object_t *object_p, /**< the object */
new_property_p->type = ECMA_PROPERTY_INTERNAL;
ecma_property_t *list_head_p = ecma_get_property_list (object_p);
ECMA_SET_POINTER(new_property_p->next_property_p, list_head_p);
ECMA_SET_POINTER (new_property_p->next_property_p, list_head_p);
ecma_set_property_list (object_p, new_property_p);
JERRY_STATIC_ASSERT (ECMA_INTERNAL_PROPERTY__COUNT <= (1ull << ECMA_PROPERTY_INTERNAL_PROPERTY_TYPE_WIDTH));
@@ -454,10 +454,10 @@ ecma_property_t*
ecma_find_internal_property (ecma_object_t *object_p, /**< object descriptor */
ecma_internal_property_id_t property_id) /**< internal property identifier */
{
JERRY_ASSERT(object_p != NULL);
JERRY_ASSERT (object_p != NULL);
JERRY_ASSERT(property_id != ECMA_INTERNAL_PROPERTY_PROTOTYPE
&& property_id != ECMA_INTERNAL_PROPERTY_EXTENSIBLE);
JERRY_ASSERT (property_id != ECMA_INTERNAL_PROPERTY_PROTOTYPE
&& property_id != ECMA_INTERNAL_PROPERTY_EXTENSIBLE);
for (ecma_property_t *property_p = ecma_get_property_list (object_p);
property_p != NULL;
@@ -489,7 +489,7 @@ ecma_get_internal_property (ecma_object_t *object_p, /**< object descriptor */
{
ecma_property_t *property_p = ecma_find_internal_property (object_p, property_id);
JERRY_ASSERT(property_p != NULL);
JERRY_ASSERT (property_p != NULL);
return property_p;
} /* ecma_get_internal_property */
@@ -507,15 +507,15 @@ ecma_create_named_data_property (ecma_object_t *obj_p, /**< object */
bool is_enumerable, /**< 'Enumerable' attribute */
bool is_configurable) /**< 'Configurable' attribute */
{
JERRY_ASSERT(obj_p != NULL && name_p != NULL);
JERRY_ASSERT(ecma_find_named_property (obj_p, name_p) == NULL);
JERRY_ASSERT (obj_p != NULL && name_p != NULL);
JERRY_ASSERT (ecma_find_named_property (obj_p, name_p) == NULL);
ecma_property_t *prop_p = ecma_alloc_property ();
prop_p->type = ECMA_PROPERTY_NAMEDDATA;
name_p = ecma_copy_or_ref_ecma_string (name_p);
ECMA_SET_NON_NULL_POINTER(prop_p->u.named_data_property.name_p, name_p);
ECMA_SET_NON_NULL_POINTER (prop_p->u.named_data_property.name_p, name_p);
prop_p->u.named_data_property.writable = is_writable ? ECMA_PROPERTY_WRITABLE : ECMA_PROPERTY_NOT_WRITABLE;
prop_p->u.named_data_property.enumerable = is_enumerable ? ECMA_PROPERTY_ENUMERABLE : ECMA_PROPERTY_NOT_ENUMERABLE;
@@ -529,7 +529,7 @@ ecma_create_named_data_property (ecma_object_t *obj_p, /**< object */
ecma_lcache_invalidate (obj_p, name_p, NULL);
ecma_property_t *list_head_p = ecma_get_property_list (obj_p);
ECMA_SET_POINTER(prop_p->next_property_p, list_head_p);
ECMA_SET_POINTER (prop_p->next_property_p, list_head_p);
ecma_set_property_list (obj_p, prop_p);
return prop_p;
@@ -548,15 +548,15 @@ ecma_create_named_accessor_property (ecma_object_t *obj_p, /**< object */
bool is_enumerable, /**< 'enumerable' attribute */
bool is_configurable) /**< 'configurable' attribute */
{
JERRY_ASSERT(obj_p != NULL && name_p != NULL);
JERRY_ASSERT(ecma_find_named_property (obj_p, name_p) == NULL);
JERRY_ASSERT (obj_p != NULL && name_p != NULL);
JERRY_ASSERT (ecma_find_named_property (obj_p, name_p) == NULL);
ecma_property_t *prop_p = ecma_alloc_property ();
prop_p->type = ECMA_PROPERTY_NAMEDACCESSOR;
name_p = ecma_copy_or_ref_ecma_string (name_p);
ECMA_SET_NON_NULL_POINTER(prop_p->u.named_accessor_property.name_p, name_p);
ECMA_SET_NON_NULL_POINTER (prop_p->u.named_accessor_property.name_p, name_p);
prop_p->u.named_accessor_property.enumerable = (is_enumerable ?
ECMA_PROPERTY_ENUMERABLE : ECMA_PROPERTY_NOT_ENUMERABLE);
@@ -568,7 +568,7 @@ ecma_create_named_accessor_property (ecma_object_t *obj_p, /**< object */
ecma_lcache_invalidate (obj_p, name_p, NULL);
ecma_property_t *list_head_p = ecma_get_property_list (obj_p);
ECMA_SET_POINTER(prop_p->next_property_p, list_head_p);
ECMA_SET_POINTER (prop_p->next_property_p, list_head_p);
ecma_set_property_list (obj_p, prop_p);
ecma_getter_setter_pointers_t *getter_setter_pointers_p = ecma_alloc_getter_setter_pointers ();
@@ -593,8 +593,8 @@ ecma_property_t*
ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in */
ecma_string_t *name_p) /**< property's name */
{
JERRY_ASSERT(obj_p != NULL);
JERRY_ASSERT(name_p != NULL);
JERRY_ASSERT (obj_p != NULL);
JERRY_ASSERT (name_p != NULL);
ecma_property_t *property_p;
@@ -616,15 +616,15 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
}
else if (property_p->type == ECMA_PROPERTY_NAMEDACCESSOR)
{
property_name_p = ECMA_GET_NON_NULL_POINTER(ecma_string_t,
property_p->u.named_accessor_property.name_p);
property_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t,
property_p->u.named_accessor_property.name_p);
}
else
{
continue;
}
JERRY_ASSERT(property_name_p != NULL);
JERRY_ASSERT (property_name_p != NULL);
if (ecma_compare_ecma_strings (name_p, property_name_p))
{
@@ -650,12 +650,12 @@ ecma_property_t*
ecma_get_named_property (ecma_object_t *obj_p, /**< object to find property in */
ecma_string_t *name_p) /**< property's name */
{
JERRY_ASSERT(obj_p != NULL);
JERRY_ASSERT(name_p != NULL);
JERRY_ASSERT (obj_p != NULL);
JERRY_ASSERT (name_p != NULL);
ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);
JERRY_ASSERT(property_p != NULL);
JERRY_ASSERT (property_p != NULL);
return property_p;
} /* ecma_get_named_property */
@@ -871,14 +871,14 @@ ecma_delete_property (ecma_object_t *obj_p, /**< object */
}
else
{
ECMA_SET_POINTER(prev_prop_p->next_property_p, next_prop_p);
ECMA_SET_POINTER (prev_prop_p->next_property_p, next_prop_p);
}
return;
}
}
JERRY_UNREACHABLE();
JERRY_UNREACHABLE ();
} /* ecma_delete_property */
/**
+6 -6
View File
@@ -88,7 +88,7 @@ ecma_stack_add_frame (ecma_stack_frame_t *frame_p, /**< frame to initialize */
for (int32_t i = 0; i < regs_num; i++)
{
regs_p [i] = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
regs_p[i] = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
}
} /* ecma_stack_add_frame */
@@ -115,7 +115,7 @@ ecma_stack_free_frame (ecma_stack_frame_t *frame_p) /**< frame to initialize */
reg_index < frame_p->regs_number;
reg_index++)
{
ecma_free_value (frame_p->regs_p [reg_index], false);
ecma_free_value (frame_p->regs_p[reg_index], false);
}
} /* ecma_stack_free_frame */
@@ -130,7 +130,7 @@ ecma_stack_frame_get_reg_value (ecma_stack_frame_t *frame_p, /**< frame */
{
JERRY_ASSERT (reg_index >= 0 && reg_index < frame_p->regs_number);
return frame_p->regs_p [reg_index];
return frame_p->regs_p[reg_index];
} /* ecma_stack_frame_get_reg_value */
/**
@@ -143,7 +143,7 @@ ecma_stack_frame_set_reg_value (ecma_stack_frame_t *frame_p, /**< frame */
{
JERRY_ASSERT (reg_index >= 0 && reg_index < frame_p->regs_number);
frame_p->regs_p [reg_index] = value;
frame_p->regs_p[reg_index] = value;
} /* ecma_stack_frame_set_reg_value */
/**
@@ -199,7 +199,7 @@ ecma_stack_push_value (ecma_stack_frame_t *frame_p, /**< ecma-stack frame */
JERRY_ASSERT (frame_p->current_slot_index < ecma_stack_slots_in_top_chunk (frame_p));
frame_p->dynamically_allocated_value_slots_p [frame_p->current_slot_index] = value;
frame_p->dynamically_allocated_value_slots_p[frame_p->current_slot_index] = value;
} /* ecma_stack_push_value */
/**
@@ -212,7 +212,7 @@ ecma_stack_top_value (ecma_stack_frame_t *frame_p) /**< ecma-stack frame */
JERRY_ASSERT (frame_p->current_slot_index < slots_in_top_chunk);
return frame_p->dynamically_allocated_value_slots_p [frame_p->current_slot_index];
return frame_p->dynamically_allocated_value_slots_p[frame_p->current_slot_index];
} /* ecma_stack_top_value */
/**
+3 -3
View File
@@ -49,9 +49,9 @@ typedef struct ecma_stack_frame_t
ecma_value_t *dynamically_allocated_value_slots_p; /**< pointer to dynamically allocated value slots
* in the top-most chunk */
uint32_t current_slot_index; /**< index of first free slot in the top chunk */
ecma_value_t inlined_values [ECMA_STACK_FRAME_INLINED_VALUES_NUMBER]; /**< place for values inlined in stack frame
* (instead of being dynamically allocated
* on the heap) */
ecma_value_t inlined_values[ECMA_STACK_FRAME_INLINED_VALUES_NUMBER]; /**< place for values inlined in stack frame
* (instead of being dynamically allocated
* on the heap) */
ecma_value_t *regs_p; /**< register variables */
int32_t regs_number; /**< number of register variables */
} ecma_stack_frame_t;