Add jerryscript-compiler.h public header to cover compiler incompatibilities (#2313)

In general, public headers should not have compiler-specific
constructs but both the core and the port headers have attributes,
which are non-standard. It's better to factor out such constructs
to a common place (a new header) and hide them behind macros, which
can then be defined on a per-compiler basis.

This patch moves the existing definitions of function attributes and
likely/unlikely builtins to the new header. At the same time, it
unifies the names of these attribute defines and where they are
used. Moreover, it touches on jerry-main and removes the uses of
`__attribute__((unused))` entirely and replaces them with the
elsewhere used `(void) ...` pattern.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2018-05-14 02:41:26 +02:00
committed by yichoi
parent 0e131da4f7
commit 65ae949dc3
58 changed files with 433 additions and 340 deletions
+12 -12
View File
@@ -87,7 +87,7 @@ DECLARE_ROUTINES_FOR (number)
*
* @return pointer to allocated memory
*/
inline ecma_object_t * __attr_always_inline___
inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_object (void)
{
#ifdef JMEM_STATS
@@ -100,7 +100,7 @@ ecma_alloc_object (void)
/**
* Dealloc memory from an ecma-object
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */
{
#ifdef JMEM_STATS
@@ -115,7 +115,7 @@ ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */
*
* @return pointer to allocated memory
*/
inline ecma_extended_object_t * __attr_always_inline___
inline ecma_extended_object_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_extended_object (size_t size) /**< size of object */
{
#ifdef JMEM_STATS
@@ -128,7 +128,7 @@ ecma_alloc_extended_object (size_t size) /**< size of object */
/**
* Dealloc memory of an extended object
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */
size_t size) /**< size of object */
{
@@ -144,7 +144,7 @@ ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */
*
* @return pointer to allocated memory
*/
inline ecma_string_t * __attr_always_inline___
inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string (void)
{
#ifdef JMEM_STATS
@@ -157,7 +157,7 @@ ecma_alloc_string (void)
/**
* Dealloc memory from ecma-string descriptor
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */
{
#ifdef JMEM_STATS
@@ -172,7 +172,7 @@ ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */
*
* @return pointer to allocated memory
*/
inline ecma_string_t * __attr_always_inline___
inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string_buffer (size_t size) /**< size of string */
{
#ifdef JMEM_STATS
@@ -185,7 +185,7 @@ ecma_alloc_string_buffer (size_t size) /**< size of string */
/**
* Dealloc memory of a string with character data
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
size_t size) /**< size of string */
{
@@ -201,7 +201,7 @@ ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
*
* @return pointer to allocated memory
*/
inline ecma_getter_setter_pointers_t * __attr_always_inline___
inline ecma_getter_setter_pointers_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_getter_setter_pointers (void)
{
#ifdef JMEM_STATS
@@ -214,7 +214,7 @@ ecma_alloc_getter_setter_pointers (void)
/**
* Dealloc memory from getter-setter pointer pair
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_getter_setter_pointers (ecma_getter_setter_pointers_t *getter_setter_pointers_p) /**< pointer pair
* to be freed */
{
@@ -230,7 +230,7 @@ ecma_dealloc_getter_setter_pointers (ecma_getter_setter_pointers_t *getter_sette
*
* @return pointer to allocated memory
*/
inline ecma_property_pair_t * __attr_always_inline___
inline ecma_property_pair_t * JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_property_pair (void)
{
#ifdef JMEM_STATS
@@ -243,7 +243,7 @@ ecma_alloc_property_pair (void)
/**
* Dealloc memory of an ecma-property
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p) /**< property pair to be freed */
{
#ifdef JMEM_STATS
+4 -4
View File
@@ -124,7 +124,7 @@ ecma_init_gc_info (ecma_object_t *object_p) /**< object */
void
ecma_ref_object (ecma_object_t *object_p) /**< object */
{
if (likely (object_p->type_flags_refs < ECMA_OBJECT_MAX_REF))
if (JERRY_LIKELY (object_p->type_flags_refs < ECMA_OBJECT_MAX_REF))
{
object_p->type_flags_refs = (uint16_t) (object_p->type_flags_refs + ECMA_OBJECT_REF_ONE);
}
@@ -137,7 +137,7 @@ ecma_ref_object (ecma_object_t *object_p) /**< object */
/**
* Decrease reference counter of an object
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_deref_object (ecma_object_t *object_p) /**< object */
{
JERRY_ASSERT (object_p->type_flags_refs >= ECMA_OBJECT_REF_ONE);
@@ -778,7 +778,7 @@ ecma_gc_run (jmem_free_unused_memory_severity_t severity) /**< gc severity */
if (ecma_gc_is_object_visited (obj_iter_p))
{
/* Moving the object to list of marked objects. */
if (likely (obj_prev_p != NULL))
if (JERRY_LIKELY (obj_prev_p != NULL))
{
obj_prev_p->gc_next_cp = obj_iter_p->gc_next_cp;
}
@@ -828,7 +828,7 @@ ecma_gc_run (jmem_free_unused_memory_severity_t severity) /**< gc severity */
if (ecma_gc_is_object_visited (obj_iter_p))
{
/* Moving the object to list of marked objects */
if (likely (obj_prev_p != NULL))
if (JERRY_LIKELY (obj_prev_p != NULL))
{
obj_prev_p->gc_next_cp = obj_iter_p->gc_next_cp;
}
+1 -1
View File
@@ -218,7 +218,7 @@ enum
* Checks whether the error flag is set.
*/
#define ECMA_IS_VALUE_ERROR(value) \
(unlikely ((value) == ECMA_VALUE_ERROR))
(JERRY_UNLIKELY ((value) == ECMA_VALUE_ERROR))
/**
* Representation for native external pointer
@@ -818,7 +818,7 @@ ecma_uint32_to_utf8_string (uint32_t value, /**< value to convert */
lit_utf8_size_t bytes_copied = (lit_utf8_size_t) (out_buffer_p + buffer_size - buf_p);
if (likely (buf_p != out_buffer_p))
if (JERRY_LIKELY (buf_p != out_buffer_p))
{
memmove (out_buffer_p, buf_p, bytes_copied);
}
@@ -960,7 +960,7 @@ ecma_number_to_decimal (ecma_number_t num, /**< ecma-number */
*
* @return number of digits
*/
inline static int32_t __attr_always_inline___
inline static int32_t JERRY_ATTR_ALWAYS_INLINE
ecma_number_of_digits (double val) /**< ecma number */
{
JERRY_ASSERT (fabs (fmod (val, 1.0)) < EPSILON);
@@ -978,7 +978,7 @@ ecma_number_of_digits (double val) /**< ecma number */
/**
* Convert double value to ASCII
*/
inline static void __attr_always_inline___
inline static void JERRY_ATTR_ALWAYS_INLINE
ecma_double_to_ascii (double val, /**< ecma number */
lit_utf8_byte_t *buffer_p, /**< buffer to generate digits into */
int32_t num_of_digits, /**< number of digits */
@@ -1012,7 +1012,7 @@ ecma_double_to_ascii (double val, /**< ecma number */
*
* @return number of generated digits
*/
static inline lit_utf8_size_t __attr_always_inline___
static inline lit_utf8_size_t JERRY_ATTR_ALWAYS_INLINE
ecma_double_to_binary_floating_point (double val, /**< ecma number */
lit_utf8_byte_t *buffer_p, /**< buffer to generate digits into */
int32_t *exp_p) /**< [out] exponent */
+3 -3
View File
@@ -73,7 +73,7 @@ typedef struct
/**
* Normalize the number by factoring in the error.
*/
static inline void __attr_always_inline___
static inline void JERRY_ATTR_ALWAYS_INLINE
ecma_normalize_high_prec_data (ecma_high_prec_t *hp_data_p) /**< [in, out] float pair */
{
double val = hp_data_p->value;
@@ -85,7 +85,7 @@ ecma_normalize_high_prec_data (ecma_high_prec_t *hp_data_p) /**< [in, out] float
/**
* Multiply the high-precision number by ten.
*/
static inline void __attr_always_inline___
static inline void JERRY_ATTR_ALWAYS_INLINE
ecma_multiply_high_prec_by_10 (ecma_high_prec_t *hp_data_p) /**< [in, out] high-precision number */
{
double value = hp_data_p->value;
@@ -127,7 +127,7 @@ ecma_divide_high_prec_by_10 (ecma_high_prec_t *hp_data_p) /**< [in, out] high-pr
*
* @return number of generated digits
*/
inline lit_utf8_size_t __attr_always_inline___
inline lit_utf8_size_t JERRY_ATTR_ALWAYS_INLINE
ecma_errol0_dtoa (double val, /**< ecma number */
lit_utf8_byte_t *buffer_p, /**< buffer to generate digits into */
int32_t *exp_p) /**< [out] exponent */
+6 -6
View File
@@ -238,7 +238,7 @@ ecma_number_get_sign_field (ecma_number_t num) /**< ecma-number */
fraction is filled with anything but not all zero bits,
* false - otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_number_is_nan (ecma_number_t num) /**< ecma-number */
{
bool is_nan = (num != num);
@@ -291,7 +291,7 @@ ecma_number_make_infinity (bool sign) /**< true - for negative Infinity,
* @return true - if sign bit of ecma-number is set
* false - otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_number_is_negative (ecma_number_t num) /**< ecma-number */
{
JERRY_ASSERT (!ecma_number_is_nan (num));
@@ -360,7 +360,7 @@ ecma_number_get_fraction_and_exponent (ecma_number_t num, /**< ecma-number */
uint64_t fraction = ecma_number_get_fraction_field (num);
int32_t exponent;
if (unlikely (biased_exp == 0))
if (JERRY_UNLIKELY (biased_exp == 0))
{
/* IEEE-754 2008, 3.4, d */
if (ecma_number_is_zero (num))
@@ -658,18 +658,18 @@ ecma_number_calc_remainder (ecma_number_t left_num, /**< left operand */
*
* @return number - result of multiplication.
*/
inline ecma_value_t __attr_always_inline___
inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE
ecma_integer_multiply (ecma_integer_value_t left_integer, /**< left operand */
ecma_integer_value_t right_integer) /**< right operand */
{
#if defined (__GNUC__) || defined (__clang__)
/* Check if left_integer is power of 2 */
if (unlikely ((left_integer & (left_integer - 1)) == 0))
if (JERRY_UNLIKELY ((left_integer & (left_integer - 1)) == 0))
{
/* Right shift right_integer with log2 (left_integer) */
return ecma_make_integer_value (right_integer << (__builtin_ctz ((unsigned int) left_integer)));
}
else if (unlikely ((right_integer & (right_integer - 1)) == 0))
else if (JERRY_UNLIKELY ((right_integer & (right_integer - 1)) == 0))
{
/* Right shift left_integer with log2 (right_integer) */
return ecma_make_integer_value (left_integer << (__builtin_ctz ((unsigned int) right_integer)));
+29 -29
View File
@@ -219,7 +219,7 @@ ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, /**< utf-8 stri
ecma_string_t *string_desc_p;
lit_utf8_byte_t *data_p;
if (likely (string_size <= UINT16_MAX))
if (JERRY_LIKELY (string_size <= UINT16_MAX))
{
string_desc_p = ecma_alloc_string_buffer (sizeof (ecma_string_t) + string_size);
@@ -307,7 +307,7 @@ ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string
lit_utf8_byte_t *data_p;
if (likely (converted_string_size <= UINT16_MAX))
if (JERRY_LIKELY (converted_string_size <= UINT16_MAX))
{
string_desc_p = ecma_alloc_string_buffer (sizeof (ecma_string_t) + converted_string_size);
@@ -387,7 +387,7 @@ ecma_new_ecma_string_from_code_unit (ecma_char_t code_unit) /**< code unit */
ecma_string_t *
ecma_new_ecma_string_from_uint32 (uint32_t uint32_number) /**< uint32 value of the string */
{
if (likely (uint32_number <= ECMA_DIRECT_STRING_MAX_IMM))
if (JERRY_LIKELY (uint32_number <= ECMA_DIRECT_STRING_MAX_IMM))
{
return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT, (uintptr_t) uint32_number);
}
@@ -473,7 +473,7 @@ ecma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */
*
* @return pointer to ecma-string descriptor
*/
inline ecma_string_t * __attr_always_inline___
inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_get_magic_string (lit_magic_string_id_t id) /**< identifier of magic string */
{
JERRY_ASSERT (id < LIT_MAGIC_STRING__COUNT);
@@ -490,7 +490,7 @@ ecma_new_ecma_string_from_magic_string_ex_id (lit_magic_string_ex_id_t id) /**<
{
JERRY_ASSERT (id < lit_get_magic_string_ex_count ());
if (likely (id <= ECMA_DIRECT_STRING_MAX_IMM))
if (JERRY_LIKELY (id <= ECMA_DIRECT_STRING_MAX_IMM))
{
return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_MAGIC_EX, (uintptr_t) id);
}
@@ -521,7 +521,7 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */
{
JERRY_ASSERT (string1_p != NULL && cesu8_string2_size > 0 && cesu8_string2_length > 0);
if (unlikely (ecma_string_is_empty (string1_p)))
if (JERRY_UNLIKELY (ecma_string_is_empty (string1_p)))
{
return ecma_new_ecma_string_from_utf8 (cesu8_string2_p, cesu8_string2_size);
}
@@ -673,7 +673,7 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */
ecma_string_t *string_desc_p;
lit_utf8_byte_t *data_p;
if (likely (new_size <= UINT16_MAX))
if (JERRY_LIKELY (new_size <= UINT16_MAX))
{
string_desc_p = ecma_alloc_string_buffer (sizeof (ecma_string_t) + new_size);
@@ -734,12 +734,12 @@ ecma_concat_ecma_strings (ecma_string_t *string1_p, /**< first ecma-string */
{
JERRY_ASSERT (string1_p != NULL && string2_p != NULL);
if (unlikely (ecma_string_is_empty (string1_p)))
if (JERRY_UNLIKELY (ecma_string_is_empty (string1_p)))
{
ecma_ref_ecma_string (string2_p);
return string2_p;
}
else if (unlikely (ecma_string_is_empty (string2_p)))
else if (JERRY_UNLIKELY (ecma_string_is_empty (string2_p)))
{
return string1_p;
}
@@ -842,7 +842,7 @@ ecma_string_t *
ecma_append_magic_string_to_string (ecma_string_t *string1_p,
lit_magic_string_id_t string2_id)
{
if (unlikely (ecma_string_is_empty (string1_p)))
if (JERRY_UNLIKELY (ecma_string_is_empty (string1_p)))
{
return ecma_get_magic_string (string2_id);
}
@@ -868,7 +868,7 @@ ecma_ref_ecma_string (ecma_string_t *string_p) /**< string descriptor */
JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);
if (likely (string_p->refs_and_container < ECMA_STRING_MAX_REF))
if (JERRY_LIKELY (string_p->refs_and_container < ECMA_STRING_MAX_REF))
{
/* Increase reference counter. */
string_p->refs_and_container = (uint16_t) (string_p->refs_and_container + ECMA_STRING_REF_ONE);
@@ -990,7 +990,7 @@ ecma_string_to_number (const ecma_string_t *string_p) /**< ecma-string */
* @return ECMA_STRING_NOT_ARRAY_INDEX if string is not array index
* the array index otherwise
*/
inline uint32_t __attr_always_inline___
inline uint32_t JERRY_ATTR_ALWAYS_INLINE
ecma_string_get_array_index (const ecma_string_t *str_p) /**< ecma-string */
{
if (ECMA_IS_DIRECT_STRING (str_p))
@@ -1021,7 +1021,7 @@ ecma_string_get_array_index (const ecma_string_t *str_p) /**< ecma-string */
*
* @return number of bytes, actually copied to the buffer.
*/
lit_utf8_size_t __attr_return_value_should_be_checked___
lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT
ecma_string_copy_to_cesu8_buffer (const ecma_string_t *string_p, /**< ecma-string descriptor */
lit_utf8_byte_t *buffer_p, /**< destination buffer pointer
* (can be NULL if buffer_size == 0) */
@@ -1071,7 +1071,7 @@ ecma_string_copy_to_cesu8_buffer (const ecma_string_t *string_p, /**< ecma-strin
*
* @return number of bytes, actually copied to the buffer.
*/
lit_utf8_size_t __attr_return_value_should_be_checked___
lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT
ecma_string_copy_to_utf8_buffer (const ecma_string_t *string_p, /**< ecma-string descriptor */
lit_utf8_byte_t *buffer_p, /**< destination buffer pointer
* (can be NULL if buffer_size == 0) */
@@ -1347,7 +1347,7 @@ ecma_substring_copy_to_utf8_buffer (const ecma_string_t *string_desc_p, /**< ecm
* It is the caller's responsibility to make sure that the string fits in the buffer.
* Check if the size of the string is equal with the size of the buffer.
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_string_to_utf8_bytes (const ecma_string_t *string_desc_p, /**< ecma-string descriptor */
lit_utf8_byte_t *buffer_p, /**< destination buffer pointer
* (can be NULL if buffer_size == 0) */
@@ -1364,7 +1364,7 @@ ecma_string_to_utf8_bytes (const ecma_string_t *string_desc_p, /**< ecma-string
*
* @return size in bytes
*/
static inline ecma_length_t __attr_always_inline___
static inline ecma_length_t JERRY_ATTR_ALWAYS_INLINE
ecma_string_get_uint32_size (const uint32_t uint32_number) /**< number in the string-descriptor */
{
uint32_t prev_number = 1;
@@ -1453,7 +1453,7 @@ ecma_string_get_chars (const ecma_string_t *string_p, /**< ecma-string */
result_p = lit_get_magic_string_ex_utf8 (id);
length = 0;
if (unlikely (*flags_p & ECMA_STRING_FLAG_IS_ASCII))
if (JERRY_UNLIKELY (*flags_p & ECMA_STRING_FLAG_IS_ASCII))
{
length = lit_utf8_string_length (result_p, size);
}
@@ -1500,7 +1500,7 @@ ecma_string_get_chars (const ecma_string_t *string_p, /**< ecma-string */
size = lit_get_magic_string_ex_size (string_p->u.magic_string_ex_id);
length = 0;
if (unlikely (*flags_p & ECMA_STRING_FLAG_IS_ASCII))
if (JERRY_UNLIKELY (*flags_p & ECMA_STRING_FLAG_IS_ASCII))
{
length = lit_utf8_string_length (lit_get_magic_string_ex_utf8 (string_p->u.magic_string_ex_id), size);
}
@@ -1529,7 +1529,7 @@ ecma_string_get_chars (const ecma_string_t *string_p, /**< ecma-string */
* @return true - if the string equals to the magic string id
* false - otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_compare_ecma_string_to_magic_id (const ecma_string_t *string_p, /**< property name */
lit_magic_string_id_t id) /**< magic string id */
{
@@ -1542,7 +1542,7 @@ ecma_compare_ecma_string_to_magic_id (const ecma_string_t *string_p, /**< proper
* @return true - if the string is an empty string
* false - otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_string_is_empty (const ecma_string_t *string_p) /**< ecma-string */
{
return ecma_compare_ecma_string_to_magic_id (string_p, LIT_MAGIC_STRING__EMPTY);
@@ -1554,14 +1554,14 @@ ecma_string_is_empty (const ecma_string_t *string_p) /**< ecma-string */
* @return true - if the string equals to "length"
* false - otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_string_is_length (const ecma_string_t *string_p) /**< property name */
{
return ecma_compare_ecma_string_to_magic_id (string_p, LIT_MAGIC_STRING_LENGTH);
} /* ecma_string_is_length */
static inline ecma_string_t * __attr_always_inline___
static inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
ecma_property_to_string (ecma_property_t property, /**< property name type */
jmem_cpointer_t prop_name_cp) /**< property name compressed pointer */
{
@@ -1575,7 +1575,7 @@ ecma_property_to_string (ecma_property_t property, /**< property name type */
*
* @return the compressed pointer part of the name
*/
inline jmem_cpointer_t __attr_always_inline___
inline jmem_cpointer_t JERRY_ATTR_ALWAYS_INLINE
ecma_string_to_property_name (ecma_string_t *prop_name_p, /**< property name */
ecma_property_t *name_type_p) /**< [out] property name type */
{
@@ -1619,7 +1619,7 @@ ecma_string_from_property_name (ecma_property_t property, /**< property name typ
*
* @return hash code of property name
*/
inline lit_string_hash_t __attr_always_inline___
inline lit_string_hash_t JERRY_ATTR_ALWAYS_INLINE
ecma_string_get_property_name_hash (ecma_property_t property, /**< property name type */
jmem_cpointer_t prop_name_cp) /**< property name compressed pointer */
{
@@ -1675,7 +1675,7 @@ ecma_string_get_property_index (ecma_property_t property, /**< property name typ
* @return true if they are equals
* false otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_string_compare_to_property_name (ecma_property_t property, /**< property name type */
jmem_cpointer_t prop_name_cp, /**< property name compressed pointer */
const ecma_string_t *string_p) /**< other string */
@@ -1703,7 +1703,7 @@ ecma_string_compare_to_property_name (ecma_property_t property, /**< property na
* @return true - if strings are equal;
* false - otherwise
*/
static bool __attr_noinline___
static bool JERRY_ATTR_NOINLINE
ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /**< ecma-string */
const ecma_string_t *string2_p) /**< ecma-string */
{
@@ -1743,7 +1743,7 @@ ecma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /**< ecma-st
* @return true - if strings are equal;
* false - otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_compare_ecma_strings (const ecma_string_t *string1_p, /**< ecma-string */
const ecma_string_t *string2_p) /**< ecma-string */
{
@@ -1787,7 +1787,7 @@ ecma_compare_ecma_strings (const ecma_string_t *string1_p, /**< ecma-string */
* @return true - if strings are equal;
* false - otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_compare_ecma_non_direct_strings (const ecma_string_t *string1_p, /**< ecma-string */
const ecma_string_t *string2_p) /**< ecma-string */
{
@@ -2219,7 +2219,7 @@ ecma_get_string_magic (const ecma_string_t *string_p) /**< ecma-string */
*
* @return calculated hash
*/
inline lit_string_hash_t __attr_always_inline___
inline lit_string_hash_t JERRY_ATTR_ALWAYS_INLINE
ecma_string_hash (const ecma_string_t *string_p) /**< ecma-string to calculate hash for */
{
if (!ECMA_IS_DIRECT_STRING (string_p))
+42 -42
View File
@@ -63,7 +63,7 @@ JERRY_STATIC_ASSERT ((ECMA_VALUE_FALSE | (1 << ECMA_DIRECT_SHIFT)) == ECMA_VALUE
*
* @return type field
*/
static inline ecma_type_t __attr_const___ __attr_always_inline___
static inline ecma_type_t JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_get_value_type_field (ecma_value_t value) /**< ecma value */
{
return value & ECMA_VALUE_TYPE_MASK;
@@ -74,7 +74,7 @@ ecma_get_value_type_field (ecma_value_t value) /**< ecma value */
*
* @return ecma value
*/
static inline ecma_value_t __attr_pure___ __attr_always_inline___
static inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_pointer_to_ecma_value (const void *ptr) /**< pointer */
{
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
@@ -98,7 +98,7 @@ ecma_pointer_to_ecma_value (const void *ptr) /**< pointer */
*
* @return pointer
*/
static inline void * __attr_pure___ __attr_always_inline___
static inline void * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_pointer_from_ecma_value (ecma_value_t value) /**< value */
{
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
@@ -116,7 +116,7 @@ ecma_get_pointer_from_ecma_value (ecma_value_t value) /**< value */
* @return true - if the value is a direct value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_direct (ecma_value_t value) /**< ecma value */
{
return (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT);
@@ -128,7 +128,7 @@ ecma_is_value_direct (ecma_value_t value) /**< ecma value */
* @return true - if the value is a simple value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_simple (ecma_value_t value) /**< ecma value */
{
return (value & ECMA_DIRECT_TYPE_MASK) == ECMA_DIRECT_TYPE_SIMPLE_VALUE;
@@ -140,7 +140,7 @@ ecma_is_value_simple (ecma_value_t value) /**< ecma value */
* @return true - if the value is equal to the given simple value,
* false - otherwise
*/
static inline bool __attr_const___ __attr_always_inline___
static inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_equal_to_simple_value (ecma_value_t value, /**< ecma value */
ecma_value_t simple_value) /**< simple value */
{
@@ -153,7 +153,7 @@ ecma_is_value_equal_to_simple_value (ecma_value_t value, /**< ecma value */
* @return true - if the value contains implementation-defined empty simple value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_empty (ecma_value_t value) /**< ecma value */
{
return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_EMPTY);
@@ -165,7 +165,7 @@ ecma_is_value_empty (ecma_value_t value) /**< ecma value */
* @return true - if the value contains ecma-undefined simple value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_undefined (ecma_value_t value) /**< ecma value */
{
return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_UNDEFINED);
@@ -177,7 +177,7 @@ ecma_is_value_undefined (ecma_value_t value) /**< ecma value */
* @return true - if the value contains ecma-null simple value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_null (ecma_value_t value) /**< ecma value */
{
return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_NULL);
@@ -189,7 +189,7 @@ ecma_is_value_null (ecma_value_t value) /**< ecma value */
* @return true - if the value contains ecma-true or ecma-false simple values,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_boolean (ecma_value_t value) /**< ecma value */
{
return ecma_is_value_true (value | (1 << ECMA_DIRECT_SHIFT));
@@ -201,7 +201,7 @@ ecma_is_value_boolean (ecma_value_t value) /**< ecma value */
* @return true - if the value contains ecma-true simple value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_true (ecma_value_t value) /**< ecma value */
{
return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_TRUE);
@@ -213,7 +213,7 @@ ecma_is_value_true (ecma_value_t value) /**< ecma value */
* @return true - if the value contains ecma-false simple value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_false (ecma_value_t value) /**< ecma value */
{
return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_FALSE);
@@ -225,7 +225,7 @@ ecma_is_value_false (ecma_value_t value) /**< ecma value */
* @return true - if the value contains ecma-not-found simple value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_found (ecma_value_t value) /**< ecma value */
{
return value != ECMA_VALUE_NOT_FOUND;
@@ -237,7 +237,7 @@ ecma_is_value_found (ecma_value_t value) /**< ecma value */
* @return true - if the value contains ecma-array-hole simple value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_array_hole (ecma_value_t value) /**< ecma value */
{
return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_ARRAY_HOLE);
@@ -249,7 +249,7 @@ ecma_is_value_array_hole (ecma_value_t value) /**< ecma value */
* @return true - if the value contains an integer ecma-number value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_integer_number (ecma_value_t value) /**< ecma value */
{
return (value & ECMA_DIRECT_TYPE_MASK) == ECMA_DIRECT_TYPE_INTEGER_VALUE;
@@ -261,7 +261,7 @@ ecma_is_value_integer_number (ecma_value_t value) /**< ecma value */
* @return true - if both values contain integer ecma-number values,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_are_values_integer_numbers (ecma_value_t first_value, /**< first ecma value */
ecma_value_t second_value) /**< second ecma value */
{
@@ -277,7 +277,7 @@ ecma_are_values_integer_numbers (ecma_value_t first_value, /**< first ecma value
* @return true - if the value contains a floating-point ecma-number value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_float_number (ecma_value_t value) /**< ecma value */
{
return (ecma_get_value_type_field (value) == ECMA_TYPE_FLOAT);
@@ -289,7 +289,7 @@ ecma_is_value_float_number (ecma_value_t value) /**< ecma value */
* @return true - if the value contains ecma-number value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_number (ecma_value_t value) /**< ecma value */
{
return (ecma_is_value_integer_number (value)
@@ -305,7 +305,7 @@ JERRY_STATIC_ASSERT ((ECMA_TYPE_STRING | 0x4) == ECMA_TYPE_DIRECT_STRING,
* @return true - if the value contains ecma-string value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_string (ecma_value_t value) /**< ecma value */
{
return ((value & (ECMA_VALUE_TYPE_MASK - 0x4)) == ECMA_TYPE_STRING);
@@ -317,7 +317,7 @@ ecma_is_value_string (ecma_value_t value) /**< ecma value */
* @return true - if the value contains ecma-string value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_direct_string (ecma_value_t value) /**< ecma value */
{
return (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT_STRING);
@@ -329,7 +329,7 @@ ecma_is_value_direct_string (ecma_value_t value) /**< ecma value */
* @return true - if the value contains object value,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_object (ecma_value_t value) /**< ecma value */
{
return (ecma_get_value_type_field (value) == ECMA_TYPE_OBJECT);
@@ -341,7 +341,7 @@ ecma_is_value_object (ecma_value_t value) /**< ecma value */
* @return true - if the value contains an error reference,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_error_reference (ecma_value_t value) /**< ecma value */
{
return (ecma_get_value_type_field (value) == ECMA_TYPE_ERROR);
@@ -353,7 +353,7 @@ ecma_is_value_error_reference (ecma_value_t value) /**< ecma value */
* @return true - if the value contains a collection chunk,
* false - otherwise
*/
inline bool __attr_const___ __attr_always_inline___
inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_collection_chunk (ecma_value_t value) /**< ecma value */
{
return (ecma_get_value_type_field (value) == ECMA_TYPE_COLLECTION_CHUNK);
@@ -379,7 +379,7 @@ ecma_check_value_type_is_spec_defined (ecma_value_t value) /**< ecma value */
*
* @return boolean ecma_value
*/
inline ecma_value_t __attr_const___ __attr_always_inline___
inline ecma_value_t JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_make_boolean_value (bool boolean_value) /**< raw bool value from which the ecma value will be created */
{
return boolean_value ? ECMA_VALUE_TRUE : ECMA_VALUE_FALSE;
@@ -393,7 +393,7 @@ ecma_make_boolean_value (bool boolean_value) /**< raw bool value from which the
*
* @return ecma-value
*/
inline ecma_value_t __attr_const___ __attr_always_inline___
inline ecma_value_t JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_make_integer_value (ecma_integer_value_t integer_value) /**< integer number to be encoded */
{
JERRY_ASSERT (ECMA_IS_INTEGER_NUMBER (integer_value));
@@ -421,7 +421,7 @@ ecma_create_float_number (ecma_number_t ecma_number) /**< value of the float num
*
* @return ecma-value
*/
inline ecma_value_t __attr_always_inline___
inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE
ecma_make_nan_value (void)
{
return ecma_create_float_number (ecma_number_make_nan ());
@@ -432,7 +432,7 @@ ecma_make_nan_value (void)
*
* @return true, if it is +0.0, false otherwise
*/
static inline bool __attr_const___ __attr_always_inline___
static inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_number_equal_to_positive_zero (ecma_number_t ecma_number) /**< number */
{
#if CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32
@@ -513,7 +513,7 @@ ecma_make_uint32_value (uint32_t uint32_number) /**< uint32 number to be encoded
/**
* String value constructor
*/
inline ecma_value_t __attr_pure___ __attr_always_inline___
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);
@@ -529,7 +529,7 @@ ecma_make_string_value (const ecma_string_t *ecma_string_p) /**< string to refer
/**
* String value constructor
*/
inline ecma_value_t __attr_pure___ __attr_always_inline___
inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_make_magic_string_value (lit_magic_string_id_t id) /**< magic string id */
{
return (ecma_value_t) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_MAGIC, (uintptr_t) id);
@@ -538,7 +538,7 @@ ecma_make_magic_string_value (lit_magic_string_id_t id) /**< magic string id */
/**
* Object value constructor
*/
inline ecma_value_t __attr_pure___ __attr_always_inline___
inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_make_object_value (const ecma_object_t *object_p) /**< object to reference in value */
{
JERRY_ASSERT (object_p != NULL);
@@ -549,7 +549,7 @@ ecma_make_object_value (const ecma_object_t *object_p) /**< object to reference
/**
* Error reference constructor
*/
inline ecma_value_t __attr_pure___ __attr_always_inline___
inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_make_error_reference_value (const ecma_error_reference_t *error_ref_p) /**< error reference */
{
JERRY_ASSERT (error_ref_p != NULL);
@@ -560,7 +560,7 @@ ecma_make_error_reference_value (const ecma_error_reference_t *error_ref_p) /**<
/**
* Collection chunk constructor
*/
inline ecma_value_t __attr_pure___ __attr_always_inline___
inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_make_collection_chunk_value (const ecma_collection_chunk_t *collection_chunk_p) /**< collection chunk */
{
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
@@ -583,7 +583,7 @@ ecma_make_collection_chunk_value (const ecma_collection_chunk_t *collection_chun
*
* @return floating point value
*/
inline ecma_integer_value_t __attr_const___ __attr_always_inline___
inline ecma_integer_value_t JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_get_integer_from_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_integer_number (value));
@@ -591,7 +591,7 @@ ecma_get_integer_from_value (ecma_value_t value) /**< ecma value */
return ((ecma_integer_value_t) value) >> ECMA_DIRECT_SHIFT;
} /* ecma_get_integer_from_value */
inline ecma_number_t __attr_pure___ __attr_always_inline___
inline ecma_number_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_float_from_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_FLOAT);
@@ -604,7 +604,7 @@ ecma_get_float_from_value (ecma_value_t value) /**< ecma value */
*
* @return floating point value
*/
ecma_number_t __attr_pure___
ecma_number_t JERRY_ATTR_PURE
ecma_get_number_from_value (ecma_value_t value) /**< ecma value */
{
if (ecma_is_value_integer_number (value))
@@ -620,7 +620,7 @@ ecma_get_number_from_value (ecma_value_t value) /**< ecma value */
*
* @return the pointer
*/
inline ecma_string_t *__attr_pure___ __attr_always_inline___
inline ecma_string_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_string_from_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_string (value));
@@ -638,7 +638,7 @@ ecma_get_string_from_value (ecma_value_t value) /**< ecma value */
*
* @return the pointer
*/
inline ecma_object_t *__attr_pure___ __attr_always_inline___
inline ecma_object_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_object_from_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_object (value));
@@ -651,7 +651,7 @@ ecma_get_object_from_value (ecma_value_t value) /**< ecma value */
*
* @return the pointer
*/
inline ecma_error_reference_t *__attr_pure___ __attr_always_inline___
inline ecma_error_reference_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_error_reference_from_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_ERROR);
@@ -664,7 +664,7 @@ ecma_get_error_reference_from_value (ecma_value_t value) /**< ecma value */
*
* @return the pointer
*/
inline ecma_collection_chunk_t *__attr_pure___ __attr_always_inline___
inline ecma_collection_chunk_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_collection_chunk_from_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_COLLECTION_CHUNK);
@@ -681,7 +681,7 @@ ecma_get_collection_chunk_from_value (ecma_value_t value) /**< ecma value */
*
* @return ecma value
*/
inline ecma_value_t __attr_const___ __attr_always_inline___
inline ecma_value_t JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_invert_boolean_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_boolean (value));
@@ -739,7 +739,7 @@ ecma_copy_value (ecma_value_t value) /**< value description */
*
* @return copy of the given value
*/
inline ecma_value_t __attr_always_inline___
inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE
ecma_fast_copy_value (ecma_value_t value) /**< value description */
{
return (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT) ? value : ecma_copy_value (value);
@@ -934,7 +934,7 @@ ecma_free_value (ecma_value_t value) /**< value description */
* It also increases the binary size so it is recommended for
* critical code paths only.
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_fast_free_value (ecma_value_t value) /**< value description */
{
if (ecma_get_value_type_field (value) != ECMA_TYPE_DIRECT)
@@ -105,7 +105,7 @@ ecma_append_to_values_collection (ecma_collection_header_t *header_p, /**< colle
ecma_length_t item_index;
ecma_collection_chunk_t *chunk_p;
if (unlikely (header_p->item_count == 0))
if (JERRY_UNLIKELY (header_p->item_count == 0))
{
item_index = 0;
chunk_p = (ecma_collection_chunk_t *) jmem_heap_alloc_block (sizeof (ecma_collection_chunk_t));
@@ -120,7 +120,7 @@ ecma_append_to_values_collection (ecma_collection_header_t *header_p, /**< colle
chunk_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_chunk_t,
header_p->last_chunk_cp);
if (unlikely (item_index == 0))
if (JERRY_UNLIKELY (item_index == 0))
{
JERRY_ASSERT (ecma_is_value_collection_chunk (chunk_p->items[ECMA_COLLECTION_CHUNK_ITEMS])
&& ecma_get_collection_chunk_from_value (chunk_p->items[ECMA_COLLECTION_CHUNK_ITEMS]) == NULL);
@@ -160,7 +160,7 @@ ecma_append_to_values_collection (ecma_collection_header_t *header_p, /**< colle
ecma_value_t *
ecma_collection_iterator_init (ecma_collection_header_t *header_p) /**< header of collection */
{
if (unlikely (!header_p || header_p->item_count == 0))
if (JERRY_UNLIKELY (!header_p || header_p->item_count == 0))
{
return NULL;
}
@@ -183,7 +183,7 @@ ecma_collection_iterator_next (ecma_value_t *ecma_value_p) /**< current value */
ecma_value_p++;
if (unlikely (ecma_is_value_collection_chunk (*ecma_value_p)))
if (JERRY_UNLIKELY (ecma_is_value_collection_chunk (*ecma_value_p)))
{
ecma_value_p = ecma_get_collection_chunk_from_value (*ecma_value_p)->items;
+18 -18
View File
@@ -175,7 +175,7 @@ ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< out
/**
* Check if the object is lexical environment.
*/
inline bool __attr_pure___
inline bool JERRY_ATTR_PURE
ecma_is_lexical_environment (const ecma_object_t *object_p) /**< object or lexical environment */
{
JERRY_ASSERT (object_p != NULL);
@@ -188,7 +188,7 @@ ecma_is_lexical_environment (const ecma_object_t *object_p) /**< object or lexic
/**
* Get value of [[Extensible]] object's internal property.
*/
inline bool __attr_pure___
inline bool JERRY_ATTR_PURE
ecma_get_object_extensible (const ecma_object_t *object_p) /**< object */
{
JERRY_ASSERT (object_p != NULL);
@@ -220,7 +220,7 @@ ecma_set_object_extensible (ecma_object_t *object_p, /**< object */
/**
* Get object's internal implementation-defined type.
*/
inline ecma_object_type_t __attr_pure___
inline ecma_object_type_t JERRY_ATTR_PURE
ecma_get_object_type (const ecma_object_t *object_p) /**< object */
{
JERRY_ASSERT (object_p != NULL);
@@ -232,7 +232,7 @@ ecma_get_object_type (const ecma_object_t *object_p) /**< object */
/**
* Get object's prototype.
*/
inline ecma_object_t *__attr_pure___
inline ecma_object_t *JERRY_ATTR_PURE
ecma_get_object_prototype (const ecma_object_t *object_p) /**< object */
{
JERRY_ASSERT (object_p != NULL);
@@ -247,7 +247,7 @@ ecma_get_object_prototype (const ecma_object_t *object_p) /**< object */
*
* @return true / false
*/
inline bool __attr_pure___
inline bool JERRY_ATTR_PURE
ecma_get_object_is_builtin (const ecma_object_t *object_p) /**< object */
{
JERRY_ASSERT (object_p != NULL);
@@ -299,7 +299,7 @@ ecma_get_object_builtin_id (ecma_object_t *object_p) /**< object */
/**
* Get type of lexical environment.
*/
inline ecma_lexical_environment_type_t __attr_pure___
inline ecma_lexical_environment_type_t JERRY_ATTR_PURE
ecma_get_lex_env_type (const ecma_object_t *object_p) /**< lexical environment */
{
JERRY_ASSERT (object_p != NULL);
@@ -311,7 +311,7 @@ ecma_get_lex_env_type (const ecma_object_t *object_p) /**< lexical environment *
/**
* Get outer reference of lexical environment.
*/
inline ecma_object_t *__attr_pure___
inline ecma_object_t *JERRY_ATTR_PURE
ecma_get_lex_env_outer_reference (const ecma_object_t *object_p) /**< lexical environment */
{
JERRY_ASSERT (object_p != NULL);
@@ -327,7 +327,7 @@ ecma_get_lex_env_outer_reference (const ecma_object_t *object_p) /**< lexical en
* See also:
* ecma_op_object_get_property_names
*/
inline ecma_property_header_t *__attr_pure___
inline ecma_property_header_t *JERRY_ATTR_PURE
ecma_get_property_list (const ecma_object_t *object_p) /**< object or lexical environment */
{
JERRY_ASSERT (object_p != NULL);
@@ -341,7 +341,7 @@ ecma_get_property_list (const ecma_object_t *object_p) /**< object or lexical en
/**
* Get lexical environment's 'provideThis' property
*/
inline bool __attr_pure___
inline bool JERRY_ATTR_PURE
ecma_get_lex_env_provide_this (const ecma_object_t *object_p) /**< object-bound lexical environment */
{
JERRY_ASSERT (object_p != NULL);
@@ -355,7 +355,7 @@ ecma_get_lex_env_provide_this (const ecma_object_t *object_p) /**< object-bound
/**
* Get lexical environment's bound object.
*/
inline ecma_object_t *__attr_pure___
inline ecma_object_t *JERRY_ATTR_PURE
ecma_get_lex_env_binding_object (const ecma_object_t *object_p) /**< object-bound lexical environment */
{
JERRY_ASSERT (object_p != NULL);
@@ -1065,7 +1065,7 @@ ecma_assert_object_contains_the_property (const ecma_object_t *object_p, /**< ec
* Note:
* value previously stored in the property is freed
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_named_data_property_assign_value (ecma_object_t *obj_p, /**< object */
ecma_property_value_t *prop_value_p, /**< property value reference */
ecma_value_t value) /**< value to assign */
@@ -1157,7 +1157,7 @@ ecma_set_named_accessor_property_setter (ecma_object_t *object_p, /**< the prope
* @return true - property is writable,
* false - otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_is_property_writable (ecma_property_t property) /**< property */
{
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (property) == ECMA_PROPERTY_TYPE_NAMEDDATA
@@ -1191,7 +1191,7 @@ ecma_set_property_writable_attr (ecma_property_t *property_p, /**< [in,out] prop
* @return true - property is enumerable,
* false - otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_is_property_enumerable (ecma_property_t property) /**< property */
{
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (property) == ECMA_PROPERTY_TYPE_NAMEDDATA
@@ -1227,7 +1227,7 @@ ecma_set_property_enumerable_attr (ecma_property_t *property_p, /**< [in,out] pr
* @return true - property is configurable,
* false - otherwise
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_is_property_configurable (ecma_property_t property) /**< property */
{
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (property) == ECMA_PROPERTY_TYPE_NAMEDDATA
@@ -1262,7 +1262,7 @@ ecma_set_property_configurable_attr (ecma_property_t *property_p, /**< [in,out]
*
* @return true / false
*/
inline bool __attr_always_inline___
inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_is_property_lcached (ecma_property_t *property_p) /**< property */
{
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (*property_p) == ECMA_PROPERTY_TYPE_NAMEDDATA
@@ -1274,7 +1274,7 @@ ecma_is_property_lcached (ecma_property_t *property_p) /**< property */
/**
* Set value of flag indicating whether the property is registered in LCache
*/
inline void __attr_always_inline___
inline void JERRY_ATTR_ALWAYS_INLINE
ecma_set_property_lcached (ecma_property_t *property_p, /**< property */
bool is_lcached) /**< new value for lcached flag */
{
@@ -1388,7 +1388,7 @@ ecma_create_error_reference_from_context (void)
*
* @return error reference value
*/
inline ecma_value_t __attr_always_inline___
inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE
ecma_create_error_object_reference (ecma_object_t *object_p) /**< referenced object */
{
return ecma_create_error_reference (ecma_make_object_value (object_p), true);
@@ -1400,7 +1400,7 @@ ecma_create_error_object_reference (ecma_object_t *object_p) /**< referenced obj
void
ecma_ref_error_reference (ecma_error_reference_t *error_ref_p) /**< error reference */
{
if (likely (error_ref_p->refs_and_flags < ECMA_ERROR_MAX_REF))
if (JERRY_LIKELY (error_ref_p->refs_and_flags < ECMA_ERROR_MAX_REF))
{
error_ref_p->refs_and_flags += ECMA_ERROR_REF_ONE;
}
+46 -46
View File
@@ -138,48 +138,48 @@ typedef enum
#define ECMA_BOOL_TO_BITFIELD(x) ((x) ? 1 : 0)
/* ecma-helpers-value.c */
bool ecma_is_value_direct (ecma_value_t value) __attr_const___;
bool ecma_is_value_simple (ecma_value_t value) __attr_const___;
bool ecma_is_value_empty (ecma_value_t value) __attr_const___;
bool ecma_is_value_undefined (ecma_value_t value) __attr_const___;
bool ecma_is_value_null (ecma_value_t value) __attr_const___;
bool ecma_is_value_boolean (ecma_value_t value) __attr_const___;
bool ecma_is_value_true (ecma_value_t value) __attr_const___;
bool ecma_is_value_false (ecma_value_t value) __attr_const___;
bool ecma_is_value_found (ecma_value_t value) __attr_const___;
bool ecma_is_value_array_hole (ecma_value_t value) __attr_const___;
bool JERRY_ATTR_CONST ecma_is_value_direct (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_simple (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_empty (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_undefined (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_null (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_boolean (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_true (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_false (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_found (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_array_hole (ecma_value_t value);
bool ecma_is_value_integer_number (ecma_value_t value) __attr_const___;
bool ecma_are_values_integer_numbers (ecma_value_t first_value, ecma_value_t second_value) __attr_const___;
bool ecma_is_value_float_number (ecma_value_t value) __attr_const___;
bool ecma_is_value_number (ecma_value_t value) __attr_const___;
bool ecma_is_value_string (ecma_value_t value) __attr_const___;
bool ecma_is_value_direct_string (ecma_value_t value) __attr_const___;
bool ecma_is_value_object (ecma_value_t value) __attr_const___;
bool ecma_is_value_error_reference (ecma_value_t value) __attr_const___;
bool ecma_is_value_collection_chunk (ecma_value_t value) __attr_const___;
bool JERRY_ATTR_CONST ecma_is_value_integer_number (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_are_values_integer_numbers (ecma_value_t first_value, ecma_value_t second_value);
bool JERRY_ATTR_CONST ecma_is_value_float_number (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_number (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_string (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_direct_string (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_object (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_error_reference (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_collection_chunk (ecma_value_t value);
void ecma_check_value_type_is_spec_defined (ecma_value_t value);
ecma_value_t ecma_make_boolean_value (bool boolean_value) __attr_const___;
ecma_value_t ecma_make_integer_value (ecma_integer_value_t integer_value) __attr_const___;
ecma_value_t JERRY_ATTR_CONST ecma_make_boolean_value (bool boolean_value);
ecma_value_t JERRY_ATTR_CONST ecma_make_integer_value (ecma_integer_value_t integer_value);
ecma_value_t ecma_make_nan_value (void);
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 ecma_make_string_value (const ecma_string_t *ecma_string_p) __attr_pure___;
ecma_value_t ecma_make_magic_string_value (lit_magic_string_id_t id) __attr_pure___;
ecma_value_t ecma_make_object_value (const ecma_object_t *object_p) __attr_pure___;
ecma_value_t ecma_make_error_reference_value (const ecma_error_reference_t *error_ref_p) __attr_pure___;
ecma_value_t ecma_make_collection_chunk_value (const ecma_collection_chunk_t *collection_chunk_p) __attr_pure___;
ecma_integer_value_t ecma_get_integer_from_value (ecma_value_t value) __attr_const___;
ecma_number_t ecma_get_float_from_value (ecma_value_t value) __attr_pure___;
ecma_number_t ecma_get_number_from_value (ecma_value_t value) __attr_pure___;
ecma_string_t *ecma_get_string_from_value (ecma_value_t value) __attr_pure___;
ecma_object_t *ecma_get_object_from_value (ecma_value_t value) __attr_pure___;
ecma_error_reference_t *ecma_get_error_reference_from_value (ecma_value_t value) __attr_pure___;
ecma_collection_chunk_t *ecma_get_collection_chunk_from_value (ecma_value_t value) __attr_pure___;
ecma_value_t ecma_invert_boolean_value (ecma_value_t value) __attr_const___;
ecma_value_t JERRY_ATTR_PURE ecma_make_string_value (const ecma_string_t *ecma_string_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);
ecma_value_t JERRY_ATTR_PURE ecma_make_error_reference_value (const ecma_error_reference_t *error_ref_p);
ecma_value_t JERRY_ATTR_PURE ecma_make_collection_chunk_value (const ecma_collection_chunk_t *collection_chunk_p);
ecma_integer_value_t JERRY_ATTR_CONST ecma_get_integer_from_value (ecma_value_t value);
ecma_number_t JERRY_ATTR_PURE ecma_get_float_from_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);
ecma_object_t JERRY_ATTR_PURE *ecma_get_object_from_value (ecma_value_t value);
ecma_error_reference_t JERRY_ATTR_PURE *ecma_get_error_reference_from_value (ecma_value_t value);
ecma_collection_chunk_t JERRY_ATTR_PURE *ecma_get_collection_chunk_from_value (ecma_value_t value);
ecma_value_t JERRY_ATTR_CONST ecma_invert_boolean_value (ecma_value_t value);
ecma_value_t ecma_copy_value (ecma_value_t value);
ecma_value_t ecma_fast_copy_value (ecma_value_t value);
ecma_value_t ecma_copy_value_if_not_object (ecma_value_t value);
@@ -212,11 +212,11 @@ void ecma_deref_ecma_string (ecma_string_t *string_p);
ecma_number_t ecma_string_to_number (const ecma_string_t *str_p);
uint32_t ecma_string_get_array_index (const ecma_string_t *str_p);
lit_utf8_size_t __attr_return_value_should_be_checked___
lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT
ecma_string_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p,
lit_utf8_byte_t *buffer_p,
lit_utf8_size_t buffer_size);
lit_utf8_size_t __attr_return_value_should_be_checked___
lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT
ecma_string_copy_to_utf8_buffer (const ecma_string_t *string_desc_p,
lit_utf8_byte_t *buffer_p,
lit_utf8_size_t buffer_size);
@@ -299,19 +299,19 @@ ecma_object_t *ecma_create_object (ecma_object_t *prototype_object_p, size_t ext
ecma_object_t *ecma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p);
ecma_object_t *ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, ecma_object_t *binding_obj_p,
bool provide_this);
bool ecma_is_lexical_environment (const ecma_object_t *object_p) __attr_pure___;
bool ecma_get_object_extensible (const ecma_object_t *object_p) __attr_pure___;
bool JERRY_ATTR_PURE ecma_is_lexical_environment (const ecma_object_t *object_p);
bool JERRY_ATTR_PURE ecma_get_object_extensible (const ecma_object_t *object_p);
void ecma_set_object_extensible (ecma_object_t *object_p, bool is_extensible);
ecma_object_type_t ecma_get_object_type (const ecma_object_t *object_p) __attr_pure___;
ecma_object_t *ecma_get_object_prototype (const ecma_object_t *object_p) __attr_pure___;
bool ecma_get_object_is_builtin (const ecma_object_t *object_p) __attr_pure___;
ecma_object_type_t JERRY_ATTR_PURE ecma_get_object_type (const ecma_object_t *object_p);
ecma_object_t JERRY_ATTR_PURE *ecma_get_object_prototype (const ecma_object_t *object_p);
bool JERRY_ATTR_PURE ecma_get_object_is_builtin (const ecma_object_t *object_p);
void ecma_set_object_is_builtin (ecma_object_t *object_p);
uint8_t ecma_get_object_builtin_id (ecma_object_t *object_p);
ecma_lexical_environment_type_t ecma_get_lex_env_type (const ecma_object_t *object_p) __attr_pure___;
ecma_object_t *ecma_get_lex_env_outer_reference (const ecma_object_t *object_p) __attr_pure___;
ecma_property_header_t *ecma_get_property_list (const ecma_object_t *object_p) __attr_pure___;
ecma_object_t *ecma_get_lex_env_binding_object (const ecma_object_t *object_p) __attr_pure___;
bool ecma_get_lex_env_provide_this (const ecma_object_t *object_p) __attr_pure___;
ecma_lexical_environment_type_t JERRY_ATTR_PURE ecma_get_lex_env_type (const ecma_object_t *object_p);
ecma_object_t JERRY_ATTR_PURE *ecma_get_lex_env_outer_reference (const ecma_object_t *object_p);
ecma_property_header_t JERRY_ATTR_PURE *ecma_get_property_list (const ecma_object_t *object_p);
ecma_object_t JERRY_ATTR_PURE *ecma_get_lex_env_binding_object (const ecma_object_t *object_p);
bool JERRY_ATTR_PURE ecma_get_lex_env_provide_this (const ecma_object_t *object_p);
ecma_property_value_t *
ecma_create_named_data_property (ecma_object_t *object_p, ecma_string_t *name_p, uint8_t prop_attributes,
+3 -3
View File
@@ -50,7 +50,7 @@ ecma_lcache_init (void)
/**
* Invalidate specified LCache entry
*/
static inline void __attr_always_inline___
static inline void JERRY_ATTR_ALWAYS_INLINE
ecma_lcache_invalidate_entry (ecma_lcache_hash_entry_t *entry_p) /**< entry to invalidate */
{
JERRY_ASSERT (entry_p != NULL);
@@ -66,7 +66,7 @@ ecma_lcache_invalidate_entry (ecma_lcache_hash_entry_t *entry_p) /**< entry to i
*
* @return row index
*/
static inline size_t __attr_always_inline___
static inline size_t JERRY_ATTR_ALWAYS_INLINE
ecma_lcache_row_index (jmem_cpointer_t object_cp, /**< compressed pointer to object */
lit_string_hash_t name_hash) /**< property name hash */
{
@@ -144,7 +144,7 @@ ecma_lcache_insert (ecma_object_t *object_p, /**< object */
* @return a pointer to an ecma_property_t if the lookup is successful
* NULL otherwise
*/
inline ecma_property_t * __attr_always_inline___
inline ecma_property_t * JERRY_ATTR_ALWAYS_INLINE
ecma_lcache_lookup (ecma_object_t *object_p, /**< object */
const ecma_string_t *prop_name_p) /**< property's name */
{