Replace vera++ with clang-format (#4518)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
@@ -30,7 +31,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-aggregateerror-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID aggregate_error_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID aggregate_error_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
@@ -25,19 +25,13 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.11.7.8 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_AGGREGATE_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_AGGREGATE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.11.7.9 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_AGGREGATE_ERROR_UL,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.11.7.10 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
|
||||
LIT_MAGIC_STRING__EMPTY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -14,19 +14,20 @@
|
||||
*/
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-array-object.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-iterator-object.h"
|
||||
#include "ecma-array-object.h"
|
||||
#include "jrt.h"
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
@@ -34,7 +35,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-aggregateerror.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID aggregate_error
|
||||
#define BUILTIN_UNDERSCORED_ID aggregate_error
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -24,21 +24,15 @@
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
2,
|
||||
ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.11.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_AGGREGATE_ERROR_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-iterator-object.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
@@ -39,7 +39,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-iterator-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID array_iterator_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID array_iterator_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -130,10 +130,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
|
||||
index = (ecma_length_t) (ecma_get_number_from_value (index_value) + 1);
|
||||
}
|
||||
|
||||
ecma_value_t put_result = ecma_op_object_put (obj_p,
|
||||
prop_name_p,
|
||||
ecma_make_length_value (index),
|
||||
true);
|
||||
ecma_value_t put_result = ecma_op_object_put (obj_p, prop_name_p, ecma_make_length_value (index), true);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_true (put_result));
|
||||
|
||||
@@ -183,8 +180,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
|
||||
|
||||
/* 17.b */
|
||||
ecma_value_t entry_array_value;
|
||||
entry_array_value = ecma_create_array_from_iter_element (get_value,
|
||||
ecma_make_length_value (index));
|
||||
entry_array_value = ecma_create_array_from_iter_element (get_value, ecma_make_length_value (index));
|
||||
|
||||
result = ecma_create_iter_result_object (entry_array_value, ECMA_VALUE_FALSE);
|
||||
ecma_free_value (entry_array_value);
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_ARRAY_ITERATOR_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-prototype-unscopables.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID array_prototype_unscopables
|
||||
#define BUILTIN_UNDERSCORED_ID array_prototype_unscopables
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
@@ -21,49 +21,27 @@
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_AT,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_AT, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_COPY_WITHIN,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_COPY_WITHIN, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_ENTRIES,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_ENTRIES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_FILL,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_FILL, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_FIND,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_FIND, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_FIND_INDEX,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_FIND_INDEX, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_FLAT,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_FLAT, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_FLATMAP,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_FLATMAP, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_INCLUDES,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_INCLUDES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_KEYS,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_KEYS, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_VALUES,
|
||||
ECMA_VALUE_TRUE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_VALUES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -26,8 +26,9 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#include "jrt.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#if JERRY_BUILTIN_ARRAY
|
||||
|
||||
@@ -45,7 +46,7 @@
|
||||
enum
|
||||
{
|
||||
ECMA_ARRAY_PROTOTYPE_ROUTINE_START = 0,
|
||||
/* Note: these 2 routine ids must be in this order */
|
||||
/* Note: these 2 routine ids must be in this order */
|
||||
#if !JERRY_ESNEXT
|
||||
ECMA_ARRAY_PROTOTYPE_TO_STRING,
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
@@ -85,7 +86,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID array_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID array_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -109,15 +110,12 @@ ecma_builtin_array_prototype_helper_set_length (ecma_object_t *object, /**< obje
|
||||
ecma_number_t length) /**< new length */
|
||||
{
|
||||
ecma_value_t length_value = ecma_make_number_value (length);
|
||||
ecma_value_t ret_value = ecma_op_object_put (object,
|
||||
ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),
|
||||
length_value,
|
||||
true);
|
||||
ecma_value_t ret_value =
|
||||
ecma_op_object_put (object, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), length_value, true);
|
||||
|
||||
ecma_free_value (length_value);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_boolean (ret_value)
|
||||
|| ecma_is_value_empty (ret_value)
|
||||
JERRY_ASSERT (ecma_is_value_boolean (ret_value) || ecma_is_value_empty (ret_value)
|
||||
|| ECMA_IS_VALUE_ERROR (ret_value));
|
||||
return ret_value;
|
||||
} /* ecma_builtin_array_prototype_helper_set_length */
|
||||
@@ -202,9 +200,8 @@ ecma_builtin_array_prototype_object_concat (const ecma_value_t args[], /**< argu
|
||||
ecma_length_t new_length = 0;
|
||||
|
||||
/* 5.b - 5.c for this_arg */
|
||||
ecma_value_t concat_this_value = ecma_builtin_helper_array_concat_value (new_array_p,
|
||||
&new_length,
|
||||
ecma_make_object_value (obj_p));
|
||||
ecma_value_t concat_this_value =
|
||||
ecma_builtin_helper_array_concat_value (new_array_p, &new_length, ecma_make_object_value (obj_p));
|
||||
if (ECMA_IS_VALUE_ERROR (concat_this_value))
|
||||
{
|
||||
ecma_deref_object (new_array_p);
|
||||
@@ -227,8 +224,8 @@ ecma_builtin_array_prototype_object_concat (const ecma_value_t args[], /**< argu
|
||||
JERRY_ASSERT (ecma_is_value_empty (concat_value));
|
||||
}
|
||||
|
||||
ecma_value_t set_length_value = ecma_builtin_array_prototype_helper_set_length (new_array_p,
|
||||
((ecma_number_t) new_length));
|
||||
ecma_value_t set_length_value =
|
||||
ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) new_length));
|
||||
if (ECMA_IS_VALUE_ERROR (set_length_value))
|
||||
{
|
||||
ecma_deref_object (new_array_p);
|
||||
@@ -279,8 +276,7 @@ ecma_op_array_get_to_string_at_index (ecma_object_t *obj_p, /**< this object */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ecma_is_value_undefined (index_value)
|
||||
|| ecma_is_value_null (index_value))
|
||||
if (ecma_is_value_undefined (index_value) || ecma_is_value_null (index_value))
|
||||
{
|
||||
return ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
|
||||
}
|
||||
@@ -370,7 +366,7 @@ static ecma_value_t
|
||||
ecma_builtin_array_prototype_object_pop (ecma_object_t *obj_p, /**< object */
|
||||
ecma_length_t len) /**< object's length */
|
||||
{
|
||||
/* 4. */
|
||||
/* 4. */
|
||||
if (len == 0)
|
||||
{
|
||||
/* 4.a */
|
||||
@@ -523,14 +519,12 @@ ecma_builtin_array_prototype_object_reverse (ecma_value_t this_arg, /**< this ar
|
||||
ecma_object_t *obj_p, /**< object */
|
||||
ecma_length_t len) /**< object's length */
|
||||
{
|
||||
|
||||
if (ecma_op_object_is_fast_array (obj_p))
|
||||
{
|
||||
uint32_t middle = (uint32_t) len / 2;
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE
|
||||
&& len != 0)
|
||||
if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0)
|
||||
{
|
||||
ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);
|
||||
|
||||
@@ -674,7 +668,7 @@ ecma_builtin_array_prototype_object_reverse (ecma_value_t this_arg, /**< this ar
|
||||
|
||||
ret_value = ECMA_VALUE_EMPTY;
|
||||
|
||||
clean_up:
|
||||
clean_up:
|
||||
ecma_free_value (upper_value);
|
||||
ecma_free_value (lower_value);
|
||||
ecma_deref_ecma_string (lower_str_p);
|
||||
@@ -714,8 +708,7 @@ ecma_builtin_array_prototype_object_shift (ecma_object_t *obj_p, /**< object */
|
||||
{
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE
|
||||
&& len != 0)
|
||||
if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0)
|
||||
{
|
||||
ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);
|
||||
ecma_value_t ret_value = buffer_p[0];
|
||||
@@ -817,9 +810,7 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t arg1, /**< start */
|
||||
ecma_length_t start = 0, end = len;
|
||||
|
||||
/* 5. 6.*/
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg1,
|
||||
len,
|
||||
&start)))
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg1, len, &start)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
@@ -832,9 +823,7 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t arg1, /**< start */
|
||||
else
|
||||
{
|
||||
/* 7. part 2, 8.*/
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg2,
|
||||
len,
|
||||
&end)))
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg2, len, &end)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
@@ -946,10 +935,7 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t arg1, /**< start */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE;
|
||||
#endif /* JERRY_ESNEXT */
|
||||
put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,
|
||||
n,
|
||||
get_value,
|
||||
prop_flags);
|
||||
put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, n, get_value, prop_flags);
|
||||
ecma_free_value (get_value);
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
@@ -1057,10 +1043,7 @@ ecma_builtin_array_prototype_object_sort_compare_helper (ecma_value_t lhs, /**<
|
||||
|
||||
ecma_value_t compare_args[] = { lhs, rhs };
|
||||
|
||||
ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p,
|
||||
ECMA_VALUE_UNDEFINED,
|
||||
compare_args,
|
||||
2);
|
||||
ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p, ECMA_VALUE_UNDEFINED, compare_args, 2);
|
||||
if (ECMA_IS_VALUE_ERROR (call_value))
|
||||
{
|
||||
return call_value;
|
||||
@@ -1178,11 +1161,8 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum
|
||||
if (copied_num > 1)
|
||||
{
|
||||
const ecma_builtin_helper_sort_compare_fn_t sort_cb = &ecma_builtin_array_prototype_object_sort_compare_helper;
|
||||
ecma_value_t sort_value = ecma_builtin_helper_array_merge_sort_helper (values_buffer,
|
||||
(uint32_t) (copied_num),
|
||||
arg1,
|
||||
sort_cb,
|
||||
NULL);
|
||||
ecma_value_t sort_value =
|
||||
ecma_builtin_helper_array_merge_sort_helper (values_buffer, (uint32_t) (copied_num), arg1, sort_cb, NULL);
|
||||
if (ECMA_IS_VALUE_ERROR (sort_value))
|
||||
{
|
||||
goto clean_up;
|
||||
@@ -1271,9 +1251,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
|
||||
if (args_number > 0)
|
||||
{
|
||||
/* ES5.1: 6, ES11: 4. */
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[0],
|
||||
len,
|
||||
&actual_start)))
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[0], len, &actual_start)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
@@ -1295,8 +1273,8 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
|
||||
}
|
||||
|
||||
/* ES5.1: 7 */
|
||||
actual_delete_count = (ecma_length_t) (JERRY_MIN (JERRY_MAX (delete_num, 0),
|
||||
(ecma_number_t) (len - actual_start)));
|
||||
actual_delete_count =
|
||||
(ecma_length_t) (JERRY_MIN (JERRY_MAX (delete_num, 0), (ecma_number_t) (len - actual_start)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1344,10 +1322,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
|
||||
const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE;
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,
|
||||
k,
|
||||
from_present,
|
||||
prop_flags);
|
||||
ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, k, from_present, prop_flags);
|
||||
ecma_free_value (from_present);
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
@@ -1364,8 +1339,8 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
/* ES11: 12. */
|
||||
ecma_value_t set_length = ecma_builtin_array_prototype_helper_set_length (new_array_p,
|
||||
((ecma_number_t) actual_delete_count));
|
||||
ecma_value_t set_length =
|
||||
ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) actual_delete_count));
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (set_length))
|
||||
{
|
||||
@@ -1465,10 +1440,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
|
||||
uint32_t idx = 0;
|
||||
for (uint32_t arg_index = 2; arg_index < args_number; arg_index++, idx++)
|
||||
{
|
||||
ecma_value_t put_value = ecma_op_object_put_by_index (obj_p,
|
||||
actual_start + idx,
|
||||
args[arg_index],
|
||||
true);
|
||||
ecma_value_t put_value = ecma_op_object_put_by_index (obj_p, actual_start + idx, args[arg_index], true);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (put_value))
|
||||
{
|
||||
@@ -1506,13 +1478,11 @@ ecma_builtin_array_prototype_object_unshift (const ecma_value_t args[], /**< arg
|
||||
ecma_object_t *obj_p, /**< object */
|
||||
ecma_length_t len) /**< object's length */
|
||||
{
|
||||
|
||||
if (ecma_op_object_is_fast_array (obj_p))
|
||||
{
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE
|
||||
&& len != 0)
|
||||
if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0)
|
||||
{
|
||||
if (args_number > UINT32_MAX - len)
|
||||
{
|
||||
@@ -1730,8 +1700,7 @@ ecma_builtin_array_prototype_object_index_of (const ecma_value_t args[], /**< ar
|
||||
}
|
||||
|
||||
/* 9.b.i, 9.b.ii */
|
||||
if (ecma_is_value_found (get_value)
|
||||
&& ecma_op_strict_equality_compare (args[0], get_value))
|
||||
if (ecma_is_value_found (get_value) && ecma_op_strict_equality_compare (args[0], get_value))
|
||||
{
|
||||
ecma_free_value (get_value);
|
||||
return ecma_make_length_value (from_idx);
|
||||
@@ -1822,7 +1791,7 @@ ecma_builtin_array_prototype_object_last_index_of (const ecma_value_t args[], /*
|
||||
}
|
||||
}
|
||||
|
||||
/* 8. */
|
||||
/* 8. */
|
||||
while (from_idx < len)
|
||||
{
|
||||
/* 8.a */
|
||||
@@ -1834,8 +1803,7 @@ ecma_builtin_array_prototype_object_last_index_of (const ecma_value_t args[], /*
|
||||
}
|
||||
|
||||
/* 8.b.i, 8.b.ii */
|
||||
if (ecma_is_value_found (get_value)
|
||||
&& ecma_op_strict_equality_compare (search_element, get_value))
|
||||
if (ecma_is_value_found (get_value) && ecma_op_strict_equality_compare (search_element, get_value))
|
||||
{
|
||||
ecma_free_value (get_value);
|
||||
return ecma_make_length_value (from_idx);
|
||||
@@ -2023,10 +1991,7 @@ ecma_builtin_array_prototype_object_map (ecma_value_t arg1, /**< callbackfn */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE;
|
||||
#endif /* JERRY_ESNEXT */
|
||||
put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,
|
||||
index,
|
||||
mapped_value,
|
||||
prop_flags);
|
||||
put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, index, mapped_value, prop_flags);
|
||||
|
||||
ecma_free_value (mapped_value);
|
||||
ecma_free_value (current_value);
|
||||
@@ -2124,10 +2089,7 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t arg1, /**< callbackfn *
|
||||
if (ecma_op_to_boolean (call_value))
|
||||
{
|
||||
ecma_value_t put_comp;
|
||||
put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,
|
||||
new_array_index,
|
||||
get_value,
|
||||
prop_flags);
|
||||
put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, new_array_index, get_value, prop_flags);
|
||||
#if JERRY_ESNEXT
|
||||
if (ECMA_IS_VALUE_ERROR (put_comp))
|
||||
{
|
||||
@@ -2206,8 +2168,7 @@ ecma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's argu
|
||||
k_present = true;
|
||||
|
||||
/* 8.b.ii-iii */
|
||||
ecma_value_t current_value = ecma_op_object_find_by_index (obj_p, start_from_left ? index
|
||||
: last_index - index);
|
||||
ecma_value_t current_value = ecma_op_object_find_by_index (obj_p, start_from_left ? index : last_index - index);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (current_value))
|
||||
{
|
||||
@@ -2253,12 +2214,9 @@ ecma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's argu
|
||||
{
|
||||
/* 9.c.i, 9.c.ii */
|
||||
current_index = ecma_make_length_value (corrected_index);
|
||||
ecma_value_t call_args[] = {accumulator, current_value, current_index, ecma_make_object_value (obj_p)};
|
||||
ecma_value_t call_args[] = { accumulator, current_value, current_index, ecma_make_object_value (obj_p) };
|
||||
|
||||
ecma_value_t call_value = ecma_op_function_call (func_object_p,
|
||||
ECMA_VALUE_UNDEFINED,
|
||||
call_args,
|
||||
4);
|
||||
ecma_value_t call_value = ecma_op_function_call (func_object_p, ECMA_VALUE_UNDEFINED, call_args, 4);
|
||||
ecma_free_value (current_index);
|
||||
ecma_free_value (accumulator);
|
||||
ecma_free_value (current_value);
|
||||
@@ -2298,9 +2256,7 @@ ecma_builtin_array_prototype_fill (ecma_value_t value, /**< value */
|
||||
ecma_length_t k, final;
|
||||
|
||||
/* 5. 6. 7. */
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (start_val,
|
||||
len,
|
||||
&k)))
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (start_val, len, &k)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
@@ -2313,9 +2269,7 @@ ecma_builtin_array_prototype_fill (ecma_value_t value, /**< value */
|
||||
else
|
||||
{
|
||||
/* 8 part 2, 9, 10 */
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (end_val,
|
||||
len,
|
||||
&final)))
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (end_val, len, &final)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
@@ -2728,7 +2682,7 @@ ecma_builtin_array_flatten_into_array (ecma_value_t target, /**< target will con
|
||||
{
|
||||
/* i-ii. */
|
||||
ecma_value_t source_val = ecma_make_length_value (source_index);
|
||||
ecma_value_t args[] = {element, source_val, ecma_make_object_value (source)};
|
||||
ecma_value_t args[] = { element, source_val, ecma_make_object_value (source) };
|
||||
ecma_value_t temp_element = ecma_op_function_call (ecma_get_object_from_value (mapped_value), thisArg, args, 3);
|
||||
|
||||
ecma_free_value (element);
|
||||
@@ -2787,10 +2741,8 @@ ecma_builtin_array_flatten_into_array (ecma_value_t target, /**< target will con
|
||||
|
||||
/* vi. */
|
||||
const uint32_t flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;
|
||||
ecma_value_t element_temp = ecma_builtin_helper_def_prop_by_index (ecma_get_object_from_value (target),
|
||||
target_index,
|
||||
element,
|
||||
flags);
|
||||
ecma_value_t element_temp =
|
||||
ecma_builtin_helper_def_prop_by_index (ecma_get_object_from_value (target), target_index, element, flags);
|
||||
|
||||
ecma_free_value (element);
|
||||
|
||||
@@ -2885,13 +2837,8 @@ ecma_builtin_array_prototype_object_flat_map (ecma_value_t callback, /**< callba
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
ecma_value_t flatten_val = ecma_builtin_array_flatten_into_array (ecma_make_object_value (new_array_p),
|
||||
obj_p,
|
||||
len,
|
||||
0,
|
||||
1,
|
||||
callback,
|
||||
this_arg);
|
||||
ecma_value_t flatten_val =
|
||||
ecma_builtin_array_flatten_into_array (ecma_make_object_value (new_array_p), obj_p, len, 0, 1, callback, this_arg);
|
||||
if (ECMA_IS_VALUE_ERROR (flatten_val))
|
||||
{
|
||||
ecma_deref_object (new_array_p);
|
||||
@@ -2937,16 +2884,11 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
if (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_SORT)
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_sort (this_arg,
|
||||
arguments_list_p[0],
|
||||
obj_p);
|
||||
|
||||
ret_value = ecma_builtin_array_prototype_object_sort (this_arg, arguments_list_p[0], obj_p);
|
||||
}
|
||||
else if (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_CONCAT)
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_concat (arguments_list_p,
|
||||
arguments_number,
|
||||
obj_p);
|
||||
ret_value = ecma_builtin_array_prototype_object_concat (arguments_list_p, arguments_number, obj_p);
|
||||
}
|
||||
|
||||
ecma_deref_object (obj_p);
|
||||
@@ -3004,10 +2946,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_PUSH:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_push (arguments_list_p,
|
||||
arguments_number,
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_push (arguments_list_p, arguments_number, obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_REVERSE:
|
||||
@@ -3022,49 +2961,32 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_SLICE:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_slice (arguments_list_p[0],
|
||||
arguments_list_p[1],
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_slice (arguments_list_p[0], arguments_list_p[1], obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_SPLICE:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_splice (arguments_list_p,
|
||||
arguments_number,
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_splice (arguments_list_p, arguments_number, obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_UNSHIFT:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_unshift (arguments_list_p,
|
||||
arguments_number,
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_unshift (arguments_list_p, arguments_number, obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_AT:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_at (arguments_list_p[0],
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_at (arguments_list_p[0], obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_INDEX_OF:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_index_of (arguments_list_p,
|
||||
arguments_number,
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_index_of (arguments_list_p, arguments_number, obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_LAST_INDEX_OF:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_last_index_of (arguments_list_p,
|
||||
arguments_number,
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_last_index_of (arguments_list_p, arguments_number, obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_EVERY:
|
||||
@@ -3080,10 +3002,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_MAP:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_map (arguments_list_p[0],
|
||||
arguments_list_p[1],
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_map (arguments_list_p[0], arguments_list_p[1], obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_REDUCE:
|
||||
@@ -3099,10 +3018,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
#if JERRY_ESNEXT
|
||||
case ECMA_ARRAY_PROTOTYPE_COPY_WITHIN:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_copy_within (arguments_list_p,
|
||||
arguments_number,
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_copy_within (arguments_list_p, arguments_number, obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_FIND:
|
||||
@@ -3126,26 +3042,18 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_INCLUDES:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_includes (arguments_list_p,
|
||||
arguments_number,
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_includes (arguments_list_p, arguments_number, obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_FLAT:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_flat (arguments_list_p,
|
||||
arguments_number,
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_flat (arguments_list_p, arguments_number, obj_p, length);
|
||||
break;
|
||||
}
|
||||
case ECMA_ARRAY_PROTOTYPE_FLATMAP:
|
||||
{
|
||||
ret_value = ecma_builtin_array_prototype_object_flat_map (arguments_list_p[0],
|
||||
arguments_list_p[1],
|
||||
obj_p,
|
||||
length);
|
||||
ret_value =
|
||||
ecma_builtin_array_prototype_object_flat_map (arguments_list_p[0], arguments_list_p[1], obj_p, length);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
@@ -3153,10 +3061,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
{
|
||||
JERRY_ASSERT (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_FILTER);
|
||||
|
||||
ret_value = ecma_builtin_array_prototype_object_filter (arguments_list_p[0],
|
||||
arguments_list_p[1],
|
||||
obj_p,
|
||||
length);
|
||||
ret_value = ecma_builtin_array_prototype_object_filter (arguments_list_p[0], arguments_list_p[1], obj_p, length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.4.4.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
/* ECMA-262 v6, 22.1.3.31 */
|
||||
@@ -40,9 +38,7 @@ OBJECT_VALUE (LIT_GLOBAL_SYMBOL_UNSCOPABLES,
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.4.4 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
0,
|
||||
ECMA_PROPERTY_FLAG_WRITABLE)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_WRITABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
@@ -82,11 +78,12 @@ ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_ARRAY_PROTOTYPE_KEYS, 0, 0)
|
||||
ROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_ARRAY_PROTOTYPE_INCLUDES, NON_FIXED, 1)
|
||||
ROUTINE (LIT_MAGIC_STRING_FLAT, ECMA_ARRAY_PROTOTYPE_FLAT, 1, 0)
|
||||
ROUTINE (LIT_MAGIC_STRING_FLATMAP, ECMA_ARRAY_PROTOTYPE_FLATMAP, 2, 1)
|
||||
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL,
|
||||
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES,
|
||||
LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES, LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,
|
||||
INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,
|
||||
LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
*/
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-array-object.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
@@ -24,7 +25,7 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-iterator-object.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-array-object.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "jrt.h"
|
||||
|
||||
@@ -53,7 +54,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID array
|
||||
#define BUILTIN_UNDERSCORED_ID array
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -185,10 +186,8 @@ ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */
|
||||
{
|
||||
/* 6.g.iv.1 */
|
||||
ecma_value_t len_value = ecma_make_uint32_value (k);
|
||||
ecma_value_t set_status = ecma_op_object_put (array_obj_p,
|
||||
ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),
|
||||
len_value,
|
||||
true);
|
||||
ecma_value_t set_status =
|
||||
ecma_op_object_put (array_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len_value, true);
|
||||
ecma_free_value (len_value);
|
||||
|
||||
/* 6.g.iv.2 */
|
||||
@@ -255,7 +254,7 @@ ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */
|
||||
k++;
|
||||
}
|
||||
|
||||
iterator_cleanup:
|
||||
iterator_cleanup:
|
||||
ecma_free_value (iterator);
|
||||
ecma_free_value (next_method);
|
||||
ecma_deref_object (array_obj_p);
|
||||
@@ -376,10 +375,8 @@ iterator_cleanup:
|
||||
|
||||
/* 17. */
|
||||
len_value = ecma_make_length_value (k);
|
||||
ecma_value_t set_status = ecma_op_object_put (array_obj_p,
|
||||
ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),
|
||||
len_value,
|
||||
true);
|
||||
ecma_value_t set_status =
|
||||
ecma_op_object_put (array_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len_value, true);
|
||||
ecma_free_value (len_value);
|
||||
|
||||
/* 18. */
|
||||
@@ -420,10 +417,8 @@ ecma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */
|
||||
|
||||
ecma_value_t len = ecma_make_uint32_value (arguments_list_len);
|
||||
|
||||
ecma_value_t ret_val = ecma_op_function_construct (ecma_get_object_from_value (this_arg),
|
||||
ecma_get_object_from_value (this_arg),
|
||||
&len,
|
||||
1);
|
||||
ecma_value_t ret_val =
|
||||
ecma_op_function_construct (ecma_get_object_from_value (this_arg), ecma_get_object_from_value (this_arg), &len, 1);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ret_val))
|
||||
{
|
||||
@@ -437,10 +432,8 @@ ecma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */
|
||||
|
||||
while (k < arguments_list_len)
|
||||
{
|
||||
ecma_value_t define_status = ecma_builtin_helper_def_prop_by_index (obj_p,
|
||||
k,
|
||||
arguments_list_p[k],
|
||||
prop_status_flags);
|
||||
ecma_value_t define_status =
|
||||
ecma_builtin_helper_def_prop_by_index (obj_p, k, arguments_list_p[k], prop_status_flags);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (define_status))
|
||||
{
|
||||
@@ -452,10 +445,7 @@ ecma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */
|
||||
k++;
|
||||
}
|
||||
|
||||
ret_val = ecma_op_object_put (obj_p,
|
||||
ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),
|
||||
len,
|
||||
true);
|
||||
ret_val = ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len, true);
|
||||
|
||||
ecma_free_value (len);
|
||||
|
||||
@@ -482,8 +472,7 @@ ecma_builtin_array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
if (arguments_list_len != 1
|
||||
|| !ecma_is_value_number (arguments_list_p[0]))
|
||||
if (arguments_list_len != 1 || !ecma_is_value_number (arguments_list_p[0]))
|
||||
{
|
||||
return ecma_op_new_array_object_from_buffer (arguments_list_p, arguments_list_len);
|
||||
}
|
||||
@@ -514,8 +503,8 @@ ecma_builtin_array_dispatch_construct (const ecma_value_t *arguments_list_p, /**
|
||||
#if !JERRY_ESNEXT
|
||||
return ecma_builtin_array_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
#else /* JERRY_ESNEXT */
|
||||
ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
|
||||
ECMA_BUILTIN_ID_ARRAY_PROTOTYPE);
|
||||
ecma_object_t *proto_p =
|
||||
ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_ARRAY_PROTOTYPE);
|
||||
|
||||
if (proto_p == NULL)
|
||||
{
|
||||
|
||||
@@ -25,21 +25,15 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.4.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_ARRAY_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* Number properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_ARRAY_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ARRAY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* Routine properties:
|
||||
@@ -50,9 +44,7 @@ ROUTINE (LIT_MAGIC_STRING_FROM, ECMA_ARRAY_ROUTINE_FROM, NON_FIXED, 1)
|
||||
ROUTINE (LIT_MAGIC_STRING_OF, ECMA_ARRAY_ROUTINE_OF, NON_FIXED, 0)
|
||||
|
||||
/* ECMA-262 v6, 22.1.2.5 */
|
||||
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
|
||||
ECMA_ARRAY_ROUTINE_SPECIES_GET,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ECMA_ARRAY_ROUTINE_SPECIES_GET, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#endif /* !(JERRY_BUILTIN_ARRAY) */
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
@@ -22,9 +23,9 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
|
||||
@@ -32,7 +33,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-arraybuffer-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID arraybuffer_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID arraybuffer_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_ARRAYBUFFER,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* Readonly accessor properties */
|
||||
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,
|
||||
@@ -34,9 +32,7 @@ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 24.1.4.4 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_ARRAY_BUFFER_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
|
||||
@@ -13,14 +13,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-dataview-object.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-dataview-object.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
@@ -29,7 +30,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-arraybuffer.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID arraybuffer
|
||||
#define BUILTIN_UNDERSCORED_ID arraybuffer
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -24,20 +24,14 @@
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_ARRAY_BUFFER_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
@@ -46,9 +40,7 @@ STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
ROUTINE (LIT_MAGIC_STRING_IS_VIEW_UL, ecma_builtin_arraybuffer_object_is_view, 1, 1)
|
||||
|
||||
/* ES2015 24.1.3.3 */
|
||||
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
|
||||
ecma_builtin_arraybuffer_species_get,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_arraybuffer_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "jerryscript-types.h"
|
||||
|
||||
#include "ecma-builtin-handlers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-exceptions.h"
|
||||
@@ -23,8 +25,8 @@
|
||||
#include "ecma-iterator-object.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-promise-object.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "jerryscript-types.h"
|
||||
#include "jrt.h"
|
||||
#include "lit-magic-strings.h"
|
||||
#include "lit-strings.h"
|
||||
@@ -37,8 +39,8 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
/**
|
||||
* This object has a custom dispatch function.
|
||||
*/
|
||||
* This object has a custom dispatch function.
|
||||
*/
|
||||
#define BUILTIN_CUSTOM_DISPATCH
|
||||
|
||||
/**
|
||||
@@ -53,7 +55,7 @@ enum
|
||||
} ecma_async_from_sync_iterator_operation_type_t;
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-from-sync-iterator-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID async_from_sync_iterator_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID async_from_sync_iterator_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -146,9 +148,8 @@ ecma_builtin_async_from_sync_iterator_prototype_next (ecma_async_from_sync_itera
|
||||
ecma_value_t value) /**< routine's 'value' argument */
|
||||
{
|
||||
/* 5. */
|
||||
ecma_value_t next_result = ecma_op_iterator_next (iter_p->header.u.cls.u3.sync_iterator,
|
||||
iter_p->sync_next_method,
|
||||
value);
|
||||
ecma_value_t next_result =
|
||||
ecma_op_iterator_next (iter_p->header.u.cls.u3.sync_iterator, iter_p->sync_next_method, value);
|
||||
|
||||
/* 6. */
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_if_abrupt_reject_promise (&next_result, capability_p)))
|
||||
@@ -224,10 +225,8 @@ ecma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterato
|
||||
}
|
||||
|
||||
/* 7.b. */
|
||||
ecma_value_t resolve = ecma_op_function_call (ecma_get_object_from_value (func_obj),
|
||||
ECMA_VALUE_UNDEFINED,
|
||||
&call_arg,
|
||||
arg_size);
|
||||
ecma_value_t resolve =
|
||||
ecma_op_function_call (ecma_get_object_from_value (func_obj), ECMA_VALUE_UNDEFINED, &call_arg, arg_size);
|
||||
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (resolve));
|
||||
ecma_free_value (resolve);
|
||||
|
||||
@@ -273,10 +272,8 @@ ecma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterato
|
||||
ecma_value_t type_error = ecma_make_object_value (type_error_obj_p);
|
||||
|
||||
/* 10.a. */
|
||||
ecma_value_t reject = ecma_op_function_call (ecma_get_object_from_value (capability_p->reject),
|
||||
ECMA_VALUE_UNDEFINED,
|
||||
&type_error,
|
||||
1);
|
||||
ecma_value_t reject =
|
||||
ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), ECMA_VALUE_UNDEFINED, &type_error, 1);
|
||||
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (reject));
|
||||
ecma_deref_object (type_error_obj_p);
|
||||
ecma_free_value (reject);
|
||||
@@ -292,11 +289,11 @@ ecma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterato
|
||||
} /* ecma_builtin_async_from_sync_iterator_prototype_do */
|
||||
|
||||
/**
|
||||
* Dispatcher of the %AsyncFromSyncIteratorPrototype% built-in's routines
|
||||
*
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
* Dispatcher of the %AsyncFromSyncIteratorPrototype% built-in's routines
|
||||
*
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_builtin_async_from_sync_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide
|
||||
* routine
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-function-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID async_function_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID async_function_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -22,14 +22,10 @@
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/* ECMA-262 v11, 25.7.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_ASYNC_FUNCTION,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v11, 25.7.3.2 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_ASYNC_FUNCTION_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "ecma-function-object.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-function.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID async_function
|
||||
#define BUILTIN_UNDERSCORED_ID async_function
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -47,9 +47,7 @@ ecma_builtin_async_function_dispatch_call (const ecma_value_t *arguments_list_p,
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_op_create_dynamic_function (arguments_list_p,
|
||||
arguments_list_len,
|
||||
ECMA_PARSE_ASYNC_FUNCTION);
|
||||
return ecma_op_create_dynamic_function (arguments_list_p, arguments_list_len, ECMA_PARSE_ASYNC_FUNCTION);
|
||||
} /* ecma_builtin_async_function_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,24 +22,16 @@
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/* ECMA-262 v11, 25.7.2 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_ASYNC_FUNCTION_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v11, 25.7.2.1 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v10, 25.7.2.2 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v11, 25.7.3.2 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_ASYNC_FUNCTION_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "ecma-function-object.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-generator-function.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID async_generator_function
|
||||
#define BUILTIN_UNDERSCORED_ID async_generator_function
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -22,19 +22,13 @@
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/* ECMA-262 v10, 25.3.2 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v10, 25.3.2.1 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 25.3.2.2 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_ASYNC_GENERATOR,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_GENERATOR, ECMA_PROPERTY_FIXED)
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-iterator-object.h"
|
||||
#include "ecma-promise-object.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "opcodes.h"
|
||||
#include "vm-defines.h"
|
||||
@@ -31,8 +32,8 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
/**
|
||||
* This object has a custom dispatch function.
|
||||
*/
|
||||
* This object has a custom dispatch function.
|
||||
*/
|
||||
#define BUILTIN_CUSTOM_DISPATCH
|
||||
|
||||
/**
|
||||
@@ -47,7 +48,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-generator-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID async_generator_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID async_generator_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -64,26 +65,26 @@ enum
|
||||
* Convert routine type to operation type..
|
||||
*/
|
||||
#define ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION(type) \
|
||||
((ecma_async_generator_operation_type_t) ((type) - ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT))
|
||||
((ecma_async_generator_operation_type_t) ((type) -ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT))
|
||||
|
||||
JERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT)
|
||||
== ECMA_ASYNC_GENERATOR_DO_NEXT,
|
||||
== ECMA_ASYNC_GENERATOR_DO_NEXT,
|
||||
convert_ecma_async_generator_routine_next_to_ecma_async_generator_do_next_failed);
|
||||
|
||||
JERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_THROW)
|
||||
== ECMA_ASYNC_GENERATOR_DO_THROW,
|
||||
== ECMA_ASYNC_GENERATOR_DO_THROW,
|
||||
convert_ecma_async_generator_routine_throw_to_ecma_async_generator_do_throw_failed);
|
||||
|
||||
JERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_RETURN)
|
||||
== ECMA_ASYNC_GENERATOR_DO_RETURN,
|
||||
== ECMA_ASYNC_GENERATOR_DO_RETURN,
|
||||
convert_ecma_async_generator_routine_return_to_ecma_async_generator_do_return_failed);
|
||||
|
||||
/**
|
||||
* Dispatcher of the Generator built-in's routines
|
||||
*
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
* Dispatcher of the Generator built-in's routines
|
||||
*
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_builtin_async_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||
* identifier */
|
||||
|
||||
@@ -25,14 +25,10 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v6, 25.3.1.5 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_ASYNC_GENERATOR_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 25.2.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_ASYNC_GENERATOR,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_GENERATOR, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-generator.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID async_generator
|
||||
#define BUILTIN_UNDERSCORED_ID async_generator
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -22,14 +22,10 @@
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/* ECMA-262 v6, 25.3.2.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 25.3.2.3.2 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 25.3.2.3.3 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
|
||||
@@ -37,7 +37,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-iterator-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID async_iterator_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID async_iterator_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_BUILTIN_ATOMICS
|
||||
@@ -51,7 +52,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-atomics.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID atomics
|
||||
#define BUILTIN_UNDERSCORED_ID atomics
|
||||
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
@@ -76,7 +77,7 @@ enum
|
||||
static ecma_value_t
|
||||
ecma_builtin_atomics_compare_exchange (ecma_value_t typedarray, /**< typedArray argument */
|
||||
ecma_value_t index, /**< index argument */
|
||||
ecma_value_t expected_value, /**< expectedValue argument */
|
||||
ecma_value_t expected_value, /**< expectedValue argument */
|
||||
ecma_value_t replacement_value) /**< replacementValue argument*/
|
||||
{
|
||||
JERRY_UNUSED (typedarray);
|
||||
|
||||
@@ -22,9 +22,7 @@
|
||||
#if JERRY_BUILTIN_ATOMICS
|
||||
|
||||
/* ECMA-262 v11, 24.4.14 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_ATOMICS_U,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ATOMICS_U, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
|
||||
@@ -38,7 +38,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-bigint-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID bigint_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID bigint_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -25,14 +25,10 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v11, 20.2.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_BIGINT,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_BIGINT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v11, 20.2.3.5 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_BIGINT_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_BIGINT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-bigint.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID bigint
|
||||
#define BUILTIN_UNDERSCORED_ID bigint
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -25,22 +25,16 @@
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
/* ECMA-262 v11, 20.2.1 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v11, 20.2.1 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_BIGINT_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_BIGINT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v11, 20.2.2.3 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_BIGINT_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_BIGINT_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_BUILTIN_BOOLEAN
|
||||
@@ -45,7 +46,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-boolean-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID boolean_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID boolean_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -25,14 +25,12 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.6.4.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_BOOLEAN,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_BOOLEAN, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_TO_STRING, 0, 0)
|
||||
ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF, 0, 0)
|
||||
ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF, 0, 0)
|
||||
|
||||
#endif /* JERRY_BUILTIN_BOOLEAN */
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_BUILTIN_BOOLEAN
|
||||
@@ -30,7 +31,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-boolean.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID boolean
|
||||
#define BUILTIN_UNDERSCORED_ID boolean
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -25,21 +25,15 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.6.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* Number properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_BOOLEAN_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_BOOLEAN_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#endif /* JERRY_BUILTIN_BOOLEAN */
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
*/
|
||||
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-dataview-object.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
|
||||
#if JERRY_BUILTIN_DATAVIEW
|
||||
@@ -74,7 +74,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-dataview-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID dataview_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID dataview_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -179,7 +179,8 @@ ecma_builtin_dataview_prototype_dispatch_routine (uint8_t builtin_routine_id, /*
|
||||
return ecma_op_dataview_get_set_view_value (this_arg,
|
||||
arguments_list_p[0],
|
||||
arguments_list_p[1],
|
||||
ECMA_VALUE_EMPTY, id);
|
||||
ECMA_VALUE_EMPTY,
|
||||
id);
|
||||
}
|
||||
case ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT32:
|
||||
#if JERRY_NUMBER_TYPE_FLOAT64
|
||||
|
||||
@@ -25,14 +25,10 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v6, 24.2.3 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_DATAVIEW,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_DATAVIEW, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v6, 23.2.4.21 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_DATAVIEW_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
@@ -64,9 +60,7 @@ ROUTINE (LIT_MAGIC_STRING_SET_BIGUINT64, ECMA_DATAVIEW_PROTOTYPE_SET_BIGUINT64,
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
/* ECMA-262 v6, 24.2.4.1 */
|
||||
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BUFFER,
|
||||
ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BUFFER, ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 24.2.4.2 */
|
||||
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
*/
|
||||
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-dataview-object.h"
|
||||
#include "ecma-exceptions.h"
|
||||
|
||||
#if JERRY_BUILTIN_DATAVIEW
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-dataview.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID dataview
|
||||
#define BUILTIN_UNDERSCORED_ID dataview
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -25,22 +25,16 @@
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
/* ECMA-262 v6, 23.1.2 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 23.1 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_DATAVIEW_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v6, 23.1.2.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
#endif /* JERRY_BUILTIN_DATAVIEW */
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#if JERRY_BUILTIN_DATE
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
* Checks whether the function uses UTC time zone.
|
||||
*/
|
||||
#define BUILTIN_DATE_FUNCTION_IS_UTC(builtin_routine_id) \
|
||||
(((builtin_routine_id) - ECMA_DATE_PROTOTYPE_GET_FULL_YEAR) & 0x1)
|
||||
(((builtin_routine_id) -ECMA_DATE_PROTOTYPE_GET_FULL_YEAR) & 0x1)
|
||||
|
||||
/**
|
||||
* List of built-in routine identifiers.
|
||||
@@ -108,7 +108,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-date-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID date_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID date_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -311,7 +311,7 @@ ecma_builtin_date_prototype_dispatch_get (uint16_t builtin_routine_id, /**< buil
|
||||
* Returns true, if the built-in id sets a year.
|
||||
*/
|
||||
#define ECMA_DATE_PROTOTYPE_IS_SET_YEAR_ROUTINE(builtin_routine_id) \
|
||||
((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \
|
||||
((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \
|
||||
|| (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR \
|
||||
|| (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_YEAR)
|
||||
|
||||
@@ -321,7 +321,7 @@ ecma_builtin_date_prototype_dispatch_get (uint16_t builtin_routine_id, /**< buil
|
||||
* Returns true, if the built-in id sets a year.
|
||||
*/
|
||||
#define ECMA_DATE_PROTOTYPE_IS_SET_YEAR_ROUTINE(builtin_routine_id) \
|
||||
((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \
|
||||
((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \
|
||||
|| (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR)
|
||||
|
||||
#endif /* JERRY_BUILTIN_ANNEXB */
|
||||
@@ -677,7 +677,6 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b
|
||||
|
||||
if (builtin_routine_id <= ECMA_DATE_PROTOTYPE_SET_UTC_MILLISECONDS)
|
||||
{
|
||||
|
||||
if (builtin_routine_id <= ECMA_DATE_PROTOTYPE_GET_UTC_TIMEZONE_OFFSET)
|
||||
{
|
||||
if (!BUILTIN_DATE_FUNCTION_IS_UTC (builtin_routine_id))
|
||||
@@ -706,10 +705,7 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b
|
||||
return ecma_builtin_date_prototype_dispatch_get (builtin_routine_id, date_value);
|
||||
}
|
||||
|
||||
return ecma_builtin_date_prototype_dispatch_set (builtin_routine_id,
|
||||
this_obj_p,
|
||||
arguments_list,
|
||||
arguments_number);
|
||||
return ecma_builtin_date_prototype_dispatch_set (builtin_routine_id, this_obj_p, arguments_list, arguments_number);
|
||||
}
|
||||
|
||||
if (builtin_routine_id == ECMA_DATE_PROTOTYPE_TO_ISO_STRING)
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
|
||||
#if JERRY_BUILTIN_DATE
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_DATE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_DATE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_DATE_PROTOTYPE_TO_STRING, 0, 0)
|
||||
ROUTINE (LIT_MAGIC_STRING_TO_DATE_STRING_UL, ECMA_DATE_PROTOTYPE_TO_DATE_STRING, 0, 0)
|
||||
@@ -69,10 +67,12 @@ ROUTINE (LIT_MAGIC_STRING_TO_ISO_STRING_UL, ECMA_DATE_PROTOTYPE_TO_ISO_STRING, 0
|
||||
ROUTINE (LIT_MAGIC_STRING_TO_JSON_UL, ECMA_DATE_PROTOTYPE_TO_JSON, 1, 1)
|
||||
#if JERRY_ESNEXT
|
||||
ROUTINE_CONFIGURABLE_ONLY (LIT_GLOBAL_SYMBOL_TO_PRIMITIVE, ECMA_DATE_PROTOTYPE_TO_PRIMITIVE, 1, 1)
|
||||
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_UTC_STRING_UL, LIT_MAGIC_STRING_TO_UTC_STRING_UL,
|
||||
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_UTC_STRING_UL,
|
||||
LIT_MAGIC_STRING_TO_UTC_STRING_UL,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#if JERRY_BUILTIN_ANNEXB
|
||||
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_GMT_STRING_UL, LIT_MAGIC_STRING_TO_UTC_STRING_UL,
|
||||
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_GMT_STRING_UL,
|
||||
LIT_MAGIC_STRING_TO_UTC_STRING_UL,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_ANNEXB */
|
||||
#else /* !JERRY_ESNEXT */
|
||||
|
||||
@@ -15,15 +15,16 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#if JERRY_BUILTIN_DATE
|
||||
@@ -48,7 +49,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-date.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID date
|
||||
#define BUILTIN_UNDERSCORED_ID date
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -148,8 +149,7 @@ ecma_date_check_two_chars (const lit_utf8_byte_t *str_p, /**< pointer to the ces
|
||||
ecma_char_t expected_char1, /**< first expected character */
|
||||
ecma_char_t expected_char2) /**< second expected character */
|
||||
{
|
||||
return (str_p < str_end_p
|
||||
&& (*str_p == expected_char1 || *str_p == expected_char2));
|
||||
return (str_p < str_end_p && (*str_p == expected_char1 || *str_p == expected_char2));
|
||||
} /* ecma_date_check_two_chars */
|
||||
|
||||
/**
|
||||
@@ -236,21 +236,20 @@ ecma_date_parse_month_name (const lit_utf8_byte_t **str_p, /**< pointer to the c
|
||||
} /* ecma_date_parse_month_name */
|
||||
|
||||
/**
|
||||
* Calculate MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)) for Date constructor and UTC
|
||||
*
|
||||
* See also:
|
||||
* ECMA-262 v11, 20.4.3.4
|
||||
*
|
||||
* @return false - if the operation fails
|
||||
* true - otherwise
|
||||
*/
|
||||
* Calculate MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)) for Date constructor and UTC
|
||||
*
|
||||
* See also:
|
||||
* ECMA-262 v11, 20.4.3.4
|
||||
*
|
||||
* @return false - if the operation fails
|
||||
* true - otherwise
|
||||
*/
|
||||
static bool
|
||||
ecma_date_construct_helper (const ecma_value_t *args, /**< arguments passed to the Date constructor */
|
||||
uint32_t args_len, /**< number of arguments */
|
||||
ecma_number_t *tv_p) /**< [out] time value */
|
||||
{
|
||||
ecma_number_t date_nums[7] =
|
||||
{
|
||||
ecma_number_t date_nums[7] = {
|
||||
ECMA_NUMBER_ZERO, /* year */
|
||||
ECMA_NUMBER_ZERO, /* month */
|
||||
ECMA_NUMBER_ONE, /* date */
|
||||
@@ -287,13 +286,8 @@ ecma_date_construct_helper (const ecma_value_t *args, /**< arguments passed to t
|
||||
}
|
||||
|
||||
/* 10. */
|
||||
*tv_p = ecma_date_make_date (ecma_date_make_day (date_nums[0],
|
||||
date_nums[1],
|
||||
date_nums[2]),
|
||||
ecma_date_make_time (date_nums[3],
|
||||
date_nums[4],
|
||||
date_nums[5],
|
||||
date_nums[6]));
|
||||
*tv_p = ecma_date_make_date (ecma_date_make_day (date_nums[0], date_nums[1], date_nums[2]),
|
||||
ecma_date_make_time (date_nums[3], date_nums[4], date_nums[5], date_nums[6]));
|
||||
return true;
|
||||
} /* ecma_date_construct_helper */
|
||||
|
||||
@@ -324,10 +318,8 @@ ecma_builtin_date_parse_basic (const lit_utf8_byte_t *date_str_curr_p, /**< date
|
||||
year_limit = 999999;
|
||||
}
|
||||
|
||||
ecma_number_t year = ecma_date_parse_date_chars (&date_str_curr_p,
|
||||
date_str_end_p,
|
||||
year_digits,
|
||||
ECMA_DATE_LIMIT (0, year_limit));
|
||||
ecma_number_t year =
|
||||
ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, year_digits, ECMA_DATE_LIMIT (0, year_limit));
|
||||
if (is_year_sign_negative)
|
||||
{
|
||||
year = -year;
|
||||
@@ -466,8 +458,7 @@ ecma_builtin_date_parse_basic (const lit_utf8_byte_t *date_str_curr_p, /**< date
|
||||
* @return the parsed date as ecma_number_t or NaN otherwise
|
||||
*/
|
||||
static ecma_number_t
|
||||
ecma_builtin_date_parse_toString_formats (const lit_utf8_byte_t *date_str_curr_p,
|
||||
const lit_utf8_byte_t *date_str_end_p)
|
||||
ecma_builtin_date_parse_toString_formats (const lit_utf8_byte_t *date_str_curr_p, const lit_utf8_byte_t *date_str_end_p)
|
||||
{
|
||||
const ecma_number_t nan = ecma_number_make_nan ();
|
||||
|
||||
@@ -582,8 +573,7 @@ ecma_builtin_date_parse_toString_formats (const lit_utf8_byte_t *date_str_curr_p
|
||||
}
|
||||
|
||||
const char gmt_p[] = " GMT";
|
||||
if (date_str_end_p - date_str_curr_p < 4
|
||||
|| memcmp (date_str_curr_p, gmt_p, 4) != 0)
|
||||
if (date_str_end_p - date_str_curr_p < 4 || memcmp (date_str_curr_p, gmt_p, 4) != 0)
|
||||
{
|
||||
return nan;
|
||||
}
|
||||
@@ -725,8 +715,8 @@ ecma_builtin_date_create (ecma_number_t tv)
|
||||
#if JERRY_ESNEXT
|
||||
JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL);
|
||||
|
||||
ecma_object_t *prototype_obj_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
|
||||
ECMA_BUILTIN_ID_DATE_PROTOTYPE);
|
||||
ecma_object_t *prototype_obj_p =
|
||||
ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_DATE_PROTOTYPE);
|
||||
|
||||
if (JERRY_UNLIKELY (prototype_obj_p == NULL))
|
||||
{
|
||||
@@ -787,7 +777,6 @@ ecma_value_t
|
||||
ecma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
uint32_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
|
||||
/* 20.4.2.3 */
|
||||
if (arguments_list_len == 0)
|
||||
{
|
||||
@@ -804,7 +793,6 @@ ecma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**<
|
||||
if (ecma_is_value_object (argument)
|
||||
&& ecma_object_class_is (ecma_get_object_from_value (argument), ECMA_OBJECT_CLASS_DATE))
|
||||
{
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
tv = ((ecma_date_object_t *) ecma_get_object_from_value (argument))->date_value;
|
||||
#else /* !JERRY_ESNEXT */
|
||||
|
||||
@@ -22,22 +22,16 @@
|
||||
#if JERRY_BUILTIN_DATE
|
||||
|
||||
/* ECMA-262 v5, 15.9.4.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_DATE_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_DATE_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
7,
|
||||
ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 7, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
|
||||
ROUTINE (LIT_MAGIC_STRING_PARSE, ECMA_DATE_ROUTINE_PARSE, 1, 1)
|
||||
ROUTINE (LIT_MAGIC_STRING_UTC_U, ECMA_DATE_ROUTINE_UTC, NON_FIXED, 7)
|
||||
ROUTINE (LIT_MAGIC_STRING_NOW, ECMA_DATE_ROUTINE_NOW, 0, 0)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_DATE_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_DATE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#endif /* JERRY_BUILTIN_DATE */
|
||||
|
||||
@@ -20,18 +20,19 @@
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "lit-char-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
|
||||
#include "jrt.h"
|
||||
#include "lit-char-helpers.h"
|
||||
#include "lit-magic-strings.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
/**
|
||||
* This object has a custom dispatch function.
|
||||
*/
|
||||
* This object has a custom dispatch function.
|
||||
*/
|
||||
#define BUILTIN_CUSTOM_DISPATCH
|
||||
|
||||
/**
|
||||
@@ -44,7 +45,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-error-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID error_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID error_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -105,18 +106,16 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
ecma_string_t *name_string_p = ecma_builtin_error_prototype_object_to_string_helper (obj_p,
|
||||
LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_ERROR_UL);
|
||||
ecma_string_t *name_string_p =
|
||||
ecma_builtin_error_prototype_object_to_string_helper (obj_p, LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL);
|
||||
|
||||
if (JERRY_UNLIKELY (name_string_p == NULL))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
ecma_string_t *msg_string_p = ecma_builtin_error_prototype_object_to_string_helper (obj_p,
|
||||
LIT_MAGIC_STRING_MESSAGE,
|
||||
LIT_MAGIC_STRING__EMPTY);
|
||||
ecma_string_t *msg_string_p =
|
||||
ecma_builtin_error_prototype_object_to_string_helper (obj_p, LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY);
|
||||
|
||||
if (JERRY_UNLIKELY (msg_string_p == NULL))
|
||||
{
|
||||
@@ -136,7 +135,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
|
||||
|
||||
ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (name_string_p);
|
||||
|
||||
ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *)": ", 2);
|
||||
ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) ": ", 2);
|
||||
ecma_stringbuilder_append (&builder, msg_string_p);
|
||||
|
||||
ecma_deref_ecma_string (name_string_p);
|
||||
|
||||
@@ -23,19 +23,13 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.11.4.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.11.4.2 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_ERROR_UL,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.11.4.3 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
|
||||
LIT_MAGIC_STRING__EMPTY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
|
||||
@@ -14,23 +14,24 @@
|
||||
*/
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-error.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID error
|
||||
#define BUILTIN_UNDERSCORED_ID error
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -67,8 +68,8 @@ ecma_builtin_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**
|
||||
#if !JERRY_ESNEXT
|
||||
return ecma_builtin_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
#else /* JERRY_ESNEXT */
|
||||
ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
|
||||
ECMA_BUILTIN_ID_ERROR_PROTOTYPE);
|
||||
ecma_object_t *proto_p =
|
||||
ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_ERROR_PROTOTYPE);
|
||||
|
||||
if (proto_p == NULL)
|
||||
{
|
||||
|
||||
@@ -22,22 +22,16 @@
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.7.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_ERROR_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_ERROR_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#include "ecma-builtin-helpers-macro-undefs.inc.h"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_BUILTIN_ERRORS
|
||||
@@ -30,7 +31,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-evalerror-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID eval_error_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID eval_error_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
#endif /* JERRY_BUILTIN_ERRORS */
|
||||
|
||||
@@ -25,19 +25,13 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.11.7.8 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_EVAL_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_EVAL_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.11.7.9 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_EVAL_ERROR_UL,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.11.7.10 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
|
||||
LIT_MAGIC_STRING__EMPTY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
#endif /* JERRY_BUILTIN_ERRORS */
|
||||
|
||||
|
||||
@@ -14,17 +14,18 @@
|
||||
*/
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_BUILTIN_ERRORS
|
||||
|
||||
@@ -32,7 +33,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-evalerror.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID eval_error
|
||||
#define BUILTIN_UNDERSCORED_ID eval_error
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -69,8 +70,8 @@ ecma_builtin_eval_error_dispatch_construct (const ecma_value_t *arguments_list_p
|
||||
#if !JERRY_ESNEXT
|
||||
return ecma_builtin_eval_error_dispatch_call (arguments_list_p, arguments_list_len);
|
||||
#else /* JERRY_ESNEXT */
|
||||
ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
|
||||
ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE);
|
||||
ecma_object_t *proto_p =
|
||||
ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE);
|
||||
|
||||
if (proto_p == NULL)
|
||||
{
|
||||
|
||||
@@ -24,22 +24,16 @@
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.11.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_EVAL_ERROR_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#endif /* JERRY_BUILTIN_ERRORS */
|
||||
|
||||
@@ -13,20 +13,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-builtin-function-prototype.h"
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-extended-info.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
|
||||
#include "jrt.h"
|
||||
#include "ecma-builtin-function-prototype.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
@@ -52,7 +54,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-function-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID function_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID function_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -209,7 +211,7 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th
|
||||
/* 2. */
|
||||
if (ecma_is_value_null (arg2) || ecma_is_value_undefined (arg2))
|
||||
{
|
||||
return ecma_op_function_call (func_obj_p, arg1, NULL, 0);
|
||||
return ecma_op_function_call (func_obj_p, arg1, NULL, 0);
|
||||
}
|
||||
|
||||
/* 3. */
|
||||
@@ -256,10 +258,7 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th
|
||||
if (ecma_is_value_empty (ret_value))
|
||||
{
|
||||
JERRY_ASSERT (index == length);
|
||||
ret_value = ecma_op_function_call (func_obj_p,
|
||||
arg1,
|
||||
arguments_list_p,
|
||||
(uint32_t) length);
|
||||
ret_value = ecma_op_function_call (func_obj_p, arg1, arguments_list_p, (uint32_t) length);
|
||||
}
|
||||
|
||||
for (uint32_t remove_index = 0; remove_index < index; remove_index++)
|
||||
@@ -282,17 +281,14 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
static ecma_value_t
|
||||
ecma_builtin_function_prototype_object_call (ecma_object_t *func_obj_p , /**< this argument object */
|
||||
ecma_builtin_function_prototype_object_call (ecma_object_t *func_obj_p, /**< this argument object */
|
||||
const ecma_value_t *arguments_list_p, /**< list of arguments */
|
||||
uint32_t arguments_number) /**< number of arguments */
|
||||
{
|
||||
if (arguments_number == 0)
|
||||
{
|
||||
/* Even a 'this' argument is missing. */
|
||||
return ecma_op_function_call (func_obj_p,
|
||||
ECMA_VALUE_UNDEFINED,
|
||||
NULL,
|
||||
0);
|
||||
return ecma_op_function_call (func_obj_p, ECMA_VALUE_UNDEFINED, NULL, 0);
|
||||
}
|
||||
|
||||
return ecma_op_function_call (func_obj_p,
|
||||
@@ -311,7 +307,7 @@ ecma_builtin_function_prototype_object_call (ecma_object_t *func_obj_p , /**< th
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
static ecma_value_t
|
||||
ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**< this argument object */
|
||||
ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p, /**< this argument object */
|
||||
const ecma_value_t *arguments_list_p, /**< list of arguments */
|
||||
uint32_t arguments_number) /**< number of arguments */
|
||||
{
|
||||
@@ -353,18 +349,13 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**
|
||||
ecma_object_t *function_p;
|
||||
ecma_bound_function_t *bound_func_p;
|
||||
|
||||
if (arguments_number == 0
|
||||
|| (arguments_number == 1 && !ecma_is_value_integer_number (arguments_list_p[0])))
|
||||
if (arguments_number == 0 || (arguments_number == 1 && !ecma_is_value_integer_number (arguments_list_p[0])))
|
||||
{
|
||||
function_p = ecma_create_object (prototype_obj_p,
|
||||
sizeof (ecma_bound_function_t),
|
||||
ECMA_OBJECT_TYPE_BOUND_FUNCTION);
|
||||
function_p = ecma_create_object (prototype_obj_p, sizeof (ecma_bound_function_t), ECMA_OBJECT_TYPE_BOUND_FUNCTION);
|
||||
|
||||
/* 8. */
|
||||
bound_func_p = (ecma_bound_function_t *) function_p;
|
||||
ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function,
|
||||
this_arg_obj_p,
|
||||
0);
|
||||
ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function, this_arg_obj_p, 0);
|
||||
|
||||
bound_func_p->header.u.bound_function.args_len_or_this = ECMA_VALUE_UNDEFINED;
|
||||
|
||||
@@ -379,15 +370,11 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**
|
||||
|
||||
size_t obj_size = sizeof (ecma_bound_function_t) + (arguments_number * sizeof (ecma_value_t));
|
||||
|
||||
function_p = ecma_create_object (prototype_obj_p,
|
||||
obj_size,
|
||||
ECMA_OBJECT_TYPE_BOUND_FUNCTION);
|
||||
function_p = ecma_create_object (prototype_obj_p, obj_size, ECMA_OBJECT_TYPE_BOUND_FUNCTION);
|
||||
|
||||
/* 8. */
|
||||
bound_func_p = (ecma_bound_function_t *) function_p;
|
||||
ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function,
|
||||
this_arg_obj_p,
|
||||
0);
|
||||
ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function, this_arg_obj_p, 0);
|
||||
|
||||
/* NOTE: This solution provides temporary false data about the object's size
|
||||
but prevents GC from freeing it until it's not fully initialized. */
|
||||
@@ -413,9 +400,7 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**
|
||||
|
||||
ecma_string_t *len_string = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
|
||||
ecma_property_descriptor_t prop_desc;
|
||||
ecma_value_t status = ecma_op_object_get_own_property_descriptor (this_arg_obj_p,
|
||||
len_string,
|
||||
&prop_desc);
|
||||
ecma_value_t status = ecma_op_object_get_own_property_descriptor (this_arg_obj_p, len_string, &prop_desc);
|
||||
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
if (ECMA_IS_VALUE_ERROR (status))
|
||||
@@ -428,8 +413,7 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**
|
||||
if (ecma_is_value_true (status))
|
||||
{
|
||||
ecma_free_property_descriptor (&prop_desc);
|
||||
ecma_value_t len_value = ecma_op_object_get (this_arg_obj_p,
|
||||
len_string);
|
||||
ecma_value_t len_value = ecma_op_object_get (this_arg_obj_p, len_string);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (len_value))
|
||||
{
|
||||
@@ -552,9 +536,7 @@ ecma_builtin_function_prototype_dispatch_routine (uint8_t builtin_routine_id, /*
|
||||
}
|
||||
case ECMA_FUNCTION_PROTOTYPE_APPLY:
|
||||
{
|
||||
return ecma_builtin_function_prototype_object_apply (func_obj_p,
|
||||
arguments_list_p[0],
|
||||
arguments_list_p[1]);
|
||||
return ecma_builtin_function_prototype_object_apply (func_obj_p, arguments_list_p[0], arguments_list_p[1]);
|
||||
}
|
||||
case ECMA_FUNCTION_PROTOTYPE_CALL:
|
||||
{
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
#ifndef ECMA_BUILTIN_FUNCTION_PROTOTYPE_H
|
||||
#define ECMA_BUILTIN_FUNCTION_PROTOTYPE_H
|
||||
|
||||
ecma_value_t ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p,
|
||||
ecma_value_t arg1,
|
||||
ecma_value_t arg2);
|
||||
#include "ecma-globals.h"
|
||||
|
||||
ecma_value_t
|
||||
ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, ecma_value_t arg1, ecma_value_t arg2);
|
||||
|
||||
#endif /* !ECMA_BUILTIN_FUNCTION_PROTOTYPE_H */
|
||||
|
||||
@@ -23,21 +23,15 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.3.4.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_FUNCTION,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_FUNCTION, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* Number properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
0,
|
||||
ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING__EMPTY,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* Routine properties:
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-eval.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-lex-env.h"
|
||||
|
||||
#include "js-parser.h"
|
||||
#include "lit-magic-strings.h"
|
||||
|
||||
@@ -27,7 +28,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-function.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID function
|
||||
#define BUILTIN_UNDERSCORED_ID function
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -23,21 +23,15 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.3.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* Number properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_FUNCTION_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#include "ecma-builtin-helpers-macro-undefs.inc.h"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "ecma-function-object.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-generator-function.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID generator_function
|
||||
#define BUILTIN_UNDERSCORED_ID generator_function
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -53,7 +53,7 @@ ecma_builtin_generator_function_dispatch_call (const ecma_value_t *arguments_lis
|
||||
/**
|
||||
* Handle calling [[Construct]] of built-in GeneratorFunction object
|
||||
*
|
||||
* @return constructed generator function object - if success
|
||||
* @return constructed generator function object - if success
|
||||
* raised error otherwise
|
||||
*/
|
||||
ecma_value_t
|
||||
|
||||
@@ -22,19 +22,13 @@
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/* ECMA-262 v6, 25.2.2 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 25.2.2.1 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 25.2.2.2 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_GENERATOR,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_GENERATOR, ECMA_PROPERTY_FIXED)
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-iterator-object.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "opcodes.h"
|
||||
#include "vm-defines.h"
|
||||
@@ -29,8 +30,8 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
/**
|
||||
* This object has a custom dispatch function.
|
||||
*/
|
||||
* This object has a custom dispatch function.
|
||||
*/
|
||||
#define BUILTIN_CUSTOM_DISPATCH
|
||||
|
||||
/**
|
||||
@@ -45,7 +46,7 @@ enum
|
||||
} ecma_generator_operation_type_t;
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-generator-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID generator_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID generator_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -62,18 +63,17 @@ enum
|
||||
* Convert routine type to operation type..
|
||||
*/
|
||||
#define ECMA_GENERATOR_ROUTINE_TO_OPERATION(type) \
|
||||
((ecma_iterator_command_type_t) ((type) - ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT))
|
||||
((ecma_iterator_command_type_t) ((type) -ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT))
|
||||
|
||||
JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT)
|
||||
== ECMA_ITERATOR_NEXT,
|
||||
JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT) == ECMA_ITERATOR_NEXT,
|
||||
convert_ecma_generator_routine_next_to_ecma_iterator_next_failed);
|
||||
|
||||
JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW)
|
||||
== ECMA_ITERATOR_THROW,
|
||||
== ECMA_ITERATOR_THROW,
|
||||
convert_ecma_generator_routine_throw_to_ecma_iterator_throw_failed);
|
||||
|
||||
JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN)
|
||||
== ECMA_ITERATOR_RETURN,
|
||||
== ECMA_ITERATOR_RETURN,
|
||||
convert_ecma_generator_routine_return_to_ecma_iterator_return_failed);
|
||||
|
||||
/**
|
||||
@@ -161,9 +161,8 @@ ecma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_ob
|
||||
|
||||
if (byte_code_p[-1] == CBC_EXT_YIELD_ITERATOR)
|
||||
{
|
||||
ecma_value_t iterator = ecma_op_get_iterator (value,
|
||||
ECMA_VALUE_SYNC_ITERATOR,
|
||||
generator_object_p->frame_ctx.stack_top_p);
|
||||
ecma_value_t iterator =
|
||||
ecma_op_get_iterator (value, ECMA_VALUE_SYNC_ITERATOR, generator_object_p->frame_ctx.stack_top_p);
|
||||
ecma_free_value (value);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (iterator))
|
||||
@@ -195,11 +194,11 @@ ecma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_ob
|
||||
} /* ecma_builtin_generator_prototype_object_do */
|
||||
|
||||
/**
|
||||
* Dispatcher of the Generator built-in's routines
|
||||
*
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
* Dispatcher of the Generator built-in's routines
|
||||
*
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_builtin_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
|
||||
* identifier */
|
||||
|
||||
@@ -25,14 +25,10 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v6, 25.3.1.5 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_GENERATOR_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_GENERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 25.2.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_GENERATOR,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_GENERATOR, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-generator.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID generator
|
||||
#define BUILTIN_UNDERSCORED_ID generator
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -22,19 +22,13 @@
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/* ECMA-262 v6, 25.3.2.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_GENERATOR_FUNCTION,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_GENERATOR_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 25.3.2.3.2 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 25.3.2.3.3 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -21,14 +21,15 @@
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "jrt-bit-fields.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "jrt.h"
|
||||
#include "lit-char-helpers.h"
|
||||
#include "lit-magic-strings.h"
|
||||
#include "lit-strings.h"
|
||||
#include "vm.h"
|
||||
#include "jcontext.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "jrt-bit-fields.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
@@ -59,7 +60,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-global.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID global
|
||||
#define BUILTIN_UNDERSCORED_ID global
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -137,8 +138,7 @@ ecma_builtin_global_object_is_nan (ecma_number_t arg_num) /**< routine's first a
|
||||
static ecma_value_t
|
||||
ecma_builtin_global_object_is_finite (ecma_number_t arg_num) /**< routine's first argument */
|
||||
{
|
||||
bool is_finite = !(ecma_number_is_nan (arg_num)
|
||||
|| ecma_number_is_infinity (arg_num));
|
||||
bool is_finite = !(ecma_number_is_nan (arg_num) || ecma_number_is_infinity (arg_num));
|
||||
|
||||
return ecma_make_boolean_value (is_finite);
|
||||
} /* ecma_builtin_global_object_is_finite */
|
||||
@@ -161,22 +161,16 @@ ecma_builtin_global_object_character_is_in (uint32_t character, /**< character *
|
||||
* One bit for each character between 0 - 127.
|
||||
* Bit is set if the character is in the unescaped URI set.
|
||||
*/
|
||||
static const uint8_t unescaped_uri_set[16] =
|
||||
{
|
||||
0x0, 0x0, 0x0, 0x0, 0xda, 0xff, 0xff, 0xaf,
|
||||
0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47
|
||||
};
|
||||
static const uint8_t unescaped_uri_set[16] = { 0x0, 0x0, 0x0, 0x0, 0xda, 0xff, 0xff, 0xaf,
|
||||
0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47 };
|
||||
|
||||
/**
|
||||
* Unescaped URI component characters bitset:
|
||||
* One bit for each character between 0 - 127.
|
||||
* Bit is set if the character is in the unescaped component URI set.
|
||||
*/
|
||||
static const uint8_t unescaped_uri_component_set[16] =
|
||||
{
|
||||
0x0, 0x0, 0x0, 0x0, 0x82, 0x67, 0xff, 0x3,
|
||||
0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47
|
||||
};
|
||||
static const uint8_t unescaped_uri_component_set[16] = { 0x0, 0x0, 0x0, 0x0, 0x82, 0x67, 0xff, 0x3,
|
||||
0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47 };
|
||||
|
||||
/**
|
||||
* Format is a percent sign followed by two hex digits.
|
||||
@@ -283,8 +277,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /*
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_valid
|
||||
|| !lit_is_valid_utf8_string (octets, bytes_count, true))
|
||||
if (!is_valid || !lit_is_valid_utf8_string (octets, bytes_count, true))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 string"));
|
||||
@@ -293,8 +286,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /*
|
||||
lit_code_point_t cp;
|
||||
lit_read_code_point_from_utf8 (octets, bytes_count, &cp);
|
||||
|
||||
if (lit_is_code_point_utf16_high_surrogate (cp)
|
||||
|| lit_is_code_point_utf16_low_surrogate (cp))
|
||||
if (lit_is_code_point_utf16_high_surrogate (cp) || lit_is_code_point_utf16_low_surrogate (cp))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 codepoint"));
|
||||
@@ -431,11 +423,8 @@ ecma_builtin_global_object_encode_uri_helper (lit_utf8_byte_t *input_start_p, /*
|
||||
* Bit is set if the character does not need to be converted to %xx form.
|
||||
* These characters are: a-z A-Z 0-9 @ * _ + - . /
|
||||
*/
|
||||
static const uint8_t ecma_escape_set[16] =
|
||||
{
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0xec, 0xff, 0x3,
|
||||
0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x7
|
||||
};
|
||||
static const uint8_t ecma_escape_set[16] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0xec, 0xff, 0x3,
|
||||
0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x7 };
|
||||
|
||||
/**
|
||||
* The Global object's 'escape' routine
|
||||
@@ -502,7 +491,7 @@ ecma_builtin_global_object_escape (lit_utf8_byte_t *input_start_p, /**< routine'
|
||||
* @return number of characters processed during the escape resolve
|
||||
*/
|
||||
static uint8_t
|
||||
ecma_builtin_global_object_unescape_resolve_escape (const lit_utf8_byte_t *buffer_p, /**< character buffer */
|
||||
ecma_builtin_global_object_unescape_resolve_escape (const lit_utf8_byte_t *buffer_p, /**< character buffer */
|
||||
bool unicode_sequence, /**< true if unescaping unicode sequence */
|
||||
ecma_char_t *out_result_p) /**< [out] resolved character */
|
||||
{
|
||||
@@ -643,15 +632,12 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
|
||||
if (builtin_routine_id == ECMA_GLOBAL_PARSE_INT)
|
||||
{
|
||||
ret_value = ecma_number_parse_int (string_buff,
|
||||
string_buff_size,
|
||||
arguments_list_p[1]);
|
||||
ret_value = ecma_number_parse_int (string_buff, string_buff_size, arguments_list_p[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT (builtin_routine_id == ECMA_GLOBAL_PARSE_FLOAT);
|
||||
ret_value = ecma_number_parse_float (string_buff,
|
||||
string_buff_size);
|
||||
ret_value = ecma_number_parse_float (string_buff, string_buff_size);
|
||||
}
|
||||
|
||||
ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size);
|
||||
@@ -661,9 +647,7 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
|
||||
lit_utf8_size_t input_size = ecma_string_get_size (str_p);
|
||||
|
||||
JMEM_DEFINE_LOCAL_ARRAY (input_start_p,
|
||||
input_size + 1,
|
||||
lit_utf8_byte_t);
|
||||
JMEM_DEFINE_LOCAL_ARRAY (input_start_p, input_size + 1, lit_utf8_byte_t);
|
||||
|
||||
ecma_string_to_utf8_bytes (str_p, input_start_p, input_size);
|
||||
|
||||
@@ -686,8 +670,8 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
case ECMA_GLOBAL_DECODE_URI:
|
||||
case ECMA_GLOBAL_DECODE_URI_COMPONENT:
|
||||
{
|
||||
const uint8_t *uri_set = (builtin_routine_id == ECMA_GLOBAL_DECODE_URI ? unescaped_uri_set
|
||||
: unescaped_uri_component_set);
|
||||
const uint8_t *uri_set =
|
||||
(builtin_routine_id == ECMA_GLOBAL_DECODE_URI ? unescaped_uri_set : unescaped_uri_component_set);
|
||||
|
||||
ret_value = ecma_builtin_global_object_decode_uri_helper (input_start_p, input_size, uri_set);
|
||||
break;
|
||||
@@ -697,8 +681,8 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
JERRY_ASSERT (builtin_routine_id == ECMA_GLOBAL_ENCODE_URI
|
||||
|| builtin_routine_id == ECMA_GLOBAL_ENCODE_URI_COMPONENT);
|
||||
|
||||
const uint8_t *uri_set = (builtin_routine_id == ECMA_GLOBAL_ENCODE_URI ? unescaped_uri_set
|
||||
: unescaped_uri_component_set);
|
||||
const uint8_t *uri_set =
|
||||
(builtin_routine_id == ECMA_GLOBAL_ENCODE_URI ? unescaped_uri_set : unescaped_uri_component_set);
|
||||
|
||||
ret_value = ecma_builtin_global_object_encode_uri_helper (input_start_p, input_size, uri_set);
|
||||
break;
|
||||
|
||||
@@ -23,147 +23,101 @@
|
||||
* (property name, simple value, writable, enumerable, configurable) */
|
||||
|
||||
/* ECMA-262 v5, 15.1.1.3 */
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED,
|
||||
ECMA_VALUE_UNDEFINED,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED, ECMA_VALUE_UNDEFINED, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
/* ECMA-262 v5, 15.1.1.1 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_NAN,
|
||||
ECMA_BUILTIN_NUMBER_NAN,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_NAN, ECMA_BUILTIN_NUMBER_NAN, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.1.1.2 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL,
|
||||
ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL, ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.1.4.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_OBJECT_UL,
|
||||
ECMA_BUILTIN_ID_OBJECT,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_OBJECT_UL, ECMA_BUILTIN_ID_OBJECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.1.4.2 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_FUNCTION_UL,
|
||||
ECMA_BUILTIN_ID_FUNCTION,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_FUNCTION_UL, ECMA_BUILTIN_ID_FUNCTION, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.1.4.3 */
|
||||
#if JERRY_BUILTIN_ARRAY
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL, ECMA_BUILTIN_ID_ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_ARRAY */
|
||||
|
||||
#if JERRY_BUILTIN_STRING
|
||||
/* ECMA-262 v5, 15.1.4.4 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_STRING_UL,
|
||||
ECMA_BUILTIN_ID_STRING,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_STRING_UL, ECMA_BUILTIN_ID_STRING, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_STRING */
|
||||
|
||||
#if JERRY_BUILTIN_BOOLEAN
|
||||
/* ECMA-262 v5, 15.1.4.5 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_BOOLEAN_UL,
|
||||
ECMA_BUILTIN_ID_BOOLEAN,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_BOOLEAN_UL, ECMA_BUILTIN_ID_BOOLEAN, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_BOOLEAN */
|
||||
|
||||
#if JERRY_BUILTIN_NUMBER
|
||||
/* ECMA-262 v5, 15.1.4.6 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_NUMBER_UL,
|
||||
ECMA_BUILTIN_ID_NUMBER,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_NUMBER_UL, ECMA_BUILTIN_ID_NUMBER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_NUMBER */
|
||||
|
||||
#if JERRY_BUILTIN_DATE
|
||||
/* ECMA-262 v5, 15.1.4.7 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_DATE_UL,
|
||||
ECMA_BUILTIN_ID_DATE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_DATE_UL, ECMA_BUILTIN_ID_DATE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_DATE */
|
||||
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
/* ECMA-262 v5, 15.1.4.8 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_REGEXP_UL,
|
||||
ECMA_BUILTIN_ID_REGEXP,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_REGEXP_UL, ECMA_BUILTIN_ID_REGEXP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
|
||||
/* ECMA-262 v5, 15.1.4.9 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_ERROR_UL,
|
||||
ECMA_BUILTIN_ID_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_ERROR_UL, ECMA_BUILTIN_ID_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
#if JERRY_BUILTIN_ERRORS
|
||||
|
||||
/* ECMA-262 v5, 15.1.4.10 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_EVAL_ERROR_UL,
|
||||
ECMA_BUILTIN_ID_EVAL_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_BUILTIN_ID_EVAL_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.1.4.11 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_RANGE_ERROR_UL,
|
||||
ECMA_BUILTIN_ID_RANGE_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_RANGE_ERROR_UL, ECMA_BUILTIN_ID_RANGE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.1.4.12 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_REFERENCE_ERROR_UL,
|
||||
ECMA_BUILTIN_ID_REFERENCE_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_REFERENCE_ERROR_UL, ECMA_BUILTIN_ID_REFERENCE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.1.4.13 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_SYNTAX_ERROR_UL,
|
||||
ECMA_BUILTIN_ID_SYNTAX_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_SYNTAX_ERROR_UL, ECMA_BUILTIN_ID_SYNTAX_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.1.4.14 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_TYPE_ERROR_UL,
|
||||
ECMA_BUILTIN_ID_TYPE_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_TYPE_ERROR_UL, ECMA_BUILTIN_ID_TYPE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v5, 15.1.4.15 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_URI_ERROR_UL,
|
||||
ECMA_BUILTIN_ID_URI_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_URI_ERROR_UL, ECMA_BUILTIN_ID_URI_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_ERRORS */
|
||||
|
||||
#if JERRY_BUILTIN_MATH
|
||||
/* ECMA-262 v5, 15.1.5.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_MATH_UL,
|
||||
ECMA_BUILTIN_ID_MATH,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_MATH_UL, ECMA_BUILTIN_ID_MATH, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_MATH */
|
||||
#if JERRY_BUILTIN_REFLECT
|
||||
/* ECMA-262 v6, 26.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_REFLECT_UL,
|
||||
ECMA_BUILTIN_ID_REFLECT,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_REFLECT_UL, ECMA_BUILTIN_ID_REFLECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_REFLECT */
|
||||
|
||||
#if JERRY_BUILTIN_JSON
|
||||
/* ECMA-262 v5, 15.1.5.2 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U,
|
||||
ECMA_BUILTIN_ID_JSON,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U, ECMA_BUILTIN_ID_JSON, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_JSON */
|
||||
|
||||
#if JERRY_BUILTIN_ATOMICS
|
||||
/* ECMA-262 v5, 15.1.5.2 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_ATOMICS_U,
|
||||
ECMA_BUILTIN_ID_ATOMICS,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_ATOMICS_U, ECMA_BUILTIN_ID_ATOMICS, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_ATOMICS */
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_BUFFER_UL,
|
||||
ECMA_BUILTIN_ID_ARRAYBUFFER,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_BUILTIN_ID_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL,
|
||||
@@ -171,48 +125,28 @@ OBJECT_VALUE (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_INT8_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_INT8ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_INT8_ARRAY_UL, ECMA_BUILTIN_ID_INT8ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_UINT8ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_ARRAY_UL, ECMA_BUILTIN_ID_UINT8ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_INT16_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_INT16ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_INT16_ARRAY_UL, ECMA_BUILTIN_ID_INT16ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_UINT16_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_UINT16ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_UINT16_ARRAY_UL, ECMA_BUILTIN_ID_UINT16ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_INT32_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_INT32ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_INT32_ARRAY_UL, ECMA_BUILTIN_ID_INT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_UINT32_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_UINT32ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_UINT32_ARRAY_UL, ECMA_BUILTIN_ID_UINT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT32_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_FLOAT32ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, ECMA_BUILTIN_ID_FLOAT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
#if JERRY_NUMBER_TYPE_FLOAT64
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_FLOAT64ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, ECMA_BUILTIN_ID_FLOAT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
|
||||
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT64_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_BIGINT64ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, ECMA_BUILTIN_ID_BIGINT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_BIGUINT64ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, ECMA_BUILTIN_ID_BIGUINT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL,
|
||||
@@ -223,73 +157,49 @@ OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL,
|
||||
|
||||
#if JERRY_BUILTIN_CONTAINER
|
||||
/* ECMA-262 v6, 23.1.1.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_WEAKSET_UL,
|
||||
ECMA_BUILTIN_ID_WEAKSET,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_WEAKSET_UL, ECMA_BUILTIN_ID_WEAKSET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v6, 23.1.1.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_MAP_UL,
|
||||
ECMA_BUILTIN_ID_MAP,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_MAP_UL, ECMA_BUILTIN_ID_MAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v6, 23.1.1.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_SET_UL,
|
||||
ECMA_BUILTIN_ID_SET,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_SET_UL, ECMA_BUILTIN_ID_SET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v6, 23.1.1.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_WEAKMAP_UL,
|
||||
ECMA_BUILTIN_ID_WEAKMAP,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_WEAKMAP_UL, ECMA_BUILTIN_ID_WEAKMAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_CONTAINER */
|
||||
|
||||
#if JERRY_BUILTIN_WEAKREF
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_WEAKREF_UL,
|
||||
ECMA_BUILTIN_ID_WEAKREF,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_WEAKREF_UL, ECMA_BUILTIN_ID_WEAKREF, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_WEAKREF */
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_AGGREGATE_ERROR_UL,
|
||||
ECMA_BUILTIN_ID_AGGREGATE_ERROR,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_BUILTIN_ID_AGGREGATE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROMISE_UL,
|
||||
ECMA_BUILTIN_ID_PROMISE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROMISE_UL, ECMA_BUILTIN_ID_PROMISE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v6, 19.4.1.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_SYMBOL_UL,
|
||||
ECMA_BUILTIN_ID_SYMBOL,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_SYMBOL_UL, ECMA_BUILTIN_ID_SYMBOL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#if JERRY_BUILTIN_GLOBAL_THIS
|
||||
/* ECMA-262 v11, 18.1.1 */
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL_THIS_UL,
|
||||
ECMA_VALUE_GLOBAL_THIS,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL_THIS_UL, ECMA_VALUE_GLOBAL_THIS, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_GLOBAL_THIS */
|
||||
|
||||
#if JERRY_BUILTIN_DATAVIEW
|
||||
/* ECMA-262 v6, 23.1.1.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_DATAVIEW_UL,
|
||||
ECMA_BUILTIN_ID_DATAVIEW,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_BUILTIN_ID_DATAVIEW, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_DATAVIEW */
|
||||
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
/* ECMA-262 v6, 26.2.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROXY_UL,
|
||||
ECMA_BUILTIN_ID_PROXY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROXY_UL, ECMA_BUILTIN_ID_PROXY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
/* ECMA-262 v11, 20.2.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT_UL,
|
||||
ECMA_BUILTIN_ID_BIGINT,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT_UL, ECMA_BUILTIN_ID_BIGINT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
/* Routine properties:
|
||||
|
||||
@@ -18,18 +18,16 @@
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
#include "ecma-builtin-handlers.h"
|
||||
#include "ecma-promise-object.h"
|
||||
#include "ecma-iterator-object.h"
|
||||
#include "ecma-promise-object.h"
|
||||
|
||||
static const ecma_builtin_handler_t ecma_native_handlers[] =
|
||||
{
|
||||
static const ecma_builtin_handler_t ecma_native_handlers[] = {
|
||||
#define ECMA_NATIVE_HANDLER(id, handler, length) handler,
|
||||
#include "ecma-builtin-handlers.inc.h"
|
||||
#undef ECMA_NATIVE_HANDLER
|
||||
};
|
||||
|
||||
static const uint8_t ecma_native_handler_lengths[] =
|
||||
{
|
||||
static const uint8_t ecma_native_handler_lengths[] = {
|
||||
#define ECMA_NATIVE_HANDLER(id, handler, length) length,
|
||||
#include "ecma-builtin-handlers.inc.h"
|
||||
#undef ECMA_NATIVE_HANDLER
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-promise-object.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
|
||||
@@ -46,10 +46,8 @@ typedef enum
|
||||
*/
|
||||
#define ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT 2
|
||||
|
||||
ecma_builtin_handler_t
|
||||
ecma_builtin_handler_get (ecma_native_handler_id_t id);
|
||||
uint8_t
|
||||
ecma_builtin_handler_get_length (ecma_native_handler_id_t id);
|
||||
ecma_builtin_handler_t ecma_builtin_handler_get (ecma_native_handler_id_t id);
|
||||
uint8_t ecma_builtin_handler_get_length (ecma_native_handler_id_t id);
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#if JERRY_BUILTIN_DATE
|
||||
@@ -35,16 +36,12 @@
|
||||
/**
|
||||
* Day names
|
||||
*/
|
||||
const char day_names_p[7][3] =
|
||||
{
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||
};
|
||||
const char day_names_p[7][3] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
|
||||
|
||||
/**
|
||||
* Month names
|
||||
*/
|
||||
const char month_names_p[12][3] =
|
||||
{
|
||||
const char month_names_p[12][3] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
@@ -79,15 +76,10 @@ ecma_date_day_from_year (int32_t year) /**< year value */
|
||||
{
|
||||
if (JERRY_LIKELY (year >= 1970))
|
||||
{
|
||||
return (int32_t) (365 * (year - 1970)
|
||||
+ ((year - 1969) / 4)
|
||||
- ((year - 1901) / 100)
|
||||
+ ((year - 1601) / 400));
|
||||
return (int32_t) (365 * (year - 1970) + ((year - 1969) / 4) - ((year - 1901) / 100) + ((year - 1601) / 400));
|
||||
}
|
||||
|
||||
return (int32_t) (365 * (year - 1970)
|
||||
+ floor ((year - 1969) / 4.0)
|
||||
- floor ((year - 1901) / 100.0)
|
||||
return (int32_t) (365 * (year - 1970) + floor ((year - 1969) / 4.0) - floor ((year - 1901) / 100.0)
|
||||
+ floor ((year - 1601) / 400.0));
|
||||
} /* ecma_date_day_from_year */
|
||||
|
||||
@@ -102,8 +94,7 @@ ecma_date_day_from_year (int32_t year) /**< year value */
|
||||
static int
|
||||
ecma_date_days_in_year (int32_t year) /**< year */
|
||||
{
|
||||
if (year % 4 != 0
|
||||
|| (year % 100 == 0 && (year % 400 != 0)))
|
||||
if (year % 4 != 0 || (year % 100 == 0 && (year % 400 != 0)))
|
||||
{
|
||||
return ECMA_DATE_DAYS_IN_YEAR;
|
||||
}
|
||||
@@ -129,16 +120,34 @@ ecma_date_in_leap_year (int32_t year) /**< time value */
|
||||
/**
|
||||
* First days of months in normal and leap years
|
||||
*/
|
||||
static const uint16_t first_day_in_month[2][12] =
|
||||
{
|
||||
{
|
||||
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, /* normal year */
|
||||
}
|
||||
,
|
||||
{
|
||||
0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 /* leap year */
|
||||
}
|
||||
};
|
||||
static const uint16_t first_day_in_month[2][12] = { {
|
||||
0,
|
||||
31,
|
||||
59,
|
||||
90,
|
||||
120,
|
||||
151,
|
||||
181,
|
||||
212,
|
||||
243,
|
||||
273,
|
||||
304,
|
||||
334, /* normal year */
|
||||
},
|
||||
{
|
||||
0,
|
||||
31,
|
||||
60,
|
||||
91,
|
||||
121,
|
||||
152,
|
||||
182,
|
||||
213,
|
||||
244,
|
||||
274,
|
||||
305,
|
||||
335 /* leap year */
|
||||
} };
|
||||
|
||||
/**
|
||||
* Abstract operation: YearFromTime
|
||||
@@ -383,9 +392,7 @@ ecma_date_make_time (ecma_number_t hour, /**< hour value */
|
||||
ecma_number_t sec, /**< second value */
|
||||
ecma_number_t ms) /**< millisecond value */
|
||||
{
|
||||
if (!ecma_number_is_finite (hour)
|
||||
|| !ecma_number_is_finite (min)
|
||||
|| !ecma_number_is_finite (sec)
|
||||
if (!ecma_number_is_finite (hour) || !ecma_number_is_finite (min) || !ecma_number_is_finite (sec)
|
||||
|| !ecma_number_is_finite (ms))
|
||||
{
|
||||
return ecma_number_make_nan ();
|
||||
@@ -396,10 +403,7 @@ ecma_date_make_time (ecma_number_t hour, /**< hour value */
|
||||
ecma_number_t s = ecma_number_trunc (sec);
|
||||
ecma_number_t milli = ecma_number_trunc (ms);
|
||||
|
||||
return (ecma_number_t) ((h * ECMA_DATE_MS_PER_HOUR
|
||||
+ m * ECMA_DATE_MS_PER_MINUTE
|
||||
+ s * ECMA_DATE_MS_PER_SECOND
|
||||
+ milli));
|
||||
return h * ECMA_DATE_MS_PER_HOUR + m * ECMA_DATE_MS_PER_MINUTE + s * ECMA_DATE_MS_PER_SECOND + milli;
|
||||
} /* ecma_date_make_time */
|
||||
|
||||
/**
|
||||
@@ -416,9 +420,7 @@ ecma_date_make_day (ecma_number_t year, /**< year value */
|
||||
ecma_number_t date) /**< date value */
|
||||
{
|
||||
/* 1. */
|
||||
if (!ecma_number_is_finite (year)
|
||||
|| !ecma_number_is_finite (month)
|
||||
|| !ecma_number_is_finite (date)
|
||||
if (!ecma_number_is_finite (year) || !ecma_number_is_finite (month) || !ecma_number_is_finite (date)
|
||||
|| fabs (year) > INT32_MAX)
|
||||
{
|
||||
return ecma_number_make_nan ();
|
||||
@@ -441,9 +443,7 @@ ecma_date_make_day (ecma_number_t year, /**< year value */
|
||||
}
|
||||
|
||||
/* 7. */
|
||||
ecma_number_t days = (ecma_date_day_from_year (ym)
|
||||
+ first_day_in_month[ecma_date_in_leap_year (ym)][mn]
|
||||
+ (dt - 1));
|
||||
ecma_number_t days = (ecma_date_day_from_year (ym) + first_day_in_month[ecma_date_in_leap_year (ym)][mn] + (dt - 1));
|
||||
return days * ECMA_DATE_MS_PER_DAY;
|
||||
} /* ecma_date_make_day */
|
||||
|
||||
@@ -459,8 +459,7 @@ ecma_number_t
|
||||
ecma_date_make_date (ecma_number_t day, /**< day value */
|
||||
ecma_number_t time) /**< time value */
|
||||
{
|
||||
if (!ecma_number_is_finite (day)
|
||||
|| !ecma_number_is_finite (time))
|
||||
if (!ecma_number_is_finite (day) || !ecma_number_is_finite (time))
|
||||
{
|
||||
return ecma_number_make_nan ();
|
||||
}
|
||||
@@ -479,8 +478,7 @@ ecma_date_make_date (ecma_number_t day, /**< day value */
|
||||
ecma_number_t
|
||||
ecma_date_time_clip (ecma_number_t time) /**< time value */
|
||||
{
|
||||
if (!ecma_number_is_finite (time)
|
||||
|| fabs (time) > ECMA_DATE_MAX_VALUE)
|
||||
if (!ecma_number_is_finite (time) || fabs (time) > ECMA_DATE_MAX_VALUE)
|
||||
{
|
||||
return ecma_number_make_nan ();
|
||||
}
|
||||
@@ -674,14 +672,13 @@ ecma_date_to_string_format (ecma_number_t datetime_number, /**< datetime */
|
||||
buffer_p--;
|
||||
*buffer_p = (lit_utf8_byte_t) ((number % 10) + (int32_t) LIT_CHAR_0);
|
||||
number /= 10;
|
||||
}
|
||||
while (--number_length);
|
||||
} while (--number_length);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (dest_p <= date_buffer + date_buffer_length);
|
||||
|
||||
return ecma_make_string_value (ecma_new_ecma_string_from_ascii (date_buffer,
|
||||
(lit_utf8_size_t) (dest_p - date_buffer)));
|
||||
return ecma_make_string_value (
|
||||
ecma_new_ecma_string_from_ascii (date_buffer, (lit_utf8_size_t) (dest_p - date_buffer)));
|
||||
} /* ecma_date_to_string_format */
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,14 +14,15 @@
|
||||
*/
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -43,8 +44,7 @@ ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type, /**< native e
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
if (arguments_list_len != 0
|
||||
&& !ecma_is_value_undefined (arguments_list_p[0]))
|
||||
if (arguments_list_len != 0 && !ecma_is_value_undefined (arguments_list_p[0]))
|
||||
{
|
||||
ecma_string_t *message_string_p = ecma_op_to_string (arguments_list_p[0]);
|
||||
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
*/
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-helpers.h"
|
||||
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#if JERRY_BUILTIN_JSON
|
||||
|
||||
@@ -19,14 +19,15 @@
|
||||
#include "ecma-array-object.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "jmem.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "lit-magic-strings.h"
|
||||
|
||||
#include "jmem.h"
|
||||
#include "lit-char-helpers.h"
|
||||
#include "lit-magic-strings.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
@@ -61,8 +62,7 @@ ecma_builtin_helper_object_to_string_tag_helper (ecma_value_t tag_value) /**< st
|
||||
|
||||
lit_utf8_byte_t *buffer_ptr = str_buffer;
|
||||
|
||||
const lit_magic_string_id_t magic_string_ids[] =
|
||||
{
|
||||
const lit_magic_string_id_t magic_string_ids[] = {
|
||||
LIT_MAGIC_STRING_LEFT_SQUARE_CHAR,
|
||||
LIT_MAGIC_STRING_OBJECT,
|
||||
LIT_MAGIC_STRING_SPACE_CHAR,
|
||||
@@ -71,20 +71,23 @@ ecma_builtin_helper_object_to_string_tag_helper (ecma_value_t tag_value) /**< st
|
||||
/* Copy to buffer the "[object " string */
|
||||
for (uint32_t i = 0; i < sizeof (magic_string_ids) / sizeof (lit_magic_string_id_t); ++i)
|
||||
{
|
||||
buffer_ptr = lit_copy_magic_string_to_buffer (magic_string_ids[i], buffer_ptr,
|
||||
buffer_ptr = lit_copy_magic_string_to_buffer (magic_string_ids[i],
|
||||
buffer_ptr,
|
||||
(lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr));
|
||||
|
||||
JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size);
|
||||
}
|
||||
|
||||
/* Copy to buffer the #@@toStringTag# string */
|
||||
buffer_ptr += ecma_string_copy_to_cesu8_buffer (tag_str_p, buffer_ptr,
|
||||
buffer_ptr += ecma_string_copy_to_cesu8_buffer (tag_str_p,
|
||||
buffer_ptr,
|
||||
(lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr));
|
||||
|
||||
JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size);
|
||||
|
||||
/* Copy to buffer the "]" string */
|
||||
buffer_ptr = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_RIGHT_SQUARE_CHAR, buffer_ptr,
|
||||
buffer_ptr = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_RIGHT_SQUARE_CHAR,
|
||||
buffer_ptr,
|
||||
(lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr));
|
||||
|
||||
JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size);
|
||||
@@ -167,14 +170,10 @@ ecma_builtin_helper_object_to_string (const ecma_value_t this_arg) /**< this arg
|
||||
ecma_deref_object (obj_p);
|
||||
return ecma_builtin_helper_object_to_string_tag_helper (tag);
|
||||
}
|
||||
else if (builtin_tag != LIT_MAGIC_STRING_ARGUMENTS_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_FUNCTION_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_ERROR_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_BOOLEAN_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_NUMBER_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_STRING_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_DATE_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_REGEXP_UL
|
||||
else if (builtin_tag != LIT_MAGIC_STRING_ARGUMENTS_UL && builtin_tag != LIT_MAGIC_STRING_FUNCTION_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_ERROR_UL && builtin_tag != LIT_MAGIC_STRING_BOOLEAN_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_NUMBER_UL && builtin_tag != LIT_MAGIC_STRING_STRING_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_DATE_UL && builtin_tag != LIT_MAGIC_STRING_REGEXP_UL
|
||||
&& builtin_tag != LIT_MAGIC_STRING_ARRAY_UL)
|
||||
{
|
||||
builtin_tag = LIT_MAGIC_STRING_OBJECT_UL;
|
||||
@@ -393,10 +392,8 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *array_obj_p, /**< array *
|
||||
|
||||
/* 5.b.iii.3.b */
|
||||
/* This will always be a simple value since 'is_throw' is false, so no need to free. */
|
||||
ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p,
|
||||
*length_p + array_index,
|
||||
get_value,
|
||||
prop_flags);
|
||||
ecma_value_t put_comp =
|
||||
ecma_builtin_helper_def_prop_by_index (array_obj_p, *length_p + array_index, get_value, prop_flags);
|
||||
ecma_free_value (get_value);
|
||||
#if JERRY_ESNEXT
|
||||
if (ECMA_IS_VALUE_ERROR (put_comp))
|
||||
@@ -414,10 +411,7 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *array_obj_p, /**< array *
|
||||
|
||||
/* 5.c.i */
|
||||
/* This will always be a simple value since 'is_throw' is false, so no need to free. */
|
||||
ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p,
|
||||
(*length_p)++,
|
||||
value,
|
||||
prop_flags);
|
||||
ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p, (*length_p)++, value, prop_flags);
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
if (ECMA_IS_VALUE_ERROR (put_comp))
|
||||
@@ -686,10 +680,8 @@ ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_st
|
||||
{
|
||||
break;
|
||||
}
|
||||
uint32_t index = ecma_builtin_helper_string_find_index (original_str_p,
|
||||
search_str_p,
|
||||
(uint32_t) start_ends_with);
|
||||
ret_value = ecma_make_boolean_value (index == (uint32_t) start_ends_with);
|
||||
uint32_t index = ecma_builtin_helper_string_find_index (original_str_p, search_str_p, (uint32_t) start_ends_with);
|
||||
ret_value = ecma_make_boolean_value (index == (uint32_t) start_ends_with);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
@@ -772,7 +764,7 @@ ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, /**< index
|
||||
|
||||
while (!((size_t) (original_end_p - str_current_p) < search_str_size))
|
||||
{
|
||||
if (memcmp (str_current_p , search_str_utf8_p, search_str_size) == 0)
|
||||
if (memcmp (str_current_p, search_str_utf8_p, search_str_size) == 0)
|
||||
{
|
||||
match_found = start_pos;
|
||||
break;
|
||||
@@ -804,10 +796,7 @@ ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, /**< object */
|
||||
{
|
||||
if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))
|
||||
{
|
||||
return ecma_builtin_helper_def_prop (obj_p,
|
||||
ECMA_CREATE_DIRECT_UINT32_STRING (index),
|
||||
value,
|
||||
opts);
|
||||
return ecma_builtin_helper_def_prop (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), value, opts);
|
||||
}
|
||||
|
||||
ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);
|
||||
@@ -842,7 +831,7 @@ ecma_builtin_helper_calculate_index (ecma_value_t index, /**< relative index arg
|
||||
ecma_number_t relative_index;
|
||||
ecma_value_t conversion_result = ecma_op_to_integer (index, &relative_index);
|
||||
|
||||
/* 4. */
|
||||
/* 4. */
|
||||
if (ECMA_IS_VALUE_ERROR (conversion_result))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
@@ -893,9 +882,7 @@ ecma_builtin_helper_def_prop (ecma_object_t *obj_p, /**< object */
|
||||
|
||||
prop_desc.value = value;
|
||||
|
||||
return ecma_op_object_define_own_property (obj_p,
|
||||
name_p,
|
||||
&prop_desc);
|
||||
return ecma_op_object_define_own_property (obj_p, name_p, &prop_desc);
|
||||
} /* ecma_builtin_helper_def_prop */
|
||||
|
||||
/**
|
||||
@@ -909,16 +896,12 @@ ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p) /**< replace con
|
||||
{
|
||||
JERRY_ASSERT (ctx_p->string_p != NULL);
|
||||
JERRY_ASSERT (ctx_p->matched_p == NULL
|
||||
|| (ctx_p->matched_p >= ctx_p->string_p
|
||||
&& ctx_p->matched_p <= ctx_p->string_p + ctx_p->string_size));
|
||||
|| (ctx_p->matched_p >= ctx_p->string_p && ctx_p->matched_p <= ctx_p->string_p + ctx_p->string_size));
|
||||
|
||||
lit_utf8_size_t replace_size;
|
||||
uint8_t replace_flags = ECMA_STRING_FLAG_IS_ASCII;
|
||||
const lit_utf8_byte_t *replace_buf_p = ecma_string_get_chars (ctx_p->replace_str_p,
|
||||
&replace_size,
|
||||
NULL,
|
||||
NULL,
|
||||
&replace_flags);
|
||||
const lit_utf8_byte_t *replace_buf_p =
|
||||
ecma_string_get_chars (ctx_p->replace_str_p, &replace_size, NULL, NULL, &replace_flags);
|
||||
|
||||
const lit_utf8_byte_t *const replace_end_p = replace_buf_p + replace_size;
|
||||
const lit_utf8_byte_t *curr_p = replace_buf_p;
|
||||
@@ -1016,7 +999,7 @@ ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p) /**< replace con
|
||||
uint8_t idx = (uint8_t) (c - LIT_CHAR_0);
|
||||
if (curr_p < replace_end_p && lit_char_is_decimal_digit (*(curr_p)))
|
||||
{
|
||||
uint8_t two_digit_index = (uint8_t) (idx * 10 + (uint8_t) (*(curr_p) - LIT_CHAR_0));
|
||||
uint8_t two_digit_index = (uint8_t) (idx * 10 + (uint8_t) (*(curr_p) -LIT_CHAR_0));
|
||||
if (two_digit_index < capture_count)
|
||||
{
|
||||
idx = two_digit_index;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
#ifndef ECMA_BUILTIN_HELPERS_H
|
||||
#define ECMA_BUILTIN_HELPERS_H
|
||||
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-regexp-object.h"
|
||||
|
||||
@@ -41,45 +41,38 @@ typedef enum
|
||||
ECMA_STRING_ENDS_WITH /**< String.includes: ECMA-262 v6, 21.1.3.6 */
|
||||
} ecma_string_index_of_mode_t;
|
||||
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_object_to_string (const ecma_value_t this_arg);
|
||||
ecma_string_t *
|
||||
ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, ecma_length_t index);
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, ecma_length_t *length_p, ecma_value_t value);
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_uint32_index_normalize (ecma_value_t arg, uint32_t length, uint32_t *number_p);
|
||||
ecma_value_t ecma_builtin_helper_object_to_string (const ecma_value_t this_arg);
|
||||
ecma_string_t *ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, ecma_length_t index);
|
||||
ecma_value_t ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, ecma_length_t *length_p, ecma_value_t value);
|
||||
ecma_value_t ecma_builtin_helper_uint32_index_normalize (ecma_value_t arg, uint32_t length, uint32_t *number_p);
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_array_index_normalize (ecma_value_t arg, ecma_length_t length, ecma_length_t *number_p);
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_string_index_normalize (ecma_number_t index, uint32_t length, bool nan_to_zero);
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_str_p, ecma_value_t arg1,
|
||||
ecma_value_t arg2, ecma_string_index_of_mode_t mode);
|
||||
ecma_value_t ecma_builtin_helper_string_index_normalize (ecma_number_t index, uint32_t length, bool nan_to_zero);
|
||||
ecma_value_t ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_str_p,
|
||||
ecma_value_t arg1,
|
||||
ecma_value_t arg2,
|
||||
ecma_string_index_of_mode_t mode);
|
||||
uint32_t
|
||||
ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, ecma_string_t *search_str_p,
|
||||
uint32_t start_pos);
|
||||
ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, ecma_string_t *search_str_p, uint32_t start_pos);
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_def_prop (ecma_object_t *obj_p, ecma_string_t *name_p, ecma_value_t value, uint32_t opts);
|
||||
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, ecma_length_t index, ecma_value_t value,
|
||||
uint32_t opts);
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_calculate_index (ecma_value_t index, ecma_length_t length, ecma_length_t *out_index);
|
||||
ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, ecma_length_t index, ecma_value_t value, uint32_t opts);
|
||||
ecma_value_t ecma_builtin_helper_calculate_index (ecma_value_t index, ecma_length_t length, ecma_length_t *out_index);
|
||||
|
||||
/**
|
||||
* Context for replace substitutions
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
ecma_stringbuilder_t builder; /**< result string builder */
|
||||
const lit_utf8_byte_t *string_p; /**< source string */
|
||||
lit_utf8_size_t string_size; /**< source string size */
|
||||
const lit_utf8_byte_t *matched_p; /**< matched string */
|
||||
lit_utf8_size_t matched_size; /**< matcehd string size */
|
||||
lit_utf8_size_t match_byte_pos; /**< byte position of the match in the source string */
|
||||
uint16_t flags; /**< replace flags */
|
||||
ecma_stringbuilder_t builder; /**< result string builder */
|
||||
const lit_utf8_byte_t *string_p; /**< source string */
|
||||
lit_utf8_size_t string_size; /**< source string size */
|
||||
const lit_utf8_byte_t *matched_p; /**< matched string */
|
||||
lit_utf8_size_t matched_size; /**< matcehd string size */
|
||||
lit_utf8_size_t match_byte_pos; /**< byte position of the match in the source string */
|
||||
uint16_t flags; /**< replace flags */
|
||||
|
||||
/**
|
||||
* Capture results
|
||||
@@ -89,19 +82,17 @@ typedef struct
|
||||
#if JERRY_BUILTIN_REGEXP
|
||||
const ecma_regexp_capture_t *captures_p; /**< array of regexp capturing groups */
|
||||
#endif /* JERRY_BUILTIN_REGEXP */
|
||||
const ecma_collection_t *collection_p; /**< collection of captured substrings */
|
||||
const ecma_collection_t *collection_p; /**< collection of captured substrings */
|
||||
} u;
|
||||
|
||||
uint32_t capture_count; /**< number of captures in the capturing group array */
|
||||
ecma_string_t *replace_str_p; /**< replacement string */
|
||||
uint32_t capture_count; /**< number of captures in the capturing group array */
|
||||
ecma_string_t *replace_str_p; /**< replacement string */
|
||||
} ecma_replace_context_t;
|
||||
|
||||
void
|
||||
ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p);
|
||||
void ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p);
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
bool
|
||||
ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p);
|
||||
bool ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#if JERRY_BUILTIN_DATE
|
||||
@@ -114,35 +105,35 @@ ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p);
|
||||
*/
|
||||
|
||||
/** Hours in a day. */
|
||||
#define ECMA_DATE_HOURS_PER_DAY (24)
|
||||
#define ECMA_DATE_HOURS_PER_DAY (24)
|
||||
|
||||
/** Minutes in an hour. */
|
||||
#define ECMA_DATE_MINUTES_PER_HOUR (60)
|
||||
#define ECMA_DATE_MINUTES_PER_HOUR (60)
|
||||
|
||||
/** Seconds in a minute. */
|
||||
#define ECMA_DATE_SECONDS_PER_MINUTE (60)
|
||||
#define ECMA_DATE_SECONDS_PER_MINUTE (60)
|
||||
|
||||
/** Milliseconds in a second. */
|
||||
#define ECMA_DATE_MS_PER_SECOND (1000)
|
||||
#define ECMA_DATE_MS_PER_SECOND (1000)
|
||||
|
||||
/** ECMA_DATE_MS_PER_MINUTE == 60000 */
|
||||
#define ECMA_DATE_MS_PER_MINUTE (ECMA_DATE_MS_PER_SECOND * ECMA_DATE_SECONDS_PER_MINUTE)
|
||||
#define ECMA_DATE_MS_PER_MINUTE (ECMA_DATE_MS_PER_SECOND * ECMA_DATE_SECONDS_PER_MINUTE)
|
||||
|
||||
/** ECMA_DATE_MS_PER_HOUR == 3600000 */
|
||||
#define ECMA_DATE_MS_PER_HOUR (ECMA_DATE_MS_PER_MINUTE * ECMA_DATE_MINUTES_PER_HOUR)
|
||||
#define ECMA_DATE_MS_PER_HOUR (ECMA_DATE_MS_PER_MINUTE * ECMA_DATE_MINUTES_PER_HOUR)
|
||||
|
||||
/** ECMA_DATE_MS_PER_DAY == 86400000 */
|
||||
#define ECMA_DATE_MS_PER_DAY ((ECMA_DATE_MS_PER_HOUR * ECMA_DATE_HOURS_PER_DAY))
|
||||
#define ECMA_DATE_MS_PER_DAY ((ECMA_DATE_MS_PER_HOUR * ECMA_DATE_HOURS_PER_DAY))
|
||||
|
||||
#define ECMA_DATE_DAYS_IN_YEAR (365)
|
||||
#define ECMA_DATE_DAYS_IN_YEAR (365)
|
||||
|
||||
#define ECMA_DATE_DAYS_IN_LEAP_YEAR (366)
|
||||
#define ECMA_DATE_DAYS_IN_LEAP_YEAR (366)
|
||||
|
||||
/**
|
||||
* This gives a range of 8,640,000,000,000,000 milliseconds
|
||||
* to either side of 01 January, 1970 UTC.
|
||||
*/
|
||||
#define ECMA_DATE_MAX_VALUE 8.64e15
|
||||
#define ECMA_DATE_MAX_VALUE 8.64e15
|
||||
|
||||
/**
|
||||
* Timezone type.
|
||||
@@ -219,21 +210,20 @@ typedef struct
|
||||
ecma_stringbuilder_t result_builder;
|
||||
} ecma_json_stringify_context_t;
|
||||
|
||||
ecma_value_t ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p,
|
||||
lit_utf8_size_t string_size);
|
||||
ecma_value_t ecma_builtin_json_parse_buffer (const lit_utf8_byte_t *str_start_p, lit_utf8_size_t string_size);
|
||||
ecma_value_t ecma_builtin_json_stringify_no_opts (const ecma_value_t value);
|
||||
bool ecma_json_has_object_in_stack (ecma_json_occurrence_stack_item_t *stack_p, ecma_object_t *object_p);
|
||||
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_json_create_non_formatted_json (lit_utf8_byte_t left_bracket, lit_utf8_byte_t right_bracket,
|
||||
ecma_collection_t *partial_p);
|
||||
ecma_value_t ecma_builtin_helper_json_create_non_formatted_json (lit_utf8_byte_t left_bracket,
|
||||
lit_utf8_byte_t right_bracket,
|
||||
ecma_collection_t *partial_p);
|
||||
#endif /* JERRY_BUILTIN_JSON */
|
||||
|
||||
/* ecma-builtin-helper-error.c */
|
||||
|
||||
ecma_value_t
|
||||
ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type, const ecma_value_t *arguments_list_p,
|
||||
uint32_t arguments_list_len);
|
||||
ecma_value_t ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type,
|
||||
const ecma_value_t *arguments_list_p,
|
||||
uint32_t arguments_list_len);
|
||||
|
||||
/* ecma-builtin-helpers-sort.c */
|
||||
|
||||
|
||||
@@ -14,41 +14,38 @@
|
||||
*/
|
||||
|
||||
#ifndef BUILTIN_UNDERSCORED_ID
|
||||
# error "Please, define BUILTIN_UNDERSCORED_ID"
|
||||
#error "Please, define BUILTIN_UNDERSCORED_ID"
|
||||
#endif /* !BUILTIN_UNDERSCORED_ID */
|
||||
|
||||
#ifndef BUILTIN_INC_HEADER_NAME
|
||||
# error "Please, define BUILTIN_INC_HEADER_NAME"
|
||||
#error "Please, define BUILTIN_INC_HEADER_NAME"
|
||||
#endif /* !BUILTIN_INC_HEADER_NAME */
|
||||
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#define PASTE__(x, y) x ## y
|
||||
#define PASTE_(x, y) PASTE__ (x, y)
|
||||
#define PASTE(x, y) PASTE_ (x, y)
|
||||
#define PASTE__(x, y) x##y
|
||||
#define PASTE_(x, y) PASTE__ (x, y)
|
||||
#define PASTE(x, y) PASTE_ (x, y)
|
||||
|
||||
#define PROPERTY_DESCRIPTOR_LIST_NAME \
|
||||
PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _property_descriptor_list)
|
||||
#define DISPATCH_ROUTINE_ROUTINE_NAME \
|
||||
PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _dispatch_routine)
|
||||
#define PROPERTY_DESCRIPTOR_LIST_NAME PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _property_descriptor_list)
|
||||
#define DISPATCH_ROUTINE_ROUTINE_NAME PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _dispatch_routine)
|
||||
|
||||
#ifndef BUILTIN_CUSTOM_DISPATCH
|
||||
|
||||
#define ROUTINE_ARG(n) , ecma_value_t arg ## n
|
||||
#define ROUTINE_ARG_LIST_0 ecma_value_t this_arg
|
||||
#define ROUTINE_ARG_LIST_1 ROUTINE_ARG_LIST_0 ROUTINE_ARG(1)
|
||||
#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1 ROUTINE_ARG(2)
|
||||
#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2 ROUTINE_ARG(3)
|
||||
#define ROUTINE_ARG_LIST_NON_FIXED ROUTINE_ARG_LIST_0, \
|
||||
const ecma_value_t *arguments_list_p, uint32_t arguments_list_len
|
||||
#define ROUTINE_ARG(n) , ecma_value_t arg##n
|
||||
#define ROUTINE_ARG_LIST_0 ecma_value_t this_arg
|
||||
#define ROUTINE_ARG_LIST_1 ROUTINE_ARG_LIST_0 ROUTINE_ARG (1)
|
||||
#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1 ROUTINE_ARG (2)
|
||||
#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2 ROUTINE_ARG (3)
|
||||
#define ROUTINE_ARG_LIST_NON_FIXED ROUTINE_ARG_LIST_0, const ecma_value_t *arguments_list_p, uint32_t arguments_list_len
|
||||
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
|
||||
static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number);
|
||||
static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number);
|
||||
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
|
||||
static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number);
|
||||
static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number);
|
||||
#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \
|
||||
static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number);
|
||||
static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number);
|
||||
#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \
|
||||
static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0); \
|
||||
static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0); \
|
||||
static ecma_value_t c_setter_func_name (ROUTINE_ARG_LIST_1);
|
||||
#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \
|
||||
static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0);
|
||||
@@ -66,17 +63,14 @@
|
||||
enum
|
||||
{
|
||||
PASTE (ECMA_ROUTINE_START_, BUILTIN_UNDERSCORED_ID) = 0,
|
||||
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
|
||||
ECMA_ROUTINE_ ## name ## c_function_name,
|
||||
#define ROUTINE(name, c_function_name, args_number, length_prop_value) ECMA_ROUTINE_##name##c_function_name,
|
||||
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
|
||||
ECMA_ROUTINE_ ## name ## c_function_name,
|
||||
ECMA_ROUTINE_##name##c_function_name,
|
||||
#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \
|
||||
ECMA_ROUTINE_ ## name ## c_function_name,
|
||||
ECMA_ROUTINE_##name##c_function_name,
|
||||
#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \
|
||||
ECMA_ACCESSOR_ ## name ## c_getter_func_name, \
|
||||
ECMA_ACCESSOR_ ## name ## c_setter_func_name,
|
||||
#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \
|
||||
ECMA_ACCESSOR_ ## name ## c_getter_func_name,
|
||||
ECMA_ACCESSOR_##name##c_getter_func_name, ECMA_ACCESSOR_##name##c_setter_func_name,
|
||||
#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) ECMA_ACCESSOR_##name##c_getter_func_name,
|
||||
#include BUILTIN_INC_HEADER_NAME
|
||||
};
|
||||
|
||||
@@ -85,140 +79,80 @@ enum
|
||||
/**
|
||||
* Built-in property list of the built-in object.
|
||||
*/
|
||||
const ecma_builtin_property_descriptor_t PROPERTY_DESCRIPTOR_LIST_NAME[] =
|
||||
{
|
||||
const ecma_builtin_property_descriptor_t PROPERTY_DESCRIPTOR_LIST_NAME[] = {
|
||||
#ifndef BUILTIN_CUSTOM_DISPATCH
|
||||
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \
|
||||
ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \
|
||||
ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) },
|
||||
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \
|
||||
ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \
|
||||
ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) },
|
||||
#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) },
|
||||
#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ACCESSOR_ ## name ## c_getter_func_name \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ACCESSOR_##name##c_getter_func_name },
|
||||
#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ACCESSOR_READ_WRITE (ECMA_ACCESSOR_ ## name ## c_getter_func_name, \
|
||||
ECMA_ACCESSOR_ ## name ## c_setter_func_name) \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ACCESSOR_READ_WRITE (ECMA_ACCESSOR_##name##c_getter_func_name, ECMA_ACCESSOR_##name##c_setter_func_name) },
|
||||
#else /* BUILTIN_CUSTOM_DISPATCH */
|
||||
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \
|
||||
ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \
|
||||
ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) },
|
||||
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \
|
||||
ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \
|
||||
ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) },
|
||||
#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ROUTINE, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) },
|
||||
#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
c_getter_func_name \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
c_getter_func_name },
|
||||
#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ACCESSOR_READ_WRITE (c_getter_func_name, c_setter_func_name) \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ACCESSOR_READ_WRITE (c_getter_func_name, c_setter_func_name) },
|
||||
#endif /* !BUILTIN_CUSTOM_DISPATCH */
|
||||
#define OBJECT_VALUE(name, obj_builtin_id, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_OBJECT, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
obj_builtin_id \
|
||||
},
|
||||
{ name, ECMA_BUILTIN_PROPERTY_OBJECT, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, obj_builtin_id },
|
||||
#define SIMPLE_VALUE(name, simple_value, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_SIMPLE, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
simple_value \
|
||||
},
|
||||
{ name, ECMA_BUILTIN_PROPERTY_SIMPLE, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, simple_value },
|
||||
#define NUMBER_VALUE(name, number_value, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_NUMBER, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
number_value \
|
||||
},
|
||||
{ name, ECMA_BUILTIN_PROPERTY_NUMBER, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, number_value },
|
||||
#define STRING_VALUE(name, magic_string_id, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_STRING, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
magic_string_id \
|
||||
},
|
||||
{ name, ECMA_BUILTIN_PROPERTY_STRING, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, magic_string_id },
|
||||
#if JERRY_ESNEXT
|
||||
#define SYMBOL_VALUE(name, symbol) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_SYMBOL, \
|
||||
ECMA_PROPERTY_BUILT_IN_FIXED, \
|
||||
symbol \
|
||||
},
|
||||
#define SYMBOL_VALUE(name, symbol) { name, ECMA_BUILTIN_PROPERTY_SYMBOL, ECMA_PROPERTY_BUILT_IN_FIXED, symbol },
|
||||
#define INTRINSIC_PROPERTY(name, magic_string_id, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_INTRINSIC_PROPERTY, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
magic_string_id \
|
||||
},
|
||||
{ name, ECMA_BUILTIN_PROPERTY_INTRINSIC_PROPERTY, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, magic_string_id },
|
||||
#define ACCESSOR_BUILTIN_FUNCTION(name, getter_builtin_id, setter_builtin_id, prop_attributes) \
|
||||
{ \
|
||||
name, \
|
||||
ECMA_BUILTIN_PROPERTY_ACCESSOR_BUILTIN_FUNCTION, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ACCESSOR_READ_WRITE (getter_builtin_id, setter_builtin_id) \
|
||||
},
|
||||
{ name, \
|
||||
ECMA_BUILTIN_PROPERTY_ACCESSOR_BUILTIN_FUNCTION, \
|
||||
(prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
|
||||
ECMA_ACCESSOR_READ_WRITE (getter_builtin_id, setter_builtin_id) },
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#include BUILTIN_INC_HEADER_NAME
|
||||
{
|
||||
LIT_MAGIC_STRING__COUNT,
|
||||
ECMA_BUILTIN_PROPERTY_END,
|
||||
0,
|
||||
0
|
||||
}
|
||||
{ LIT_MAGIC_STRING__COUNT, ECMA_BUILTIN_PROPERTY_END, 0, 0 }
|
||||
};
|
||||
|
||||
#ifndef BUILTIN_CUSTOM_DISPATCH
|
||||
@@ -248,39 +182,39 @@ DISPATCH_ROUTINE_ROUTINE_NAME (uint8_t builtin_routine_id, /**< built-in wide ro
|
||||
{
|
||||
#define ROUTINE_ARG(n) (arguments_list[n - 1])
|
||||
#define ROUTINE_ARG_LIST_0
|
||||
#define ROUTINE_ARG_LIST_1 , ROUTINE_ARG(1)
|
||||
#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1, ROUTINE_ARG(2)
|
||||
#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2, ROUTINE_ARG(3)
|
||||
#define ROUTINE_ARG_LIST_1 , ROUTINE_ARG (1)
|
||||
#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1, ROUTINE_ARG (2)
|
||||
#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2, ROUTINE_ARG (3)
|
||||
#define ROUTINE_ARG_LIST_NON_FIXED , arguments_list, arguments_number
|
||||
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
|
||||
case ECMA_ROUTINE_ ## name ## c_function_name: \
|
||||
{ \
|
||||
return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \
|
||||
}
|
||||
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
|
||||
case ECMA_ROUTINE_##name##c_function_name: \
|
||||
{ \
|
||||
return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number); \
|
||||
}
|
||||
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
|
||||
case ECMA_ROUTINE_ ## name ## c_function_name: \
|
||||
{ \
|
||||
return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \
|
||||
}
|
||||
case ECMA_ROUTINE_##name##c_function_name: \
|
||||
{ \
|
||||
return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number); \
|
||||
}
|
||||
#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \
|
||||
case ECMA_ROUTINE_ ## name ## c_function_name: \
|
||||
{ \
|
||||
return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \
|
||||
}
|
||||
case ECMA_ROUTINE_##name##c_function_name: \
|
||||
{ \
|
||||
return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number); \
|
||||
}
|
||||
#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \
|
||||
case ECMA_ACCESSOR_ ## name ## c_getter_func_name: \
|
||||
{ \
|
||||
return c_getter_func_name(this_arg_value); \
|
||||
} \
|
||||
case ECMA_ACCESSOR_ ## name ## c_setter_func_name: \
|
||||
{ \
|
||||
return c_setter_func_name(this_arg_value ROUTINE_ARG_LIST_1); \
|
||||
}
|
||||
case ECMA_ACCESSOR_##name##c_getter_func_name: \
|
||||
{ \
|
||||
return c_getter_func_name (this_arg_value); \
|
||||
} \
|
||||
case ECMA_ACCESSOR_##name##c_setter_func_name: \
|
||||
{ \
|
||||
return c_setter_func_name (this_arg_value ROUTINE_ARG_LIST_1); \
|
||||
}
|
||||
#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \
|
||||
case ECMA_ACCESSOR_ ## name ## c_getter_func_name: \
|
||||
{ \
|
||||
return c_getter_func_name(this_arg_value); \
|
||||
}
|
||||
case ECMA_ACCESSOR_##name##c_getter_func_name: \
|
||||
{ \
|
||||
return c_getter_func_name (this_arg_value); \
|
||||
}
|
||||
#include BUILTIN_INC_HEADER_NAME
|
||||
#undef ROUTINE_ARG
|
||||
#undef ROUTINE_ARG_LIST_0
|
||||
|
||||
@@ -13,15 +13,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-container-object.h"
|
||||
#include "ecma-array-object.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-container-object.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
@@ -53,7 +54,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-intrinsic.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID intrinsic
|
||||
#define BUILTIN_UNDERSCORED_ID intrinsic
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -214,8 +215,8 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
|
||||
ecma_number_t *date_value_p = &((ecma_date_object_t *) ecma_get_object_from_value (this_arg))->date_value;
|
||||
#else /* !JERRY_ESNEXT */
|
||||
ecma_extended_object_t *arg_ext_object_p = (ecma_extended_object_t *) ecma_get_object_from_value (argument);
|
||||
ecma_number_t *date_value_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t,
|
||||
arg_ext_object_p->u.class_prop.u.date);
|
||||
ecma_number_t *date_value_p =
|
||||
ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, arg_ext_object_p->u.class_prop.u.date);
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
if (ecma_number_is_nan (*date_value_p))
|
||||
@@ -263,12 +264,10 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
|
||||
ecma_value_t result = ecma_make_string_value (ret_str_p);
|
||||
ecma_deref_ecma_string (to_str_p);
|
||||
return result;
|
||||
|
||||
}
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT
|
||||
|| builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT);
|
||||
JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT || builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT);
|
||||
|
||||
ecma_string_t *str_p = ecma_op_to_string (arguments_list_p[0]);
|
||||
|
||||
@@ -282,15 +281,12 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
|
||||
|
||||
if (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT)
|
||||
{
|
||||
result = ecma_number_parse_int (string_buff,
|
||||
string_buff_size,
|
||||
arguments_list_p[1]);
|
||||
result = ecma_number_parse_int (string_buff, string_buff_size, arguments_list_p[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT);
|
||||
result = ecma_number_parse_float (string_buff,
|
||||
string_buff_size);
|
||||
result = ecma_number_parse_float (string_buff, string_buff_size);
|
||||
}
|
||||
|
||||
ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size);
|
||||
|
||||
@@ -37,7 +37,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-iterator-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID iterator_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID iterator_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-array-object.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
@@ -22,11 +23,11 @@
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "jrt.h"
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "jrt.h"
|
||||
#include "lit-char-helpers.h"
|
||||
#include "lit-globals.h"
|
||||
|
||||
@@ -51,7 +52,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-json.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID json
|
||||
#define BUILTIN_UNDERSCORED_ID json
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/**
|
||||
@@ -134,9 +135,7 @@ ecma_builtin_json_parse_string (ecma_json_token_t *token_p) /**< token argument
|
||||
|
||||
if (*current_p == LIT_CHAR_BACKSLASH)
|
||||
{
|
||||
ecma_stringbuilder_append_raw (&result_builder,
|
||||
unappended_p,
|
||||
(lit_utf8_size_t) (current_p - unappended_p));
|
||||
ecma_stringbuilder_append_raw (&result_builder, unappended_p, (lit_utf8_size_t) (current_p - unappended_p));
|
||||
|
||||
current_p++;
|
||||
|
||||
@@ -212,9 +211,7 @@ ecma_builtin_json_parse_string (ecma_json_token_t *token_p) /**< token argument
|
||||
current_p++;
|
||||
}
|
||||
|
||||
ecma_stringbuilder_append_raw (&result_builder,
|
||||
unappended_p,
|
||||
(lit_utf8_size_t) (current_p - unappended_p));
|
||||
ecma_stringbuilder_append_raw (&result_builder, unappended_p, (lit_utf8_size_t) (current_p - unappended_p));
|
||||
token_p->u.string_p = ecma_stringbuilder_finalize (&result_builder);
|
||||
token_p->current_p = current_p + 1;
|
||||
token_p->type = TOKEN_STRING;
|
||||
@@ -260,8 +257,7 @@ ecma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument
|
||||
do
|
||||
{
|
||||
current_p++;
|
||||
}
|
||||
while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
|
||||
} while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
|
||||
}
|
||||
|
||||
if (current_p < end_p && *current_p == LIT_CHAR_DOT)
|
||||
@@ -276,8 +272,7 @@ ecma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument
|
||||
do
|
||||
{
|
||||
current_p++;
|
||||
}
|
||||
while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
|
||||
} while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
|
||||
}
|
||||
|
||||
if (current_p < end_p && (*current_p == LIT_CHAR_LOWERCASE_E || *current_p == LIT_CHAR_UPPERCASE_E))
|
||||
@@ -297,8 +292,7 @@ ecma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument
|
||||
do
|
||||
{
|
||||
current_p++;
|
||||
}
|
||||
while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
|
||||
} while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
|
||||
}
|
||||
|
||||
token_p->type = TOKEN_NUMBER;
|
||||
@@ -322,9 +316,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum
|
||||
token_p->type = TOKEN_INVALID;
|
||||
|
||||
while (current_p < end_p
|
||||
&& (*current_p == LIT_CHAR_SP
|
||||
|| *current_p == LIT_CHAR_CR
|
||||
|| *current_p == LIT_CHAR_LF
|
||||
&& (*current_p == LIT_CHAR_SP || *current_p == LIT_CHAR_CR || *current_p == LIT_CHAR_LF
|
||||
|| *current_p == LIT_CHAR_TAB))
|
||||
{
|
||||
current_p++;
|
||||
@@ -388,9 +380,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum
|
||||
lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_NULL);
|
||||
if (current_p + size <= end_p)
|
||||
{
|
||||
if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_NULL),
|
||||
current_p,
|
||||
size))
|
||||
if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_NULL), current_p, size))
|
||||
{
|
||||
token_p->type = TOKEN_NULL;
|
||||
token_p->current_p = current_p + size;
|
||||
@@ -404,9 +394,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum
|
||||
lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_TRUE);
|
||||
if (current_p + size <= end_p)
|
||||
{
|
||||
if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_TRUE),
|
||||
current_p,
|
||||
size))
|
||||
if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_TRUE), current_p, size))
|
||||
{
|
||||
token_p->type = TOKEN_TRUE;
|
||||
token_p->current_p = current_p + size;
|
||||
@@ -420,9 +408,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum
|
||||
lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_FALSE);
|
||||
if (current_p + size <= end_p)
|
||||
{
|
||||
if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_FALSE),
|
||||
current_p,
|
||||
size))
|
||||
if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_FALSE), current_p, size))
|
||||
{
|
||||
token_p->type = TOKEN_FALSE;
|
||||
token_p->current_p = current_p + size;
|
||||
@@ -454,10 +440,8 @@ ecma_builtin_json_define_value_property (ecma_object_t *obj_p, /**< this object
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
ecma_value_t value) /**< value */
|
||||
{
|
||||
ecma_value_t completion_value = ecma_builtin_helper_def_prop (obj_p,
|
||||
property_name_p,
|
||||
value,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
|
||||
ecma_value_t completion_value =
|
||||
ecma_builtin_helper_def_prop (obj_p, property_name_p, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_boolean (completion_value));
|
||||
} /* ecma_builtin_json_define_value_property */
|
||||
@@ -612,10 +596,9 @@ ecma_builtin_json_parse_value (ecma_json_token_t *token_p) /**< token argument *
|
||||
}
|
||||
} /* ecma_builtin_json_parse_value */
|
||||
|
||||
static ecma_value_t
|
||||
ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p,
|
||||
ecma_object_t *object_p,
|
||||
ecma_string_t *prop_name);
|
||||
static ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p,
|
||||
ecma_object_t *object_p,
|
||||
ecma_string_t *prop_name);
|
||||
|
||||
/**
|
||||
* Abstract operation InternalizeJSONProperty
|
||||
@@ -698,8 +681,8 @@ ecma_builtin_json_internalize_property (ecma_object_t *reviver_p, /**< reviver f
|
||||
/* 3.d */
|
||||
else
|
||||
{
|
||||
ecma_collection_t *props_p = ecma_op_object_get_enumerable_property_names (object_p,
|
||||
ECMA_ENUMERABLE_PROPERTY_KEYS);
|
||||
ecma_collection_t *props_p =
|
||||
ecma_op_object_get_enumerable_property_names (object_p, ECMA_ENUMERABLE_PROPERTY_KEYS);
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (props_p == NULL))
|
||||
{
|
||||
@@ -737,10 +720,7 @@ ecma_builtin_json_internalize_property (ecma_object_t *reviver_p, /**< reviver f
|
||||
arguments_list[1] = value;
|
||||
|
||||
/* 4. */
|
||||
ecma_value_t ret_value = ecma_op_function_call (reviver_p,
|
||||
ecma_make_object_value (holder_p),
|
||||
arguments_list,
|
||||
2);
|
||||
ecma_value_t ret_value = ecma_op_function_call (reviver_p, ecma_make_object_value (holder_p), arguments_list, 2);
|
||||
ecma_free_value (value);
|
||||
return ret_value;
|
||||
} /* ecma_builtin_json_internalize_property */
|
||||
@@ -755,10 +735,10 @@ ecma_builtin_json_internalize_property (ecma_object_t *reviver_p, /**< reviver f
|
||||
* @return ECMA_VALUE_TRUE - if no error occurred.
|
||||
* error if one of the operation failed.
|
||||
*/
|
||||
static
|
||||
ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p, /**< reviver function */
|
||||
ecma_object_t *object_p, /**< holder object */
|
||||
ecma_string_t *prop_name) /**< property name */
|
||||
static ecma_value_t
|
||||
ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p, /**< reviver function */
|
||||
ecma_object_t *object_p, /**< holder object */
|
||||
ecma_string_t *prop_name) /**< property name */
|
||||
{
|
||||
/* ES11: 2.b.iii.1 / 2.c.ii.1 */
|
||||
ecma_value_t new_element = ecma_builtin_json_internalize_property (reviver_p, object_p, prop_name);
|
||||
@@ -786,10 +766,8 @@ ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *revi
|
||||
else
|
||||
{
|
||||
/* ES11: 2.b.iii.3.a / 2.c.ii.3.a */
|
||||
ecma_value_t def_value = ecma_builtin_helper_def_prop (object_p,
|
||||
prop_name,
|
||||
new_element,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
|
||||
ecma_value_t def_value =
|
||||
ecma_builtin_helper_def_prop (object_p, prop_name, new_element, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
|
||||
ecma_free_value (new_element);
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
@@ -812,7 +790,7 @@ ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *revi
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p, /**< String to parse */
|
||||
ecma_builtin_json_parse_buffer (const lit_utf8_byte_t *str_start_p, /**< String to parse */
|
||||
lit_utf8_size_t string_size) /**< size of the string */
|
||||
{
|
||||
ecma_json_token_t token;
|
||||
@@ -834,7 +812,7 @@ ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p, /**< String
|
||||
}
|
||||
|
||||
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid JSON format"));
|
||||
} /*ecma_builtin_json_parse_buffer*/
|
||||
} /* ecma_builtin_json_parse_buffer */
|
||||
|
||||
/**
|
||||
* The JSON object's 'parse' routine
|
||||
@@ -939,9 +917,9 @@ ecma_builtin_json_quote (ecma_stringbuilder_t *builder_p, /**< builder for the r
|
||||
else if (c < LIT_CHAR_SP || should_escape)
|
||||
{
|
||||
/**
|
||||
* In ES10 we should escape high or low surrogate characters,
|
||||
* so we shouldn't append the unescaped character to the stringbuilder
|
||||
*/
|
||||
* In ES10 we should escape high or low surrogate characters,
|
||||
* so we shouldn't append the unescaped character to the stringbuilder
|
||||
*/
|
||||
uint8_t offset = should_escape ? LIT_UTF8_MAX_BYTES_IN_CODE_UNIT : 1;
|
||||
|
||||
ecma_stringbuilder_append_raw (builder_p,
|
||||
@@ -986,18 +964,15 @@ ecma_builtin_json_quote (ecma_stringbuilder_t *builder_p, /**< builder for the r
|
||||
}
|
||||
}
|
||||
|
||||
ecma_stringbuilder_append_raw (builder_p,
|
||||
regular_str_start_p,
|
||||
(lit_utf8_size_t) (str_end_p - regular_str_start_p));
|
||||
ecma_stringbuilder_append_raw (builder_p, regular_str_start_p, (lit_utf8_size_t) (str_end_p - regular_str_start_p));
|
||||
ecma_stringbuilder_append_byte (builder_p, LIT_CHAR_DOUBLE_QUOTE);
|
||||
|
||||
ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size);
|
||||
} /* ecma_builtin_json_quote */
|
||||
|
||||
static ecma_value_t
|
||||
ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
|
||||
ecma_object_t *holder_p,
|
||||
ecma_string_t *key_p);
|
||||
static ecma_value_t ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
|
||||
ecma_object_t *holder_p,
|
||||
ecma_string_t *key_p);
|
||||
|
||||
/**
|
||||
* Abstract operation 'SerializeJSONObject' defined in 24.3.2.3
|
||||
@@ -1272,9 +1247,8 @@ ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
|
||||
}
|
||||
|
||||
ecma_object_t *value_obj_p = ecma_get_object_from_value (to_object_value);
|
||||
ecma_value_t to_json = ecma_op_object_get_with_receiver (value_obj_p,
|
||||
ecma_get_magic_string (LIT_MAGIC_STRING_TO_JSON_UL),
|
||||
value);
|
||||
ecma_value_t to_json =
|
||||
ecma_op_object_get_with_receiver (value_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_TO_JSON_UL), value);
|
||||
|
||||
ecma_deref_object (value_obj_p);
|
||||
|
||||
@@ -1487,16 +1461,15 @@ ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*
|
||||
*/
|
||||
static ecma_value_t ecma_builtin_json_str_helper (ecma_json_stringify_context_t *context_p, /**< context argument */
|
||||
const ecma_value_t arg1) /**< object argument */
|
||||
static ecma_value_t
|
||||
ecma_builtin_json_str_helper (ecma_json_stringify_context_t *context_p, /**< context argument */
|
||||
const ecma_value_t arg1) /**< object argument */
|
||||
{
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
ecma_object_t *obj_wrapper_p = ecma_op_create_object_object_noarg ();
|
||||
ecma_string_t *empty_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
|
||||
ecma_value_t put_comp_val = ecma_builtin_helper_def_prop (obj_wrapper_p,
|
||||
empty_str_p,
|
||||
arg1,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
|
||||
ecma_value_t put_comp_val =
|
||||
ecma_builtin_helper_def_prop (obj_wrapper_p, empty_str_p, arg1, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_true (put_comp_val));
|
||||
|
||||
@@ -1556,9 +1529,9 @@ ecma_builtin_json_stringify_no_opts (const ecma_value_t value) /**< value to str
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
static ecma_value_t
|
||||
ecma_builtin_json_stringify (ecma_value_t arg1, /**< value */
|
||||
ecma_value_t arg2, /**< replacer */
|
||||
ecma_value_t arg3) /**< space */
|
||||
ecma_builtin_json_stringify (ecma_value_t arg1, /**< value */
|
||||
ecma_value_t arg2, /**< replacer */
|
||||
ecma_value_t arg3) /**< space */
|
||||
{
|
||||
ecma_json_stringify_context_t context;
|
||||
context.replacer_function_p = NULL;
|
||||
@@ -1750,8 +1723,8 @@ ecma_builtin_json_stringify (ecma_value_t arg1, /**< value */
|
||||
JMEM_DEFINE_LOCAL_ARRAY (space_buff, num_of_spaces, char);
|
||||
|
||||
memset (space_buff, LIT_CHAR_SP, (size_t) num_of_spaces);
|
||||
context.gap_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff,
|
||||
(lit_utf8_size_t) num_of_spaces);
|
||||
context.gap_str_p =
|
||||
ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff, (lit_utf8_size_t) num_of_spaces);
|
||||
|
||||
JMEM_FINALIZE_LOCAL_ARRAY (space_buff);
|
||||
}
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
/* ECMA-262 v6, 24.3.3 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_JSON_U,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_JSON_U, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* Routine properties:
|
||||
|
||||
@@ -37,7 +37,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-map-iterator-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID map_iterator_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID map_iterator_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
|
||||
#if JERRY_BUILTIN_CONTAINER
|
||||
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_MAP_ITERATOR_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MAP_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
#define BUILTIN_CUSTOM_DISPATCH
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-map-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID map_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID map_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -25,14 +25,10 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v6, 23.1.3.2 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_MAP,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_MAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v6, 23.1.3.13 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_MAP_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
@@ -44,15 +40,15 @@ ROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)
|
||||
ROUTINE (LIT_MAGIC_STRING_SET, ECMA_CONTAINER_ROUTINE_SET, 2, 2)
|
||||
ROUTINE (LIT_MAGIC_STRING_VALUES, ECMA_CONTAINER_ROUTINE_VALUES, 0, 0)
|
||||
ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_CONTAINER_ROUTINE_KEYS, 0, 0)
|
||||
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_ENTRIES, LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES,
|
||||
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_ENTRIES,
|
||||
LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES,
|
||||
INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,
|
||||
LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v6, 23.1.3.10 */
|
||||
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE,
|
||||
ECMA_CONTAINER_ROUTINE_SIZE_GETTER,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, ECMA_CONTAINER_ROUTINE_SIZE_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
#endif /* JERRY_BUILTIN_CONTAINER */
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
*/
|
||||
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-container-object.h"
|
||||
#include "ecma-exceptions.h"
|
||||
|
||||
#if JERRY_BUILTIN_CONTAINER
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-map.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID map
|
||||
#define BUILTIN_UNDERSCORED_ID map
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -25,27 +25,19 @@
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
/* ECMA-262 v6, 23.1.2 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
0,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v6, 23.1 */
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_MAP_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_MAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v6, 23.1.2.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_MAP_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_MAP_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v6, 23.1.2.2 */
|
||||
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
|
||||
ecma_builtin_map_species_get,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_map_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
#endif /* JERRY_BUILTIN_CONTAINER */
|
||||
|
||||
|
||||
@@ -23,14 +23,15 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-number-arithmetic.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "jrt.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#if defined (_WIN32)
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
#endif /* defined(_WIN32) */
|
||||
|
||||
#if JERRY_BUILTIN_MATH
|
||||
|
||||
@@ -79,11 +80,13 @@ enum
|
||||
ECMA_MATH_OBJECT_TANH, /* ECMA-262 v6, 20.2.2.34 */
|
||||
ECMA_MATH_OBJECT_TRUNC, /* ECMA-262 v6, 20.2.2.35 */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
ECMA_MATH_OBJECT_ATAN2, /* ECMA-262 v5, 15.8.2.5 */ /* first routine with 2 arguments */
|
||||
ECMA_MATH_OBJECT_ATAN2,
|
||||
/* ECMA-262 v5, 15.8.2.5 */ /* first routine with 2 arguments */
|
||||
#if JERRY_ESNEXT
|
||||
ECMA_MATH_OBJECT_IMUL, /* ECMA-262 v6, 20.2.2.19 */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
ECMA_MATH_OBJECT_POW, /* ECMA-262 v5, 15.8.2.13 */ /* last routine with 1 or 2 arguments*/
|
||||
ECMA_MATH_OBJECT_POW,
|
||||
/* ECMA-262 v5, 15.8.2.13 */ /* last routine with 1 or 2 arguments*/
|
||||
ECMA_MATH_OBJECT_MAX, /* ECMA-262 v5, 15.8.2.11 */
|
||||
ECMA_MATH_OBJECT_MIN, /* ECMA-262 v5, 15.8.2.12 */
|
||||
#if JERRY_ESNEXT
|
||||
@@ -93,7 +96,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-math.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID math
|
||||
#define BUILTIN_UNDERSCORED_ID math
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -151,8 +154,7 @@ ecma_builtin_math_object_max_min (bool is_max, /**< 'max' or 'min' operation */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ecma_number_is_zero (arg_num)
|
||||
&& ecma_number_is_zero (result_num))
|
||||
if (ecma_number_is_zero (arg_num) && ecma_number_is_zero (result_num))
|
||||
{
|
||||
bool is_negative = ecma_number_is_negative (arg_num);
|
||||
|
||||
@@ -358,8 +360,7 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi
|
||||
}
|
||||
}
|
||||
|
||||
if (builtin_routine_id >= ECMA_MATH_OBJECT_ATAN2
|
||||
&& arguments_number >= 2)
|
||||
if (builtin_routine_id >= ECMA_MATH_OBJECT_ATAN2 && arguments_number >= 2)
|
||||
{
|
||||
if (ecma_is_value_number (arguments_list[1]))
|
||||
{
|
||||
@@ -437,15 +438,11 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi
|
||||
#endif /* JERRY_ESNEXT */
|
||||
case ECMA_MATH_OBJECT_ROUND:
|
||||
{
|
||||
if (ecma_number_is_nan (x)
|
||||
|| ecma_number_is_zero (x)
|
||||
|| ecma_number_is_infinity (x)
|
||||
|| fmod (x, 1.0) == 0)
|
||||
if (ecma_number_is_nan (x) || ecma_number_is_zero (x) || ecma_number_is_infinity (x) || fmod (x, 1.0) == 0)
|
||||
{
|
||||
/* Do nothing. */
|
||||
}
|
||||
else if (ecma_number_is_negative (x)
|
||||
&& x >= -ECMA_NUMBER_HALF)
|
||||
else if (ecma_number_is_negative (x) && x >= -ECMA_NUMBER_HALF)
|
||||
{
|
||||
x = -ECMA_NUMBER_ZERO;
|
||||
}
|
||||
@@ -551,12 +548,12 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi
|
||||
case ECMA_MATH_OBJECT_CLZ32:
|
||||
{
|
||||
uint32_t n = ecma_number_to_uint32 (x);
|
||||
#if defined (__GNUC__) || defined (__clang__)
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
x = n ? __builtin_clz (n) : 32;
|
||||
#elif defined (_WIN32)
|
||||
#elif defined(_WIN32)
|
||||
unsigned long ret;
|
||||
x = _BitScanReverse (&ret, n) ? 31 - ret : 32;
|
||||
#else
|
||||
#else /* !(defined(__GNUC__) || defined(__clang__) || defined(_WIN32)) */
|
||||
x = 32;
|
||||
for (int i = 31; i >= 0; i--)
|
||||
{
|
||||
@@ -566,7 +563,7 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* defined (__GNUC__) || defined (__clang__) */
|
||||
break;
|
||||
}
|
||||
case ECMA_MATH_OBJECT_FROUND:
|
||||
|
||||
@@ -25,50 +25,32 @@
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
/* ECMA-262 v5, 15.8.1.1 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_E_U,
|
||||
ECMA_BUILTIN_NUMBER_E,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_E_U, ECMA_BUILTIN_NUMBER_E, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.8.1.2 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LN10_U,
|
||||
ECMA_BUILTIN_NUMBER_LN10,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LN10_U, ECMA_BUILTIN_NUMBER_LN10, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.8.1.3 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LN2_U,
|
||||
ECMA_BUILTIN_NUMBER_LN2,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LN2_U, ECMA_BUILTIN_NUMBER_LN2, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.8.1.4 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U,
|
||||
ECMA_BUILTIN_NUMBER_LOG2E,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U, ECMA_BUILTIN_NUMBER_LOG2E, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.8.1.5 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U,
|
||||
ECMA_BUILTIN_NUMBER_LOG10E,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U, ECMA_BUILTIN_NUMBER_LOG10E, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.8.1.6 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_PI_U,
|
||||
ECMA_BUILTIN_NUMBER_PI,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_PI_U, ECMA_BUILTIN_NUMBER_PI, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.8.1.7 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U,
|
||||
ECMA_BUILTIN_NUMBER_SQRT_1_2,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U, ECMA_BUILTIN_NUMBER_SQRT_1_2, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.8.1.8 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U,
|
||||
ECMA_BUILTIN_NUMBER_SQRT2,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U, ECMA_BUILTIN_NUMBER_SQRT2, ECMA_PROPERTY_FIXED)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
/* ECMA-262 v6, 20.2.1.9 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_MATH_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MATH_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* Routine properties:
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "jrt.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#if JERRY_BUILTIN_NUMBER
|
||||
@@ -53,7 +54,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-number-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID number_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID number_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -146,13 +147,9 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, /
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
uint32_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
static const lit_utf8_byte_t digit_chars[36] =
|
||||
{
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
|
||||
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z'
|
||||
};
|
||||
static const lit_utf8_byte_t digit_chars[36] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b',
|
||||
'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
|
||||
|
||||
uint32_t radix = 10;
|
||||
if (arguments_list_len > 0 && !ecma_is_value_undefined (arguments_list_p[0]))
|
||||
@@ -172,10 +169,8 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, /
|
||||
}
|
||||
}
|
||||
|
||||
if (ecma_number_is_nan (this_arg_number)
|
||||
|| ecma_number_is_infinity (this_arg_number)
|
||||
|| ecma_number_is_zero (this_arg_number)
|
||||
|| radix == 10)
|
||||
if (ecma_number_is_nan (this_arg_number) || ecma_number_is_infinity (this_arg_number)
|
||||
|| ecma_number_is_zero (this_arg_number) || radix == 10)
|
||||
{
|
||||
ecma_string_t *ret_str_p = ecma_new_ecma_string_from_number (this_arg_number);
|
||||
return ecma_make_string_value (ret_str_p);
|
||||
@@ -319,7 +314,7 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, /
|
||||
* Calculate where we have to put the radix point relative to the beginning of
|
||||
* the new digits. If the exponent is non-negative this will be right after the number.
|
||||
*/
|
||||
int point = exponent >= 0 ? magnitude + 1: buff_index - magnitude;
|
||||
int point = exponent >= 0 ? magnitude + 1 : buff_index - magnitude;
|
||||
|
||||
if (point < 0)
|
||||
{
|
||||
@@ -464,10 +459,10 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this_arg) /**< this
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NUMBER_ROUTINE_TO_FIXED, /**< Number.prototype.toFixed: ECMA-262 v11, 20.1.3.3 */
|
||||
NUMBER_ROUTINE_TO_FIXED, /**< Number.prototype.toFixed: ECMA-262 v11, 20.1.3.3 */
|
||||
NUMBER_ROUTINE_TO_EXPONENTIAL, /**< Number.prototype.toExponential: ECMA-262 v11, 20.1.3.2 */
|
||||
NUMBER_ROUTINE_TO_PRECISION, /**< Number.prototype.toPrecision: ECMA-262 v11, 20.1.3.5 */
|
||||
NUMBER_ROUTINE__COUNT, /**< count of the modes */
|
||||
NUMBER_ROUTINE_TO_PRECISION, /**< Number.prototype.toPrecision: ECMA-262 v11, 20.1.3.5 */
|
||||
NUMBER_ROUTINE__COUNT, /**< count of the modes */
|
||||
} number_routine_mode_t;
|
||||
|
||||
/**
|
||||
@@ -478,8 +473,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
|
||||
ecma_value_t arg, /**< routine's argument */
|
||||
number_routine_mode_t mode) /**< number routine mode */
|
||||
{
|
||||
if (ecma_is_value_undefined (arg)
|
||||
&& mode == NUMBER_ROUTINE_TO_PRECISION)
|
||||
if (ecma_is_value_undefined (arg) && mode == NUMBER_ROUTINE_TO_PRECISION)
|
||||
{
|
||||
return ecma_builtin_number_prototype_object_to_string (this_num, NULL, 0);
|
||||
}
|
||||
@@ -493,8 +487,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
|
||||
}
|
||||
|
||||
/* Argument boundary check for toFixed method */
|
||||
if (mode == NUMBER_ROUTINE_TO_FIXED
|
||||
&& (arg_num <= -1 || arg_num >= 101))
|
||||
if (mode == NUMBER_ROUTINE_TO_FIXED && (arg_num <= -1 || arg_num >= 101))
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100"));
|
||||
}
|
||||
@@ -561,14 +554,12 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
|
||||
}
|
||||
|
||||
/* Argument boundary check for toExponential and toPrecision methods */
|
||||
if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL
|
||||
&& (arg_num <= -1 || arg_num >= 101))
|
||||
if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL && (arg_num <= -1 || arg_num >= 101))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100"));
|
||||
}
|
||||
else if (mode == NUMBER_ROUTINE_TO_PRECISION
|
||||
&& (arg_num < 1 || arg_num > 100))
|
||||
else if (mode == NUMBER_ROUTINE_TO_PRECISION && (arg_num < 1 || arg_num > 100))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Precision digits must be between 1 and 100"));
|
||||
@@ -582,8 +573,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
|
||||
arg_int = (int32_t) num_of_digits - 1;
|
||||
}
|
||||
|
||||
if (mode == NUMBER_ROUTINE_TO_FIXED
|
||||
&& exponent > 21)
|
||||
if (mode == NUMBER_ROUTINE_TO_FIXED && exponent > 21)
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
|
||||
@@ -606,16 +596,11 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
|
||||
digits_to_keep += 1;
|
||||
}
|
||||
|
||||
num_of_digits = ecma_builtin_number_prototype_helper_round (digits,
|
||||
num_of_digits,
|
||||
digits_to_keep,
|
||||
&exponent,
|
||||
false);
|
||||
num_of_digits = ecma_builtin_number_prototype_helper_round (digits, num_of_digits, digits_to_keep, &exponent, false);
|
||||
|
||||
/* toExponent routine and toPrecision cases where the exponent > precision or exponent < -5 */
|
||||
if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL
|
||||
|| (mode == NUMBER_ROUTINE_TO_PRECISION
|
||||
&& (exponent < -5 || exponent > arg_int)))
|
||||
|| (mode == NUMBER_ROUTINE_TO_PRECISION && (exponent < -5 || exponent > arg_int)))
|
||||
{
|
||||
/* Append first digit */
|
||||
ecma_stringbuilder_append_byte (&builder, *digits);
|
||||
@@ -664,13 +649,11 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
|
||||
|
||||
if (mode == NUMBER_ROUTINE_TO_FIXED)
|
||||
{
|
||||
result_digits = ((exponent > 0) ? (lit_utf8_size_t) (exponent + arg_int)
|
||||
: (lit_utf8_size_t) (arg_int + 1));
|
||||
result_digits = ((exponent > 0) ? (lit_utf8_size_t) (exponent + arg_int) : (lit_utf8_size_t) (arg_int + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
result_digits = ((exponent <= 0) ? (lit_utf8_size_t) (1 - exponent + arg_int)
|
||||
: (lit_utf8_size_t) arg_int);
|
||||
result_digits = ((exponent <= 0) ? (lit_utf8_size_t) (1 - exponent + arg_int) : (lit_utf8_size_t) arg_int);
|
||||
}
|
||||
|
||||
/* Number of digits we copied from digits array */
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.7.4.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_NUMBER,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_NUMBER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-number-object.h"
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_BUILTIN_NUMBER
|
||||
@@ -52,7 +53,7 @@ enum
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-number.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID number
|
||||
#define BUILTIN_UNDERSCORED_ID number
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -24,64 +24,42 @@
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
|
||||
/* ECMA-262 v5, 15.7.3.4 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_NAN,
|
||||
ECMA_BUILTIN_NUMBER_NAN,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_NAN, ECMA_BUILTIN_NUMBER_NAN, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.7.3.2 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_MAX_VALUE_U,
|
||||
ECMA_BUILTIN_NUMBER_MAX,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_MAX_VALUE_U, ECMA_BUILTIN_NUMBER_MAX, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.7.3.3 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_MIN_VALUE_U,
|
||||
ECMA_BUILTIN_NUMBER_MIN,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_MIN_VALUE_U, ECMA_BUILTIN_NUMBER_MIN, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.7.3.5 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_POSITIVE_INFINITY_U,
|
||||
ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v5, 15.7.3.6 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U,
|
||||
ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY, ECMA_PROPERTY_FIXED)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/* ECMA-262 v6, 20.1.2.1 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_EPSILON_U,
|
||||
ECMA_BUILTIN_NUMBER_EPSILON,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_EPSILON_U, ECMA_BUILTIN_NUMBER_EPSILON, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v6, 20.1.2.6 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U,
|
||||
ECMA_BUILTIN_NUMBER_MAX_SAFE_INTEGER,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U, ECMA_BUILTIN_NUMBER_MAX_SAFE_INTEGER, ECMA_PROPERTY_FIXED)
|
||||
|
||||
/* ECMA-262 v6, 20.1.2.8 */
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_MIN_SAFE_INTEGER_U,
|
||||
ECMA_BUILTIN_NUMBER_MIN_SAFE_INTEGER,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_MIN_SAFE_INTEGER_U, ECMA_BUILTIN_NUMBER_MIN_SAFE_INTEGER, ECMA_PROPERTY_FIXED)
|
||||
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_NUMBER_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_NUMBER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.7.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_NUMBER_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
#endif /* JERRY_BUILTIN_NUMBER */
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-builtin-object.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
#include "ecma-string-object.h"
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
@@ -60,7 +61,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-object-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID object_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID object_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -247,11 +248,8 @@ ecma_builtin_object_prototype_define_getter_setter (ecma_value_t this_arg, /**<
|
||||
|
||||
/* 3. */
|
||||
ecma_property_descriptor_t desc = ecma_make_empty_property_descriptor ();
|
||||
desc.flags |= (JERRY_PROP_IS_ENUMERABLE
|
||||
| JERRY_PROP_IS_CONFIGURABLE
|
||||
| JERRY_PROP_IS_ENUMERABLE_DEFINED
|
||||
| JERRY_PROP_IS_CONFIGURABLE_DEFINED
|
||||
| JERRY_PROP_SHOULD_THROW);
|
||||
desc.flags |= (JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE_DEFINED
|
||||
| JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_SHOULD_THROW);
|
||||
|
||||
if (define_getter)
|
||||
{
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.2.4.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_OBJECT,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_OBJECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
ACCESSOR_READ_WRITE (LIT_MAGIC_STRING__PROTO__,
|
||||
ECMA_OBJECT_PROTOTYPE_GET_PROTO,
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-builtin-object.h"
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-array-object.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
@@ -22,14 +24,15 @@
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
#include "ecma-objects-general.h"
|
||||
|
||||
#include "jrt.h"
|
||||
#include "ecma-builtin-object.h"
|
||||
#if JERRY_ESNEXT
|
||||
#include "ecma-iterator-object.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-iterator-object.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
@@ -82,7 +85,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-object.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID object
|
||||
#define BUILTIN_UNDERSCORED_ID object
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -104,8 +107,7 @@ ecma_value_t
|
||||
ecma_builtin_object_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
uint32_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
if (arguments_list_len == 0
|
||||
|| ecma_is_value_undefined (arguments_list_p[0])
|
||||
if (arguments_list_len == 0 || ecma_is_value_undefined (arguments_list_p[0])
|
||||
|| ecma_is_value_null (arguments_list_p[0]))
|
||||
{
|
||||
return ecma_make_object_value (ecma_op_create_object_object_noarg ());
|
||||
@@ -126,16 +128,14 @@ ecma_builtin_object_dispatch_construct (const ecma_value_t *arguments_list_p, /*
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_CONTEXT (current_new_target_p) != ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT))
|
||||
{
|
||||
ecma_object_t *prototype_obj_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
|
||||
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
ecma_object_t *prototype_obj_p =
|
||||
ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
if (JERRY_UNLIKELY (prototype_obj_p == NULL))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
|
||||
0,
|
||||
ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_object_t *object_p = ecma_create_object (prototype_obj_p, 0, ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
return ecma_make_object_value (object_p);
|
||||
@@ -374,9 +374,7 @@ ecma_builtin_object_set_integrity_level (ecma_object_t *obj_p, /**< object */
|
||||
prop_desc.flags |= JERRY_PROP_SHOULD_THROW;
|
||||
|
||||
/* 8.a.i */
|
||||
ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p,
|
||||
property_name_p,
|
||||
&prop_desc);
|
||||
ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, property_name_p, &prop_desc);
|
||||
|
||||
ecma_free_property_descriptor (&prop_desc);
|
||||
|
||||
@@ -425,9 +423,7 @@ ecma_builtin_object_set_integrity_level (ecma_object_t *obj_p, /**< object */
|
||||
prop_desc.flags |= JERRY_PROP_SHOULD_THROW;
|
||||
|
||||
/* 9.3 */
|
||||
ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p,
|
||||
property_name_p,
|
||||
&prop_desc);
|
||||
ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, property_name_p, &prop_desc);
|
||||
|
||||
ecma_free_property_descriptor (&prop_desc);
|
||||
|
||||
@@ -440,7 +436,6 @@ ecma_builtin_object_set_integrity_level (ecma_object_t *obj_p, /**< object */
|
||||
|
||||
ecma_free_value (define_own_prop_ret);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ecma_collection_free (props_p);
|
||||
@@ -636,8 +631,7 @@ ecma_builtin_object_test_integrity_level (ecma_object_t *obj_p, /**< routine's a
|
||||
|
||||
/* 2.b for isFrozen */
|
||||
/* 2.b for isSealed, 2.c for isFrozen */
|
||||
if ((mode == ECMA_OBJECT_ROUTINE_IS_FROZEN && is_writable_data)
|
||||
|| is_configurable)
|
||||
if ((mode == ECMA_OBJECT_ROUTINE_IS_FROZEN && is_writable_data) || is_configurable)
|
||||
{
|
||||
ret_value = ECMA_VALUE_FALSE;
|
||||
break;
|
||||
@@ -855,9 +849,7 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine
|
||||
ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (buffer_p[i]);
|
||||
|
||||
ecma_property_descriptor_t prop_desc;
|
||||
ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (props_p,
|
||||
prop_name_p,
|
||||
&prop_desc);
|
||||
ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (props_p, prop_name_p, &prop_desc);
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
if (ECMA_IS_VALUE_ERROR (get_desc))
|
||||
@@ -878,8 +870,8 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ecma_value_t conv_result = ecma_op_to_property_descriptor (desc_obj,
|
||||
&property_descriptors[property_descriptor_number]);
|
||||
ecma_value_t conv_result =
|
||||
ecma_op_to_property_descriptor (desc_obj, &property_descriptors[property_descriptor_number]);
|
||||
|
||||
property_descriptors[property_descriptor_number].flags |= JERRY_PROP_SHOULD_THROW;
|
||||
|
||||
@@ -906,9 +898,8 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine
|
||||
{
|
||||
ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (enum_prop_names->buffer_p[i]);
|
||||
|
||||
ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p,
|
||||
prop_name_p,
|
||||
&property_descriptors[i]);
|
||||
ecma_value_t define_own_prop_ret =
|
||||
ecma_op_object_define_own_property (obj_p, prop_name_p, &property_descriptors[i]);
|
||||
if (ECMA_IS_VALUE_ERROR (define_own_prop_ret))
|
||||
{
|
||||
goto cleanup;
|
||||
@@ -922,9 +913,7 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine
|
||||
|
||||
cleanup:
|
||||
/* Clean up. */
|
||||
for (uint32_t index = 0;
|
||||
index < property_descriptor_number;
|
||||
index++)
|
||||
for (uint32_t index = 0; index < property_descriptor_number; index++)
|
||||
{
|
||||
ecma_free_property_descriptor (&property_descriptors[index]);
|
||||
}
|
||||
@@ -1011,9 +1000,7 @@ ecma_builtin_object_object_define_property (ecma_object_t *obj_p, /**< routine's
|
||||
|
||||
prop_desc.flags |= JERRY_PROP_SHOULD_THROW;
|
||||
|
||||
ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p,
|
||||
name_str_p,
|
||||
&prop_desc);
|
||||
ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, name_str_p, &prop_desc);
|
||||
|
||||
ecma_free_property_descriptor (&prop_desc);
|
||||
ecma_free_value (conv_result);
|
||||
@@ -1272,10 +1259,8 @@ ecma_builtin_object_from_entries (ecma_value_t iterator) /**< object's iterator
|
||||
if (property_p == NULL)
|
||||
{
|
||||
ecma_property_value_t *prop;
|
||||
prop = ecma_create_named_data_property (obj_p,
|
||||
property_key,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,
|
||||
NULL);
|
||||
prop =
|
||||
ecma_create_named_data_property (obj_p, property_key, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);
|
||||
prop->value = ecma_copy_value_if_not_object (value);
|
||||
}
|
||||
else
|
||||
@@ -1331,8 +1316,7 @@ ecma_op_object_get_own_property_keys (ecma_value_t this_arg, /**< this argument
|
||||
|
||||
if (type == ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_SYMBOLS)
|
||||
{
|
||||
filter = (JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS
|
||||
| JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES);
|
||||
filter = (JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS | JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES);
|
||||
}
|
||||
|
||||
ecma_collection_t *props_p = ecma_op_object_own_property_keys (obj_p, filter);
|
||||
@@ -1488,8 +1472,8 @@ ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
JERRY_ASSERT (builtin_routine_id - ECMA_OBJECT_ROUTINE_KEYS < ECMA_ENUMERABLE_PROPERTY__COUNT);
|
||||
|
||||
const int option = builtin_routine_id - ECMA_OBJECT_ROUTINE_KEYS;
|
||||
result = ecma_builtin_object_object_keys_values_helper (obj_p,
|
||||
(ecma_enumerable_property_names_options_t) option);
|
||||
result =
|
||||
ecma_builtin_object_object_keys_values_helper (obj_p, (ecma_enumerable_property_names_options_t) option);
|
||||
break;
|
||||
}
|
||||
case ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTOR:
|
||||
|
||||
@@ -15,22 +15,20 @@
|
||||
#ifndef ECMA_BUILTIN_OBJECT_H
|
||||
#define ECMA_BUILTIN_OBJECT_H
|
||||
|
||||
#include "ecma-globals.h"
|
||||
|
||||
ecma_value_t ecma_builtin_object_object_get_prototype_of (ecma_object_t *obj_p);
|
||||
|
||||
ecma_value_t ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1,
|
||||
ecma_value_t arg2);
|
||||
ecma_value_t ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1, ecma_value_t arg2);
|
||||
|
||||
ecma_value_t ecma_builtin_object_object_set_proto (ecma_value_t arg1,
|
||||
ecma_value_t arg2);
|
||||
ecma_value_t ecma_builtin_object_object_set_proto (ecma_value_t arg1, ecma_value_t arg2);
|
||||
|
||||
ecma_value_t ecma_builtin_object_object_prevent_extensions (ecma_object_t *obj_p);
|
||||
|
||||
ecma_value_t ecma_builtin_object_object_is_extensible (ecma_object_t *obj_p);
|
||||
|
||||
ecma_value_t ecma_builtin_object_object_get_own_property_descriptor (ecma_object_t *obj_p,
|
||||
ecma_string_t *name_str_p);
|
||||
ecma_value_t ecma_builtin_object_object_define_property (ecma_object_t *obj_p,
|
||||
ecma_string_t *name_str_p,
|
||||
ecma_value_t arg3);
|
||||
ecma_value_t ecma_builtin_object_object_get_own_property_descriptor (ecma_object_t *obj_p, ecma_string_t *name_str_p);
|
||||
ecma_value_t
|
||||
ecma_builtin_object_object_define_property (ecma_object_t *obj_p, ecma_string_t *name_str_p, ecma_value_t arg3);
|
||||
|
||||
#endif /* !ECMA_BUILTIN_OBJECT_H */
|
||||
|
||||
@@ -22,22 +22,16 @@
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
/* ECMA-262 v5, 15.2.3.1 */
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_OBJECT_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_OBJECT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
/* Routine properties:
|
||||
|
||||
@@ -38,7 +38,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-promise-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID promise_prototype
|
||||
#define BUILTIN_UNDERSCORED_ID promise_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -74,7 +74,7 @@ ecma_builtin_promise_prototype_dispatch_routine (uint8_t builtin_routine_id, /**
|
||||
}
|
||||
case ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH:
|
||||
{
|
||||
ecma_value_t args[] = {ECMA_VALUE_UNDEFINED, arguments_list_p[0]};
|
||||
ecma_value_t args[] = { ECMA_VALUE_UNDEFINED, arguments_list_p[0] };
|
||||
return ecma_op_invoke_by_magic_id (this_arg, LIT_MAGIC_STRING_THEN, args, 2);
|
||||
}
|
||||
case ECMA_PROMISE_PROTOTYPE_ROUTINE_FINALLY:
|
||||
|
||||
@@ -20,14 +20,10 @@
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_PROMISE,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_PROMISE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* ECMA-262 v6, 25.4.5.4 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_PROMISE_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_PROMISE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
ROUTINE (LIT_MAGIC_STRING_THEN, ECMA_PROMISE_PROTOTYPE_ROUTINE_THEN, 2, 2)
|
||||
ROUTINE (LIT_MAGIC_STRING_CATCH, ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH, 1, 1)
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-array-object.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtin-handlers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "ecma-iterator-object.h"
|
||||
#include "ecma-number-object.h"
|
||||
#include "ecma-promise-object.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
@@ -52,7 +53,7 @@ enum
|
||||
};
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-promise.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID promise
|
||||
#define BUILTIN_UNDERSCORED_ID promise
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -87,8 +88,7 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for
|
||||
|
||||
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;
|
||||
|
||||
ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor),
|
||||
LIT_MAGIC_STRING_RESOLVE);
|
||||
ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor), LIT_MAGIC_STRING_RESOLVE);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (resolve))
|
||||
{
|
||||
@@ -143,7 +143,7 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for
|
||||
}
|
||||
|
||||
/* i. */
|
||||
ecma_value_t args[2] = {capability_p->resolve, capability_p->reject};
|
||||
ecma_value_t args[2] = { capability_p->resolve, capability_p->reject };
|
||||
ecma_value_t result = ecma_op_invoke_by_magic_id (next_promise, LIT_MAGIC_STRING_THEN, args, 2);
|
||||
ecma_free_value (next_promise);
|
||||
|
||||
@@ -175,7 +175,7 @@ exit:
|
||||
static inline ecma_value_t
|
||||
ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
|
||||
ecma_value_t next_method, /**< next method */
|
||||
ecma_object_t *capability_obj_p, /**< PromiseCapability record */
|
||||
ecma_object_t *capability_obj_p, /**< PromiseCapability record */
|
||||
ecma_value_t ctor, /**< the caller of Promise.all */
|
||||
uint8_t builtin_routine_id, /**< built-in wide routine identifier */
|
||||
bool *done_p) /**< [out] iteratorRecord[[done]] */
|
||||
@@ -186,8 +186,7 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
|
||||
|
||||
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;
|
||||
|
||||
ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor),
|
||||
LIT_MAGIC_STRING_RESOLVE);
|
||||
ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor), LIT_MAGIC_STRING_RESOLVE);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (resolve))
|
||||
{
|
||||
@@ -293,8 +292,8 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
|
||||
if (builtin_routine_id != ECMA_PROMISE_ROUTINE_ANY)
|
||||
{
|
||||
/* k. */
|
||||
executor_func_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER,
|
||||
sizeof (ecma_promise_all_executor_t));
|
||||
executor_func_p =
|
||||
ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, sizeof (ecma_promise_all_executor_t));
|
||||
|
||||
ecma_promise_all_executor_t *executor_p = (ecma_promise_all_executor_t *) executor_func_p;
|
||||
|
||||
@@ -339,8 +338,8 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
|
||||
executor_type = ECMA_PROMISE_ANY_REJECT << ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT;
|
||||
}
|
||||
|
||||
ecma_object_t *reject_func_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER,
|
||||
sizeof (ecma_promise_all_executor_t));
|
||||
ecma_object_t *reject_func_p =
|
||||
ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, sizeof (ecma_promise_all_executor_t));
|
||||
|
||||
ecma_promise_all_executor_t *reject_p = (ecma_promise_all_executor_t *) reject_func_p;
|
||||
reject_p->index = idx;
|
||||
@@ -421,12 +420,8 @@ ecma_builtin_promise_helper (ecma_value_t this_arg, /**< 'this' argument */
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = ecma_builtin_promise_perform (iterator,
|
||||
next_method,
|
||||
capability_obj_p,
|
||||
this_arg,
|
||||
builtin_routine_id,
|
||||
&is_done);
|
||||
ret =
|
||||
ecma_builtin_promise_perform (iterator, next_method, capability_obj_p, this_arg, builtin_routine_id, &is_done);
|
||||
}
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ret))
|
||||
|
||||
@@ -24,20 +24,14 @@
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_PROMISE_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_PROMISE_PROTOTYPE, ECMA_PROPERTY_FIXED)
|
||||
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_PROMISE_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_PROMISE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
@@ -49,9 +43,7 @@ ROUTINE (LIT_MAGIC_STRING_ALLSETTLED, ECMA_PROMISE_ROUTINE_ALLSETTLED, 1, 1)
|
||||
ROUTINE (LIT_MAGIC_STRING_ANY, ECMA_PROMISE_ROUTINE_ANY, 1, 1)
|
||||
|
||||
/* ES2015 25.4.4.6 */
|
||||
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
|
||||
ECMA_PROMISE_ROUTINE_SPECIES_GET,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ECMA_PROMISE_ROUTINE_SPECIES_GET, ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user