Replace // double slash comments with /* */. (#1461)

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
Robert Sipka
2016-11-29 15:54:35 +01:00
committed by Tilmann Scheller
parent 4d2c22a118
commit fb3e8cf8b8
54 changed files with 362 additions and 366 deletions
+3 -3
View File
@@ -1041,9 +1041,9 @@ typedef struct
* An object's GC color * An object's GC color
* *
* Tri-color marking: * Tri-color marking:
* WHITE_GRAY, unvisited -> WHITE // not referenced by a live object or the reference not found yet * WHITE_GRAY, unvisited -> WHITE: not referenced by a live object or the reference not found yet
* WHITE_GRAY, visited -> GRAY // referenced by some live object * WHITE_GRAY, visited -> GRAY: referenced by some live object
* BLACK -> BLACK // all referenced objects are gray or black * BLACK -> BLACK: all referenced objects are gray or black
*/ */
typedef enum typedef enum
{ {
+15 -15
View File
@@ -819,7 +819,7 @@ ecma_number_to_uint32 (ecma_number_t num) /**< ecma-number */
const bool sign = ecma_number_is_negative (num); const bool sign = ecma_number_is_negative (num);
const ecma_number_t abs_num = sign ? ecma_number_negate (num) : num; const ecma_number_t abs_num = sign ? ecma_number_negate (num) : num;
// 2 ^ 32 /* 2 ^ 32 */
const uint64_t uint64_2_pow_32 = (1ull << 32); const uint64_t uint64_2_pow_32 = (1ull << 32);
const ecma_number_t num_2_pow_32 = (float) uint64_2_pow_32; const ecma_number_t num_2_pow_32 = (float) uint64_2_pow_32;
@@ -836,7 +836,7 @@ ecma_number_to_uint32 (ecma_number_t num) /**< ecma-number */
num_in_uint32_range = abs_num; num_in_uint32_range = abs_num;
} }
// Check that the floating point value can be represented with uint32_t /* Check that the floating point value can be represented with uint32_t. */
JERRY_ASSERT (num_in_uint32_range < uint64_2_pow_32); JERRY_ASSERT (num_in_uint32_range < uint64_2_pow_32);
uint32_t uint32_num = (uint32_t) num_in_uint32_range; uint32_t uint32_num = (uint32_t) num_in_uint32_range;
@@ -870,10 +870,10 @@ ecma_number_to_int32 (ecma_number_t num) /**< ecma-number */
{ {
uint32_t uint32_num = ecma_number_to_uint32 (num); uint32_t uint32_num = ecma_number_to_uint32 (num);
// 2 ^ 32 /* 2 ^ 32 */
const int64_t int64_2_pow_32 = (1ll << 32); const int64_t int64_2_pow_32 = (1ll << 32);
// 2 ^ 31 /* 2 ^ 31 */
const uint32_t uint32_2_pow_31 = (1ull << 31); const uint32_t uint32_2_pow_31 = (1ull << 31);
int32_t ret; int32_t ret;
@@ -945,14 +945,14 @@ ecma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */
if (ecma_number_is_nan (num)) if (ecma_number_is_nan (num))
{ {
// 1. /* 1. */
dst_p = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_NAN, buffer_p, buffer_size); dst_p = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_NAN, buffer_p, buffer_size);
return (lit_utf8_size_t) (dst_p - buffer_p); return (lit_utf8_size_t) (dst_p - buffer_p);
} }
if (ecma_number_is_zero (num)) if (ecma_number_is_zero (num))
{ {
// 2. /* 2. */
*buffer_p = LIT_CHAR_0; *buffer_p = LIT_CHAR_0;
JERRY_ASSERT (1 <= buffer_size); JERRY_ASSERT (1 <= buffer_size);
return 1; return 1;
@@ -962,14 +962,14 @@ ecma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */
if (ecma_number_is_negative (num)) if (ecma_number_is_negative (num))
{ {
// 3. /* 3. */
*dst_p++ = LIT_CHAR_MINUS; *dst_p++ = LIT_CHAR_MINUS;
num = ecma_number_negate (num); num = ecma_number_negate (num);
} }
if (ecma_number_is_infinity (num)) if (ecma_number_is_infinity (num))
{ {
// 4. /* 4. */
dst_p = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_INFINITY_UL, dst_p, dst_p = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_INFINITY_UL, dst_p,
(lit_utf8_size_t) (buffer_p + buffer_size - dst_p)); (lit_utf8_size_t) (buffer_p + buffer_size - dst_p));
JERRY_ASSERT (dst_p <= buffer_p + buffer_size); JERRY_ASSERT (dst_p <= buffer_p + buffer_size);
@@ -978,7 +978,7 @@ ecma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */
JERRY_ASSERT (ecma_number_get_next (ecma_number_get_prev (num)) == num); JERRY_ASSERT (ecma_number_get_next (ecma_number_get_prev (num)) == num);
// 5. /* 5. */
uint32_t num_uint32 = ecma_number_to_uint32 (num); uint32_t num_uint32 = ecma_number_to_uint32 (num);
if (((ecma_number_t) num_uint32) == num) if (((ecma_number_t) num_uint32) == num)
@@ -997,7 +997,7 @@ ecma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */
if (k <= n && n <= 21) if (k <= n && n <= 21)
{ {
// 6. /* 6. */
dst_p += k; dst_p += k;
memset (dst_p, LIT_CHAR_0, (size_t) (n - k)); memset (dst_p, LIT_CHAR_0, (size_t) (n - k));
@@ -1009,7 +1009,7 @@ ecma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */
if (0 < n && n <= 21) if (0 < n && n <= 21)
{ {
// 7. /* 7. */
memmove (dst_p + n + 1, dst_p + n, (size_t) (k - n)); memmove (dst_p + n + 1, dst_p + n, (size_t) (k - n));
*(dst_p + n) = LIT_CHAR_DOT; *(dst_p + n) = LIT_CHAR_DOT;
dst_p += k + 1; dst_p += k + 1;
@@ -1020,7 +1020,7 @@ ecma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */
if (-6 < n && n <= 0) if (-6 < n && n <= 0)
{ {
// 8. /* 8. */
memmove (dst_p + 2 - n, dst_p, (size_t) k); memmove (dst_p + 2 - n, dst_p, (size_t) k);
memset (dst_p + 2, LIT_CHAR_0, (size_t) -n); memset (dst_p + 2, LIT_CHAR_0, (size_t) -n);
*dst_p = LIT_CHAR_0; *dst_p = LIT_CHAR_0;
@@ -1033,18 +1033,18 @@ ecma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */
if (k == 1) if (k == 1)
{ {
// 9. /* 9. */
dst_p++; dst_p++;
} }
else else
{ {
// 10. /* 10. */
memmove (dst_p + 2, dst_p + 1, (size_t) (k - 1)); memmove (dst_p + 2, dst_p + 1, (size_t) (k - 1));
*(dst_p + 1) = LIT_CHAR_DOT; *(dst_p + 1) = LIT_CHAR_DOT;
dst_p += k + 1; dst_p += k + 1;
} }
// 9., 10. /* 9., 10. */
*dst_p++ = LIT_CHAR_LOWERCASE_E; *dst_p++ = LIT_CHAR_LOWERCASE_E;
*dst_p++ = (n >= 1) ? LIT_CHAR_PLUS : LIT_CHAR_MINUS; *dst_p++ = (n >= 1) ? LIT_CHAR_PLUS : LIT_CHAR_MINUS;
uint32_t t = (uint32_t) (n >= 1 ? (n - 1) : -(n - 1)); uint32_t t = (uint32_t) (n >= 1 ? (n - 1) : -(n - 1));
@@ -40,7 +40,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.4.4.1 /* ECMA-262 v5, 15.4.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_ARRAY, ECMA_BUILTIN_ID_ARRAY,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -48,7 +48,7 @@ OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
/* Number properties: /* Number properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.4.4 /* ECMA-262 v5, 15.4.4 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
0, 0,
ECMA_PROPERTY_FLAG_WRITABLE) ECMA_PROPERTY_FLAG_WRITABLE)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_ARRAY)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.4.3.1 /* ECMA-262 v5, 15.4.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, ECMA_BUILTIN_ID_ARRAY_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
/* Number properties: /* Number properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.4.3 /* ECMA-262 v5, 15.4.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -35,7 +35,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.6.4.1 /* ECMA-262 v5, 15.6.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_BOOLEAN, ECMA_BUILTIN_ID_BOOLEAN,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_BOOLEAN)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.6.3.1 /* ECMA-262 v5, 15.6.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
/* Number properties: /* Number properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.6.3 /* ECMA-262 v5, 15.6.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -37,7 +37,7 @@
/* Object identifier */ /* Object identifier */
OBJECT_ID (ECMA_BUILTIN_ID_DATE) OBJECT_ID (ECMA_BUILTIN_ID_DATE)
// ECMA-262 v5, 15.9.4.1 /* ECMA-262 v5, 15.9.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_DATE_PROTOTYPE, ECMA_BUILTIN_ID_DATE_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -58,7 +58,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
{ {
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
// 2. /* 2. */
if (!ecma_is_value_object (this_arg)) if (!ecma_is_value_object (this_arg))
{ {
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object.")); ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object."));
@@ -39,17 +39,17 @@ OBJECT_ID (ECMA_BUILTIN_ID_ERROR_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.4.1 /* ECMA-262 v5, 15.11.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_ERROR, ECMA_BUILTIN_ID_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.4.2 /* ECMA-262 v5, 15.11.4.2 */
STRING_VALUE (LIT_MAGIC_STRING_NAME, STRING_VALUE (LIT_MAGIC_STRING_NAME,
LIT_MAGIC_STRING_ERROR_UL, LIT_MAGIC_STRING_ERROR_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.4.3 /* ECMA-262 v5, 15.11.4.3 */
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
LIT_MAGIC_STRING__EMPTY, LIT_MAGIC_STRING__EMPTY,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_ERROR)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// 15.11.3 /* ECMA-262 v5, 15.11.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.7.3.1 /* ECMA-262 v5, 15.7.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_ERROR_PROTOTYPE, ECMA_BUILTIN_ID_ERROR_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -35,17 +35,17 @@ OBJECT_ID (ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.7.8 /* ECMA-262 v5, 15.11.7.8 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_EVAL_ERROR, ECMA_BUILTIN_ID_EVAL_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.9 /* ECMA-262 v5, 15.11.7.9 */
STRING_VALUE (LIT_MAGIC_STRING_NAME, STRING_VALUE (LIT_MAGIC_STRING_NAME,
LIT_MAGIC_STRING_EVAL_ERROR_UL, LIT_MAGIC_STRING_EVAL_ERROR_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.10 /* ECMA-262 v5, 15.11.7.10 */
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
LIT_MAGIC_STRING__EMPTY, LIT_MAGIC_STRING__EMPTY,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_EVAL_ERROR)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// 15.11.3 /* ECMA-262 v5, 15.11.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.3.1 /* ECMA-262 v5, 15.11.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE, ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.3.4.1 /* ECMA-262 v5, 15.3.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_FUNCTION, ECMA_BUILTIN_ID_FUNCTION,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -47,7 +47,7 @@ OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
/* Number properties: /* Number properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.3.4 /* ECMA-262 v5, 15.3.4 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
0, 0,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_FUNCTION)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.3.3.1 /* ECMA-262 v5, 15.3.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
/* Number properties: /* Number properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.3.3.2 /* ECMA-262 v5, 15.3.3.2 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -43,7 +43,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_GLOBAL)
/* Simple value properties: /* Simple value properties:
* (property name, simple value, writable, enumerable, configurable) */ * (property name, simple value, writable, enumerable, configurable) */
// ECMA-262 v5, 15.1.1.3 /* ECMA-262 v5, 15.1.1.3 */
SIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED, SIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED,
ECMA_SIMPLE_VALUE_UNDEFINED, ECMA_SIMPLE_VALUE_UNDEFINED,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -51,12 +51,12 @@ SIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED,
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// ECMA-262 v5, 15.1.1.1 /* ECMA-262 v5, 15.1.1.1 */
NUMBER_VALUE (LIT_MAGIC_STRING_NAN, NUMBER_VALUE (LIT_MAGIC_STRING_NAN,
ECMA_BUILTIN_NUMBER_NAN, ECMA_BUILTIN_NUMBER_NAN,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.1.1.2 /* ECMA-262 v5, 15.1.1.2 */
NUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL, NUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL,
ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -64,17 +64,17 @@ NUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// ECMA-262 v5, 15.1.4.1 /* ECMA-262 v5, 15.1.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_OBJECT_UL, OBJECT_VALUE (LIT_MAGIC_STRING_OBJECT_UL,
ECMA_BUILTIN_ID_OBJECT, ECMA_BUILTIN_ID_OBJECT,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// ECMA-262 v5, 15.1.4.2 /* ECMA-262 v5, 15.1.4.2 */
OBJECT_VALUE (LIT_MAGIC_STRING_FUNCTION_UL, OBJECT_VALUE (LIT_MAGIC_STRING_FUNCTION_UL,
ECMA_BUILTIN_ID_FUNCTION, ECMA_BUILTIN_ID_FUNCTION,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// ECMA-262 v5, 15.1.4.3 /* ECMA-262 v5, 15.1.4.3 */
#ifndef CONFIG_DISABLE_ARRAY_BUILTIN #ifndef CONFIG_DISABLE_ARRAY_BUILTIN
OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL, OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL,
ECMA_BUILTIN_ID_ARRAY, ECMA_BUILTIN_ID_ARRAY,
@@ -82,87 +82,87 @@ OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL,
#endif /* !CONFIG_DISABLE_ARRAY_BUILTIN*/ #endif /* !CONFIG_DISABLE_ARRAY_BUILTIN*/
#ifndef CONFIG_DISABLE_STRING_BUILTIN #ifndef CONFIG_DISABLE_STRING_BUILTIN
// ECMA-262 v5, 15.1.4.4 /* ECMA-262 v5, 15.1.4.4 */
OBJECT_VALUE (LIT_MAGIC_STRING_STRING_UL, OBJECT_VALUE (LIT_MAGIC_STRING_STRING_UL,
ECMA_BUILTIN_ID_STRING, ECMA_BUILTIN_ID_STRING,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* !CONFIG_DISABLE_STRING_BUILTIN */ #endif /* !CONFIG_DISABLE_STRING_BUILTIN */
#ifndef CONFIG_DISABLE_BOOLEAN_BUILTIN #ifndef CONFIG_DISABLE_BOOLEAN_BUILTIN
// ECMA-262 v5, 15.1.4.5 /* ECMA-262 v5, 15.1.4.5 */
OBJECT_VALUE (LIT_MAGIC_STRING_BOOLEAN_UL, OBJECT_VALUE (LIT_MAGIC_STRING_BOOLEAN_UL,
ECMA_BUILTIN_ID_BOOLEAN, ECMA_BUILTIN_ID_BOOLEAN,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* !CONFIG_DISABLE_BOOLEAN_BUILTIN */ #endif /* !CONFIG_DISABLE_BOOLEAN_BUILTIN */
#ifndef CONFIG_DISABLE_NUMBER_BUILTIN #ifndef CONFIG_DISABLE_NUMBER_BUILTIN
// ECMA-262 v5, 15.1.4.6 /* ECMA-262 v5, 15.1.4.6 */
OBJECT_VALUE (LIT_MAGIC_STRING_NUMBER_UL, OBJECT_VALUE (LIT_MAGIC_STRING_NUMBER_UL,
ECMA_BUILTIN_ID_NUMBER, ECMA_BUILTIN_ID_NUMBER,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* !CONFIG_DISABLE_NUMBER_BUILTIN */ #endif /* !CONFIG_DISABLE_NUMBER_BUILTIN */
#ifndef CONFIG_DISABLE_DATE_BUILTIN #ifndef CONFIG_DISABLE_DATE_BUILTIN
// ECMA-262 v5, 15.1.4.7 /* ECMA-262 v5, 15.1.4.7 */
OBJECT_VALUE (LIT_MAGIC_STRING_DATE_UL, OBJECT_VALUE (LIT_MAGIC_STRING_DATE_UL,
ECMA_BUILTIN_ID_DATE, ECMA_BUILTIN_ID_DATE,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* !CONFIG_DISABLE_DATE_BUILTIN */ #endif /* !CONFIG_DISABLE_DATE_BUILTIN */
#ifndef CONFIG_DISABLE_REGEXP_BUILTIN #ifndef CONFIG_DISABLE_REGEXP_BUILTIN
// ECMA-262 v5, 15.1.4.8 /* ECMA-262 v5, 15.1.4.8 */
OBJECT_VALUE (LIT_MAGIC_STRING_REGEXP_UL, OBJECT_VALUE (LIT_MAGIC_STRING_REGEXP_UL,
ECMA_BUILTIN_ID_REGEXP, ECMA_BUILTIN_ID_REGEXP,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */ #endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */
// ECMA-262 v5, 15.1.4.9 /* ECMA-262 v5, 15.1.4.9 */
OBJECT_VALUE (LIT_MAGIC_STRING_ERROR_UL, OBJECT_VALUE (LIT_MAGIC_STRING_ERROR_UL,
ECMA_BUILTIN_ID_ERROR, ECMA_BUILTIN_ID_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#ifndef CONFIG_DISABLE_ERROR_BUILTINS #ifndef CONFIG_DISABLE_ERROR_BUILTINS
// ECMA-262 v5, 15.1.4.10 /* ECMA-262 v5, 15.1.4.10 */
OBJECT_VALUE (LIT_MAGIC_STRING_EVAL_ERROR_UL, OBJECT_VALUE (LIT_MAGIC_STRING_EVAL_ERROR_UL,
ECMA_BUILTIN_ID_EVAL_ERROR, ECMA_BUILTIN_ID_EVAL_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// ECMA-262 v5, 15.1.4.11 /* ECMA-262 v5, 15.1.4.11 */
OBJECT_VALUE (LIT_MAGIC_STRING_RANGE_ERROR_UL, OBJECT_VALUE (LIT_MAGIC_STRING_RANGE_ERROR_UL,
ECMA_BUILTIN_ID_RANGE_ERROR, ECMA_BUILTIN_ID_RANGE_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// ECMA-262 v5, 15.1.4.12 /* ECMA-262 v5, 15.1.4.12 */
OBJECT_VALUE (LIT_MAGIC_STRING_REFERENCE_ERROR_UL, OBJECT_VALUE (LIT_MAGIC_STRING_REFERENCE_ERROR_UL,
ECMA_BUILTIN_ID_REFERENCE_ERROR, ECMA_BUILTIN_ID_REFERENCE_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// ECMA-262 v5, 15.1.4.13 /* ECMA-262 v5, 15.1.4.13 */
OBJECT_VALUE (LIT_MAGIC_STRING_SYNTAX_ERROR_UL, OBJECT_VALUE (LIT_MAGIC_STRING_SYNTAX_ERROR_UL,
ECMA_BUILTIN_ID_SYNTAX_ERROR, ECMA_BUILTIN_ID_SYNTAX_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// ECMA-262 v5, 15.1.4.14 /* ECMA-262 v5, 15.1.4.14 */
OBJECT_VALUE (LIT_MAGIC_STRING_TYPE_ERROR_UL, OBJECT_VALUE (LIT_MAGIC_STRING_TYPE_ERROR_UL,
ECMA_BUILTIN_ID_TYPE_ERROR, ECMA_BUILTIN_ID_TYPE_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// ECMA-262 v5, 15.1.4.15 /* ECMA-262 v5, 15.1.4.15 */
OBJECT_VALUE (LIT_MAGIC_STRING_URI_ERROR_UL, OBJECT_VALUE (LIT_MAGIC_STRING_URI_ERROR_UL,
ECMA_BUILTIN_ID_URI_ERROR, ECMA_BUILTIN_ID_URI_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* !CONFIG_DISABLE_ERROR_BUILTINS */ #endif /* !CONFIG_DISABLE_ERROR_BUILTINS */
#ifndef CONFIG_DISABLE_MATH_BUILTIN #ifndef CONFIG_DISABLE_MATH_BUILTIN
// ECMA-262 v5, 15.1.5.1 /* ECMA-262 v5, 15.1.5.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_MATH_UL, OBJECT_VALUE (LIT_MAGIC_STRING_MATH_UL,
ECMA_BUILTIN_ID_MATH, ECMA_BUILTIN_ID_MATH,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* !CONFIG_DISABLE_MATH_BUILTIN */ #endif /* !CONFIG_DISABLE_MATH_BUILTIN */
#ifndef CONFIG_DISABLE_JSON_BUILTIN #ifndef CONFIG_DISABLE_JSON_BUILTIN
// ECMA-262 v5, 15.1.5.2 /* ECMA-262 v5, 15.1.5.2 */
OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U, OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U,
ECMA_BUILTIN_ID_JSON, ECMA_BUILTIN_ID_JSON,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -171,7 +171,7 @@ OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U,
/* Routine properties: /* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
// Implementation-defined 'print' routine /* Implementation-defined 'print' routine */
ROUTINE (LIT_MAGIC_STRING_PRINT, ecma_builtin_global_object_print, NON_FIXED, 1) ROUTINE (LIT_MAGIC_STRING_PRINT, ecma_builtin_global_object_print, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_EVAL, ecma_builtin_global_object_eval, 1, 1) ROUTINE (LIT_MAGIC_STRING_EVAL, ecma_builtin_global_object_eval, 1, 1)
@@ -43,42 +43,42 @@ OBJECT_ID (ECMA_BUILTIN_ID_MATH)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// ECMA-262 v5, 15.8.1.1 /* ECMA-262 v5, 15.8.1.1 */
NUMBER_VALUE (LIT_MAGIC_STRING_E_U, NUMBER_VALUE (LIT_MAGIC_STRING_E_U,
ECMA_BUILTIN_NUMBER_E, ECMA_BUILTIN_NUMBER_E,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.8.1.2 /* ECMA-262 v5, 15.8.1.2 */
NUMBER_VALUE (LIT_MAGIC_STRING_LN10_U, NUMBER_VALUE (LIT_MAGIC_STRING_LN10_U,
ECMA_BUILTIN_NUMBER_LN10, ECMA_BUILTIN_NUMBER_LN10,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.8.1.3 /* ECMA-262 v5, 15.8.1.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LN2_U, NUMBER_VALUE (LIT_MAGIC_STRING_LN2_U,
ECMA_BUILTIN_NUMBER_LN2, ECMA_BUILTIN_NUMBER_LN2,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.8.1.4 /* ECMA-262 v5, 15.8.1.4 */
NUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U, NUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U,
ECMA_BUILTIN_NUMBER_LOG2E, ECMA_BUILTIN_NUMBER_LOG2E,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.8.1.5 /* ECMA-262 v5, 15.8.1.5 */
NUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U, NUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U,
ECMA_BUILTIN_NUMBER_LOG10E, ECMA_BUILTIN_NUMBER_LOG10E,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.8.1.6 /* ECMA-262 v5, 15.8.1.6 */
NUMBER_VALUE (LIT_MAGIC_STRING_PI_U, NUMBER_VALUE (LIT_MAGIC_STRING_PI_U,
ECMA_BUILTIN_NUMBER_PI, ECMA_BUILTIN_NUMBER_PI,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.8.1.7 /* ECMA-262 v5, 15.8.1.7 */
NUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U, NUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U,
ECMA_BUILTIN_NUMBER_SQRT_1_2, ECMA_BUILTIN_NUMBER_SQRT_1_2,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.8.1.8 /* ECMA-262 v5, 15.8.1.8 */
NUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U, NUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U,
ECMA_BUILTIN_NUMBER_SQRT2, ECMA_BUILTIN_NUMBER_SQRT2,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -35,7 +35,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.7.4.1 /* ECMA-262 v5, 15.7.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_NUMBER, ECMA_BUILTIN_ID_NUMBER,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -35,32 +35,32 @@ OBJECT_ID (ECMA_BUILTIN_ID_NUMBER)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// 15.7.3 /* ECMA-262 v5, 15.7.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// 15.7.3.4 /* ECMA-262 v5, 15.7.3.4 */
NUMBER_VALUE (LIT_MAGIC_STRING_NAN, NUMBER_VALUE (LIT_MAGIC_STRING_NAN,
ECMA_BUILTIN_NUMBER_NAN, ECMA_BUILTIN_NUMBER_NAN,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// 15.7.3.2 /* ECMA-262 v5, 15.7.3.2 */
NUMBER_VALUE (LIT_MAGIC_STRING_MAX_VALUE_U, NUMBER_VALUE (LIT_MAGIC_STRING_MAX_VALUE_U,
ECMA_BUILTIN_NUMBER_MAX, ECMA_BUILTIN_NUMBER_MAX,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// 15.7.3.3 /* ECMA-262 v5, 15.7.3.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_MIN_VALUE_U, NUMBER_VALUE (LIT_MAGIC_STRING_MIN_VALUE_U,
ECMA_BUILTIN_NUMBER_MIN, ECMA_BUILTIN_NUMBER_MIN,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// 15.7.3.5 /* ECMA-262 v5, 15.7.3.5 */
NUMBER_VALUE (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, NUMBER_VALUE (LIT_MAGIC_STRING_POSITIVE_INFINITY_U,
ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// 15.7.3.6 /* ECMA-262 v5, 15.7.3.6 */
NUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, NUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U,
ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY, ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -68,7 +68,7 @@ NUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.7.3.1 /* ECMA-262 v5, 15.7.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, ECMA_BUILTIN_ID_NUMBER_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -35,7 +35,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.2.4.1 /* ECMA-262 v5, 15.2.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_OBJECT, ECMA_BUILTIN_ID_OBJECT,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -183,14 +183,14 @@ ecma_builtin_object_object_seal (ecma_value_t this_arg, /**< 'this' argument */
JERRY_UNUSED (this_arg); JERRY_UNUSED (this_arg);
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
// 1. /* 1. */
if (!ecma_is_value_object (arg)) if (!ecma_is_value_object (arg))
{ {
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object."));
} }
else else
{ {
// 2. /* 2. */
ecma_object_t *obj_p = ecma_get_object_from_value (arg); ecma_object_t *obj_p = ecma_get_object_from_value (arg);
ecma_collection_header_t *props_p = ecma_op_object_get_property_names (obj_p, false, false, false); ecma_collection_header_t *props_p = ecma_op_object_get_property_names (obj_p, false, false, false);
@@ -203,7 +203,7 @@ ecma_builtin_object_object_seal (ecma_value_t this_arg, /**< 'this' argument */
{ {
ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p); ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p);
// 2.a /* 2.a */
ecma_property_descriptor_t prop_desc; ecma_property_descriptor_t prop_desc;
if (!ecma_op_object_get_own_property_descriptor (obj_p, property_name_p, &prop_desc)) if (!ecma_op_object_get_own_property_descriptor (obj_p, property_name_p, &prop_desc))
@@ -211,10 +211,10 @@ ecma_builtin_object_object_seal (ecma_value_t this_arg, /**< 'this' argument */
continue; continue;
} }
// 2.b /* 2.b */
prop_desc.is_configurable = false; prop_desc.is_configurable = false;
// 2.c /* 2.c */
ECMA_TRY_CATCH (define_own_prop_ret, ECMA_TRY_CATCH (define_own_prop_ret,
ecma_op_object_define_own_property (obj_p, ecma_op_object_define_own_property (obj_p,
property_name_p, property_name_p,
@@ -230,10 +230,10 @@ ecma_builtin_object_object_seal (ecma_value_t this_arg, /**< 'this' argument */
if (ecma_is_value_empty (ret_value)) if (ecma_is_value_empty (ret_value))
{ {
// 3. /* 3. */
ecma_set_object_extensible (obj_p, false); ecma_set_object_extensible (obj_p, false);
// 4. /* 4. */
ret_value = ecma_copy_value (arg); ret_value = ecma_copy_value (arg);
} }
} }
@@ -257,14 +257,14 @@ ecma_builtin_object_object_freeze (ecma_value_t this_arg, /**< 'this' argument *
JERRY_UNUSED (this_arg); JERRY_UNUSED (this_arg);
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
// 1. /* 1. */
if (!ecma_is_value_object (arg)) if (!ecma_is_value_object (arg))
{ {
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object."));
} }
else else
{ {
// 2. /* 2. */
ecma_object_t *obj_p = ecma_get_object_from_value (arg); ecma_object_t *obj_p = ecma_get_object_from_value (arg);
ecma_collection_header_t *props_p = ecma_op_object_get_property_names (obj_p, false, false, false); ecma_collection_header_t *props_p = ecma_op_object_get_property_names (obj_p, false, false, false);
@@ -278,7 +278,7 @@ ecma_builtin_object_object_freeze (ecma_value_t this_arg, /**< 'this' argument *
{ {
ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p); ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p);
// 2.a /* 2.a */
ecma_property_descriptor_t prop_desc; ecma_property_descriptor_t prop_desc;
if (!ecma_op_object_get_own_property_descriptor (obj_p, property_name_p, &prop_desc)) if (!ecma_op_object_get_own_property_descriptor (obj_p, property_name_p, &prop_desc))
@@ -286,16 +286,16 @@ ecma_builtin_object_object_freeze (ecma_value_t this_arg, /**< 'this' argument *
continue; continue;
} }
// 2.b /* 2.b */
if (prop_desc.is_writable_defined && prop_desc.is_writable) if (prop_desc.is_writable_defined && prop_desc.is_writable)
{ {
prop_desc.is_writable = false; prop_desc.is_writable = false;
} }
// 2.c /* 2.c */
prop_desc.is_configurable = false; prop_desc.is_configurable = false;
// 2.d /* 2.d */
ECMA_TRY_CATCH (define_own_prop_ret, ECMA_TRY_CATCH (define_own_prop_ret,
ecma_op_object_define_own_property (obj_p, ecma_op_object_define_own_property (obj_p,
property_name_p, property_name_p,
@@ -311,10 +311,10 @@ ecma_builtin_object_object_freeze (ecma_value_t this_arg, /**< 'this' argument *
if (ecma_is_value_empty (ret_value)) if (ecma_is_value_empty (ret_value))
{ {
// 3. /* 3. */
ecma_set_object_extensible (obj_p, false); ecma_set_object_extensible (obj_p, false);
// 4. /* 4. */
ret_value = ecma_copy_value (arg); ret_value = ecma_copy_value (arg);
} }
} }
@@ -369,7 +369,7 @@ ecma_builtin_object_object_is_sealed (ecma_value_t this_arg, /**< 'this' argumen
JERRY_UNUSED (this_arg); JERRY_UNUSED (this_arg);
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
// 1. /* 1. */
if (!ecma_is_value_object (arg)) if (!ecma_is_value_object (arg))
{ {
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object."));
@@ -380,7 +380,7 @@ ecma_builtin_object_object_is_sealed (ecma_value_t this_arg, /**< 'this' argumen
bool is_sealed; bool is_sealed;
// 3. /* 3. */
if (ecma_get_object_extensible (obj_p)) if (ecma_get_object_extensible (obj_p))
{ {
is_sealed = false; is_sealed = false;
@@ -390,7 +390,7 @@ ecma_builtin_object_object_is_sealed (ecma_value_t this_arg, /**< 'this' argumen
/* the value can be updated in the loop below */ /* the value can be updated in the loop below */
is_sealed = true; is_sealed = true;
// 2. /* 2. */
ecma_collection_header_t *props_p = ecma_op_object_get_property_names (obj_p, false, false, false); ecma_collection_header_t *props_p = ecma_op_object_get_property_names (obj_p, false, false, false);
ecma_collection_iterator_t iter; ecma_collection_iterator_t iter;
@@ -400,13 +400,13 @@ ecma_builtin_object_object_is_sealed (ecma_value_t this_arg, /**< 'this' argumen
{ {
ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p); ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p);
// 2.a /* 2.a */
ecma_property_t property = ecma_op_object_get_own_property (obj_p, ecma_property_t property = ecma_op_object_get_own_property (obj_p,
property_name_p, property_name_p,
NULL, NULL,
ECMA_PROPERTY_GET_NO_OPTIONS); ECMA_PROPERTY_GET_NO_OPTIONS);
// 2.b /* 2.b */
if (ecma_is_property_configurable (property)) if (ecma_is_property_configurable (property))
{ {
is_sealed = false; is_sealed = false;
@@ -417,7 +417,7 @@ ecma_builtin_object_object_is_sealed (ecma_value_t this_arg, /**< 'this' argumen
ecma_free_values_collection (props_p, true); ecma_free_values_collection (props_p, true);
} }
// 4. /* 4. */
ret_value = ecma_make_simple_value (is_sealed ? ECMA_SIMPLE_VALUE_TRUE ret_value = ecma_make_simple_value (is_sealed ? ECMA_SIMPLE_VALUE_TRUE
: ECMA_SIMPLE_VALUE_FALSE); : ECMA_SIMPLE_VALUE_FALSE);
} }
@@ -441,7 +441,7 @@ ecma_builtin_object_object_is_frozen (ecma_value_t this_arg, /**< 'this' argumen
JERRY_UNUSED (this_arg); JERRY_UNUSED (this_arg);
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
// 1. /* 1. */
if (!ecma_is_value_object (arg)) if (!ecma_is_value_object (arg))
{ {
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object."));
@@ -452,7 +452,7 @@ ecma_builtin_object_object_is_frozen (ecma_value_t this_arg, /**< 'this' argumen
bool is_frozen; bool is_frozen;
// 3. /* 3. */
if (ecma_get_object_extensible (obj_p)) if (ecma_get_object_extensible (obj_p))
{ {
is_frozen = false; is_frozen = false;
@@ -461,7 +461,7 @@ ecma_builtin_object_object_is_frozen (ecma_value_t this_arg, /**< 'this' argumen
{ {
is_frozen = true; is_frozen = true;
// 2. /* 2. */
ecma_collection_header_t *props_p = ecma_op_object_get_property_names (obj_p, false, false, false); ecma_collection_header_t *props_p = ecma_op_object_get_property_names (obj_p, false, false, false);
ecma_collection_iterator_t iter; ecma_collection_iterator_t iter;
@@ -471,13 +471,13 @@ ecma_builtin_object_object_is_frozen (ecma_value_t this_arg, /**< 'this' argumen
{ {
ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p); ecma_string_t *property_name_p = ecma_get_string_from_value (*iter.current_value_p);
// 2.a /* 2.a */
ecma_property_t property = ecma_op_object_get_own_property (obj_p, ecma_property_t property = ecma_op_object_get_own_property (obj_p,
property_name_p, property_name_p,
NULL, NULL,
ECMA_PROPERTY_GET_NO_OPTIONS); ECMA_PROPERTY_GET_NO_OPTIONS);
// 2.b /* 2.b */
if (ECMA_PROPERTY_GET_TYPE (property) != ECMA_PROPERTY_TYPE_NAMEDACCESSOR if (ECMA_PROPERTY_GET_TYPE (property) != ECMA_PROPERTY_TYPE_NAMEDACCESSOR
&& ecma_is_property_writable (property)) && ecma_is_property_writable (property))
{ {
@@ -485,7 +485,7 @@ ecma_builtin_object_object_is_frozen (ecma_value_t this_arg, /**< 'this' argumen
break; break;
} }
// 2.c /* 2.c */
if (ecma_is_property_configurable (property)) if (ecma_is_property_configurable (property))
{ {
is_frozen = false; is_frozen = false;
@@ -496,7 +496,7 @@ ecma_builtin_object_object_is_frozen (ecma_value_t this_arg, /**< 'this' argumen
ecma_free_values_collection (props_p, true); ecma_free_values_collection (props_p, true);
} }
// 4. /* 4 */
ret_value = ecma_make_simple_value (is_frozen ? ECMA_SIMPLE_VALUE_TRUE ret_value = ecma_make_simple_value (is_frozen ? ECMA_SIMPLE_VALUE_TRUE
: ECMA_SIMPLE_VALUE_FALSE); : ECMA_SIMPLE_VALUE_FALSE);
} }
@@ -585,7 +585,7 @@ ecma_builtin_object_object_get_own_property_descriptor (ecma_value_t this_arg, /
JERRY_UNUSED (this_arg); JERRY_UNUSED (this_arg);
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
// 1. /* 1. */
if (!ecma_is_value_object (arg1)) if (!ecma_is_value_object (arg1))
{ {
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object."));
@@ -594,19 +594,19 @@ ecma_builtin_object_object_get_own_property_descriptor (ecma_value_t this_arg, /
ecma_object_t *obj_p = ecma_get_object_from_value (arg1); ecma_object_t *obj_p = ecma_get_object_from_value (arg1);
// 2. /* 2. */
ECMA_TRY_CATCH (name_str_value, ECMA_TRY_CATCH (name_str_value,
ecma_op_to_string (arg2), ecma_op_to_string (arg2),
ret_value); ret_value);
ecma_string_t *name_str_p = ecma_get_string_from_value (name_str_value); ecma_string_t *name_str_p = ecma_get_string_from_value (name_str_value);
// 3. /* 3. */
ecma_property_descriptor_t prop_desc; ecma_property_descriptor_t prop_desc;
if (ecma_op_object_get_own_property_descriptor (obj_p, name_str_p, &prop_desc)) if (ecma_op_object_get_own_property_descriptor (obj_p, name_str_p, &prop_desc))
{ {
// 4. /* 4. */
ecma_object_t *desc_obj_p = ecma_op_from_property_descriptor (&prop_desc); ecma_object_t *desc_obj_p = ecma_op_from_property_descriptor (&prop_desc);
ecma_free_property_descriptor (&prop_desc); ecma_free_property_descriptor (&prop_desc);
@@ -639,7 +639,7 @@ ecma_builtin_object_object_create (ecma_value_t this_arg, /**< 'this' argument *
{ {
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
// 1. /* 1. */
if (!ecma_is_value_object (arg1) && !ecma_is_value_null (arg1)) if (!ecma_is_value_object (arg1) && !ecma_is_value_null (arg1))
{ {
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object."));
@@ -652,10 +652,10 @@ ecma_builtin_object_object_create (ecma_value_t this_arg, /**< 'this' argument *
{ {
obj_p = ecma_get_object_from_value (arg1); obj_p = ecma_get_object_from_value (arg1);
} }
// 2-3. /* 2-3. */
ecma_object_t *result_obj_p = ecma_op_create_object_object_noarg_and_set_prototype (obj_p); ecma_object_t *result_obj_p = ecma_op_create_object_object_noarg_and_set_prototype (obj_p);
// 4. /* 4. */
if (!ecma_is_value_undefined (arg2)) if (!ecma_is_value_undefined (arg2))
{ {
ECMA_TRY_CATCH (obj, ECMA_TRY_CATCH (obj,
@@ -666,7 +666,7 @@ ecma_builtin_object_object_create (ecma_value_t this_arg, /**< 'this' argument *
ECMA_FINALIZE (obj); ECMA_FINALIZE (obj);
} }
// 5. /* 5. */
if (ecma_is_value_empty (ret_value)) if (ecma_is_value_empty (ret_value))
{ {
ret_value = ecma_copy_value (ecma_make_object_value (result_obj_p)); ret_value = ecma_copy_value (ecma_make_object_value (result_obj_p));
@@ -695,7 +695,7 @@ ecma_builtin_object_object_define_properties (ecma_value_t this_arg, /**< 'this'
JERRY_UNUSED (this_arg); JERRY_UNUSED (this_arg);
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
// 1. /* 1. */
if (!ecma_is_value_object (arg1)) if (!ecma_is_value_object (arg1))
{ {
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object."));
@@ -704,20 +704,20 @@ ecma_builtin_object_object_define_properties (ecma_value_t this_arg, /**< 'this'
{ {
ecma_object_t *obj_p = ecma_get_object_from_value (arg1); ecma_object_t *obj_p = ecma_get_object_from_value (arg1);
// 2. /* 2. */
ECMA_TRY_CATCH (props, ECMA_TRY_CATCH (props,
ecma_op_to_object (arg2), ecma_op_to_object (arg2),
ret_value); ret_value);
ecma_object_t *props_p = ecma_get_object_from_value (props); ecma_object_t *props_p = ecma_get_object_from_value (props);
// 3. /* 3. */
ecma_collection_header_t *prop_names_p = ecma_op_object_get_property_names (props_p, false, true, false); ecma_collection_header_t *prop_names_p = ecma_op_object_get_property_names (props_p, false, true, false);
uint32_t property_number = prop_names_p->unit_number; uint32_t property_number = prop_names_p->unit_number;
ecma_collection_iterator_t iter; ecma_collection_iterator_t iter;
ecma_collection_iterator_init (&iter, prop_names_p); ecma_collection_iterator_init (&iter, prop_names_p);
// 4. /* 4. */
JMEM_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; uint32_t property_descriptor_number = 0;
@@ -725,12 +725,12 @@ ecma_builtin_object_object_define_properties (ecma_value_t this_arg, /**< 'this'
while (ecma_collection_iterator_next (&iter) while (ecma_collection_iterator_next (&iter)
&& ecma_is_value_empty (ret_value)) && ecma_is_value_empty (ret_value))
{ {
// 5.a /* 5.a */
ECMA_TRY_CATCH (desc_obj, ECMA_TRY_CATCH (desc_obj,
ecma_op_object_get (props_p, ecma_get_string_from_value (*iter.current_value_p)), ecma_op_object_get (props_p, ecma_get_string_from_value (*iter.current_value_p)),
ret_value); ret_value);
// 5.b /* 5.b */
ECMA_TRY_CATCH (conv_result, ECMA_TRY_CATCH (conv_result,
ecma_op_to_property_descriptor (desc_obj, ecma_op_to_property_descriptor (desc_obj,
&property_descriptors[property_descriptor_number]), &property_descriptors[property_descriptor_number]),
@@ -742,7 +742,7 @@ ecma_builtin_object_object_define_properties (ecma_value_t this_arg, /**< 'this'
ECMA_FINALIZE (desc_obj); ECMA_FINALIZE (desc_obj);
} }
// 6. /* 6. */
ecma_collection_iterator_init (&iter, prop_names_p); ecma_collection_iterator_init (&iter, prop_names_p);
for (uint32_t index = 0; for (uint32_t index = 0;
index < property_number && ecma_is_value_empty (ret_value); index < property_number && ecma_is_value_empty (ret_value);
@@ -761,7 +761,7 @@ ecma_builtin_object_object_define_properties (ecma_value_t this_arg, /**< 'this'
ECMA_FINALIZE (define_own_prop_ret); ECMA_FINALIZE (define_own_prop_ret);
} }
// Clean up /* Clean up. */
for (uint32_t index = 0; for (uint32_t index = 0;
index < property_descriptor_number; index < property_descriptor_number;
index++) index++)
@@ -773,7 +773,7 @@ ecma_builtin_object_object_define_properties (ecma_value_t this_arg, /**< 'this'
ecma_free_values_collection (prop_names_p, true); ecma_free_values_collection (prop_names_p, true);
// 7. /* 7. */
if (ecma_is_value_empty (ret_value)) if (ecma_is_value_empty (ret_value))
{ {
ret_value = ecma_copy_value (arg1); ret_value = ecma_copy_value (arg1);
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_OBJECT)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// 15.2.3 /* ECMA-262 v5, 15.2.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.2.3.1 /* ECMA-262 v5, 15.2.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -35,17 +35,17 @@ OBJECT_ID (ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.7.8 /* ECMA-262 v5, 15.11.7.8 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_RANGE_ERROR, ECMA_BUILTIN_ID_RANGE_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.9 /* ECMA-262 v5, 15.11.7.9 */
STRING_VALUE (LIT_MAGIC_STRING_NAME, STRING_VALUE (LIT_MAGIC_STRING_NAME,
LIT_MAGIC_STRING_RANGE_ERROR_UL, LIT_MAGIC_STRING_RANGE_ERROR_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.10 /* ECMA-262 v5, 15.11.7.10 */
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
LIT_MAGIC_STRING__EMPTY, LIT_MAGIC_STRING__EMPTY,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_RANGE_ERROR)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// 15.11.3 /* ECMA-262 v5, 15.11.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.3.1 /* ECMA-262 v5, 15.11.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE, ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -35,17 +35,17 @@ OBJECT_ID (ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.7.8 /* ECMA-262 v5, 15.11.7.8 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_REFERENCE_ERROR, ECMA_BUILTIN_ID_REFERENCE_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.9 /* ECMA-262 v5, 15.11.7.9 */
STRING_VALUE (LIT_MAGIC_STRING_NAME, STRING_VALUE (LIT_MAGIC_STRING_NAME,
LIT_MAGIC_STRING_REFERENCE_ERROR_UL, LIT_MAGIC_STRING_REFERENCE_ERROR_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.10 /* ECMA-262 v5, 15.11.7.10 */
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
LIT_MAGIC_STRING__EMPTY, LIT_MAGIC_STRING__EMPTY,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_REFERENCE_ERROR)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// 15.11.3 /* ECMA-262 v5, 15.11.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.3.1 /* ECMA-262 v5, 15.11.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE, ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -45,32 +45,32 @@
/* Object identifier */ /* Object identifier */
OBJECT_ID (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE) OBJECT_ID (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE)
// ECMA-262 v5, 15.10.6.1 /* ECMA-262 v5, 15.10.6.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_REGEXP, ECMA_BUILTIN_ID_REGEXP,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// ECMA-262 v5, 15.10.7.1 /* ECMA-262 v5, 15.10.7.1 */
STRING_VALUE (LIT_MAGIC_STRING_SOURCE, STRING_VALUE (LIT_MAGIC_STRING_SOURCE,
LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP, LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.10.7.2 /* ECMA-262 v5, 15.10.7.2 */
SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL, SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL,
ECMA_SIMPLE_VALUE_FALSE, ECMA_SIMPLE_VALUE_FALSE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.10.7.3 /* ECMA-262 v5, 15.10.7.3 */
SIMPLE_VALUE (LIT_MAGIC_STRING_IGNORECASE_UL, SIMPLE_VALUE (LIT_MAGIC_STRING_IGNORECASE_UL,
ECMA_SIMPLE_VALUE_FALSE, ECMA_SIMPLE_VALUE_FALSE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.10.7.4 /* ECMA-262 v5, 15.10.7.4 */
SIMPLE_VALUE (LIT_MAGIC_STRING_MULTILINE, SIMPLE_VALUE (LIT_MAGIC_STRING_MULTILINE,
ECMA_SIMPLE_VALUE_FALSE, ECMA_SIMPLE_VALUE_FALSE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.10.7.5 /* ECMA-262 v5, 15.10.7.5 */
NUMBER_VALUE (LIT_MAGIC_STRING_LASTINDEX_UL, NUMBER_VALUE (LIT_MAGIC_STRING_LASTINDEX_UL,
0, 0,
ECMA_PROPERTY_FLAG_WRITABLE) ECMA_PROPERTY_FLAG_WRITABLE)
@@ -33,12 +33,12 @@
/* Object identifier */ /* Object identifier */
OBJECT_ID (ECMA_BUILTIN_ID_REGEXP) OBJECT_ID (ECMA_BUILTIN_ID_REGEXP)
// ECMA-262 v5, 15.10.5 /* ECMA-262 v5, 15.10.5 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
2, 2,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
// ECMA-262 v5, 15.10.5.1 /* ECMA-262 v5, 15.10.5.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_REGEXP_PROTOTYPE, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_STRING_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.5.4.1 /* ECMA-262 v5, 15.5.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_STRING, ECMA_BUILTIN_ID_STRING,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -47,7 +47,7 @@ OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
/* Number properties: /* Number properties:
* (property name, number value) */ * (property name, number value) */
// 15.5.4 (String.prototype is itself a String object whose value is an empty String), 15.5.5.1 /* ECMA-262 v5, 15.5.4 (String.prototype is itself a String object whose value is an empty String), 15.5.5.1 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
0, 0,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_STRING)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// 15.5.3 /* ECMA-262 v5, 15.5.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.7.3.1 /* ECMA-262 v5, 15.7.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_STRING_PROTOTYPE, ECMA_BUILTIN_ID_STRING_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -35,17 +35,17 @@ OBJECT_ID (ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.7.8 /* ECMA-262 v5, 15.11.7.8 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_SYNTAX_ERROR, ECMA_BUILTIN_ID_SYNTAX_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.9 /* ECMA-262 v5, 15.11.7.9 */
STRING_VALUE (LIT_MAGIC_STRING_NAME, STRING_VALUE (LIT_MAGIC_STRING_NAME,
LIT_MAGIC_STRING_SYNTAX_ERROR_UL, LIT_MAGIC_STRING_SYNTAX_ERROR_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.10 /* ECMA-262 v5, 15.11.7.10 */
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
LIT_MAGIC_STRING__EMPTY, LIT_MAGIC_STRING__EMPTY,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_SYNTAX_ERROR)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// 15.11.3 /* ECMA-262 v5, 15.11.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.3.1 /* ECMA-262 v5, 15.11.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE, ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -35,17 +35,17 @@ OBJECT_ID (ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.7.8 /* ECMA-262 v5, 15.11.7.8 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_TYPE_ERROR, ECMA_BUILTIN_ID_TYPE_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.9 /* ECMA-262 v5, 15.11.7.9 */
STRING_VALUE (LIT_MAGIC_STRING_NAME, STRING_VALUE (LIT_MAGIC_STRING_NAME,
LIT_MAGIC_STRING_TYPE_ERROR_UL, LIT_MAGIC_STRING_TYPE_ERROR_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.10 /* ECMA-262 v5, 15.11.7.10 */
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
LIT_MAGIC_STRING__EMPTY, LIT_MAGIC_STRING__EMPTY,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_TYPE_ERROR)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// 15.11.3 /* ECMA-262 v5, 15.11.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.3.1 /* ECMA-262 v5, 15.11.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE, ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -35,17 +35,17 @@ OBJECT_ID (ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE)
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.7.8 /* ECMA-262 v5, 15.11.7.8 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_URI_ERROR, ECMA_BUILTIN_ID_URI_ERROR,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.9 /* ECMA-262 v5, 15.11.7.9 */
STRING_VALUE (LIT_MAGIC_STRING_NAME, STRING_VALUE (LIT_MAGIC_STRING_NAME,
LIT_MAGIC_STRING_URI_ERROR_UL, LIT_MAGIC_STRING_URI_ERROR_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
// 15.11.7.10 /* ECMA-262 v5, 15.11.7.10 */
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
LIT_MAGIC_STRING__EMPTY, LIT_MAGIC_STRING__EMPTY,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
@@ -39,7 +39,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_URI_ERROR)
/* Number properties: /* Number properties:
* (property name, number value, writable, enumerable, configurable) */ * (property name, number value, writable, enumerable, configurable) */
// 15.11.3 /* ECMA-262 v5, 15.11.3 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1, 1,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
@@ -47,7 +47,7 @@ NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
/* Object properties: /* Object properties:
* (property name, object pointer getter) */ * (property name, object pointer getter) */
// 15.11.3.1 /* ECMA-262 v5, 15.11.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE, ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE,
ECMA_PROPERTY_FIXED) ECMA_PROPERTY_FIXED)
+22 -22
View File
@@ -53,7 +53,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
{ {
if (ecma_is_value_number (y)) if (ecma_is_value_number (y))
{ {
// 1.c /* 1.c */
ecma_number_t x_num = ecma_get_number_from_value (x); ecma_number_t x_num = ecma_get_number_from_value (x);
ecma_number_t y_num = ecma_get_number_from_value (y); ecma_number_t y_num = ecma_get_number_from_value (y);
@@ -94,7 +94,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
{ {
if (ecma_is_value_string (y)) if (ecma_is_value_string (y))
{ {
// 1., d. /* 1., d. */
ecma_string_t *x_str_p = ecma_get_string_from_value (x); ecma_string_t *x_str_p = ecma_get_string_from_value (x);
ecma_string_t *y_str_p = ecma_get_string_from_value (y); ecma_string_t *y_str_p = ecma_get_string_from_value (y);
@@ -105,7 +105,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
if (ecma_is_value_number (y)) if (ecma_is_value_number (y))
{ {
// 4. /* 4. */
ecma_value_t x_num_value = ecma_op_to_number (x); ecma_value_t x_num_value = ecma_op_to_number (x);
if (ECMA_IS_VALUE_ERROR (x_num_value)) if (ECMA_IS_VALUE_ERROR (x_num_value))
@@ -129,12 +129,12 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
{ {
if (ecma_is_value_boolean (x)) if (ecma_is_value_boolean (x))
{ {
// 1., e. /* 1., e. */
/* Note: the (x == y) comparison captures the true case. */ /* Note: the (x == y) comparison captures the true case. */
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE); return ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE);
} }
// 7. /* 7. */
return ecma_op_abstract_equality_compare (x, ecma_make_integer_value (ecma_is_value_true (y) ? 1 : 0)); return ecma_op_abstract_equality_compare (x, ecma_make_integer_value (ecma_is_value_true (y) ? 1 : 0));
} }
@@ -143,7 +143,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
if (ecma_is_value_string (y) if (ecma_is_value_string (y)
|| ecma_is_value_number (y)) || ecma_is_value_number (y))
{ {
// 9. /* 9. */
ecma_value_t x_prim_value = ecma_op_to_primitive (x, ECMA_PREFERRED_TYPE_NO); ecma_value_t x_prim_value = ecma_op_to_primitive (x, ECMA_PREFERRED_TYPE_NO);
if (ECMA_IS_VALUE_ERROR (x_prim_value)) if (ECMA_IS_VALUE_ERROR (x_prim_value))
@@ -157,22 +157,22 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
return compare_result; return compare_result;
} }
// 1., f. /* 1., f. */
/* Note: the (x == y) comparison captures the true case. */ /* Note: the (x == y) comparison captures the true case. */
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE); return ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE);
} }
if (ecma_is_value_boolean (x)) if (ecma_is_value_boolean (x))
{ {
// 6. /* 6. */
return ecma_op_abstract_equality_compare (ecma_make_integer_value (ecma_is_value_true (x) ? 1 : 0), y); return ecma_op_abstract_equality_compare (ecma_make_integer_value (ecma_is_value_true (x) ? 1 : 0), y);
} }
if (ecma_is_value_undefined (x) if (ecma_is_value_undefined (x)
|| ecma_is_value_null (x)) || ecma_is_value_null (x))
{ {
// 1. a., b. /* 1. a., b. */
// 2., 3. /* 2., 3. */
bool is_equal = ecma_is_value_undefined (y) || ecma_is_value_null (y); bool is_equal = ecma_is_value_undefined (y) || ecma_is_value_null (y);
return ecma_make_boolean_value (is_equal); return ecma_make_boolean_value (is_equal);
@@ -285,7 +285,7 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
{ {
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
// 1., 2. /* 1., 2. */
ECMA_TRY_CATCH (prim_first_converted_value, ECMA_TRY_CATCH (prim_first_converted_value,
ecma_op_to_primitive (x, ECMA_PREFERRED_TYPE_NUMBER), ecma_op_to_primitive (x, ECMA_PREFERRED_TYPE_NUMBER),
ret_value); ret_value);
@@ -301,17 +301,17 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
if (!(is_px_string && is_py_string)) if (!(is_px_string && is_py_string))
{ {
// 3. /* 3. */
// a. /* a. */
ECMA_OP_TO_NUMBER_TRY_CATCH (nx, px, ret_value); ECMA_OP_TO_NUMBER_TRY_CATCH (nx, px, ret_value);
ECMA_OP_TO_NUMBER_TRY_CATCH (ny, py, ret_value); ECMA_OP_TO_NUMBER_TRY_CATCH (ny, py, ret_value);
// b. /* b. */
if (ecma_number_is_nan (nx) if (ecma_number_is_nan (nx)
|| ecma_number_is_nan (ny)) || ecma_number_is_nan (ny))
{ {
// c., d. /* c., d. */
ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED); ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
} }
else else
@@ -325,36 +325,36 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
|| (ecma_number_is_zero (nx) || (ecma_number_is_zero (nx)
&& ecma_number_is_zero (ny))) && ecma_number_is_zero (ny)))
{ {
// e., f., g. /* e., f., g. */
is_x_less_than_y_check = false; is_x_less_than_y_check = false;
} }
else if (ecma_number_is_infinity (nx) else if (ecma_number_is_infinity (nx)
&& !ecma_number_is_negative (nx)) && !ecma_number_is_negative (nx))
{ {
// h. /* h. */
is_x_less_than_y_check = false; is_x_less_than_y_check = false;
} }
else if (ecma_number_is_infinity (ny) else if (ecma_number_is_infinity (ny)
&& !ecma_number_is_negative (ny)) && !ecma_number_is_negative (ny))
{ {
// i. /* i. */
is_x_less_than_y_check = true; is_x_less_than_y_check = true;
} }
else if (ecma_number_is_infinity (ny) else if (ecma_number_is_infinity (ny)
&& ecma_number_is_negative (ny)) && ecma_number_is_negative (ny))
{ {
// j. /* j. */
is_x_less_than_y_check = false; is_x_less_than_y_check = false;
} }
else if (ecma_number_is_infinity (nx) else if (ecma_number_is_infinity (nx)
&& ecma_number_is_negative (nx)) && ecma_number_is_negative (nx))
{ {
// k. /* k. */
is_x_less_than_y_check = true; is_x_less_than_y_check = true;
} }
else else
{ {
// l. /* l. */
JERRY_ASSERT (!ecma_number_is_nan (nx) JERRY_ASSERT (!ecma_number_is_nan (nx)
&& !ecma_number_is_infinity (nx)); && !ecma_number_is_infinity (nx));
JERRY_ASSERT (!ecma_number_is_nan (ny) JERRY_ASSERT (!ecma_number_is_nan (ny)
@@ -382,7 +382,7 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
ECMA_OP_TO_NUMBER_FINALIZE (nx); ECMA_OP_TO_NUMBER_FINALIZE (nx);
} }
else else
{ // 4. { /* 4. */
JERRY_ASSERT (is_px_string && is_py_string); JERRY_ASSERT (is_px_string && is_py_string);
ecma_string_t *str_x_p = ecma_get_string_from_value (px); ecma_string_t *str_x_p = ecma_get_string_from_value (px);
+17 -18
View File
@@ -121,7 +121,7 @@ ecma_op_same_value (ecma_value_t x, /**< ecma value */
* If both are NaN * If both are NaN
* return true; * return true;
* else * else
* // one of the numbers is NaN, and another - is not * one of the numbers is NaN, and another - is not
* return false; * return false;
*/ */
return (is_x_nan && is_y_nan); return (is_x_nan && is_y_nan);
@@ -435,7 +435,7 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */
ecma_object_t * ecma_object_t *
ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_desc_p) /**< property descriptor */ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_desc_p) /**< property descriptor */
{ {
// 2. /* 2. */
ecma_object_t *obj_p = ecma_op_create_object_object_noarg (); ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();
ecma_value_t completion; ecma_value_t completion;
@@ -453,13 +453,13 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des
prop_desc.is_configurable = true; prop_desc.is_configurable = true;
} }
// 3. /* 3. */
if (src_prop_desc_p->is_value_defined if (src_prop_desc_p->is_value_defined
|| src_prop_desc_p->is_writable_defined) || src_prop_desc_p->is_writable_defined)
{ {
JERRY_ASSERT (prop_desc.is_value_defined && prop_desc.is_writable_defined); JERRY_ASSERT (prop_desc.is_value_defined && prop_desc.is_writable_defined);
// a. /* a. */
prop_desc.value = src_prop_desc_p->value; prop_desc.value = src_prop_desc_p->value;
ecma_string_t *value_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_VALUE); ecma_string_t *value_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_VALUE);
@@ -470,7 +470,7 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des
ecma_deref_ecma_string (value_magic_string_p); ecma_deref_ecma_string (value_magic_string_p);
JERRY_ASSERT (ecma_is_value_true (completion)); JERRY_ASSERT (ecma_is_value_true (completion));
// b. /* b. */
const bool is_writable = (src_prop_desc_p->is_writable); const bool is_writable = (src_prop_desc_p->is_writable);
prop_desc.value = ecma_make_boolean_value (is_writable); prop_desc.value = ecma_make_boolean_value (is_writable);
@@ -484,11 +484,11 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des
} }
else else
{ {
// 4. /* 4. */
JERRY_ASSERT (src_prop_desc_p->is_get_defined JERRY_ASSERT (src_prop_desc_p->is_get_defined
|| src_prop_desc_p->is_set_defined); || src_prop_desc_p->is_set_defined);
// a. /* a. */
if (src_prop_desc_p->get_p == NULL) if (src_prop_desc_p->get_p == NULL)
{ {
prop_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED); prop_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
@@ -506,7 +506,7 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des
ecma_deref_ecma_string (get_magic_string_p); ecma_deref_ecma_string (get_magic_string_p);
JERRY_ASSERT (ecma_is_value_true (completion)); JERRY_ASSERT (ecma_is_value_true (completion));
// b. /* b. */
if (src_prop_desc_p->set_p == NULL) if (src_prop_desc_p->set_p == NULL)
{ {
prop_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED); prop_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
@@ -567,7 +567,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
{ {
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY); ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
// 1. /* 1. */
if (!ecma_is_value_object (obj_value)) if (!ecma_is_value_object (obj_value))
{ {
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected an object.")); ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected an object."));
@@ -576,10 +576,10 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
{ {
ecma_object_t *obj_p = ecma_get_object_from_value (obj_value); ecma_object_t *obj_p = ecma_get_object_from_value (obj_value);
// 2. /* 2. */
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor (); ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
// 3. /* 3. */
ecma_string_t *enumerable_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE); ecma_string_t *enumerable_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE);
ECMA_TRY_CATCH (enumerable_prop_value, ECMA_TRY_CATCH (enumerable_prop_value,
@@ -600,7 +600,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
{ {
JERRY_ASSERT (ecma_is_value_empty (ret_value)); JERRY_ASSERT (ecma_is_value_empty (ret_value));
// 4. /* 4. */
ecma_string_t *configurable_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE); ecma_string_t *configurable_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE);
ECMA_TRY_CATCH (configurable_prop_value, ECMA_TRY_CATCH (configurable_prop_value,
@@ -622,7 +622,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
{ {
JERRY_ASSERT (ecma_is_value_empty (ret_value)); JERRY_ASSERT (ecma_is_value_empty (ret_value));
// 5. /* 5. */
ecma_string_t *value_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_VALUE); ecma_string_t *value_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_VALUE);
ECMA_TRY_CATCH (value_prop_value, ECMA_TRY_CATCH (value_prop_value,
@@ -644,7 +644,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
{ {
JERRY_ASSERT (ecma_is_value_empty (ret_value)); JERRY_ASSERT (ecma_is_value_empty (ret_value));
// 6. /* 6. */
ecma_string_t *writable_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE); ecma_string_t *writable_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE);
ECMA_TRY_CATCH (writable_prop_value, ECMA_TRY_CATCH (writable_prop_value,
@@ -666,7 +666,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
{ {
JERRY_ASSERT (ecma_is_value_empty (ret_value)); JERRY_ASSERT (ecma_is_value_empty (ret_value));
// 7. /* 7. */
ecma_string_t *get_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_GET); ecma_string_t *get_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_GET);
ECMA_TRY_CATCH (get_prop_value, ECMA_TRY_CATCH (get_prop_value,
@@ -709,8 +709,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
{ {
JERRY_ASSERT (ecma_is_value_empty (ret_value)); JERRY_ASSERT (ecma_is_value_empty (ret_value));
// 8. /* 8. */
ecma_string_t *set_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_SET); ecma_string_t *set_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_SET);
ECMA_TRY_CATCH (set_prop_value, ECMA_TRY_CATCH (set_prop_value,
@@ -753,7 +752,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
{ {
JERRY_ASSERT (ecma_is_value_empty (ret_value)); JERRY_ASSERT (ecma_is_value_empty (ret_value));
// 9. /* 9. */
if (prop_desc.is_get_defined if (prop_desc.is_get_defined
|| prop_desc.is_set_defined) || prop_desc.is_set_defined)
{ {
@@ -112,7 +112,7 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
is_strict_mode_code = true; is_strict_mode_code = true;
} }
// 1., 4., 13. /* 1., 4., 13. */
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE); ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
ecma_object_t *func_p = ecma_create_object (prototype_obj_p, ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
@@ -121,14 +121,14 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
ecma_deref_object (prototype_obj_p); ecma_deref_object (prototype_obj_p);
// 2., 6., 7., 8. /* 2., 6., 7., 8. */
/* /*
* We don't setup [[Get]], [[Call]], [[Construct]], [[HasInstance]] for each function object. * We don't setup [[Get]], [[Call]], [[Construct]], [[HasInstance]] for each function object.
* Instead we set the object's type to ECMA_OBJECT_TYPE_FUNCTION * Instead we set the object's type to ECMA_OBJECT_TYPE_FUNCTION
* that defines which version of the routine should be used on demand. * that defines which version of the routine should be used on demand.
*/ */
// 3. /* 3. */
/* /*
* [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_FUNCTION type. * [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_FUNCTION type.
* *
@@ -137,21 +137,21 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) func_p; ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) func_p;
// 9. /* 9. */
ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_p->u.function.scope_cp, scope_p); ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_p->u.function.scope_cp, scope_p);
// 10., 11., 12. /* 10., 11., 12. */
ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_p->u.function.bytecode_cp, bytecode_data_p); ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_p->u.function.bytecode_cp, bytecode_data_p);
ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p); ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);
// 14., 15., 16., 17., 18. /* 14., 15., 16., 17., 18. */
/* /*
* 'length' and 'prototype' properties are instantiated lazily * 'length' and 'prototype' properties are instantiated lazily
* *
* See also: ecma_op_function_try_lazy_instantiate_property * See also: ecma_op_function_try_lazy_instantiate_property
*/ */
// 19. /* 19. */
if (is_strict_mode_code) if (is_strict_mode_code)
{ {
ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER); ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);
@@ -481,7 +481,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
ecma_object_t *scope_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, ecma_object_t *scope_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t,
ext_func_p->u.function.scope_cp); ext_func_p->u.function.scope_cp);
// 8. /* 8. */
ecma_value_t this_binding; ecma_value_t this_binding;
bool is_strict; bool is_strict;
bool is_no_lex_env; bool is_no_lex_env;
@@ -493,7 +493,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
is_strict = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE) ? true : false; is_strict = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE) ? true : false;
is_no_lex_env = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED) ? true : false; is_no_lex_env = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED) ? true : false;
// 1. /* 1. */
if (is_strict) if (is_strict)
{ {
this_binding = ecma_copy_value (this_arg_value); this_binding = ecma_copy_value (this_arg_value);
@@ -501,18 +501,18 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
else if (ecma_is_value_undefined (this_arg_value) else if (ecma_is_value_undefined (this_arg_value)
|| ecma_is_value_null (this_arg_value)) || ecma_is_value_null (this_arg_value))
{ {
// 2. /* 2. */
this_binding = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL)); this_binding = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL));
} }
else else
{ {
// 3., 4. /* 3., 4. */
this_binding = ecma_op_to_object (this_arg_value); this_binding = ecma_op_to_object (this_arg_value);
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (this_binding)); JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (this_binding));
} }
// 5. /* 5. */
ecma_object_t *local_env_p; ecma_object_t *local_env_p;
if (is_no_lex_env) if (is_no_lex_env)
{ {
@@ -629,24 +629,24 @@ ecma_op_function_construct_simple_or_external (ecma_object_t *func_obj_p, /**< F
ecma_string_t *prototype_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_PROTOTYPE); ecma_string_t *prototype_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_PROTOTYPE);
// 5. /* 5. */
ECMA_TRY_CATCH (func_obj_prototype_prop_value, ECMA_TRY_CATCH (func_obj_prototype_prop_value,
ecma_op_object_get (func_obj_p, ecma_op_object_get (func_obj_p,
prototype_magic_string_p), prototype_magic_string_p),
ret_value); ret_value);
// 1., 2., 4. /* 1., 2., 4. */
ecma_object_t *obj_p; ecma_object_t *obj_p;
if (ecma_is_value_object (func_obj_prototype_prop_value)) if (ecma_is_value_object (func_obj_prototype_prop_value))
{ {
// 6. /* 6. */
obj_p = ecma_create_object (ecma_get_object_from_value (func_obj_prototype_prop_value), obj_p = ecma_create_object (ecma_get_object_from_value (func_obj_prototype_prop_value),
0, 0,
ECMA_OBJECT_TYPE_GENERAL); ECMA_OBJECT_TYPE_GENERAL);
} }
else else
{ {
// 7. /* 7. */
ecma_object_t *prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE); ecma_object_t *prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
obj_p = ecma_create_object (prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL); obj_p = ecma_create_object (prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);
@@ -654,7 +654,7 @@ ecma_op_function_construct_simple_or_external (ecma_object_t *func_obj_p, /**< F
ecma_deref_object (prototype_p); ecma_deref_object (prototype_p);
} }
// 3. /* 3. */
/* /*
* [[Class]] property of ECMA_OBJECT_TYPE_GENERAL type objects * [[Class]] property of ECMA_OBJECT_TYPE_GENERAL type objects
* without ECMA_INTERNAL_PROPERTY_CLASS internal property * without ECMA_INTERNAL_PROPERTY_CLASS internal property
@@ -663,7 +663,7 @@ ecma_op_function_construct_simple_or_external (ecma_object_t *func_obj_p, /**< F
* See also: ecma_object_get_class_name. * See also: ecma_object_get_class_name.
*/ */
// 8. /* 8. */
ECMA_TRY_CATCH (call_completion, ECMA_TRY_CATCH (call_completion,
ecma_op_function_call (func_obj_p, ecma_op_function_call (func_obj_p,
ecma_make_object_value (obj_p), ecma_make_object_value (obj_p),
@@ -671,14 +671,14 @@ ecma_op_function_construct_simple_or_external (ecma_object_t *func_obj_p, /**< F
arguments_list_len), arguments_list_len),
ret_value); ret_value);
// 9. /* 9. */
if (ecma_is_value_object (call_completion)) if (ecma_is_value_object (call_completion))
{ {
ret_value = ecma_copy_value (call_completion); ret_value = ecma_copy_value (call_completion);
} }
else else
{ {
// 10. /* 10. */
ecma_ref_object (obj_p); ecma_ref_object (obj_p);
ret_value = ecma_make_object_value (obj_p); ret_value = ecma_make_object_value (obj_p);
} }
@@ -50,17 +50,17 @@ ecma_op_get_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc
{ {
const bool is_unresolvable_reference = (ref_base_lex_env_p == NULL); const bool is_unresolvable_reference = (ref_base_lex_env_p == NULL);
// 3. /* 3. */
if (unlikely (is_unresolvable_reference)) if (unlikely (is_unresolvable_reference))
{ {
return ecma_raise_reference_error (ECMA_ERR_MSG ("Cannot resolve reference.")); return ecma_raise_reference_error (ECMA_ERR_MSG ("Cannot resolve reference."));
} }
// 5. /* 5. */
JERRY_ASSERT (ref_base_lex_env_p != NULL JERRY_ASSERT (ref_base_lex_env_p != NULL
&& ecma_is_lexical_environment (ref_base_lex_env_p)); && ecma_is_lexical_environment (ref_base_lex_env_p));
// 5.a /* 5.a */
return ecma_op_get_binding_value (ref_base_lex_env_p, return ecma_op_get_binding_value (ref_base_lex_env_p,
var_name_string_p, var_name_string_p,
is_strict); is_strict);
@@ -144,17 +144,17 @@ ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc
{ {
const bool is_unresolvable_reference = (ref_base_lex_env_p == NULL); const bool is_unresolvable_reference = (ref_base_lex_env_p == NULL);
// 3. /* 3. */
if (unlikely (is_unresolvable_reference)) if (unlikely (is_unresolvable_reference))
{ {
// 3.a. /* 3.a. */
if (is_strict) if (is_strict)
{ {
return ecma_raise_reference_error (ECMA_ERR_MSG ("Cannot resolve reference.")); return ecma_raise_reference_error (ECMA_ERR_MSG ("Cannot resolve reference."));
} }
else else
{ {
// 3.b. /* 3.b. */
ecma_object_t *global_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL); ecma_object_t *global_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL);
ecma_value_t completion = ecma_op_object_put (global_object_p, ecma_value_t completion = ecma_op_object_put (global_object_p,
@@ -170,11 +170,11 @@ ecma_op_put_value_lex_env_base (ecma_object_t *ref_base_lex_env_p, /**< referenc
} }
} }
// 5. /* 5. */
JERRY_ASSERT (ref_base_lex_env_p != NULL JERRY_ASSERT (ref_base_lex_env_p != NULL
&& ecma_is_lexical_environment (ref_base_lex_env_p)); && ecma_is_lexical_environment (ref_base_lex_env_p));
// 5.a /* 5.a */
return ecma_op_set_mutable_binding (ref_base_lex_env_p, return ecma_op_set_mutable_binding (ref_base_lex_env_p,
var_name_string_p, var_name_string_p,
value, value,
@@ -114,7 +114,7 @@ ecma_op_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function
ecma_property_value_t *prop_value_p; ecma_property_value_t *prop_value_p;
// 11.a, 11.b /* 11.a, 11.b */
for (ecma_length_t indx = 0; for (ecma_length_t indx = 0;
indx < arguments_number; indx < arguments_number;
indx++) indx++)
@@ -131,7 +131,7 @@ ecma_op_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function
ecma_deref_ecma_string (indx_string_p); ecma_deref_ecma_string (indx_string_p);
} }
// 7. /* 7. */
ecma_string_t *length_magic_string_p = ecma_new_ecma_length_string (); ecma_string_t *length_magic_string_p = ecma_new_ecma_length_string ();
prop_value_p = ecma_create_named_data_property (obj_p, prop_value_p = ecma_create_named_data_property (obj_p,
@@ -145,7 +145,7 @@ ecma_op_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor (); ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
// 13. /* 13. */
if (!is_strict) if (!is_strict)
{ {
ecma_string_t *callee_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_CALLEE); ecma_string_t *callee_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_CALLEE);
@@ -163,7 +163,7 @@ ecma_op_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function
{ {
ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER); ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);
// 14. /* 14. */
prop_desc = ecma_make_empty_property_descriptor (); prop_desc = ecma_make_empty_property_descriptor ();
{ {
prop_desc.is_get_defined = true; prop_desc.is_get_defined = true;
@@ -244,7 +244,7 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, /**< the
* descriptor */ * descriptor */
bool is_throw) /**< flag that controls failure handling */ bool is_throw) /**< flag that controls failure handling */
{ {
// 3. /* 3. */
ecma_value_t ret_value = ecma_op_general_object_define_own_property (object_p, ecma_value_t ret_value = ecma_op_general_object_define_own_property (object_p,
property_name_p, property_name_p,
property_desc_p, property_desc_p,
@@ -326,7 +326,7 @@ ecma_op_arguments_object_delete (ecma_object_t *object_p, /**< the object */
ecma_string_t *property_name_p, /**< property name */ ecma_string_t *property_name_p, /**< property name */
bool is_throw) /**< flag that controls failure handling */ bool is_throw) /**< flag that controls failure handling */
{ {
// 3. /* 3. */
ecma_value_t ret_value = ecma_op_general_object_delete (object_p, property_name_p, is_throw); ecma_value_t ret_value = ecma_op_general_object_delete (object_p, property_name_p, is_throw);
if (ECMA_IS_VALUE_ERROR (ret_value)) if (ECMA_IS_VALUE_ERROR (ret_value))
@@ -62,7 +62,7 @@ ecma_op_create_object_object_noarg (void)
{ {
ecma_object_t *object_prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE); ecma_object_t *object_prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
// 3., 4., 6., 7. /* 3., 4., 6., 7. */
ecma_object_t *obj_p = ecma_op_create_object_object_noarg_and_set_prototype (object_prototype_p); ecma_object_t *obj_p = ecma_op_create_object_object_noarg_and_set_prototype (object_prototype_p);
ecma_deref_object (object_prototype_p); ecma_deref_object (object_prototype_p);
@@ -87,12 +87,12 @@ ecma_op_create_object_object_arg (ecma_value_t value) /**< argument of construct
|| ecma_is_value_string (value) || ecma_is_value_string (value)
|| ecma_is_value_boolean (value)) || ecma_is_value_boolean (value))
{ {
// 1.b, 1.c, 1.d /* 1.b, 1.c, 1.d */
return ecma_op_to_object (value); return ecma_op_to_object (value);
} }
else else
{ {
// 2. /* 2. */
JERRY_ASSERT (ecma_is_value_undefined (value) JERRY_ASSERT (ecma_is_value_undefined (value)
|| ecma_is_value_null (value)); || ecma_is_value_null (value));
@@ -147,7 +147,7 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
&& !ecma_is_lexical_environment (obj_p)); && !ecma_is_lexical_environment (obj_p));
JERRY_ASSERT (property_name_p != NULL); JERRY_ASSERT (property_name_p != NULL);
// 1. /* 1. */
ecma_property_ref_t property_ref; ecma_property_ref_t property_ref;
ecma_property_t property = ecma_op_object_get_own_property (obj_p, ecma_property_t property = ecma_op_object_get_own_property (obj_p,
@@ -155,29 +155,29 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
&property_ref, &property_ref,
ECMA_PROPERTY_GET_NO_OPTIONS); ECMA_PROPERTY_GET_NO_OPTIONS);
// 2. /* 2. */
if (property == ECMA_PROPERTY_TYPE_NOT_FOUND) if (property == ECMA_PROPERTY_TYPE_NOT_FOUND)
{ {
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE); return ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE);
} }
// 3. /* 3. */
if (ecma_is_property_configurable (property)) if (ecma_is_property_configurable (property))
{ {
// a. /* a. */
ecma_delete_property (obj_p, property_ref.value_p); ecma_delete_property (obj_p, property_ref.value_p);
// b. /* b. */
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE); return ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE);
} }
else if (is_throw) else if (is_throw)
{ {
// 4. /* 4. */
return ecma_raise_type_error (ECMA_ERR_MSG ("Expected a configurable property.")); return ecma_raise_type_error (ECMA_ERR_MSG ("Expected a configurable property."));
} }
else else
{ {
// 5. /* 5. */
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE); return ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE);
} }
@@ -313,7 +313,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
JERRY_ASSERT (property_desc_p->is_enumerable_defined || !property_desc_p->is_enumerable); JERRY_ASSERT (property_desc_p->is_enumerable_defined || !property_desc_p->is_enumerable);
JERRY_ASSERT (property_desc_p->is_writable_defined || !property_desc_p->is_writable); JERRY_ASSERT (property_desc_p->is_writable_defined || !property_desc_p->is_writable);
// 1. /* 1. */
ecma_extended_property_ref_t ext_property_ref; ecma_extended_property_ref_t ext_property_ref;
ecma_property_t current_prop; ecma_property_t current_prop;
@@ -324,18 +324,18 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
if (current_prop == ECMA_PROPERTY_TYPE_NOT_FOUND) if (current_prop == ECMA_PROPERTY_TYPE_NOT_FOUND)
{ {
// 3. /* 3. */
if (!ecma_get_object_extensible (object_p)) if (!ecma_get_object_extensible (object_p))
{ {
// 2. /* 2. */
return ecma_reject (is_throw); return ecma_reject (is_throw);
} }
// 4. /* 4. */
if (property_desc_type != ECMA_PROPERTY_TYPE_NAMEDACCESSOR) if (property_desc_type != ECMA_PROPERTY_TYPE_NAMEDACCESSOR)
{ {
// a. /* a. */
JERRY_ASSERT (property_desc_type == ECMA_PROPERTY_TYPE_GENERIC JERRY_ASSERT (property_desc_type == ECMA_PROPERTY_TYPE_GENERIC
|| property_desc_type == ECMA_PROPERTY_TYPE_NAMEDDATA); || property_desc_type == ECMA_PROPERTY_TYPE_NAMEDDATA);
@@ -367,7 +367,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
} }
else else
{ {
// b. /* b. */
uint8_t prop_attributes = 0; uint8_t prop_attributes = 0;
@@ -390,7 +390,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE); return ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE);
} }
// 6. /* 6. */
ecma_property_types_t current_property_type = ECMA_PROPERTY_GET_TYPE (current_prop); ecma_property_types_t current_property_type = ECMA_PROPERTY_GET_TYPE (current_prop);
const bool is_current_configurable = ecma_is_property_configurable (current_prop); const bool is_current_configurable = ecma_is_property_configurable (current_prop);
@@ -398,7 +398,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
|| current_property_type == ECMA_PROPERTY_TYPE_NAMEDACCESSOR || current_property_type == ECMA_PROPERTY_TYPE_NAMEDACCESSOR
|| current_property_type == ECMA_PROPERTY_TYPE_VIRTUAL); || current_property_type == ECMA_PROPERTY_TYPE_VIRTUAL);
// 7. a., b. /* 7. a., b. */
if (!is_current_configurable if (!is_current_configurable
&& (property_desc_p->is_configurable && (property_desc_p->is_configurable
|| (property_desc_p->is_enumerable_defined || (property_desc_p->is_enumerable_defined
@@ -430,7 +430,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
return result; return result;
} }
// 8. /* 8. */
if (property_desc_type == ECMA_PROPERTY_TYPE_GENERIC) if (property_desc_type == ECMA_PROPERTY_TYPE_GENERIC)
{ {
/* No action required. */ /* No action required. */
@@ -442,7 +442,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
{ {
if (property_desc_type == ECMA_PROPERTY_TYPE_NAMEDDATA) if (property_desc_type == ECMA_PROPERTY_TYPE_NAMEDDATA)
{ {
// 10. a. i. & ii. /* 10. a. i. & ii. */
if (!ecma_is_property_writable (current_prop) if (!ecma_is_property_writable (current_prop)
&& (property_desc_p->is_writable && (property_desc_p->is_writable
|| (property_desc_p->is_value_defined || (property_desc_p->is_value_defined
@@ -454,9 +454,9 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
} }
else else
{ {
// 11. /* 11. */
// a. /* a. */
ecma_property_value_t *value_p = ext_property_ref.property_ref.value_p; ecma_property_value_t *value_p = ext_property_ref.property_ref.value_p;
if ((property_desc_p->is_get_defined if ((property_desc_p->is_get_defined
@@ -464,7 +464,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
|| (property_desc_p->is_set_defined || (property_desc_p->is_set_defined
&& property_desc_p->set_p != ecma_get_named_accessor_property_setter (value_p))) && property_desc_p->set_p != ecma_get_named_accessor_property_setter (value_p)))
{ {
// i., ii. /* i., ii. */
return ecma_reject (is_throw); return ecma_reject (is_throw);
} }
} }
@@ -472,10 +472,10 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
} }
else else
{ {
// 9. /* 9. */
if (!is_current_configurable) if (!is_current_configurable)
{ {
// a. /* a. */
return ecma_reject (is_throw); return ecma_reject (is_throw);
} }
@@ -516,7 +516,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
*(ext_property_ref.property_p) = prop_flags; *(ext_property_ref.property_p) = prop_flags;
} }
// 12. /* 12. */
if (property_desc_type == ECMA_PROPERTY_TYPE_NAMEDDATA) if (property_desc_type == ECMA_PROPERTY_TYPE_NAMEDDATA)
{ {
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (*ext_property_ref.property_p) == ECMA_PROPERTY_TYPE_NAMEDDATA); JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (*ext_property_ref.property_p) == ECMA_PROPERTY_TYPE_NAMEDDATA);
+17 -17
View File
@@ -190,13 +190,13 @@ void jmem_heap_finalize (void)
static __attr_hot___ static __attr_hot___
void *jmem_heap_alloc_block_internal (const size_t size) void *jmem_heap_alloc_block_internal (const size_t size)
{ {
// Align size /* Align size. */
const size_t required_size = ((size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT) * JMEM_ALIGNMENT; const size_t required_size = ((size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT) * JMEM_ALIGNMENT;
jmem_heap_free_t *data_space_p = NULL; jmem_heap_free_t *data_space_p = NULL;
VALGRIND_DEFINED_SPACE (&JERRY_HEAP_CONTEXT (first), sizeof (jmem_heap_free_t)); VALGRIND_DEFINED_SPACE (&JERRY_HEAP_CONTEXT (first), sizeof (jmem_heap_free_t));
// Fast path for 8 byte chunks, first region is guaranteed to be sufficient /* Fast path for 8 byte chunks, first region is guaranteed to be sufficient. */
if (required_size == JMEM_ALIGNMENT if (required_size == JMEM_ALIGNMENT
&& likely (JERRY_HEAP_CONTEXT (first).next_offset != JMEM_HEAP_END_OF_LIST)) && likely (JERRY_HEAP_CONTEXT (first).next_offset != JMEM_HEAP_END_OF_LIST))
{ {
@@ -233,7 +233,7 @@ void *jmem_heap_alloc_block_internal (const size_t size)
JERRY_CONTEXT (jmem_heap_list_skip_p) = JMEM_HEAP_GET_ADDR_FROM_OFFSET (JERRY_HEAP_CONTEXT (first).next_offset); JERRY_CONTEXT (jmem_heap_list_skip_p) = JMEM_HEAP_GET_ADDR_FROM_OFFSET (JERRY_HEAP_CONTEXT (first).next_offset);
} }
} }
// Slow path for larger regions /* Slow path for larger regions. */
else else
{ {
uint32_t current_offset = JERRY_HEAP_CONTEXT (first).next_offset; uint32_t current_offset = JERRY_HEAP_CONTEXT (first).next_offset;
@@ -252,31 +252,31 @@ void *jmem_heap_alloc_block_internal (const size_t size)
if (current_p->size >= required_size) if (current_p->size >= required_size)
{ {
// Region is sufficiently big, store address /* Region is sufficiently big, store address. */
data_space_p = current_p; data_space_p = current_p;
JERRY_CONTEXT (jmem_heap_allocated_size) += required_size; JERRY_CONTEXT (jmem_heap_allocated_size) += required_size;
// Region was larger than necessary /* Region was larger than necessary. */
if (current_p->size > required_size) if (current_p->size > required_size)
{ {
// Get address of remaining space /* Get address of remaining space. */
jmem_heap_free_t *const remaining_p = (jmem_heap_free_t *) ((uint8_t *) current_p + required_size); jmem_heap_free_t *const remaining_p = (jmem_heap_free_t *) ((uint8_t *) current_p + required_size);
// Update metadata /* Update metadata. */
VALGRIND_DEFINED_SPACE (remaining_p, sizeof (jmem_heap_free_t)); VALGRIND_DEFINED_SPACE (remaining_p, sizeof (jmem_heap_free_t));
remaining_p->size = current_p->size - (uint32_t) required_size; remaining_p->size = current_p->size - (uint32_t) required_size;
remaining_p->next_offset = next_offset; remaining_p->next_offset = next_offset;
VALGRIND_NOACCESS_SPACE (remaining_p, sizeof (jmem_heap_free_t)); VALGRIND_NOACCESS_SPACE (remaining_p, sizeof (jmem_heap_free_t));
// Update list /* Update list. */
VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t)); VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));
prev_p->next_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (remaining_p); prev_p->next_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (remaining_p);
VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t)); VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));
} }
// Block is an exact fit /* Block is an exact fit. */
else else
{ {
// Remove the region from the list /* Remove the region from the list. */
VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t)); VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));
prev_p->next_offset = next_offset; prev_p->next_offset = next_offset;
VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t)); VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));
@@ -284,12 +284,12 @@ void *jmem_heap_alloc_block_internal (const size_t size)
JERRY_CONTEXT (jmem_heap_list_skip_p) = prev_p; JERRY_CONTEXT (jmem_heap_list_skip_p) = prev_p;
// Found enough space /* Found enough space. */
break; break;
} }
VALGRIND_NOACCESS_SPACE (current_p, sizeof (jmem_heap_free_t)); VALGRIND_NOACCESS_SPACE (current_p, sizeof (jmem_heap_free_t));
// Next in list /* Next in list. */
prev_p = current_p; prev_p = current_p;
current_offset = next_offset; current_offset = next_offset;
} }
@@ -450,7 +450,7 @@ jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the
const uint32_t block_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (block_p); const uint32_t block_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (block_p);
VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t)); VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));
// Find position of region in the list /* Find position of region in the list. */
while (prev_p->next_offset < block_offset) while (prev_p->next_offset < block_offset)
{ {
jmem_heap_free_t *const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset); jmem_heap_free_t *const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
@@ -471,10 +471,10 @@ jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the
VALGRIND_DEFINED_SPACE (block_p, sizeof (jmem_heap_free_t)); VALGRIND_DEFINED_SPACE (block_p, sizeof (jmem_heap_free_t));
VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t)); VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));
// Update prev /* Update prev. */
if (jmem_heap_get_region_end (prev_p) == block_p) if (jmem_heap_get_region_end (prev_p) == block_p)
{ {
// Can be merged /* Can be merged. */
prev_p->size += (uint32_t) aligned_size; prev_p->size += (uint32_t) aligned_size;
VALGRIND_NOACCESS_SPACE (block_p, sizeof (jmem_heap_free_t)); VALGRIND_NOACCESS_SPACE (block_p, sizeof (jmem_heap_free_t));
block_p = prev_p; block_p = prev_p;
@@ -486,7 +486,7 @@ jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the
} }
VALGRIND_DEFINED_SPACE (next_p, sizeof (jmem_heap_free_t)); VALGRIND_DEFINED_SPACE (next_p, sizeof (jmem_heap_free_t));
// Update next /* Update next. */
if (jmem_heap_get_region_end (block_p) == next_p) if (jmem_heap_get_region_end (block_p) == next_p)
{ {
if (unlikely (next_p == JERRY_CONTEXT (jmem_heap_list_skip_p))) if (unlikely (next_p == JERRY_CONTEXT (jmem_heap_list_skip_p)))
@@ -494,7 +494,7 @@ jmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the
JERRY_CONTEXT (jmem_heap_list_skip_p) = block_p; JERRY_CONTEXT (jmem_heap_list_skip_p) = block_p;
} }
// Can be merged /* Can be merged. */
block_p->size += next_p->size; block_p->size += next_p->size;
block_p->next_offset = next_p->next_offset; block_p->next_offset = next_p->next_offset;
+2 -2
View File
@@ -228,7 +228,7 @@ lit_char_is_identifier_start (const uint8_t *src_p) /**< pointer to a vaild UTF8
bool bool
lit_char_is_identifier_start_character (uint16_t chr) /**< EcmaScript character */ lit_char_is_identifier_start_character (uint16_t chr) /**< EcmaScript character */
{ {
// Fast path for ASCII-defined letters /* Fast path for ASCII-defined letters. */
if (chr <= LIT_UTF8_1_BYTE_CODE_POINT_MAX) if (chr <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)
{ {
return ((LEXER_TO_ASCII_LOWERCASE (chr) >= LIT_CHAR_LOWERCASE_A return ((LEXER_TO_ASCII_LOWERCASE (chr) >= LIT_CHAR_LOWERCASE_A
@@ -264,7 +264,7 @@ lit_char_is_identifier_part (const uint8_t *src_p) /**< pointer to a vaild UTF8
bool bool
lit_char_is_identifier_part_character (uint16_t chr) /**< EcmaScript character */ lit_char_is_identifier_part_character (uint16_t chr) /**< EcmaScript character */
{ {
// Fast path for ASCII-defined letters /* Fast path for ASCII-defined letters. */
if (chr <= LIT_UTF8_1_BYTE_CODE_POINT_MAX) if (chr <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)
{ {
return ((LEXER_TO_ASCII_LOWERCASE (chr) >= LIT_CHAR_LOWERCASE_A return ((LEXER_TO_ASCII_LOWERCASE (chr) >= LIT_CHAR_LOWERCASE_A
+2 -2
View File
@@ -541,7 +541,7 @@ lit_utf8_string_hash_combine (lit_string_hash_t hash_basis, /**< hash to be comb
for (uint32_t i = 0; i < utf8_buf_size; i++) for (uint32_t i = 0; i < utf8_buf_size; i++)
{ {
// 16777619 is 32 bit FNV_prime = 2^24 + 2^8 + 0x93 = 16777619 /* 16777619 is 32 bit FNV_prime = 2^24 + 2^8 + 0x93 = 16777619 */
hash = (hash ^ utf8_buf_p[i]) * 16777619; hash = (hash ^ utf8_buf_p[i]) * 16777619;
} }
@@ -559,7 +559,7 @@ lit_utf8_string_calc_hash (const lit_utf8_byte_t *utf8_buf_p, /**< characters bu
{ {
JERRY_ASSERT (utf8_buf_p != NULL || utf8_buf_size == 0); JERRY_ASSERT (utf8_buf_p != NULL || utf8_buf_size == 0);
// 32 bit offset_basis for FNV = 2166136261 /* 32 bit offset_basis for FNV = 2166136261 */
return lit_utf8_string_hash_combine ((lit_string_hash_t) 2166136261, utf8_buf_p, utf8_buf_size); return lit_utf8_string_hash_combine ((lit_string_hash_t) 2166136261, utf8_buf_p, utf8_buf_size);
} /* lit_utf8_string_calc_hash */ } /* lit_utf8_string_calc_hash */
+1 -1
View File
@@ -525,7 +525,7 @@ vfprintf (FILE *stream, /**< stream pointer */
assert (false && "unsupported width field *"); assert (false && "unsupported width field *");
} }
// If there is a number, recognize it as field width /* If there is a number, recognize it as field width. */
while (*format_iter_p >= '0' && *format_iter_p <= '9') while (*format_iter_p >= '0' && *format_iter_p <= '9')
{ {
width = width * 10u + (uint32_t) (*format_iter_p - '0'); width = width * 10u + (uint32_t) (*format_iter_p - '0');
+4 -4
View File
@@ -56,7 +56,7 @@ CALL_PRAGMA (GCC optimize ("-fno-tree-loop-distribute-patterns"))
* *
* @return @a s * @return @a s
*/ */
void * __attr_used___ // FIXME void * __attr_used___
memset (void *s, /**< area to set values in */ memset (void *s, /**< area to set values in */
int c, /**< value to set */ int c, /**< value to set */
size_t n) /**< area size */ size_t n) /**< area size */
@@ -98,7 +98,7 @@ memcmp (const void *s1, /**< first area */
/** /**
* memcpy * memcpy
*/ */
void * __attr_used___ // FIXME void * __attr_used___
memcpy (void *s1, /**< destination */ memcpy (void *s1, /**< destination */
const void *s2, /**< source */ const void *s2, /**< source */
size_t n) /**< bytes number */ size_t n) /**< bytes number */
@@ -137,7 +137,7 @@ memcpy (void *s1, /**< destination */
* *
* @return the dest pointer's value * @return the dest pointer's value
*/ */
void * __attr_used___ // FIXME void * __attr_used___
memmove (void *s1, /**< destination */ memmove (void *s1, /**< destination */
const void *s2, /**< source */ const void *s2, /**< source */
size_t n) /**< bytes number */ size_t n) /**< bytes number */
@@ -216,7 +216,7 @@ strncmp (const char *s1, const char *s2, size_t n)
/** Copy a string. At most n bytes of src are copied. Warning: If there is no /** Copy a string. At most n bytes of src are copied. Warning: If there is no
null byte among the first n bytes of src, the string placed in dest will not be null-terminated. null byte among the first n bytes of src, the string placed in dest will not be null-terminated.
@return a pointer to the destination string dest. */ @return a pointer to the destination string dest. */
char * __attr_used___ // FIXME char * __attr_used___
strncpy (char *dest, const char *src, size_t n) strncpy (char *dest, const char *src, size_t n)
{ {
while (n--) while (n--)
+1 -1
View File
@@ -272,7 +272,7 @@ gettimeofday (void *tp, /**< struct timeval */
return (int) syscall_2 (SYSCALL_NO (gettimeofday), (long int) tp, (long int) tzp); return (int) syscall_2 (SYSCALL_NO (gettimeofday), (long int) tp, (long int) tzp);
} /* gettimeofday */ } /* gettimeofday */
// FIXME /* FIXME */
#if 0 #if 0
/** /**
* Setup new memory limits * Setup new memory limits
+8 -11
View File
@@ -22,8 +22,7 @@ extern "C"
{ {
#endif /* __cplusplus */ #endif /* __cplusplus */
// General Constants /* General Constants. */
#define INFINITY (1.0/0.0) #define INFINITY (1.0/0.0)
#define NAN (0.0/0.0) #define NAN (0.0/0.0)
#define HUGE_VAL INFINITY #define HUGE_VAL INFINITY
@@ -32,8 +31,7 @@ extern "C"
#define isinf(x) (((x) == INFINITY) || ((x) == -INFINITY)) #define isinf(x) (((x) == INFINITY) || ((x) == -INFINITY))
#define isfinite(x) (!(isinf(x)) && (x != NAN)) #define isfinite(x) (!(isinf(x)) && (x != NAN))
// Exponential and Logarithmic constants /* Exponential and Logarithmic constants. */
#define M_E 2.7182818284590452353602874713526625 #define M_E 2.7182818284590452353602874713526625
#define M_SQRT2 1.4142135623730950488016887242096981 #define M_SQRT2 1.4142135623730950488016887242096981
#define M_SQRT1_2 0.7071067811865475244008443621048490 #define M_SQRT1_2 0.7071067811865475244008443621048490
@@ -42,8 +40,7 @@ extern "C"
#define M_LN2 0.6931471805599453094172321214581765 #define M_LN2 0.6931471805599453094172321214581765
#define M_LN10 2.3025850929940456840179914546843642 #define M_LN10 2.3025850929940456840179914546843642
// Trigonometric Constants /* Trigonometric Constants. */
#define M_PI 3.1415926535897932384626433832795029 #define M_PI 3.1415926535897932384626433832795029
#define M_PI_2 1.5707963267948966192313216916397514 #define M_PI_2 1.5707963267948966192313216916397514
#define M_PI_4 0.7853981633974483096156608458198757 #define M_PI_4 0.7853981633974483096156608458198757
@@ -51,7 +48,7 @@ extern "C"
#define M_2_PI 0.6366197723675813430755350534900574 #define M_2_PI 0.6366197723675813430755350534900574
#define M_2_SQRTPI 1.1283791670955125738961589031215452 #define M_2_SQRTPI 1.1283791670955125738961589031215452
// Trigonometric functions /* Trigonometric functions. */
double cos (double); double cos (double);
double sin (double); double sin (double);
double tan (double); double tan (double);
@@ -60,19 +57,19 @@ double asin (double);
double atan (double); double atan (double);
double atan2 (double, double); double atan2 (double, double);
// Exponential and logarithmic functions /* Exponential and logarithmic functions. */
double exp (double); double exp (double);
double log (double); double log (double);
// Power functions /* Power functions. */
double pow (double, double); double pow (double, double);
double sqrt (double); double sqrt (double);
// Rounding and remainder functions /* Rounding and remainder functions. */
double ceil (double); double ceil (double);
double floor (double); double floor (double);
// Other functions /* Other functions. */
double fabs (double); double fabs (double);
double fmod (double, double); double fmod (double, double);
+48 -48
View File
@@ -334,7 +334,7 @@ main (void)
global_obj_val = jerry_get_global_object (); global_obj_val = jerry_get_global_object ();
// Test corner case for jerry_string_to_char_buffer /* Test corner case for jerry_string_to_char_buffer */
args[0] = jerry_create_string ((jerry_char_t *) ""); args[0] = jerry_create_string ((jerry_char_t *) "");
sz = jerry_get_string_size (args[0]); sz = jerry_get_string_size (args[0]);
TEST_ASSERT (sz == 0); TEST_ASSERT (sz == 0);
@@ -398,24 +398,24 @@ main (void)
TEST_ASSERT (utf8_sz == 12); TEST_ASSERT (utf8_sz == 12);
jerry_release_value (args[0]); jerry_release_value (args[0]);
// Get global.boo (non-existing field) /* Get global.boo (non-existing field) */
val_t = get_property (global_obj_val, "boo"); val_t = get_property (global_obj_val, "boo");
TEST_ASSERT (!jerry_value_has_error_flag (val_t)); TEST_ASSERT (!jerry_value_has_error_flag (val_t));
TEST_ASSERT (jerry_value_is_undefined (val_t)); TEST_ASSERT (jerry_value_is_undefined (val_t));
// Get global.t /* Get global.t */
val_t = get_property (global_obj_val, "t"); val_t = get_property (global_obj_val, "t");
TEST_ASSERT (!jerry_value_has_error_flag (val_t)); TEST_ASSERT (!jerry_value_has_error_flag (val_t));
TEST_ASSERT (jerry_value_is_number (val_t) TEST_ASSERT (jerry_value_is_number (val_t)
&& jerry_get_number_value (val_t) == 1.0); && jerry_get_number_value (val_t) == 1.0);
jerry_release_value (val_t); jerry_release_value (val_t);
// Get global.foo /* Get global.foo */
val_foo = get_property (global_obj_val, "foo"); val_foo = get_property (global_obj_val, "foo");
TEST_ASSERT (!jerry_value_has_error_flag (val_foo)); TEST_ASSERT (!jerry_value_has_error_flag (val_foo));
TEST_ASSERT (jerry_value_is_object (val_foo)); TEST_ASSERT (jerry_value_is_object (val_foo));
// Call foo (4, 2) /* Call foo (4, 2) */
args[0] = jerry_create_number (4); args[0] = jerry_create_number (4);
args[1] = jerry_create_number (2); args[1] = jerry_create_number (2);
res = jerry_call_function (val_foo, jerry_create_undefined (), args, 2); res = jerry_call_function (val_foo, jerry_create_undefined (), args, 2);
@@ -424,12 +424,12 @@ main (void)
&& jerry_get_number_value (res) == 1.0); && jerry_get_number_value (res) == 1.0);
jerry_release_value (res); jerry_release_value (res);
// Get global.bar /* Get global.bar */
val_bar = get_property (global_obj_val, "bar"); val_bar = get_property (global_obj_val, "bar");
TEST_ASSERT (!jerry_value_has_error_flag (val_bar)); TEST_ASSERT (!jerry_value_has_error_flag (val_bar));
TEST_ASSERT (jerry_value_is_object (val_bar)); TEST_ASSERT (jerry_value_is_object (val_bar));
// Call bar (4, 2) /* Call bar (4, 2) */
res = jerry_call_function (val_bar, jerry_create_undefined (), args, 2); res = jerry_call_function (val_bar, jerry_create_undefined (), args, 2);
TEST_ASSERT (!jerry_value_has_error_flag (res)); TEST_ASSERT (!jerry_value_has_error_flag (res));
TEST_ASSERT (jerry_value_is_number (res) TEST_ASSERT (jerry_value_is_number (res)
@@ -437,7 +437,7 @@ main (void)
jerry_release_value (res); jerry_release_value (res);
jerry_release_value (val_bar); jerry_release_value (val_bar);
// Set global.t = "abcd" /* Set global.t = "abcd" */
jerry_release_value (args[0]); jerry_release_value (args[0]);
args[0] = jerry_create_string ((jerry_char_t *) "abcd"); args[0] = jerry_create_string ((jerry_char_t *) "abcd");
res = set_property (global_obj_val, "t", args[0]); res = set_property (global_obj_val, "t", args[0]);
@@ -445,7 +445,7 @@ main (void)
TEST_ASSERT (jerry_get_boolean_value (res)); TEST_ASSERT (jerry_get_boolean_value (res));
jerry_release_value (res); jerry_release_value (res);
// Call foo (4, 2) /* Call foo (4, 2) */
res = jerry_call_function (val_foo, jerry_create_undefined (), args, 2); res = jerry_call_function (val_foo, jerry_create_undefined (), args, 2);
TEST_ASSERT (!jerry_value_has_error_flag (res)); TEST_ASSERT (!jerry_value_has_error_flag (res));
TEST_ASSERT (jerry_value_is_string (res)); TEST_ASSERT (jerry_value_is_string (res));
@@ -458,12 +458,12 @@ main (void)
jerry_release_value (args[0]); jerry_release_value (args[0]);
jerry_release_value (args[1]); jerry_release_value (args[1]);
// Get global.A /* Get global.A */
val_A = get_property (global_obj_val, "A"); val_A = get_property (global_obj_val, "A");
TEST_ASSERT (!jerry_value_has_error_flag (val_A)); TEST_ASSERT (!jerry_value_has_error_flag (val_A));
TEST_ASSERT (jerry_value_is_object (val_A)); TEST_ASSERT (jerry_value_is_object (val_A));
// Get A.prototype /* Get A.prototype */
is_ok = jerry_value_is_constructor (val_A); is_ok = jerry_value_is_constructor (val_A);
TEST_ASSERT (is_ok); TEST_ASSERT (is_ok);
val_A_prototype = get_property (val_A, "prototype"); val_A_prototype = get_property (val_A, "prototype");
@@ -471,7 +471,7 @@ main (void)
TEST_ASSERT (jerry_value_is_object (val_A_prototype)); TEST_ASSERT (jerry_value_is_object (val_A_prototype));
jerry_release_value (val_A); jerry_release_value (val_A);
// Set A.prototype.foo = global.foo /* Set A.prototype.foo = global.foo */
res = set_property (val_A_prototype, "foo", val_foo); res = set_property (val_A_prototype, "foo", val_foo);
TEST_ASSERT (!jerry_value_has_error_flag (res)); TEST_ASSERT (!jerry_value_has_error_flag (res));
TEST_ASSERT (jerry_get_boolean_value (res)); TEST_ASSERT (jerry_get_boolean_value (res));
@@ -479,42 +479,42 @@ main (void)
jerry_release_value (val_A_prototype); jerry_release_value (val_A_prototype);
jerry_release_value (val_foo); jerry_release_value (val_foo);
// Get global.a /* Get global.a */
val_a = get_property (global_obj_val, "a"); val_a = get_property (global_obj_val, "a");
TEST_ASSERT (!jerry_value_has_error_flag (val_a)); TEST_ASSERT (!jerry_value_has_error_flag (val_a));
TEST_ASSERT (jerry_value_is_object (val_a)); TEST_ASSERT (jerry_value_is_object (val_a));
// Get a.t /* Get a.t */
res = get_property (val_a, "t"); res = get_property (val_a, "t");
TEST_ASSERT (!jerry_value_has_error_flag (res)); TEST_ASSERT (!jerry_value_has_error_flag (res));
TEST_ASSERT (jerry_value_is_number (res) TEST_ASSERT (jerry_value_is_number (res)
&& jerry_get_number_value (res) == 12.0); && jerry_get_number_value (res) == 12.0);
jerry_release_value (res); jerry_release_value (res);
// foreach properties /* foreach properties */
val_p = get_property (global_obj_val, "p"); val_p = get_property (global_obj_val, "p");
is_ok = jerry_foreach_object_property (val_p, foreach, (void *) "user_data"); is_ok = jerry_foreach_object_property (val_p, foreach, (void *) "user_data");
TEST_ASSERT (is_ok); TEST_ASSERT (is_ok);
// break foreach at third element /* break foreach at third element */
int count = 0; int count = 0;
is_ok = jerry_foreach_object_property (val_p, foreach_subset, &count); is_ok = jerry_foreach_object_property (val_p, foreach_subset, &count);
TEST_ASSERT (is_ok); TEST_ASSERT (is_ok);
TEST_ASSERT (count == 3); TEST_ASSERT (count == 3);
jerry_release_value (val_p); jerry_release_value (val_p);
// foreach with throw test /* foreach with throw test */
val_np = get_property (global_obj_val, "np"); val_np = get_property (global_obj_val, "np");
is_ok = !jerry_foreach_object_property (val_np, foreach_exception, NULL); is_ok = !jerry_foreach_object_property (val_np, foreach_exception, NULL);
TEST_ASSERT (is_ok); TEST_ASSERT (is_ok);
jerry_release_value (val_np); jerry_release_value (val_np);
// Get a.foo /* Get a.foo */
val_a_foo = get_property (val_a, "foo"); val_a_foo = get_property (val_a, "foo");
TEST_ASSERT (!jerry_value_has_error_flag (val_a_foo)); TEST_ASSERT (!jerry_value_has_error_flag (val_a_foo));
TEST_ASSERT (jerry_value_is_object (val_a_foo)); TEST_ASSERT (jerry_value_is_object (val_a_foo));
// Call a.foo () /* Call a.foo () */
res = jerry_call_function (val_a_foo, val_a, NULL, 0); res = jerry_call_function (val_a_foo, val_a, NULL, 0);
TEST_ASSERT (!jerry_value_has_error_flag (res)); TEST_ASSERT (!jerry_value_has_error_flag (res));
TEST_ASSERT (jerry_value_is_number (res) TEST_ASSERT (jerry_value_is_number (res)
@@ -524,7 +524,7 @@ main (void)
jerry_release_value (val_a); jerry_release_value (val_a);
// Create native handler bound function object and set it to 'external' variable /* Create native handler bound function object and set it to 'external' variable */
external_func_val = jerry_create_external_function (handler); external_func_val = jerry_create_external_function (handler);
TEST_ASSERT (jerry_value_is_function (external_func_val) TEST_ASSERT (jerry_value_is_function (external_func_val)
&& jerry_value_is_constructor (external_func_val)); && jerry_value_is_constructor (external_func_val));
@@ -534,7 +534,7 @@ main (void)
TEST_ASSERT (jerry_get_boolean_value (res)); TEST_ASSERT (jerry_get_boolean_value (res));
jerry_release_value (external_func_val); jerry_release_value (external_func_val);
// Call 'call_external' function that should call external function created above /* Call 'call_external' function that should call external function created above */
val_call_external = get_property (global_obj_val, "call_external"); val_call_external = get_property (global_obj_val, "call_external");
TEST_ASSERT (!jerry_value_has_error_flag (val_call_external)); TEST_ASSERT (!jerry_value_has_error_flag (val_call_external));
TEST_ASSERT (jerry_value_is_object (val_call_external)); TEST_ASSERT (jerry_value_is_object (val_call_external));
@@ -549,7 +549,7 @@ main (void)
jerry_release_value (res); jerry_release_value (res);
TEST_ASSERT (!strncmp (buffer, "string from handler", (size_t) sz)); TEST_ASSERT (!strncmp (buffer, "string from handler", (size_t) sz));
// Create native handler bound function object and set it to 'external_construct' variable /* Create native handler bound function object and set it to 'external_construct' variable */
external_construct_val = jerry_create_external_function (handler_construct); external_construct_val = jerry_create_external_function (handler_construct);
TEST_ASSERT (jerry_value_is_function (external_construct_val) TEST_ASSERT (jerry_value_is_function (external_construct_val)
&& jerry_value_is_constructor (external_construct_val)); && jerry_value_is_constructor (external_construct_val));
@@ -559,14 +559,14 @@ main (void)
TEST_ASSERT (jerry_get_boolean_value (res)); TEST_ASSERT (jerry_get_boolean_value (res));
jerry_release_value (res); jerry_release_value (res);
// Call external function created above, as constructor /* Call external function created above, as constructor */
args[0] = jerry_create_boolean (true); args[0] = jerry_create_boolean (true);
res = jerry_construct_object (external_construct_val, args, 1); res = jerry_construct_object (external_construct_val, args, 1);
TEST_ASSERT (!jerry_value_has_error_flag (res)); TEST_ASSERT (!jerry_value_has_error_flag (res));
TEST_ASSERT (jerry_value_is_object (res)); TEST_ASSERT (jerry_value_is_object (res));
val_value_field = get_property (res, "value_field"); val_value_field = get_property (res, "value_field");
// Get 'value_field' of constructed object /* Get 'value_field' of constructed object */
TEST_ASSERT (!jerry_value_has_error_flag (val_value_field)); TEST_ASSERT (!jerry_value_has_error_flag (val_value_field));
TEST_ASSERT (jerry_value_is_boolean (val_value_field) TEST_ASSERT (jerry_value_is_boolean (val_value_field)
&& jerry_get_boolean_value (val_value_field)); && jerry_get_boolean_value (val_value_field));
@@ -580,7 +580,7 @@ main (void)
jerry_release_value (res); jerry_release_value (res);
// Test: Throwing exception from native handler. /* Test: Throwing exception from native handler. */
throw_test_handler_val = jerry_create_external_function (handler_throw_test); throw_test_handler_val = jerry_create_external_function (handler_throw_test);
TEST_ASSERT (jerry_value_is_function (throw_test_handler_val)); TEST_ASSERT (jerry_value_is_function (throw_test_handler_val));
@@ -599,7 +599,7 @@ main (void)
jerry_release_value (val_t); jerry_release_value (val_t);
jerry_release_value (res); jerry_release_value (res);
// Test: Unhandled exception in called function /* Test: Unhandled exception in called function */
val_t = get_property (global_obj_val, "throw_reference_error"); val_t = get_property (global_obj_val, "throw_reference_error");
TEST_ASSERT (!jerry_value_has_error_flag (val_t)); TEST_ASSERT (!jerry_value_has_error_flag (val_t));
TEST_ASSERT (jerry_value_is_object (val_t)); TEST_ASSERT (jerry_value_is_object (val_t));
@@ -609,22 +609,22 @@ main (void)
TEST_ASSERT (jerry_value_has_error_flag (res)); TEST_ASSERT (jerry_value_has_error_flag (res));
jerry_release_value (val_t); jerry_release_value (val_t);
// 'res' should contain exception object /* 'res' should contain exception object */
TEST_ASSERT (jerry_value_is_object (res)); TEST_ASSERT (jerry_value_is_object (res));
jerry_release_value (res); jerry_release_value (res);
// Test: Call of non-function /* Test: Call of non-function */
obj_val = jerry_create_object (); obj_val = jerry_create_object ();
res = jerry_call_function (obj_val, global_obj_val, NULL, 0); res = jerry_call_function (obj_val, global_obj_val, NULL, 0);
TEST_ASSERT (jerry_value_has_error_flag (res)); TEST_ASSERT (jerry_value_has_error_flag (res));
// 'res' should contain exception object /* 'res' should contain exception object */
TEST_ASSERT (jerry_value_is_object (res)); TEST_ASSERT (jerry_value_is_object (res));
jerry_release_value (res); jerry_release_value (res);
jerry_release_value (obj_val); jerry_release_value (obj_val);
// Test: Unhandled exception in function called, as constructor /* Test: Unhandled exception in function called, as constructor */
val_t = get_property (global_obj_val, "throw_reference_error"); val_t = get_property (global_obj_val, "throw_reference_error");
TEST_ASSERT (!jerry_value_has_error_flag (val_t)); TEST_ASSERT (!jerry_value_has_error_flag (val_t));
TEST_ASSERT (jerry_value_is_object (val_t)); TEST_ASSERT (jerry_value_is_object (val_t));
@@ -633,22 +633,22 @@ main (void)
TEST_ASSERT (jerry_value_has_error_flag (res)); TEST_ASSERT (jerry_value_has_error_flag (res));
jerry_release_value (val_t); jerry_release_value (val_t);
// 'res' should contain exception object /* 'res' should contain exception object */
TEST_ASSERT (jerry_value_is_object (res)); TEST_ASSERT (jerry_value_is_object (res));
jerry_release_value (res); jerry_release_value (res);
// Test: Call of non-function as constructor /* Test: Call of non-function as constructor */
obj_val = jerry_create_object (); obj_val = jerry_create_object ();
res = jerry_construct_object (obj_val, NULL, 0); res = jerry_construct_object (obj_val, NULL, 0);
TEST_ASSERT (jerry_value_has_error_flag (res)); TEST_ASSERT (jerry_value_has_error_flag (res));
// 'res' should contain exception object /* 'res' should contain exception object */
TEST_ASSERT (jerry_value_is_object (res)); TEST_ASSERT (jerry_value_is_object (res));
jerry_release_value (res); jerry_release_value (res);
jerry_release_value (obj_val); jerry_release_value (obj_val);
// Test: Array Object API /* Test: Array Object API */
jerry_value_t array_obj_val = jerry_create_array (10); jerry_value_t array_obj_val = jerry_create_array (10);
TEST_ASSERT (jerry_value_is_array (array_obj_val)); TEST_ASSERT (jerry_value_is_array (array_obj_val));
TEST_ASSERT (jerry_get_array_length (array_obj_val) == 10); TEST_ASSERT (jerry_get_array_length (array_obj_val) == 10);
@@ -664,7 +664,7 @@ main (void)
jerry_release_value (v_out); jerry_release_value (v_out);
jerry_release_value (array_obj_val); jerry_release_value (array_obj_val);
// Test: init property descriptor /* Test: init property descriptor */
jerry_property_descriptor_t prop_desc; jerry_property_descriptor_t prop_desc;
jerry_init_property_descriptor_fields (&prop_desc); jerry_init_property_descriptor_fields (&prop_desc);
TEST_ASSERT (prop_desc.is_value_defined == false); TEST_ASSERT (prop_desc.is_value_defined == false);
@@ -680,7 +680,7 @@ main (void)
TEST_ASSERT (prop_desc.is_set_defined == false); TEST_ASSERT (prop_desc.is_set_defined == false);
TEST_ASSERT (jerry_value_is_undefined (prop_desc.setter)); TEST_ASSERT (jerry_value_is_undefined (prop_desc.setter));
// Test: define own properties /* Test: define own properties */
jerry_value_t prop_name = jerry_create_string ((const jerry_char_t *) "my_defined_property"); jerry_value_t prop_name = jerry_create_string ((const jerry_char_t *) "my_defined_property");
prop_desc.is_value_defined = true; prop_desc.is_value_defined = true;
prop_desc.value = jerry_acquire_value (prop_name); prop_desc.value = jerry_acquire_value (prop_name);
@@ -691,7 +691,7 @@ main (void)
jerry_release_value (res); jerry_release_value (res);
jerry_free_property_descriptor_fields (&prop_desc); jerry_free_property_descriptor_fields (&prop_desc);
// Test: get own property descriptor /* Test: get own property descriptor */
is_ok = jerry_get_own_property_descriptor (global_obj_val, prop_name, &prop_desc); is_ok = jerry_get_own_property_descriptor (global_obj_val, prop_name, &prop_desc);
TEST_ASSERT (is_ok); TEST_ASSERT (is_ok);
TEST_ASSERT (prop_desc.is_value_defined == true); TEST_ASSERT (prop_desc.is_value_defined == true);
@@ -706,13 +706,13 @@ main (void)
jerry_release_value (prop_name); jerry_release_value (prop_name);
jerry_free_property_descriptor_fields (&prop_desc); jerry_free_property_descriptor_fields (&prop_desc);
// Test: object keys /* Test: object keys */
res = jerry_get_object_keys (global_obj_val); res = jerry_get_object_keys (global_obj_val);
TEST_ASSERT (!jerry_value_has_error_flag (res)); TEST_ASSERT (!jerry_value_has_error_flag (res));
TEST_ASSERT (jerry_value_is_array (res)); TEST_ASSERT (jerry_value_is_array (res));
jerry_release_value (res); jerry_release_value (res);
// Test: jerry_value_to_primitive /* Test: jerry_value_to_primitive */
obj_val = jerry_eval ((jerry_char_t *) "new String ('hello')", 20, false); obj_val = jerry_eval ((jerry_char_t *) "new String ('hello')", 20, false);
TEST_ASSERT (!jerry_value_has_error_flag (obj_val)); TEST_ASSERT (!jerry_value_has_error_flag (obj_val));
TEST_ASSERT (jerry_value_is_object (obj_val)); TEST_ASSERT (jerry_value_is_object (obj_val));
@@ -722,13 +722,13 @@ main (void)
TEST_ASSERT (jerry_value_is_string (prim_val)); TEST_ASSERT (jerry_value_is_string (prim_val));
jerry_release_value (prim_val); jerry_release_value (prim_val);
// Test: jerry_get_prototype /* Test: jerry_get_prototype */
proto_val = jerry_get_prototype (obj_val); proto_val = jerry_get_prototype (obj_val);
TEST_ASSERT (!jerry_value_has_error_flag (proto_val)); TEST_ASSERT (!jerry_value_has_error_flag (proto_val));
TEST_ASSERT (jerry_value_is_object (proto_val)); TEST_ASSERT (jerry_value_is_object (proto_val));
jerry_release_value (obj_val); jerry_release_value (obj_val);
// Test: jerry_set_prototype /* Test: jerry_set_prototype */
obj_val = jerry_create_object (); obj_val = jerry_create_object ();
res = jerry_set_prototype (obj_val, jerry_create_null ()); res = jerry_set_prototype (obj_val, jerry_create_null ());
TEST_ASSERT (!jerry_value_has_error_flag (res)); TEST_ASSERT (!jerry_value_has_error_flag (res));
@@ -745,7 +745,7 @@ main (void)
jerry_release_value (proto_val); jerry_release_value (proto_val);
jerry_release_value (obj_val); jerry_release_value (obj_val);
// Test: eval /* Test: eval */
const char *eval_code_src_p = "(function () { return 123; })"; const char *eval_code_src_p = "(function () { return 123; })";
val_t = jerry_eval ((jerry_char_t *) eval_code_src_p, strlen (eval_code_src_p), true); val_t = jerry_eval ((jerry_char_t *) eval_code_src_p, strlen (eval_code_src_p), true);
TEST_ASSERT (!jerry_value_has_error_flag (val_t)); TEST_ASSERT (!jerry_value_has_error_flag (val_t));
@@ -760,13 +760,13 @@ main (void)
jerry_release_value (val_t); jerry_release_value (val_t);
// cleanup. /* cleanup. */
jerry_release_value (global_obj_val); jerry_release_value (global_obj_val);
// Test: run gc. /* Test: run gc. */
jerry_gc (); jerry_gc ();
// Test: number /* Test: number */
val_t = jerry_create_number (6.25); val_t = jerry_create_number (6.25);
number_val = jerry_get_number_value (val_t); number_val = jerry_get_number_value (val_t);
TEST_ASSERT (number_val * 3 == 18.75); TEST_ASSERT (number_val * 3 == 18.75);
@@ -786,7 +786,7 @@ main (void)
TEST_ASSERT (test_api_is_free_callback_was_called); TEST_ASSERT (test_api_is_free_callback_was_called);
// Test: parser error location /* Test: parser error location */
jerry_init (JERRY_INIT_SHOW_OPCODES); jerry_init (JERRY_INIT_SHOW_OPCODES);
const char *parser_err_src_p = "b = 'hello';\nvar a = (;"; const char *parser_err_src_p = "b = 'hello';\nvar a = (;";
@@ -808,7 +808,7 @@ main (void)
"SyntaxError: Primary expression expected. [line: 2, column: 10]")); "SyntaxError: Primary expression expected. [line: 2, column: 10]"));
jerry_cleanup (); jerry_cleanup ();
// External Magic String /* External Magic String */
jerry_init (JERRY_INIT_SHOW_OPCODES); jerry_init (JERRY_INIT_SHOW_OPCODES);
uint32_t num_magic_string_items = (uint32_t) (sizeof (magic_string_items) / sizeof (jerry_char_ptr_t)); uint32_t num_magic_string_items = (uint32_t) (sizeof (magic_string_items) / sizeof (jerry_char_ptr_t));
@@ -827,7 +827,7 @@ main (void)
jerry_cleanup (); jerry_cleanup ();
// Dump / execute snapshot /* Dump / execute snapshot */
if (true) if (true)
{ {
static uint8_t global_mode_snapshot_buffer[1024]; static uint8_t global_mode_snapshot_buffer[1024];
+4 -4
View File
@@ -18,16 +18,16 @@
#include "test-common.h" #include "test-common.h"
// Heap size is 32K /* Heap size is 32K. */
#define test_heap_size (32 * 1024) #define test_heap_size (32 * 1024)
// Iterations count /* Iterations count. */
#define test_iters (4 * 1024) #define test_iters (4 * 1024)
// Subiterations count /* Subiterations count. */
#define test_sub_iters 32 #define test_sub_iters 32
// Threshold size of block to allocate /* Threshold size of block to allocate. */
#define test_threshold_block_size 8192 #define test_threshold_block_size 8192
uint8_t *ptrs[test_sub_iters]; uint8_t *ptrs[test_sub_iters];
+3 -3
View File
@@ -43,7 +43,7 @@ main ()
size_t length; size_t length;
// test 1-byte-long unicode sequences /* Test 1-byte-long unicode sequences. */
length = lit_char_get_utf8_length (lexer_hex_to_character (0, _1_byte_long1 + 2, 4)); length = lit_char_get_utf8_length (lexer_hex_to_character (0, _1_byte_long1 + 2, 4));
TEST_ASSERT (length == 1); TEST_ASSERT (length == 1);
@@ -53,7 +53,7 @@ main ()
length = lit_char_get_utf8_length (lexer_hex_to_character (0, _1_byte_long3 + 2, 4)); length = lit_char_get_utf8_length (lexer_hex_to_character (0, _1_byte_long3 + 2, 4));
TEST_ASSERT (length == 1); TEST_ASSERT (length == 1);
// test 2-byte-long unicode sequences /* Test 2-byte-long unicode sequences. */
length = lit_char_get_utf8_length (lexer_hex_to_character (0, _2_byte_long1 + 2, 4)); length = lit_char_get_utf8_length (lexer_hex_to_character (0, _2_byte_long1 + 2, 4));
TEST_ASSERT (length == 2); TEST_ASSERT (length == 2);
@@ -63,7 +63,7 @@ main ()
length = lit_char_get_utf8_length (lexer_hex_to_character (0, _2_byte_long3 + 2, 4)); length = lit_char_get_utf8_length (lexer_hex_to_character (0, _2_byte_long3 + 2, 4));
TEST_ASSERT (length == 2); TEST_ASSERT (length == 2);
// test 3-byte-long unicode sequences /* Test 3-byte-long unicode sequences. */
length = lit_char_get_utf8_length (lexer_hex_to_character (0, _3_byte_long1 + 2, 4)); length = lit_char_get_utf8_length (lexer_hex_to_character (0, _3_byte_long1 + 2, 4));
TEST_ASSERT (length != 2); TEST_ASSERT (length != 2);
+5 -5
View File
@@ -18,13 +18,13 @@
#include "ecma-literal-storage.h" #include "ecma-literal-storage.h"
#include "test-common.h" #include "test-common.h"
// Iterations count /* Iterations count. */
#define test_iters 64 #define test_iters 64
// Subiterations count /* Subiterations count. */
#define test_sub_iters 64 #define test_sub_iters 64
// Max characters in a string /* Max characters in a string. */
#define max_characters_in_string 256 #define max_characters_in_string 256
static void static void
@@ -100,7 +100,7 @@ main ()
} }
} }
// Add empty string /* Add empty string. */
ecma_find_or_create_literal_string (NULL, 0); ecma_find_or_create_literal_string (NULL, 0);
for (uint32_t j = 0; j < test_sub_iters; j++) for (uint32_t j = 0; j < test_sub_iters; j++)
@@ -124,7 +124,7 @@ main ()
TEST_ASSERT (lit1 == lit2); TEST_ASSERT (lit1 == lit2);
} }
// Check empty string exists /* Check empty string exists. */
TEST_ASSERT (ecma_find_or_create_literal_string (NULL, 0) != JMEM_CP_NULL); TEST_ASSERT (ecma_find_or_create_literal_string (NULL, 0) != JMEM_CP_NULL);
} }
+2 -2
View File
@@ -25,10 +25,10 @@
#include "test-common.h" #include "test-common.h"
// Iterations count /* Iterations count. */
const uint32_t test_iters = 1024; const uint32_t test_iters = 1024;
// Subiterations count /* Subiterations count. */
#define TEST_MAX_SUB_ITERS 1024 #define TEST_MAX_SUB_ITERS 1024
#define TEST_CHUNK_SIZE 8 #define TEST_CHUNK_SIZE 8
+3 -3
View File
@@ -20,13 +20,13 @@
#include "test-common.h" #include "test-common.h"
// Iterations count /* Iterations count. */
#define test_iters (1024) #define test_iters (1024)
// Sub iterations count /* Sub iterations count. */
#define test_subiters (128) #define test_subiters (128)
// Max bytes in string /* Max bytes in string. */
#define max_bytes_in_string (16 * 1024) #define max_bytes_in_string (16 * 1024)
#define max_code_units_in_string (max_bytes_in_string) #define max_code_units_in_string (max_bytes_in_string)