Remove the ENABLED/DISABLED macros (#4515)

The removal of these macros enabled cppcheck to reveal new errors.
These errors are also fixed by the patch.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2021-02-04 23:47:05 +01:00
committed by GitHub
parent e01c2549d7
commit 0628ae1e7b
337 changed files with 5186 additions and 5191 deletions
@@ -100,14 +100,14 @@ ecma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, /**< shar
ECMA_SET_INTERNAL_VALUE_POINTER (mapped_arguments_p->lex_env, lex_env_p);
arguments_p->header.u.pseudo_array.extra_info |= ECMA_ARGUMENTS_OBJECT_MAPPED;
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)
{
arguments_p->header.u.pseudo_array.extra_info |= ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE;
mapped_arguments_p->u.byte_code_p = (ecma_compiled_code_t *) bytecode_data_p;
}
else
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
{
ECMA_SET_INTERNAL_VALUE_POINTER (mapped_arguments_p->u.byte_code, bytecode_data_p);
}
@@ -343,17 +343,17 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object
{
ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);
prop_value_p = ecma_create_named_accessor_property (object_p,
ecma_get_magic_string (LIT_MAGIC_STRING_CALLEE),
thrower_p,
thrower_p,
ECMA_PROPERTY_FIXED,
&prop_p);
ecma_create_named_accessor_property (object_p,
ecma_get_magic_string (LIT_MAGIC_STRING_CALLEE),
thrower_p,
thrower_p,
ECMA_PROPERTY_FIXED,
&prop_p);
}
return prop_p;
}
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
if (property_name_p == ecma_get_magic_string (LIT_MAGIC_STRING_CALLER)
&& !(arguments_p->header.u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_CALLER_INITIALIZED))
{
@@ -366,15 +366,15 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object
ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);
prop_value_p = ecma_create_named_accessor_property (object_p,
ecma_get_magic_string (LIT_MAGIC_STRING_CALLER),
thrower_p,
thrower_p,
ECMA_PROPERTY_FIXED,
&prop_p);
ecma_create_named_accessor_property (object_p,
ecma_get_magic_string (LIT_MAGIC_STRING_CALLER),
thrower_p,
thrower_p,
ECMA_PROPERTY_FIXED,
&prop_p);
return prop_p;
}
#else /* ENABLED (JERRY_ESNEXT) */
#else /* JERRY_ESNEXT */
ecma_string_t *symbol_p = ecma_op_get_global_symbol (LIT_GLOBAL_SYMBOL_ITERATOR);
if (property_name_p == symbol_p
@@ -395,7 +395,7 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object
}
ecma_deref_ecma_string (symbol_p);
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
return prop_p;
} /* ecma_op_arguments_object_try_to_lazy_instantiate_property */
@@ -444,20 +444,20 @@ ecma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p, /**< ar
prop_counter_p->string_named_props++;
}
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
if (!(flags & (ECMA_ARGUMENTS_OBJECT_CALLER_INITIALIZED | ECMA_ARGUMENTS_OBJECT_MAPPED)))
{
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER));
prop_counter_p->string_named_props++;
}
#else /* ENABLED (JERRY_ESNEXT) */
#else /* JERRY_ESNEXT */
if (!(flags & ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED))
{
ecma_string_t *symbol_p = ecma_op_get_global_symbol (LIT_GLOBAL_SYMBOL_ITERATOR);
ecma_collection_push_back (prop_names_p, ecma_make_symbol_value (symbol_p));
prop_counter_p->symbol_named_props++;
}
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
} /* ecma_op_arguments_object_list_lazy_property_names */
/**
@@ -475,13 +475,13 @@ ecma_op_arguments_object_get_formal_parameter (ecma_mapped_arguments_t *mapped_a
ecma_compiled_code_t *byte_code_p;
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
if (mapped_arguments_p->unmapped.header.u.pseudo_array.extra_info & ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE)
{
byte_code_p = mapped_arguments_p->u.byte_code_p;
}
else
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
{
byte_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, mapped_arguments_p->u.byte_code);
}
+20 -20
View File
@@ -35,21 +35,21 @@
* @{
*/
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
/**
* Maximum length of the array length to allocate fast mode access for it
* e.g. new Array(5000) is constructed as fast mode access array,
* but new Array(50000000) is consturcted as normal property list based array
*/
#define ECMA_FAST_ARRAY_MAX_INITIAL_LENGTH (1 << 17)
#else /* ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* JERRY_CPOINTER_32_BIT */
/**
* Maximum length of the array length to allocate fast mode access for it
* e.g. new Array(5000) is constructed as fast mode access array,
* but new Array(50000000) is consturcted as normal property list based array
*/
#define ECMA_FAST_ARRAY_MAX_INITIAL_LENGTH (1 << 13)
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
/**
* Property name type flag for array indices.
@@ -65,11 +65,11 @@
static ecma_object_t *
ecma_op_alloc_array_object (uint32_t length) /**< length of the new array */
{
#if ENABLED (JERRY_BUILTIN_ARRAY)
#if JERRY_BUILTIN_ARRAY
ecma_object_t *array_prototype_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE);
#else /* !ENABLED (JERRY_BUILTIN_ARRAY) */
#else /* !JERRY_BUILTIN_ARRAY */
ecma_object_t *array_prototype_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
#endif /* ENABLED (JERRY_BUILTIN_ARRAY) */
#endif /* JERRY_BUILTIN_ARRAY */
ecma_object_t *object_p = ecma_create_object (array_prototype_object_p,
sizeof (ecma_extended_object_t),
@@ -170,13 +170,13 @@ ecma_op_new_array_object (uint32_t length) /**< length of the new array */
ecma_object_t *
ecma_op_new_array_object_from_length (ecma_length_t length) /**< length of the new array */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (length > UINT32_MAX)
{
ecma_raise_range_error (ECMA_ERR_MSG ("Invalid Array length"));
return NULL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_op_new_array_object ((uint32_t) length);
} /* ecma_op_new_array_object_from_length */
@@ -677,7 +677,7 @@ ecma_fast_array_object_own_property_keys (ecma_object_t *object_p) /**< fast acc
return ret_p;
} /* ecma_fast_array_object_own_property_keys */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Array object creation with custom prototype.
*
@@ -709,7 +709,7 @@ ecma_op_array_species_create (ecma_object_t *original_array_p, /**< The object f
return NULL;
}
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
if (ecma_is_constructor (constructor))
{
ecma_object_t *constructor_p = ecma_get_object_from_value (constructor);
@@ -722,7 +722,7 @@ ecma_op_array_species_create (ecma_object_t *original_array_p, /**< The object f
constructor = ECMA_VALUE_UNDEFINED;
}
}
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
if (ecma_is_value_object (constructor))
{
@@ -800,7 +800,7 @@ ecma_op_create_array_iterator (ecma_object_t *obj_p, /**< array object */
ECMA_PSEUDO_ARRAY_ITERATOR,
kind);
} /* ecma_op_create_array_iterator */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Low level delete of array items from new_length to old_length
@@ -832,14 +832,14 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */
ecma_property_header_t *current_prop_p;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
current_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, current_prop_cp);
if (current_prop_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)
{
current_prop_cp = current_prop_p->next_property_cp;
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
while (current_prop_cp != JMEM_CP_NULL)
{
@@ -878,7 +878,7 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */
current_prop_cp = object_p->u1.property_list_cp;
ecma_property_header_t *prev_prop_p = NULL;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
JERRY_ASSERT (current_prop_cp != JMEM_CP_NULL);
ecma_property_hashmap_delete_status hashmap_status = ECMA_PROPERTY_HASHMAP_DELETE_NO_HASHMAP;
@@ -890,7 +890,7 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */
current_prop_cp = current_prop_p->next_property_cp;
hashmap_status = ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP;
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
while (current_prop_cp != JMEM_CP_NULL)
{
@@ -911,14 +911,14 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */
{
JERRY_ASSERT (index != ECMA_STRING_NOT_ARRAY_INDEX);
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP)
{
hashmap_status = ecma_property_hashmap_delete (object_p,
prop_pair_p->names_cp[i],
current_prop_p->types + i);
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
ecma_free_property (object_p, prop_pair_p->names_cp[i], current_prop_p->types + i);
current_prop_p->types[i] = ECMA_PROPERTY_TYPE_DELETED;
@@ -950,13 +950,13 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */
}
}
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP)
{
ecma_property_hashmap_free (object_p);
ecma_property_hashmap_create (object_p);
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
return new_length;
} /* ecma_delete_array_properties */
@@ -102,7 +102,7 @@ ecma_fast_array_object_own_property_keys (ecma_object_t *object_p);
void
ecma_fast_array_convert_to_normal (ecma_object_t *object_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_object_t *
ecma_op_array_species_create (ecma_object_t *original_array_p,
ecma_length_t length);
@@ -110,7 +110,7 @@ ecma_op_array_species_create (ecma_object_t *original_array_p,
ecma_value_t
ecma_op_create_array_iterator (ecma_object_t *obj_p,
ecma_iterator_kind_t kind);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t
ecma_op_array_object_set_length (ecma_object_t *object_p, ecma_value_t new_value, uint32_t flags);
@@ -25,7 +25,7 @@
#include "jcontext.h"
#include "ecma-function-object.h"
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
/** \addtogroup ecma ECMA
* @{
@@ -273,4 +273,4 @@ ecma_arraybuffer_detach (ecma_object_t *object_p) /**< pointer to the ArrayBuffe
* @}
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
@@ -18,7 +18,7 @@
#include "ecma-globals.h"
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
/** \addtogroup ecma ECMA
* @{
@@ -55,5 +55,5 @@ ecma_is_arraybuffer (ecma_value_t val);
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#endif /* !ECMA_ARRAYBUFFER_OBJECT_H */
@@ -29,7 +29,7 @@
#include "vm.h"
#include "vm-stack.h"
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/** \addtogroup ecma ECMA
* @{
@@ -534,7 +534,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl
}
} /* ecma_await_continue */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
@@ -19,7 +19,7 @@
#include "ecma-globals.h"
#include "vm-defines.h"
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/** \addtogroup ecma ECMA
* @{
@@ -83,7 +83,7 @@ void ecma_async_generator_finalize (vm_executable_object_t *async_generator_obje
ecma_value_t ecma_await_continue (vm_executable_object_t *async_generator_object_p, ecma_value_t value);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
+5 -6
View File
@@ -18,7 +18,7 @@
#include "jmem.h"
#include "lit-char-helpers.h"
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
JERRY_STATIC_ASSERT (sizeof (ecma_bigint_two_digits_t) == 2 * sizeof (ecma_bigint_digit_t),
ecma_big_int_two_digits_must_be_twice_as_long_as_ecma_big_int_digit);
@@ -925,13 +925,12 @@ ecma_big_uint_div_digit (ecma_extended_primitive_t *left_value_p, /**< left BigU
last_digit = last_digit / divisor_digit;
ecma_bigint_digit_t result_size = 0;
ecma_extended_primitive_t *result_p = NULL;
ecma_bigint_digit_t *current_p = NULL;
if (!is_mod)
{
result_size = left_size;
ecma_bigint_digit_t result_size = left_size;
if (last_digit == 0)
{
@@ -1494,7 +1493,7 @@ ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left B
return ecma_big_uint_increase_result (result_value_p);
} /* ecma_big_uint_shift_right */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Compute the left value raised to the power of right value
@@ -1566,7 +1565,7 @@ ecma_big_uint_pow (ecma_extended_primitive_t *left_value_p, /**< left BigUInt va
return result_p;
} /* ecma_big_uint_pow */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Perform bitwise operations on two BigUInt numbers
@@ -1799,4 +1798,4 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation
return result_value_p;
} /* ecma_big_uint_bitwise_op */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
+4 -4
View File
@@ -18,7 +18,7 @@
#include "ecma-globals.h"
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Limit of BigUInt memory allocation in JerryScript.
@@ -127,14 +127,14 @@ ecma_extended_primitive_t *ecma_big_uint_shift_left (ecma_extended_primitive_t *
ecma_extended_primitive_t *ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, uint32_t right_value,
bool increase_result);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_extended_primitive_t *ecma_big_uint_pow (ecma_extended_primitive_t *left_value_p, uint32_t right_value);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_extended_primitive_t *ecma_big_uint_bitwise_op (uint32_t operation_and_options,
ecma_extended_primitive_t *left_value_p,
ecma_extended_primitive_t *right_value_p);
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
#endif /* ECMA_BIG_UINT_H */
@@ -23,7 +23,7 @@
#include "ecma-objects.h"
#include "ecma-objects-general.h"
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/** \addtogroup ecma ECMA
* @{
@@ -63,4 +63,4 @@ ecma_op_create_bigint_object (ecma_value_t arg) /**< argument passed to the toOb
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
@@ -18,7 +18,7 @@
#include "ecma-globals.h"
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/** \addtogroup ecma ECMA
* @{
@@ -34,6 +34,6 @@ ecma_value_t ecma_op_create_bigint_object (ecma_value_t arg);
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
#endif /* !ECMA_BIGINT_OBJECT_H */
+15 -15
View File
@@ -20,7 +20,7 @@
#include "ecma-objects.h"
#include "lit-char-helpers.h"
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Raise a not enough memory error
@@ -325,18 +325,18 @@ ecma_bigint_number_to_digits (ecma_number_t number, /**< ecma number */
fraction >>= ECMA_NUMBER_FRACTION_WIDTH - biased_exp;
digits_p[0] = (ecma_bigint_digit_t) fraction;
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
digits_p[1] = (ecma_bigint_digit_t) (fraction >> (8 * sizeof (ecma_bigint_digit_t)));
return ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (digits_p[1] == 0 ? 1 : 2) | has_fraction;
#else /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
return ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (1) | has_fraction;
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
}
digits_p[0] = (ecma_bigint_digit_t) fraction;
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
digits_p[1] = (ecma_bigint_digit_t) (fraction >> (8 * sizeof (ecma_bigint_digit_t)));
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
biased_exp -= ECMA_NUMBER_FRACTION_WIDTH;
@@ -345,27 +345,27 @@ ecma_bigint_number_to_digits (ecma_number_t number, /**< ecma number */
if (shift_left == 0)
{
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
return biased_exp | ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (2);
#else /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
return biased_exp | ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (1);
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
}
uint32_t shift_right = (1 << ECMA_BIGINT_DIGIT_SHIFT) - shift_left;
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
digits_p[2] = digits_p[1] >> shift_right;
digits_p[1] = (digits_p[1] << shift_left) | (digits_p[0] >> shift_right);
digits_p[0] <<= shift_left;
return biased_exp | ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (digits_p[2] == 0 ? 2 : 3);
#else /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
digits_p[1] = digits_p[0] >> shift_right;
digits_p[0] <<= shift_left;
return biased_exp | ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (digits_p[1] == 0 ? 1 : 2);
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
} /* ecma_bigint_number_to_digits */
/**
@@ -1451,7 +1451,7 @@ ecma_bigint_shift (ecma_value_t left_value, /**< left BigInt value */
return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);
} /* ecma_bigint_shift */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Compute the left value raised to the power of right value
@@ -1541,7 +1541,7 @@ ecma_bigint_pow (ecma_value_t left_value, /**< left BigInt value */
return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);
} /* ecma_bigint_pow */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Convert the result to an ecma value
@@ -1723,4 +1723,4 @@ ecma_bigint_xor (ecma_value_t left_value, /**< left BigInt value */
return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
} /* ecma_bigint_xor */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
+4 -4
View File
@@ -18,7 +18,7 @@
#include "ecma-globals.h"
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Sign bit of a BigInt value. The number is negative, if this bit is set.
@@ -71,14 +71,14 @@ ecma_value_t ecma_bigint_add_sub (ecma_value_t left_value, ecma_value_t right_va
ecma_value_t ecma_bigint_mul (ecma_value_t left_value, ecma_value_t right_value);
ecma_value_t ecma_bigint_div_mod (ecma_value_t left_value, ecma_value_t right_value, bool is_mod);
ecma_value_t ecma_bigint_shift (ecma_value_t left_value, ecma_value_t right_value, bool is_left);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t ecma_bigint_pow (ecma_value_t left_value, ecma_value_t right_value);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t ecma_bigint_and (ecma_value_t left_value, ecma_value_t right_value);
ecma_value_t ecma_bigint_or (ecma_value_t left_value, ecma_value_t right_value);
ecma_value_t ecma_bigint_xor (ecma_value_t left_value, ecma_value_t right_value);
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
#endif /* ECMA_BIG_INT_H */
@@ -46,15 +46,15 @@ ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boo
bool boolean_value = ecma_op_to_boolean (arg);
ecma_builtin_id_t proto_id;
#if ENABLED (JERRY_BUILTIN_BOOLEAN)
#if JERRY_BUILTIN_BOOLEAN
proto_id = ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE;
#else /* ENABLED (JERRY_BUILTIN_BOOLEAN) */
#else /* JERRY_BUILTIN_BOOLEAN */
proto_id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE;
#endif /* !(ENABLED (JERRY_BUILTIN_BOOLEAN) */
#endif /* !(JERRY_BUILTIN_BOOLEAN */
ecma_object_t *prototype_obj_p = ecma_builtin_get (proto_id);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_object_t *new_target = JERRY_CONTEXT (current_new_target_p);
if (new_target)
{
@@ -65,7 +65,7 @@ ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boo
return ECMA_VALUE_ERROR;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
sizeof (ecma_extended_object_t),
ECMA_OBJECT_TYPE_CLASS);
@@ -74,12 +74,12 @@ ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boo
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_BOOLEAN_UL;
ext_object_p->u.class_prop.u.value = ecma_make_boolean_value (boolean_value);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (new_target)
{
ecma_deref_object (prototype_obj_p);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_make_object_value (object_p);
} /* ecma_op_create_boolean_object */
+16 -16
View File
@@ -151,7 +151,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
return ecma_op_abstract_equality_compare (ecma_make_integer_value (ecma_is_value_true (x) ? 1 : 0), y);
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (JERRY_UNLIKELY (ecma_is_value_bigint (x)))
{
if (ecma_is_value_bigint (y))
@@ -187,7 +187,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
y ^= x;
x ^= y;
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
if (ecma_is_value_undefined (x)
|| ecma_is_value_null (x))
@@ -199,7 +199,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
return ecma_make_boolean_value (is_equal);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (ecma_is_value_symbol (x)))
{
if (!ecma_is_value_object (y))
@@ -212,17 +212,17 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
y ^= x;
x ^= y;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
JERRY_ASSERT (ecma_is_value_object (x));
if (ecma_is_value_string (y)
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
|| ecma_is_value_symbol (y)
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_BIGINT
|| ecma_is_value_bigint (y)
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
|| ecma_is_value_number (y))
{
/* 9. */
@@ -259,10 +259,10 @@ ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */
{
if (ecma_is_value_direct (x)
|| ecma_is_value_direct (y)
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
|| ecma_is_value_symbol (x)
|| ecma_is_value_symbol (y)
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
|| ecma_is_value_object (x)
|| ecma_is_value_object (y))
{
@@ -305,7 +305,7 @@ ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */
return ecma_compare_ecma_strings (x_str_p, y_str_p);
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (JERRY_UNLIKELY (ecma_is_value_bigint (x)))
{
if (!ecma_is_value_bigint (y))
@@ -315,7 +315,7 @@ ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */
return ecma_bigint_is_equal_to_bigint (x, y);
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
if (!ecma_is_value_number (y))
{
@@ -389,11 +389,11 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
if (!(is_px_string && is_py_string))
{
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (JERRY_LIKELY (!ecma_is_value_bigint (px))
&& JERRY_LIKELY (!ecma_is_value_bigint (py)))
{
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
/* 3. */
/* a. */
@@ -478,7 +478,7 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
ret_value = ecma_make_boolean_value (is_x_less_than_y);
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
}
else
{
@@ -546,7 +546,7 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
ret_value = ecma_make_boolean_value (compare_result < 0);
}
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
}
else
{ /* 4. */
@@ -26,7 +26,7 @@
#include "ecma-property-hashmap.h"
#include "ecma-objects.h"
#if ENABLED (JERRY_BUILTIN_CONTAINER)
#if JERRY_BUILTIN_CONTAINER
/** \addtogroup ecma ECMA
* @{
@@ -184,7 +184,7 @@ ecma_op_container_entry_size (lit_magic_string_id_t lit_id) /**< class id */
return ECMA_CONTAINER_VALUE_SIZE;
} /* ecma_op_container_entry_size */
#if ENABLED (JERRY_BUILTIN_WEAKSET)
#if JERRY_BUILTIN_WEAKSET
/**
* Release the entries in the WeakSet container.
*/
@@ -213,9 +213,9 @@ ecma_op_container_free_weakset_entries (ecma_object_t *object_p, /**< object poi
*entry_p = ECMA_VALUE_EMPTY;
}
} /* ecma_op_container_free_weakset_entries */
#endif /* ENABLED (JERRY_BUILTIN_WEAKSET) */
#endif /* JERRY_BUILTIN_WEAKSET */
#if ENABLED (JERRY_BUILTIN_WEAKMAP)
#if JERRY_BUILTIN_WEAKMAP
/**
* Release the entries in the WeakMap container.
*/
@@ -247,9 +247,9 @@ ecma_op_container_free_weakmap_entries (ecma_object_t *object_p, /**< object poi
entry_p->value = ECMA_VALUE_EMPTY;
}
} /* ecma_op_container_free_weakmap_entries */
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) */
#endif /* JERRY_BUILTIN_WEAKMAP */
#if ENABLED (JERRY_BUILTIN_SET)
#if JERRY_BUILTIN_SET
/**
* Release the entries in the Set container.
*/
@@ -274,9 +274,9 @@ ecma_op_container_free_set_entries (ecma_collection_t *container_p)
*entry_p = ECMA_VALUE_EMPTY;
}
} /* ecma_op_container_free_set_entries */
#endif /* ENABLED (JERRY_BUILTIN_SET) */
#endif /* JERRY_BUILTIN_SET */
#if ENABLED (JERRY_BUILTIN_MAP)
#if JERRY_BUILTIN_MAP
/**
* Release the entries in the Map container.
*/
@@ -304,7 +304,7 @@ ecma_op_container_free_map_entries (ecma_collection_t *container_p)
entry_p->value = ECMA_VALUE_EMPTY;
}
} /* ecma_op_container_free_map_entries */
#endif /* ENABLED (JERRY_BUILTIN_MAP) */
#endif /* JERRY_BUILTIN_MAP */
/**
* Release the internal buffer and the stored entries.
@@ -320,34 +320,34 @@ ecma_op_container_free_entries (ecma_object_t *object_p) /**< collection object
switch (map_object_p->u.class_prop.class_id)
{
#if ENABLED (JERRY_BUILTIN_WEAKSET)
#if JERRY_BUILTIN_WEAKSET
case LIT_MAGIC_STRING_WEAKSET_UL:
{
ecma_op_container_free_weakset_entries (object_p, container_p);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_WEAKSET) */
#if ENABLED (JERRY_BUILTIN_WEAKMAP)
#endif /* JERRY_BUILTIN_WEAKSET */
#if JERRY_BUILTIN_WEAKMAP
case LIT_MAGIC_STRING_WEAKMAP_UL:
{
ecma_op_container_free_weakmap_entries (object_p, container_p);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) */
#if ENABLED (JERRY_BUILTIN_SET)
#endif /* JERRY_BUILTIN_WEAKMAP */
#if JERRY_BUILTIN_SET
case LIT_MAGIC_STRING_SET_UL:
{
ecma_op_container_free_set_entries (container_p);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_SET) */
#if ENABLED (JERRY_BUILTIN_MAP)
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_MAP
case LIT_MAGIC_STRING_MAP_UL:
{
ecma_op_container_free_map_entries (container_p);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_MAP) */
#endif /* JERRY_BUILTIN_MAP */
default:
{
break;
@@ -401,7 +401,7 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l
ecma_value_t set_value = ecma_make_object_value (object_p);
ecma_value_t result = set_value;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (arguments_list_len == 0)
{
return result;
@@ -543,7 +543,7 @@ cleanup_adder:
ecma_deref_object (adder_func_p);
cleanup_object:
ecma_deref_object (object_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return result;
} /* ecma_op_container_create */
@@ -573,13 +573,13 @@ ecma_op_container_get_object (ecma_value_t this_arg, /**< this argument */
}
}
#if ENABLED (JERRY_ERROR_MESSAGES)
#if JERRY_ERROR_MESSAGES
ecma_raise_standard_error_with_format (ECMA_ERROR_TYPE,
"Expected a % object",
ecma_make_string_value (ecma_get_magic_string (lit_id)));
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
#else /* !JERRY_ERROR_MESSAGES */
ecma_raise_type_error (NULL);
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
#endif /* JERRY_ERROR_MESSAGES */
return NULL;
} /* ecma_op_container_get_object */
@@ -609,12 +609,12 @@ ecma_op_container_get (ecma_extended_object_t *map_object_p, /**< map object */
ecma_value_t key_arg, /**< key argument */
lit_magic_string_id_t lit_id) /**< internal class id */
{
#if ENABLED (JERRY_BUILTIN_WEAKMAP)
#if JERRY_BUILTIN_WEAKMAP
if (lit_id == LIT_MAGIC_STRING_WEAKMAP_UL && !ecma_is_value_object (key_arg))
{
return ECMA_VALUE_UNDEFINED;
}
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) */
#endif /* JERRY_BUILTIN_WEAKMAP */
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
map_object_p->u.class_prop.u.value);
@@ -648,13 +648,13 @@ ecma_op_container_has (ecma_extended_object_t *map_object_p, /**< map object */
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
map_object_p->u.class_prop.u.value);
#if ENABLED (JERRY_BUILTIN_WEAKMAP) || ENABLED (JERRY_BUILTIN_WEAKSET)
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET
if ((map_object_p->u.class_prop.extra_info & ECMA_CONTAINER_FLAGS_WEAK) != 0
&& !ecma_is_value_object (key_arg))
{
return ECMA_VALUE_FALSE;
}
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) || ENABLED (JERRY_BUILTIN_WEAKSET) */
#endif /* JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET */
if (ECMA_CONTAINER_GET_SIZE (container_p) == 0)
{
@@ -748,13 +748,13 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */
ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
map_object_p->u.class_prop.u.value);
#if ENABLED (JERRY_BUILTIN_WEAKMAP) || ENABLED (JERRY_BUILTIN_WEAKSET)
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET
if ((map_object_p->u.class_prop.extra_info & ECMA_CONTAINER_FLAGS_WEAK) != 0
&& !ecma_is_value_object (key_arg))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Key must be an object"));
}
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) || ENABLED (JERRY_BUILTIN_WEAKSET) */
#endif /* JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET */
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);
@@ -765,13 +765,13 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */
value_arg,
lit_id);
#if ENABLED (JERRY_BUILTIN_WEAKMAP) || ENABLED (JERRY_BUILTIN_WEAKSET)
#if JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET
if ((map_object_p->u.class_prop.extra_info & ECMA_CONTAINER_FLAGS_WEAK) != 0)
{
ecma_object_t *key_p = ecma_get_object_from_value (key_arg);
ecma_op_container_set_weak (key_p, map_object_p);
}
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) || ENABLED (JERRY_BUILTIN_WEAKSET) */
#endif /* JERRY_BUILTIN_WEAKMAP || JERRY_BUILTIN_WEAKSET */
}
else
{
@@ -957,7 +957,7 @@ ecma_op_container_remove_weak_entry (ecma_object_t *object_p, /**< internal cont
ecma_op_internal_buffer_delete (container_p, (ecma_container_pair_t *) entry_p, map_object_p->u.class_prop.class_id);
} /* ecma_op_container_remove_weak_entry */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* The Create{Set, Map}Iterator Abstract operation
@@ -1227,11 +1227,11 @@ ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id, /**< built
}
} /* ecma_builtin_container_dispatch_routine */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_CONTAINER) */
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -19,7 +19,7 @@
#include "ecma-globals.h"
#include "ecma-builtins.h"
#if ENABLED (JERRY_BUILTIN_CONTAINER)
#if JERRY_BUILTIN_CONTAINER
/** \addtogroup ecma ECMA
* @{
@@ -84,6 +84,6 @@ ecma_value_t ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_i
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_CONTAINER) */
#endif /* JERRY_BUILTIN_CONTAINER */
#endif /* !ECMA_CONTAINER_OBJECT_H */
+35 -35
View File
@@ -123,19 +123,19 @@ ecma_op_same_value (ecma_value_t x, /**< ecma value */
return ecma_compare_ecma_strings (x_str_p, y_str_p);
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (ecma_is_value_bigint (x))
{
return (ecma_is_value_bigint (y) && ecma_bigint_compare_to_bigint (x, y) == 0);
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
JERRY_ASSERT (ecma_is_value_object (x) || ecma_is_value_symbol (x));
return false;
} /* ecma_op_same_value */
#if ENABLED (JERRY_BUILTIN_MAP)
#if JERRY_BUILTIN_MAP
/**
* SameValueZero operation.
*
@@ -182,7 +182,7 @@ ecma_op_same_value_zero (ecma_value_t x, /**< ecma value */
return ecma_op_same_value (x, y);
} /* ecma_op_same_value_zero */
#endif /* ENABLED (JERRY_BUILTIN_MAP) */
#endif /* JERRY_BUILTIN_MAP */
/**
* ToPrimitive operation.
@@ -253,12 +253,12 @@ ecma_op_to_boolean (ecma_value_t value) /**< ecma value */
return !ecma_string_is_empty (str_p);
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (ecma_is_value_bigint (value))
{
return value != ECMA_BIGINT_ZERO;
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
JERRY_ASSERT (ecma_is_value_object (value) || ecma_is_value_symbol (value));
@@ -341,14 +341,14 @@ ecma_op_to_numeric (ecma_value_t value, /**< ecma value */
return ECMA_VALUE_EMPTY;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ecma_is_value_symbol (value))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a Symbol value to a number"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (ecma_is_value_bigint (value))
{
if (options & ECMA_TO_NUMERIC_ALLOW_BIGINT)
@@ -357,7 +357,7 @@ ecma_op_to_numeric (ecma_value_t value, /**< ecma value */
}
return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a BigInt value to a number"));
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
JERRY_ASSERT (ecma_is_value_object (value));
@@ -438,20 +438,20 @@ ecma_op_to_string (ecma_value_t value) /**< ecma value */
return ecma_get_magic_string (LIT_MAGIC_STRING_FALSE);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ecma_is_value_symbol (value))
{
ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a Symbol value to a string"));
return NULL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (ecma_is_value_bigint (value))
{
return ecma_bigint_to_string (value, 10);
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
JERRY_ASSERT (ecma_is_value_object (value));
@@ -493,7 +493,7 @@ ecma_op_to_property_key (ecma_value_t value) /**< ecma value */
return key_p;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t key = ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_STRING);
if (ECMA_IS_VALUE_ERROR (key))
@@ -511,11 +511,11 @@ ecma_op_to_property_key (ecma_value_t value) /**< ecma value */
ecma_free_value (key);
return result;
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
ecma_check_value_type_is_spec_defined (value);
return ecma_op_to_string (value);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} /* ecma_op_to_property_key */
/**
@@ -536,35 +536,35 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */
if (ecma_is_value_number (value))
{
#if ENABLED (JERRY_BUILTIN_NUMBER)
#if JERRY_BUILTIN_NUMBER
proto_id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE;
#endif /* ENABLED (JERRY_BUILTIN_NUMBER) */
#endif /* JERRY_BUILTIN_NUMBER */
lit_id = LIT_MAGIC_STRING_NUMBER_UL;
}
else if (ecma_is_value_string (value))
{
#if ENABLED (JERRY_BUILTIN_STRING)
#if JERRY_BUILTIN_STRING
proto_id = ECMA_BUILTIN_ID_STRING_PROTOTYPE;
#endif /* ENABLED (JERRY_BUILTIN_STRING) */
#endif /* JERRY_BUILTIN_STRING */
lit_id = LIT_MAGIC_STRING_STRING_UL;
}
else if (ecma_is_value_object (value))
{
return ecma_copy_value (value);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (ecma_is_value_symbol (value))
{
proto_id = ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE;
lit_id = LIT_MAGIC_STRING_SYMBOL_UL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_BIGINT
else if (ecma_is_value_bigint (value))
{
return ecma_op_create_bigint_object (value);
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
else
{
if (ecma_is_value_undefined (value)
@@ -575,9 +575,9 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */
else
{
JERRY_ASSERT (ecma_is_value_boolean (value));
#if ENABLED (JERRY_BUILTIN_BOOLEAN)
#if JERRY_BUILTIN_BOOLEAN
proto_id = ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE;
#endif /* ENABLED (JERRY_BUILTIN_BOOLEAN) */
#endif /* JERRY_BUILTIN_BOOLEAN */
lit_id = LIT_MAGIC_STRING_BOOLEAN_UL;
}
}
@@ -656,11 +656,11 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des
}
else
{
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
JERRY_ASSERT (src_prop_desc_p->flags & (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED));
#else /* ENABLED (JERRY_ESNEXT) */
#else /* JERRY_ESNEXT */
if (src_prop_desc_p->flags & (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED))
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
{
/* a. */
if (src_prop_desc_p->get_p == NULL)
@@ -999,7 +999,7 @@ ecma_op_to_length (ecma_value_t value, /**< ecma value */
return value;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* 2 */
ecma_number_t num;
ecma_value_t length_num = ecma_op_to_integer (value, &num);
@@ -1027,7 +1027,7 @@ ecma_op_to_length (ecma_value_t value, /**< ecma value */
/* 6 */
*length = (ecma_length_t) num;
return ECMA_VALUE_EMPTY;
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
/* In the case of ES5, ToLength(ES6) operation is the same as ToUint32(ES5) */
ecma_number_t num;
ecma_value_t to_number = ecma_op_to_number (value, &num);
@@ -1040,10 +1040,10 @@ ecma_op_to_length (ecma_value_t value, /**< ecma value */
*length = ecma_number_to_uint32 (num);
return ECMA_VALUE_EMPTY;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} /* ecma_op_to_length */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* ToIndex operation.
*
@@ -1145,7 +1145,7 @@ ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */
/* 9. */
return list_ptr;
} /* ecma_op_create_list_from_array_like */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
+4 -4
View File
@@ -49,9 +49,9 @@ typedef enum
bool ecma_op_require_object_coercible (ecma_value_t value);
bool ecma_op_same_value (ecma_value_t x, ecma_value_t y);
#if ENABLED (JERRY_BUILTIN_MAP)
#if JERRY_BUILTIN_MAP
bool ecma_op_same_value_zero (ecma_value_t x, ecma_value_t y, bool strict_equality);
#endif /* ENABLED (JERRY_BUILTIN_MAP) */
#endif /* JERRY_BUILTIN_MAP */
ecma_value_t ecma_op_to_primitive (ecma_value_t value, ecma_preferred_type_hint_t preferred_type);
bool ecma_op_to_boolean (ecma_value_t value);
ecma_value_t ecma_op_to_number (ecma_value_t value, ecma_number_t *number_p);
@@ -65,10 +65,10 @@ ecma_value_t ecma_op_create_class_object (ecma_builtin_id_t proto_id,
uint16_t lit_id);
ecma_value_t ecma_op_to_integer (ecma_value_t value, ecma_number_t *number_p);
ecma_value_t ecma_op_to_length (ecma_value_t value, ecma_length_t *length);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t ecma_op_to_index (ecma_value_t value, ecma_number_t *index);
ecma_collection_t *ecma_op_create_list_from_array_like (ecma_value_t arr, bool prop_names_only);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_object_t *ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_desc_p);
ecma_value_t ecma_op_to_property_descriptor (ecma_value_t obj_value, ecma_property_descriptor_t *out_prop_desc_p);
@@ -25,7 +25,7 @@
#include "ecma-typedarray-object.h"
#include "ecma-objects.h"
#if ENABLED (JERRY_BUILTIN_DATAVIEW)
#if JERRY_BUILTIN_DATAVIEW
/** \addtogroup ecma ECMA
* @{
@@ -268,7 +268,7 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi
/* SetViewValue 4 - 5. */
if (!ecma_is_value_empty (value_to_set))
{
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (id))
{
value_to_set = ecma_bigint_to_bigint (value_to_set, true);
@@ -279,7 +279,7 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi
}
}
else
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
{
ecma_number_t value_to_set_number;
ecma_value_t value = ecma_op_to_number (value_to_set, &value_to_set_number);
@@ -373,4 +373,4 @@ ecma_is_dataview (ecma_value_t value) /**< the target need to be checked */
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW */
#endif /* JERRY_BUILTIN_DATAVIEW */
@@ -18,7 +18,7 @@
#include "ecma-globals.h"
#if ENABLED (JERRY_BUILTIN_DATAVIEW)
#if JERRY_BUILTIN_DATAVIEW
/** \addtogroup ecma ECMA
* @{
@@ -39,6 +39,6 @@ bool ecma_is_dataview (ecma_value_t value);
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW */
#endif /* JERRY_BUILTIN_DATAVIEW */
#endif /* !ECMA_DATAVIEW_OBJECT_H */
+5 -5
View File
@@ -79,7 +79,7 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
size_t code_buffer_size, /**< size of the buffer */
uint32_t parse_opts) /**< ecma_parse_opts_t option bits */
{
#if ENABLED (JERRY_PARSER)
#if JERRY_PARSER
JERRY_ASSERT (code_p != NULL);
uint32_t is_strict_call = ECMA_PARSE_STRICT_MODE | ECMA_PARSE_DIRECT_EVAL;
@@ -91,9 +91,9 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
parse_opts |= ECMA_PARSE_EVAL;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ECMA_CLEAR_LOCAL_PARSE_OPTS ();
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t resource_name = ecma_make_magic_string_value (LIT_MAGIC_STRING_RESOURCE_EVAL);
ecma_compiled_code_t *bytecode_p = parser_parse_script (NULL,
@@ -109,13 +109,13 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b
}
return vm_run_eval (bytecode_p, parse_opts);
#else /* !ENABLED (JERRY_PARSER) */
#else /* !JERRY_PARSER */
JERRY_UNUSED (code_p);
JERRY_UNUSED (code_buffer_size);
JERRY_UNUSED (parse_opts);
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Source code parsing is disabled"));
#endif /* ENABLED (JERRY_PARSER) */
#endif /* JERRY_PARSER */
} /* ecma_op_eval_chars_buffer */
/**
+12 -12
View File
@@ -25,9 +25,9 @@
#include "jcontext.h"
#include "jrt.h"
#if ENABLED (JERRY_LINE_INFO)
#if JERRY_LINE_INFO
#include "vm.h"
#endif /* ENABLED (JERRY_LINE_INFO) */
#endif /* JERRY_LINE_INFO */
/** \addtogroup ecma ECMA
* @{
@@ -53,14 +53,14 @@ const ecma_error_mapping_t ecma_error_mappings[] =
#define ERROR_ELEMENT(TYPE, ID) { TYPE, ID }
ERROR_ELEMENT (ECMA_ERROR_COMMON, ECMA_BUILTIN_ID_ERROR_PROTOTYPE),
#if ENABLED (JERRY_BUILTIN_ERRORS)
#if JERRY_BUILTIN_ERRORS
ERROR_ELEMENT (ECMA_ERROR_EVAL, ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE),
ERROR_ELEMENT (ECMA_ERROR_RANGE, ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE),
ERROR_ELEMENT (ECMA_ERROR_REFERENCE, ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE),
ERROR_ELEMENT (ECMA_ERROR_TYPE, ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE),
ERROR_ELEMENT (ECMA_ERROR_URI, ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE),
ERROR_ELEMENT (ECMA_ERROR_SYNTAX, ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE),
#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */
#endif /* JERRY_BUILTIN_ERRORS */
#undef ERROR_ELEMENT
};
@@ -82,7 +82,7 @@ ecma_object_t *
ecma_new_standard_error (ecma_standard_error_t error_type, /**< native error type */
ecma_string_t *message_string_p) /**< message string */
{
#if ENABLED (JERRY_BUILTIN_ERRORS)
#if JERRY_BUILTIN_ERRORS
ecma_builtin_id_t prototype_id = ECMA_BUILTIN_ID__COUNT;
switch (error_type)
@@ -134,7 +134,7 @@ ecma_new_standard_error (ecma_standard_error_t error_type, /**< native error typ
#else
JERRY_UNUSED (error_type);
ecma_builtin_id_t prototype_id = ECMA_BUILTIN_ID_ERROR_PROTOTYPE;
#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */
#endif /* JERRY_BUILTIN_ERRORS */
ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id);
@@ -167,7 +167,7 @@ ecma_new_standard_error (ecma_standard_error_t error_type, /**< native error typ
}
else
{
#if ENABLED (JERRY_LINE_INFO)
#if JERRY_LINE_INFO
/* Default decorator when line info is enabled. */
ecma_string_t *stack_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_STACK);
@@ -181,7 +181,7 @@ ecma_new_standard_error (ecma_standard_error_t error_type, /**< native error typ
prop_value_p->value = backtrace_value;
ecma_deref_object (ecma_get_object_from_value (backtrace_value));
#endif /* ENABLED (JERRY_LINE_INFO) */
#endif /* JERRY_LINE_INFO */
}
return new_error_obj_p;
@@ -244,7 +244,7 @@ ecma_raise_standard_error (ecma_standard_error_t error_type, /**< error type */
return ECMA_VALUE_ERROR;
} /* ecma_raise_standard_error */
#if ENABLED (JERRY_ERROR_MESSAGES)
#if JERRY_ERROR_MESSAGES
/**
* Raise a standard ecma-error with the given format string and arguments.
@@ -288,13 +288,13 @@ ecma_raise_standard_error_with_format (ecma_standard_error_t error_type, /**< er
lit_magic_string_id_t class_name = ecma_object_get_class_name (arg_object_p);
arg_string_p = ecma_get_magic_string (class_name);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (ecma_is_value_symbol (arg_val))
{
ecma_value_t symbol_desc_value = ecma_get_symbol_descriptive_string (arg_val);
arg_string_p = ecma_get_string_from_value (symbol_desc_value);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else
{
arg_string_p = ecma_op_to_string (arg_val);
@@ -330,7 +330,7 @@ ecma_raise_standard_error_with_format (ecma_standard_error_t error_type, /**< er
return ECMA_VALUE_ERROR;
} /* ecma_raise_standard_error_with_format */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
#endif /* JERRY_ERROR_MESSAGES */
/**
* Raise a common error with the given message.
+5 -5
View File
@@ -26,11 +26,11 @@
* @{
*/
#if ENABLED (JERRY_ERROR_MESSAGES)
#if JERRY_ERROR_MESSAGES
#define ECMA_ERR_MSG(msg) msg
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
#else /* !JERRY_ERROR_MESSAGES */
#define ECMA_ERR_MSG(msg) NULL
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
#endif /* JERRY_ERROR_MESSAGES */
/**
* Native errors.
@@ -52,9 +52,9 @@ typedef enum
ecma_standard_error_t ecma_get_error_type (ecma_object_t *error_object);
ecma_object_t *ecma_new_standard_error (ecma_standard_error_t error_type, ecma_string_t *message_string_p);
#if ENABLED (JERRY_ERROR_MESSAGES)
#if JERRY_ERROR_MESSAGES
ecma_value_t ecma_raise_standard_error_with_format (ecma_standard_error_t error_type, const char *msg_p, ...);
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
#endif /* JERRY_ERROR_MESSAGES */
ecma_value_t ecma_raise_common_error (const char *msg_p);
ecma_value_t ecma_raise_range_error (const char *msg_p);
ecma_value_t ecma_raise_reference_error (const char *msg_p);
+156 -156
View File
@@ -36,7 +36,7 @@
* @{
*/
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* SetFunctionName operation
*
@@ -86,7 +86,7 @@ ecma_op_function_form_name (ecma_string_t *prop_name_p, /**< property name */
return ecma_make_string_value (prop_name_p);
} /* ecma_op_function_form_name */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* IsCallable operation.
@@ -103,12 +103,12 @@ ecma_op_object_is_callable (ecma_object_t *obj_p) /**< ecma object */
const ecma_object_type_t type = ecma_get_object_type (obj_p);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_TYPE_IS_PROXY (type))
{
return (obj_p->u2.prototype_cp & ECMA_PROXY_IS_CALLABLE) != 0;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
return type >= ECMA_OBJECT_TYPE_FUNCTION;
} /* ecma_op_object_is_callable */
@@ -161,12 +161,12 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
{
JERRY_ASSERT (!ecma_get_object_is_builtin (obj_p));
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
const ecma_compiled_code_t *byte_code_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) obj_p);
if (!CBC_FUNCTION_IS_CONSTRUCTABLE (byte_code_p->status_flags))
{
#if ENABLED (JERRY_ERROR_MESSAGES)
#if JERRY_ERROR_MESSAGES
switch (CBC_FUNCTION_GET_TYPE (byte_code_p->status_flags))
{
case CBC_FUNCTION_SCRIPT:
@@ -203,16 +203,16 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
return "Async arrow functions cannot be invoked with 'new'";
}
}
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
#else /* !JERRY_ERROR_MESSAGES */
return NULL;
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
#endif /* JERRY_ERROR_MESSAGES */
}
#endif /* ENABLED (JERRY_NEXT) */
#endif /* JERRY_NEXT */
return ECMA_IS_VALID_CONSTRUCTOR;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_TYPE_IS_PROXY (type))
{
if (!(obj_p->u2.prototype_cp & ECMA_PROXY_IS_CONSTRUCTABLE))
@@ -222,7 +222,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
return ECMA_IS_VALID_CONSTRUCTOR;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
@@ -233,9 +233,9 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
return ECMA_ERR_MSG ("Built-in routines have no constructor");
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_ASSERT (((ecma_extended_object_t *) obj_p)->u.built_in.id != ECMA_BUILTIN_ID_HANDLER);
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
}
return ECMA_IS_VALID_CONSTRUCTOR;
@@ -356,12 +356,12 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
size_t function_object_size = sizeof (ecma_extended_object_t);
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)
{
function_object_size = sizeof (ecma_static_function_t);
}
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
function_object_size,
@@ -388,14 +388,14 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
/* 10., 11., 12. */
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)
{
ext_func_p->u.function.bytecode_cp = JMEM_CP_NULL;
((ecma_static_function_t *) func_p)->bytecode_p = bytecode_data_p;
}
else
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
{
ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_p->u.function.bytecode_cp, bytecode_data_p);
ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);
@@ -475,22 +475,22 @@ ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, /**< argu
return ECMA_VALUE_ERROR;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t *func_name_p;
func_name_p = ecma_compiled_code_resolve_function_name ((const ecma_compiled_code_t *) bytecode_p);
*func_name_p = ecma_make_magic_string_value (LIT_MAGIC_STRING_ANONYMOUS);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_object_t *global_object_p = ecma_builtin_get_global ();
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
JERRY_ASSERT (global_object_p == (ecma_object_t *) ecma_op_function_get_realm (bytecode_p));
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
ecma_object_t *global_env_p = ecma_get_global_environment (global_object_p);
ecma_builtin_id_t fallback_proto = ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_object_t *new_target_p = JERRY_CONTEXT (current_new_target_p);
ecma_builtin_id_t fallback_ctor = ECMA_BUILTIN_ID_FUNCTION;
@@ -523,14 +523,14 @@ ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, /**< argu
ecma_bytecode_deref (bytecode_p);
return ECMA_VALUE_ERROR;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_object_t *func_obj_p = ecma_op_create_function_object (global_env_p, bytecode_p, fallback_proto);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ECMA_SET_NON_NULL_POINTER (func_obj_p->u2.prototype_cp, proto);
ecma_deref_object (proto);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_bytecode_deref (bytecode_p);
return ecma_make_object_value (func_obj_p);
@@ -550,7 +550,7 @@ ecma_op_create_simple_function_object (ecma_object_t *scope_p, /**< function's s
return ecma_op_create_function_object (scope_p, bytecode_data_p, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
} /* ecma_op_create_simple_function_object */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Create a function object with the appropriate prototype.
@@ -616,12 +616,12 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
size_t arrow_function_object_size = sizeof (ecma_arrow_function_t);
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)
{
arrow_function_object_size = sizeof (ecma_static_arrow_function_t);
}
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
arrow_function_object_size,
@@ -631,7 +631,7 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
ECMA_SET_NON_NULL_POINTER_TAG (arrow_func_p->header.u.function.scope_cp, scope_p, 0);
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
if ((bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
{
arrow_func_p->header.u.function.bytecode_cp = ECMA_NULL_POINTER;
@@ -639,12 +639,12 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
}
else
{
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
ECMA_SET_INTERNAL_VALUE_POINTER (arrow_func_p->header.u.function.bytecode_cp, bytecode_data_p);
ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
}
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
arrow_func_p->this_binding = ecma_copy_value_if_not_object (this_binding);
arrow_func_p->new_target = ECMA_VALUE_UNDEFINED;
@@ -656,7 +656,7 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
return func_p;
} /* ecma_op_create_arrow_function_object */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* External function object creation operation.
@@ -683,16 +683,16 @@ ecma_op_create_external_function_object (ecma_native_handler_t handler_cb) /**<
*/
ecma_native_function_t *native_function_p = (ecma_native_function_t *) function_obj_p;
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ECMA_SET_INTERNAL_VALUE_POINTER (native_function_p->realm_value,
ecma_builtin_get_global ());
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
native_function_p->native_handler_cb = handler_cb;
return function_obj_p;
} /* ecma_op_create_external_function_object */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Create built-in native handler object.
@@ -715,15 +715,15 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */
ext_func_obj_p->u.built_in.routine_id = (uint8_t) id;
ext_func_obj_p->u.built_in.u2.routine_flags = ECMA_NATIVE_HANDLER_FLAGS_NONE;
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_obj_p->u.built_in.realm_value,
ecma_builtin_get_global ());
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
return function_obj_p;
} /* ecma_op_create_native_handler */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Get compiled code of a function object.
@@ -733,7 +733,7 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */
extern inline const ecma_compiled_code_t * JERRY_ATTR_ALWAYS_INLINE
ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< function pointer */
{
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
if (JERRY_LIKELY (function_p->u.function.bytecode_cp != ECMA_NULL_POINTER))
{
return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
@@ -741,13 +741,13 @@ ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< fun
}
return ((ecma_static_function_t *) function_p)->bytecode_p;
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
#else /* !JERRY_SNAPSHOT_EXEC */
return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
function_p->u.function.bytecode_cp);
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
} /* ecma_op_function_get_compiled_code */
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
/**
* Get realm from a byte code.
@@ -773,16 +773,16 @@ ecma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p) /**<
realm_value = args_p->realm_value;
}
#if ENABLED (JERRY_SNAPSHOT_EXEC)
#if JERRY_SNAPSHOT_EXEC
if (JERRY_LIKELY (realm_value != JMEM_CP_NULL))
{
return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, realm_value);
}
return (ecma_global_object_t *) ecma_builtin_get_global ();
#else /* !ENABLED (JERRY_SNAPSHOT_EXEC) */
#else /* !JERRY_SNAPSHOT_EXEC */
return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, realm_value);
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#endif /* JERRY_SNAPSHOT_EXEC */
} /* ecma_op_function_get_realm */
/**
@@ -818,7 +818,7 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob
native_function_p->realm_value);
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (func_obj_p))
{
ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) func_obj_p;
@@ -830,7 +830,7 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob
func_obj_p = ecma_get_object_from_value (proxy_obj_p->target);
continue;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION);
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p;
@@ -839,7 +839,7 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob
}
} /* ecma_op_function_get_function_realm */
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
/**
* 15.3.5.3 implementation of [[HasInstance]] for Function objects
@@ -894,11 +894,11 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
ecma_object_t *prototype_obj_p = ecma_get_object_from_value (prototype_obj_value);
JERRY_ASSERT (prototype_obj_p != NULL);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
ecma_value_t result = ECMA_VALUE_ERROR;
#else /* !ENABLED (JERRY_BUILTIN_PROXY) */
#else /* !JERRY_BUILTIN_PROXY */
ecma_value_t result = ECMA_VALUE_FALSE;
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
ecma_ref_object (v_obj_p);
@@ -909,9 +909,9 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
if (current_proto_p == NULL)
{
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
result = ECMA_VALUE_FALSE;
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
break;
}
else if (current_proto_p == ECMA_OBJECT_POINTER_ERROR)
@@ -934,7 +934,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
return result;
} /* ecma_op_function_has_instance */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* GetSuperConstructor operation for class methods
@@ -964,7 +964,7 @@ ecma_op_function_get_super_constructor (ecma_object_t *func_obj_p) /**< function
return ecma_make_object_value (super_ctor_p);
} /* ecma_op_function_get_super_constructor */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Ordinary internal method: GetPrototypeFromConstructor (constructor, intrinsicDefaultProto)
@@ -996,7 +996,7 @@ ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, /**< construc
{
ecma_free_value (proto);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (ctor_obj_p))
{
ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) ctor_obj_p;
@@ -1006,13 +1006,13 @@ ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, /**< construc
return NULL;
}
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
proto_obj_p = ecma_builtin_get_from_realm (ecma_op_function_get_function_realm (ctor_obj_p), default_proto_id);
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
#else /* !JERRY_BUILTIN_REALMS */
proto_obj_p = ecma_builtin_get (default_proto_id);
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
ecma_ref_object (proto_obj_p);
}
else
@@ -1059,12 +1059,12 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
shared_args.header.bytecode_header_p = bytecode_data_p;
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_global_object_t *realm_p = ecma_op_function_get_realm (bytecode_data_p);
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
/* 1. */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (CBC_FUNCTION_IS_ARROW (status_flags)))
{
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) func_obj_p;
@@ -1082,7 +1082,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
else
{
shared_args.header.status_flags |= VM_FRAME_CTX_SHARED_NON_ARROW_FUNC;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (!(status_flags & CBC_CODE_FLAGS_STRICT_MODE))
{
@@ -1090,11 +1090,11 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
|| ecma_is_value_null (this_binding))
{
/* 2. */
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
this_binding = realm_p->this_binding;
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
#else /* !JERRY_BUILTIN_REALMS */
this_binding = ecma_make_object_value (ecma_builtin_get_global ());
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
}
else if (!ecma_is_value_object (this_binding))
{
@@ -1105,9 +1105,9 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (this_binding));
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* 5. */
if (!(status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED))
@@ -1118,7 +1118,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
ecma_value_t ret_value;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (CBC_FUNCTION_GET_TYPE (status_flags) == CBC_FUNCTION_CONSTRUCTOR))
{
if (JERRY_CONTEXT (current_new_target_p) == NULL)
@@ -1137,20 +1137,20 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
ecma_op_create_environment_record (scope_p, lexical_this, func_obj_p);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);
JERRY_CONTEXT (global_object_p) = realm_p;
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
ret_value = vm_run (&shared_args.header, this_binding, scope_p);
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
JERRY_CONTEXT (global_object_p) = saved_global_object_p;
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* ECMAScript v6, 9.2.2.13 */
if (JERRY_UNLIKELY (shared_args.header.status_flags & VM_FRAME_CTX_SHARED_HERITAGE_PRESENT))
{
@@ -1169,7 +1169,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
}
exit:
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (JERRY_UNLIKELY (shared_args.header.status_flags & VM_FRAME_CTX_SHARED_FREE_LOCAL_ENV))
{
@@ -1200,41 +1200,41 @@ ecma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */
if (ecma_get_object_is_builtin (func_obj_p))
{
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;
JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
ext_func_obj_p->u.built_in.realm_value);
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
ecma_value_t ret_value = ecma_builtin_dispatch_call (func_obj_p,
this_arg_value,
arguments_list_p,
arguments_list_len);
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
JERRY_CONTEXT (global_object_p) = saved_global_object_p;
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
return ret_value;
}
ecma_native_function_t *native_function_p = (ecma_native_function_t *) func_obj_p;
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);
JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
native_function_p->realm_value);
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
JERRY_ASSERT (native_function_p->native_handler_cb != NULL);
ecma_value_t ret_value = native_function_p->native_handler_cb (ecma_make_object_value (func_obj_p),
this_arg_value,
arguments_list_p,
arguments_list_len);
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
JERRY_CONTEXT (global_object_p) = saved_global_object_p;
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
if (JERRY_UNLIKELY (ecma_is_value_error_reference (ret_value)))
{
@@ -1242,9 +1242,9 @@ ecma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */
return ECMA_VALUE_ERROR;
}
#if ENABLED (JERRY_DEBUGGER)
#if JERRY_DEBUGGER
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
#endif /* ENABLED (JERRY_DEBUGGER) */
#endif /* JERRY_DEBUGGER */
return ret_value;
} /* ecma_op_function_call_native */
@@ -1355,20 +1355,20 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
const ecma_object_type_t type = ecma_get_object_type (func_obj_p);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_TYPE_IS_PROXY (type))
{
return ecma_proxy_object_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p);
if (JERRY_UNLIKELY (!(JERRY_CONTEXT (status_flags) & ECMA_STATUS_DIRECT_EVAL)))
{
JERRY_CONTEXT (current_new_target_p) = NULL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t result;
@@ -1385,9 +1385,9 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
result = ecma_op_function_call_bound (func_obj_p, arguments_list_p, arguments_list_len);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_CONTEXT (current_new_target_p) = old_new_target_p;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return result;
} /* ecma_op_function_call */
@@ -1453,16 +1453,16 @@ ecma_op_function_construct_native (ecma_object_t *func_obj_p, /**< Function obje
ecma_value_t this_arg = ecma_make_object_value (new_this_obj_p);
ecma_deref_object (proto_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p);
JERRY_CONTEXT (current_new_target_p) = new_target_p;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t ret_value = ecma_op_function_call_native (func_obj_p, this_arg, arguments_list_p, arguments_list_len);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_CONTEXT (current_new_target_p) = old_new_target_p;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (ECMA_IS_VALUE_ERROR (ret_value) || ecma_is_value_object (ret_value))
{
@@ -1494,7 +1494,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
const ecma_object_type_t type = ecma_get_object_type (func_obj_p);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_TYPE_IS_PROXY (type))
{
return ecma_proxy_object_construct (func_obj_p,
@@ -1502,7 +1502,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
arguments_list_p,
arguments_list_len);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
if (JERRY_UNLIKELY (type == ECMA_OBJECT_TYPE_BOUND_FUNCTION))
{
@@ -1513,26 +1513,26 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
{
if (JERRY_UNLIKELY (ecma_get_object_is_builtin (func_obj_p)))
{
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);
ecma_value_t realm_value = ((ecma_extended_object_t *) func_obj_p)->u.built_in.realm_value;
JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, realm_value);
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_object_t *old_new_target = JERRY_CONTEXT (current_new_target_p);
JERRY_CONTEXT (current_new_target_p) = new_target_p;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t ret_value = ecma_builtin_dispatch_construct (func_obj_p, arguments_list_p, arguments_list_len);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_CONTEXT (current_new_target_p) = old_new_target;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
JERRY_CONTEXT (global_object_p) = saved_global_object_p;
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
return ret_value;
}
@@ -1545,13 +1545,13 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
ecma_object_t *new_this_obj_p = NULL;
ecma_value_t this_arg;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;
/* 5. */
if (!ECMA_GET_THIRD_BIT_FROM_POINTER_TAG (ext_func_obj_p->u.function.scope_cp))
{
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* 5.a */
ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (new_target_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
@@ -1564,7 +1564,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
new_this_obj_p = ecma_create_object (proto_p, 0, ECMA_OBJECT_TYPE_GENERAL);
ecma_deref_object (proto_p);
this_arg = ecma_make_object_value (new_this_obj_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
}
else
{
@@ -1574,25 +1574,25 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
/* 6. */
ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p);
JERRY_CONTEXT (current_new_target_p) = new_target_p;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t ret_value = ecma_op_function_call_simple (func_obj_p, this_arg, arguments_list_p, arguments_list_len);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_CONTEXT (current_new_target_p) = old_new_target_p;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* 13.a */
if (ECMA_IS_VALUE_ERROR (ret_value) || ecma_is_value_object (ret_value))
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (new_this_obj_p != NULL)
{
ecma_deref_object (new_this_obj_p);
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
ecma_deref_object (new_this_obj_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ret_value;
}
@@ -1612,7 +1612,7 @@ ecma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the fun
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION
|| ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_global_object_t *global_object_p;
if (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION)
@@ -1629,14 +1629,14 @@ ecma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the fun
global_object_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
native_function_p->realm_value);
}
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
/* ECMA-262 v5, 13.2, 16-18 */
ecma_object_t *proto_object_p = NULL;
bool init_constructor = true;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION)
{
const ecma_compiled_code_t *byte_code_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);
@@ -1650,11 +1650,11 @@ ecma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the fun
{
ecma_object_t *prototype_p;
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
prototype_p = ecma_builtin_get_from_realm (global_object_p, ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE);
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
#else /* !JERRY_BUILTIN_REALMS */
prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE);
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
proto_object_p = ecma_create_object (prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);
init_constructor = false;
@@ -1664,29 +1664,29 @@ ecma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the fun
{
ecma_object_t *prototype_p;
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
prototype_p = ecma_builtin_get_from_realm (global_object_p, ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE);
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
#else /* !JERRY_BUILTIN_REALMS */
prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE);
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
proto_object_p = ecma_create_object (prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);
init_constructor = false;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (proto_object_p == NULL)
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
{
ecma_object_t *prototype_p;
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
prototype_p = ecma_builtin_get_from_realm (global_object_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
#else /* !JERRY_BUILTIN_REALMS */
prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
proto_object_p = ecma_op_create_object_object_noarg_and_set_prototype (prototype_p);
}
@@ -1735,7 +1735,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
{
JERRY_ASSERT (!ecma_get_object_is_builtin (object_p));
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH))
{
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
@@ -1802,7 +1802,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
return NULL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_PROTOTYPE)
&& ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION)
@@ -1818,7 +1818,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
const ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)
&& CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_NORMAL)
{
@@ -1831,7 +1831,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
value_p->value = is_arguments ? ECMA_VALUE_NULL : ECMA_VALUE_UNDEFINED;
return value_prop_p;
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)
{
ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);
@@ -1846,7 +1846,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
&caller_prop_p);
return caller_prop_p;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
return NULL;
@@ -1903,7 +1903,7 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
args_length = ecma_get_integer_from_value (args_len_or_this);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (bound_func_p->header.u.bound_function.target_function))
{
return NULL;
@@ -1914,7 +1914,7 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
/* Set tag bit to represent initialized 'length' property */
ECMA_SET_FIRST_BIT_TO_POINTER_TAG (bound_func_p->header.u.bound_function.target_function);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
length_attributes = ECMA_PROPERTY_FIXED;
ecma_object_t *target_func_p;
@@ -1931,7 +1931,7 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
length = (ecma_number_t) (ecma_get_integer_from_value (get_len_value) - (args_length - 1));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (length < 0)
{
@@ -1948,7 +1948,7 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
return len_prop_p;
}
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER)
|| ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS))
{
@@ -1964,7 +1964,7 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
&caller_prop_p);
return caller_prop_p;
}
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
return NULL;
} /* ecma_op_bound_function_try_to_lazy_instantiate_property */
@@ -1981,7 +1981,7 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
ecma_collection_t *prop_names_p, /**< prop name collection */
ecma_property_counter_t *prop_counter_p) /**< prop counter */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
if (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (ext_func_p->u.function.scope_cp))
{
@@ -1989,31 +1989,31 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
prop_counter_p->string_named_props++;
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
/* 'length' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
prop_counter_p->string_named_props++;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
const ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (!CBC_FUNCTION_HAS_PROTOTYPE (bytecode_data_p->status_flags))
{
return;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE));
prop_counter_p->string_named_props++;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
bool append_caller_and_arguments = !(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
bool append_caller_and_arguments = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (append_caller_and_arguments)
{
@@ -2039,11 +2039,11 @@ ecma_op_external_function_list_lazy_property_names (ecma_object_t *object_p, /**
ecma_collection_t *prop_names_p, /**< prop name collection */
ecma_property_counter_t *prop_counter_p) /**< prop counter */
{
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
JERRY_UNUSED (object_p);
#else /* ENABLED (JERRY_ESNEXT) */
#else /* JERRY_ESNEXT */
if (!ecma_op_ordinary_object_has_own_property (object_p, ecma_get_magic_string (LIT_MAGIC_STRING_PROTOTYPE)))
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
{
/* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE));
@@ -2063,7 +2063,7 @@ ecma_op_bound_function_list_lazy_property_names (ecma_object_t *object_p, /**< b
ecma_collection_t *prop_names_p, /**< prop name collection */
ecma_property_counter_t *prop_counter_p) /**< prop counter */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* Unintialized 'length' property is non-enumerable (ECMA-262 v6, 19.2.4.1) */
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) object_p;
if (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (bound_func_p->header.u.bound_function.target_function))
@@ -2071,12 +2071,12 @@ ecma_op_bound_function_list_lazy_property_names (ecma_object_t *object_p, /**< b
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
prop_counter_p->string_named_props++;
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
JERRY_UNUSED (object_p);
/* 'length' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));
prop_counter_p->string_named_props++;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER));
@@ -28,9 +28,9 @@
* @{
*/
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t ecma_op_function_form_name (ecma_string_t *prop_name_p, char *prefix_p, lit_utf8_size_t prefix_size);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
bool ecma_op_is_callable (ecma_value_t value);
bool ecma_op_object_is_callable (ecma_object_t *obj_p);
@@ -56,20 +56,20 @@ ecma_op_create_external_function_object (ecma_native_handler_t handler_cb);
const ecma_compiled_code_t *
ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p);
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_global_object_t *
ecma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p);
ecma_global_object_t *
ecma_op_function_get_function_realm (ecma_object_t *func_obj_p);
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
ecma_value_t
ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p,
uint32_t arguments_list_len,
ecma_parse_opts_t opts);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t
ecma_op_function_get_super_constructor (ecma_object_t *func_obj_p);
@@ -83,7 +83,7 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, const ecma_compile
ecma_object_t *
ecma_op_create_native_handler (ecma_native_handler_id_t id, size_t object_size);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_object_t *
ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, ecma_builtin_id_t default_proto_id);
+28 -28
View File
@@ -64,24 +64,24 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
*ref_base_lex_env_p = lex_env_p;
ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))
{
return ecma_raise_reference_error (ECMA_ERR_MSG ("Variables declared by let/const must be"
" initialized before reading their value"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_fast_copy_value (property_value_p->value);
}
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case ECMA_LEXICAL_ENVIRONMENT_HOME_OBJECT_BOUND:
{
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);
@@ -108,13 +108,13 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
}
*ref_base_lex_env_p = NULL;
#if ENABLED (JERRY_ERROR_MESSAGES)
#if JERRY_ERROR_MESSAGES
return ecma_raise_standard_error_with_format (ECMA_ERROR_REFERENCE,
"% is not defined",
ecma_make_string_value (name_p));
#else /* ENABLED (JERRY_ERROR_MESSAGES) */
#else /* JERRY_ERROR_MESSAGES */
return ecma_raise_reference_error (NULL);
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
#endif /* JERRY_ERROR_MESSAGES */
} /* ecma_op_get_value_lex_env_base */
@@ -158,34 +158,34 @@ ecma_op_get_value_object_base (ecma_value_t base_value, /**< base value */
return ecma_make_string_value (ecma_new_ecma_string_from_code_unit (char_at_idx));
}
#if ENABLED (JERRY_BUILTIN_STRING)
#if JERRY_BUILTIN_STRING
id = ECMA_BUILTIN_ID_STRING_PROTOTYPE;
#endif /* ENABLED (JERRY_BUILTIN_STRING) */
#endif /* JERRY_BUILTIN_STRING */
}
else if (ecma_is_value_number (base_value))
{
#if ENABLED (JERRY_BUILTIN_NUMBER)
#if JERRY_BUILTIN_NUMBER
id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE;
#endif /* ENABLED (JERRY_BUILTIN_NUMBER) */
#endif /* JERRY_BUILTIN_NUMBER */
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (ecma_is_value_symbol (base_value))
{
id = ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_BIGINT
else if (ecma_is_value_bigint (base_value))
{
id = ECMA_BUILTIN_ID_BIGINT_PROTOTYPE;
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
else
{
JERRY_ASSERT (ecma_is_value_boolean (base_value));
#if ENABLED (JERRY_BUILTIN_BOOLEAN)
#if JERRY_BUILTIN_BOOLEAN
id = ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE;
#endif /* ENABLED (JERRY_BUILTIN_BOOLEAN) */
#endif /* JERRY_BUILTIN_BOOLEAN */
}
obj_p = ecma_builtin_get (id);
@@ -225,17 +225,17 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
{
ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))
{
return ecma_raise_reference_error (ECMA_ERR_MSG ("Variables declared by let/const must be"
" initialized before writing their value"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_named_data_property_assign_value (lex_env_p, property_value_p, value);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (ecma_is_property_enumerable (*property_p))
{
if (JERRY_UNLIKELY (ECMA_PROPERTY_VALUE_PTR (property_p)->value == ECMA_VALUE_UNINITIALIZED))
@@ -246,7 +246,7 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
return ecma_raise_type_error (ECMA_ERR_MSG ("Constant bindings cannot be reassigned"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else if (is_strict)
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Binding cannot be set"));
@@ -255,12 +255,12 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
}
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case ECMA_LEXICAL_ENVIRONMENT_HOME_OBJECT_BOUND:
{
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);
@@ -269,12 +269,12 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
ecma_value_t has_property = ecma_op_object_has_property (binding_obj_p, name_p);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_IS_VALUE_ERROR (has_property))
{
return has_property;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
if (ecma_is_value_true (has_property))
{
@@ -308,13 +308,13 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
if (is_strict)
{
#if ENABLED (JERRY_ERROR_MESSAGES)
#if JERRY_ERROR_MESSAGES
return ecma_raise_standard_error_with_format (ECMA_ERROR_REFERENCE,
"% is not defined",
ecma_make_string_value (name_p));
#else /* !ENABLED (JERRY_ERROR_MESSAGES) */
#else /* !JERRY_ERROR_MESSAGES */
return ecma_raise_reference_error (NULL);
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
#endif /* JERRY_ERROR_MESSAGES */
}
ecma_value_t completion = ecma_op_object_put (ecma_get_lex_env_binding_object (lex_env_p),
@@ -35,7 +35,7 @@
* @{
*/
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Implementation of 'CreateArrayFromList' specialized for iterators
@@ -620,7 +620,7 @@ ecma_op_iterator_do (ecma_iterator_command_type_t command, /**< command to be ex
return result;
} /* ecma_op_iterator_do */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
@@ -18,7 +18,7 @@
#include "ecma-globals.h"
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/** \addtogroup ecma ECMA
* @{
@@ -74,7 +74,7 @@ ecma_value_t
ecma_op_iterator_do (ecma_iterator_command_type_t command, ecma_value_t iterator,
ecma_value_t next_method, ecma_value_t value, bool *done_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
+2 -2
View File
@@ -24,7 +24,7 @@
#include "opcodes.h"
#include "vm-stack.h"
#if ENABLED (JERRY_BUILTIN_PROMISE)
#if JERRY_BUILTIN_PROMISE
/**
* Mask for job queue type.
@@ -586,4 +586,4 @@ ecma_free_all_enqueued_jobs (void)
* @}
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
#endif /* JERRY_BUILTIN_PROMISE */
+2 -2
View File
@@ -16,7 +16,7 @@
#ifndef ECMA_JOB_QUEUE_H
#define ECMA_JOB_QUEUE_H
#if ENABLED (JERRY_BUILTIN_PROMISE)
#if JERRY_BUILTIN_PROMISE
/** \addtogroup ecma ECMA
* @{
@@ -60,5 +60,5 @@ ecma_value_t ecma_process_all_enqueued_jobs (void);
* @}
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
#endif /* JERRY_BUILTIN_PROMISE */
#endif /* !ECMA_JOB_QUEUE_H */
+12 -12
View File
@@ -67,7 +67,7 @@ ecma_get_global_environment (ecma_object_t *global_object_p) /**< global object
return ECMA_GET_NON_NULL_POINTER (ecma_object_t, ((ecma_global_object_t *) global_object_p)->global_env_cp);
} /* ecma_get_global_environment */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Create the global lexical block on top of the global environment.
*/
@@ -86,7 +86,7 @@ ecma_create_global_lexical_block (ecma_object_t *global_object_p) /**< global ob
ecma_deref_object (global_scope_p);
}
} /* ecma_create_global_lexical_block */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Get reference to Global lexical scope
@@ -97,12 +97,12 @@ ecma_create_global_lexical_block (ecma_object_t *global_object_p) /**< global ob
ecma_object_t *
ecma_get_global_scope (ecma_object_t *global_object_p) /**< global object */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_ASSERT (global_object_p != NULL && ecma_builtin_is_global (global_object_p));
return ECMA_GET_NON_NULL_POINTER (ecma_object_t, ((ecma_global_object_t *) global_object_p)->global_scope_cp);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
return ecma_get_global_environment (global_object_p);
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
} /* ecma_get_global_scope */
/**
@@ -180,7 +180,7 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
#if ENABLED (JERRY_BUILTIN_PROXY) && ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_PROXY && JERRY_BUILTIN_REALMS
if (ECMA_OBJECT_IS_PROXY (binding_obj_p))
{
ecma_value_t result = ecma_proxy_object_is_extensible (binding_obj_p);
@@ -199,12 +199,12 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
{
return NULL;
}
#else /* !ENABLED (JERRY_BUILTIN_PROXY) || !ENABLED (JERRY_BUILTIN_REALMS) */
#else /* !JERRY_BUILTIN_PROXY || !JERRY_BUILTIN_REALMS */
if (!ecma_op_ordinary_object_is_extensible (binding_obj_p))
{
return NULL;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) && ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_PROXY && JERRY_BUILTIN_REALMS */
const uint32_t flags = ECMA_PROPERTY_ENUMERABLE_WRITABLE | ECMA_IS_THROW;
@@ -261,12 +261,12 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
{
ecma_named_data_property_assign_value (lex_env_p, ECMA_PROPERTY_VALUE_PTR (property_p), value);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (ecma_is_property_enumerable (*property_p))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Constant bindings cannot be reassigned"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else if (is_strict)
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Binding cannot be set"));
@@ -455,7 +455,7 @@ ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environ
prop_value_p->value = ecma_copy_value_if_not_object (value);
} /* ecma_op_create_immutable_binding */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* InitializeBinding operation.
*
@@ -599,7 +599,7 @@ ecma_op_get_this_binding (ecma_object_t *lex_env_p) /**< lexical environment */
return this_value;
} /* ecma_op_get_this_binding */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
+6 -6
View File
@@ -34,14 +34,14 @@ void ecma_init_global_environment (void);
void ecma_finalize_global_environment (void);
ecma_object_t *ecma_get_global_environment (ecma_object_t *global_object_p);
ecma_object_t *ecma_get_global_scope (ecma_object_t *global_object_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void ecma_create_global_lexical_block (ecma_object_t *global_object_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_MODULE_SYSTEM)
#if JERRY_MODULE_SYSTEM
void ecma_module_add_lex_env (ecma_object_t *lex_env_p);
void ecma_module_finalize_lex_envs (void);
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
/**
* @}
@@ -66,7 +66,7 @@ ecma_value_t ecma_op_implicit_this_value (ecma_object_t *lex_env_p);
/* ECMA-262 v5, Table 18. Additional methods of Declarative Environment Records */
void ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void ecma_op_initialize_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value);
void ecma_op_create_environment_record (ecma_object_t *lex_env_p, ecma_value_t this_binding,
@@ -76,7 +76,7 @@ ecma_environment_record_t *ecma_op_get_environment_record (ecma_object_t *lex_en
bool ecma_op_this_binding_is_initialized (ecma_environment_record_t *environment_record_p);
void ecma_op_bind_this_value (ecma_environment_record_t *environment_record_p, ecma_value_t this_binding);
ecma_value_t ecma_op_get_this_binding (ecma_object_t *lex_env_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
@@ -53,13 +53,13 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb
conv_to_num_completion = ecma_make_number_value (num);
ecma_builtin_id_t proto_id;
#if ENABLED (JERRY_BUILTIN_NUMBER)
#if JERRY_BUILTIN_NUMBER
proto_id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE;
#else /* ENABLED (JERRY_BUILTIN_NUMBER) */
#else /* JERRY_BUILTIN_NUMBER */
proto_id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE;
#endif /* ENABLED (JERRY_BUILTIN_NUMBER) */
#endif /* JERRY_BUILTIN_NUMBER */
ecma_object_t *prototype_obj_p = ecma_builtin_get (proto_id);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_object_t *new_target = JERRY_CONTEXT (current_new_target_p);
if (new_target)
{
@@ -69,7 +69,7 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb
return ECMA_VALUE_ERROR;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
sizeof (ecma_extended_object_t),
ECMA_OBJECT_TYPE_CLASS);
@@ -79,12 +79,12 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb
/* Pass reference (no need to free conv_to_num_completion). */
ext_object_p->u.class_prop.u.value = conv_to_num_completion;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (new_target)
{
ecma_deref_object (prototype_obj_p);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_make_object_value (object_p);
} /* ecma_op_create_number_object */
@@ -170,7 +170,7 @@ static const lit_magic_string_id_t to_primitive_non_string_hint_method_names[2]
LIT_MAGIC_STRING_TO_STRING_UL, /**< toString operation */
};
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Hints for the ecma general object's toPrimitve operation
*/
@@ -180,7 +180,7 @@ static const lit_magic_string_id_t hints[3] =
LIT_MAGIC_STRING_NUMBER, /**< "number" hint */
LIT_MAGIC_STRING_STRING, /**< "string" hint */
};
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* [[DefaultValue]] ecma general object's operation
@@ -199,7 +199,7 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
JERRY_ASSERT (obj_p != NULL
&& !ecma_is_lexical_environment (obj_p));
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t obj_value = ecma_make_object_value (obj_p);
ecma_value_t exotic_to_prim = ecma_op_get_method_by_symbol_id (obj_value,
@@ -239,7 +239,7 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
{
hint = ECMA_PREFERRED_TYPE_NUMBER;
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
if (hint == ECMA_PREFERRED_TYPE_NO)
{
if (ecma_object_class_is (obj_p, LIT_MAGIC_STRING_DATE_UL))
@@ -251,7 +251,7 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
hint = ECMA_PREFERRED_TYPE_NUMBER;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_op_general_object_ordinary_value (obj_p, hint);
} /* ecma_op_general_object_default_value */
@@ -335,12 +335,12 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
const ecma_property_descriptor_t *property_desc_p) /**< property
* descriptor */
{
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (object_p))
{
return ecma_proxy_object_define_own_property (object_p, property_name_p, property_desc_p);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
JERRY_ASSERT (object_p != NULL
&& !ecma_is_lexical_environment (object_p));
@@ -519,26 +519,26 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
JERRY_ASSERT (current_prop & ECMA_PROPERTY_FLAG_DATA);
ecma_free_value_if_not_object (value_p->value);
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));
getter_setter_pair_p->getter_cp = JMEM_CP_NULL;
getter_setter_pair_p->setter_cp = JMEM_CP_NULL;
ECMA_SET_NON_NULL_POINTER (value_p->getter_setter_pair_cp, getter_setter_pair_p);
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
value_p->getter_setter_pair.getter_cp = JMEM_CP_NULL;
value_p->getter_setter_pair.setter_cp = JMEM_CP_NULL;
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
}
else
{
JERRY_ASSERT (!(current_prop & ECMA_PROPERTY_FLAG_DATA));
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
ecma_getter_setter_pointers_t *getter_setter_pair_p;
getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t,
value_p->getter_setter_pair_cp);
jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
value_p->value = ECMA_VALUE_UNDEFINED;
}
@@ -600,7 +600,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
return ECMA_VALUE_TRUE;
} /* ecma_op_general_object_define_own_property */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* The IsCompatiblePropertyDescriptor method for Proxy object internal methods
*
@@ -744,7 +744,7 @@ ecma_op_to_complete_property_descriptor (ecma_property_descriptor_t *desc_p) /**
desc_p->flags |= (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED);
}
} /* ecma_op_to_complete_property_descriptor */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
@@ -36,13 +36,13 @@ ecma_value_t ecma_op_general_object_ordinary_value (ecma_object_t *obj_p, ecma_p
ecma_value_t ecma_op_general_object_define_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p,
const ecma_property_descriptor_t *property_desc_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void ecma_op_to_complete_property_descriptor (ecma_property_descriptor_t *desc_p);
bool ecma_op_is_compatible_property_descriptor (const ecma_property_descriptor_t *desc_p,
const ecma_property_descriptor_t *current_p,
bool is_extensible);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
+138 -138
View File
@@ -30,10 +30,10 @@
#include "ecma-proxy-object.h"
#include "jcontext.h"
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
#include "ecma-typedarray-object.h"
#include "ecma-arraybuffer-object.h"
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
/** \addtogroup ecma ECMA
* @{
@@ -76,9 +76,9 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
{
JERRY_ASSERT (object_p != NULL
&& !ecma_is_lexical_environment (object_p));
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
JERRY_ASSERT (property_name_p != NULL);
JERRY_ASSERT (options == ECMA_PROPERTY_GET_NO_OPTIONS
|| property_ref_p != NULL);
@@ -173,7 +173,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
break;
}
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
case ECMA_OBJECT_TYPE_PSEUDO_ARRAY:
{
/* ES2015 9.4.5.1 */
@@ -229,7 +229,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
break;
}
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
default:
{
break;
@@ -257,7 +257,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
{
case ECMA_OBJECT_TYPE_FUNCTION:
{
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
if (ecma_string_is_length (property_name_p))
{
if (options & ECMA_PROPERTY_GET_VALUE)
@@ -283,7 +283,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
return ECMA_PROPERTY_VIRTUAL;
}
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
/* Get prototype physical property. */
property_p = ecma_op_function_try_to_lazy_instantiate_property (object_p, property_name_p);
@@ -335,7 +335,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
if (!ecma_is_value_empty (argv_p[index]))
{
#if ENABLED (JERRY_LCACHE)
#if JERRY_LCACHE
/* Mapped arguments initialized properties MUST not be lcached */
if (ecma_is_property_lcached (property_p))
{
@@ -351,7 +351,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
}
ecma_lcache_invalidate (object_p, prop_name_cp, property_p);
}
#endif /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index);
ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env);
@@ -393,12 +393,12 @@ ecma_op_object_has_property (ecma_object_t *object_p, /**< the object */
{
while (true)
{
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (object_p))
{
return ecma_proxy_object_has (object_p, property_name_p);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
/* 2 - 3. */
if (ecma_op_ordinary_object_has_own_property (object_p, property_name_p))
@@ -527,7 +527,7 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
}
}
}
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
/* ES2015 9.4.5.4 */
if (ecma_object_is_typedarray (object_p))
{
@@ -563,7 +563,7 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
ecma_deref_ecma_string (num_to_str);
}
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
break;
}
@@ -594,7 +594,7 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
{
case ECMA_OBJECT_TYPE_FUNCTION:
{
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
if (ecma_string_is_length (property_name_p))
{
/* Get length virtual property. */
@@ -615,7 +615,7 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
return ecma_make_uint32_value (len);
}
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
/* Get prototype physical property. */
property_p = ecma_op_function_try_to_lazy_instantiate_property (object_p, property_name_p);
@@ -715,12 +715,12 @@ ecma_op_object_find (ecma_object_t *object_p, /**< the object */
while (true)
{
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (object_p))
{
return ecma_proxy_object_find (object_p, property_name_p);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
ecma_value_t value = ecma_op_object_find_own (base_value, object_p, property_name_p);
@@ -782,12 +782,12 @@ ecma_op_object_get_with_receiver (ecma_object_t *object_p, /**< the object */
{
while (true)
{
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (object_p))
{
return ecma_proxy_object_get (object_p, property_name_p, receiver);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
ecma_value_t value = ecma_op_object_find_own (receiver, object_p, property_name_p);
@@ -879,7 +879,7 @@ ecma_op_object_get_by_magic_id (ecma_object_t *object_p, /**< the object */
return ecma_op_object_get (object_p, ecma_get_magic_string (property_id));
} /* ecma_op_object_get_by_magic_id */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Descriptor string for each global symbol
@@ -1046,7 +1046,7 @@ ecma_op_get_method_by_magic_id (ecma_value_t value, /**< ecma value */
{
return ecma_op_get_method (value, ecma_get_magic_string (magic_id));
} /* ecma_op_get_method_by_magic_id */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* [[Put]] ecma general object's operation specialized for property index
@@ -1108,7 +1108,7 @@ ecma_op_object_put (ecma_object_t *object_p, /**< the object */
is_throw);
} /* ecma_op_object_put */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* [[Set]] ( P, V, Receiver) operation part for ordinary objects
*
@@ -1175,7 +1175,7 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
return result;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (receiver_obj_p))
{
ecma_property_descriptor_t desc;
@@ -1197,7 +1197,7 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
return ret_value;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
if (JERRY_UNLIKELY (ecma_op_object_is_fast_array (receiver_obj_p)))
{
@@ -1215,7 +1215,7 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
return ECMA_VALUE_TRUE;
} /* ecma_op_object_put_apply_receiver */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* [[Put]] ecma general object's operation with given receiver
@@ -1247,12 +1247,12 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
&& !ecma_is_lexical_environment (object_p));
JERRY_ASSERT (property_name_p != NULL);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (object_p))
{
return ecma_proxy_object_set (object_p, property_name_p, value, receiver, is_throw);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
ecma_object_type_t type = ecma_get_object_type (object_p);
@@ -1314,7 +1314,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
}
}
}
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
/* ES2015 9.4.5.5 */
if (ecma_object_is_typedarray (object_p))
{
@@ -1348,7 +1348,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
return ECMA_VALUE_FALSE;
}
}
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
break;
}
default:
@@ -1399,19 +1399,19 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
}
case ECMA_OBJECT_TYPE_FUNCTION:
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* Uninitialized 'length' property is non-writable (ECMA-262 v6, 19.2.4.1) */
if ((ecma_string_is_length (property_name_p))
&& (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (((ecma_extended_object_t *) object_p)->u.function.scope_cp)))
{
return ecma_reject (is_throw);
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
if (ecma_string_is_length (property_name_p))
{
return ecma_reject (is_throw);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Get prototype physical property. */
property_p = ecma_op_function_try_to_lazy_instantiate_property (object_p, property_name_p);
@@ -1453,12 +1453,12 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
{
if (ecma_is_property_writable (*property_p))
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ecma_make_object_value (object_p) != receiver)
{
return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* There is no need for special casing arrays here because changing the
* value of an existing property never changes the length of an array. */
@@ -1495,7 +1495,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
ecma_property_ref_t property_ref = { NULL };
proto_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, obj_cp);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (proto_p))
{
return ecma_op_object_put_with_receiver (proto_p,
@@ -1504,7 +1504,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
receiver,
is_throw);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
ecma_property_t inherited_property = ecma_op_object_get_own_property (proto_p,
property_name_p,
@@ -1528,14 +1528,14 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
}
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (create_new_property
&& ecma_is_value_object (receiver)
&& ECMA_OBJECT_IS_PROXY (ecma_get_object_from_value (receiver)))
{
return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
if (create_new_property
&& ecma_op_ordinary_object_is_extensible (object_p))
@@ -1575,9 +1575,9 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_property_value_t *new_prop_value_p;
new_prop_value_p = ecma_create_named_data_property (object_p,
@@ -1669,12 +1669,12 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
}
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (obj_p))
{
return ecma_proxy_object_delete_property (obj_p, property_name_p, is_strict);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p));
@@ -1741,12 +1741,12 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
const ecma_object_type_t type = ecma_get_object_type (obj_p);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (obj_p))
{
return ecma_proxy_object_define_own_property (obj_p, property_name_p, property_desc_p);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
switch (type)
{
@@ -1774,16 +1774,16 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
if (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS)
{
#else /* !ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#else /* !JERRY_BUILTIN_TYPEDARRAY */
JERRY_ASSERT (ext_object_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS);
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
return ecma_op_arguments_object_define_own_property (obj_p,
property_name_p,
property_desc_p);
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
}
/* ES2015 9.4.5.3 */
if (ecma_object_is_typedarray (obj_p))
@@ -1829,9 +1829,9 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
return ecma_op_general_object_define_own_property (obj_p,
property_name_p,
property_desc_p);
#else /* !ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#else /* !JERRY_BUILTIN_TYPEDARRAY */
break;
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
}
}
} /* ecma_op_object_define_own_property */
@@ -1858,12 +1858,12 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
{
*prop_desc_p = ecma_make_empty_property_descriptor ();
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (object_p))
{
return ecma_proxy_object_get_own_property_descriptor (object_p, property_name_p, prop_desc_p);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
ecma_property_ref_t property_ref;
@@ -1926,7 +1926,7 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
return ECMA_VALUE_TRUE;
} /* ecma_op_object_get_own_property_descriptor */
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
/**
* Get property descriptor from a target value for a specified property.
*
@@ -1947,7 +1947,7 @@ ecma_op_get_own_property_descriptor (ecma_value_t target, /**< target value */
return ecma_op_object_get_own_property_descriptor (ecma_get_object_from_value (target), property_name_p, prop_desc_p);
} /* ecma_op_get_own_property_descriptor */
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
/**
* [[HasInstance]] ecma object's operation
@@ -1989,7 +1989,7 @@ ecma_op_object_get_prototype_of (ecma_object_t *obj_p) /**< input object */
{
JERRY_ASSERT (obj_p != NULL);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (obj_p))
{
ecma_value_t proto = ecma_proxy_object_get_prototype_of (obj_p);
@@ -2008,7 +2008,7 @@ ecma_op_object_get_prototype_of (ecma_object_t *obj_p) /**< input object */
return ecma_get_object_from_value (proto);
}
else
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
{
jmem_cpointer_t proto_cp = ecma_op_ordinary_object_get_prototype_of (obj_p);
@@ -2081,12 +2081,12 @@ ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p, /**< routine
/* 2. */
ecma_collection_t *prop_names_p = ecma_op_object_own_property_keys (obj_p);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (JERRY_UNLIKELY (prop_names_p == NULL))
{
return prop_names_p;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
ecma_value_t *names_buffer_p = prop_names_p->buffer_p;
/* 3. */
@@ -2224,12 +2224,12 @@ ecma_object_list_lazy_property_names (ecma_object_t *obj_p, /**< object */
{
ecma_op_arguments_object_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
}
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
if (ecma_object_is_typedarray (obj_p))
{
ecma_op_typedarray_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p);
}
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
break;
}
case ECMA_OBJECT_TYPE_FUNCTION:
@@ -2281,32 +2281,32 @@ ecma_object_sort_property_names (ecma_collection_t *prop_names_p, /**< prop name
ecma_property_counter_t *prop_counter) /**< prop counter */
{
uint32_t lazy_string_prop_name_count = prop_counter->lazy_string_named_props;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
uint32_t lazy_symbol_prop_name_count = prop_counter->lazy_symbol_named_props;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
uint32_t string_name_pos = prop_counter->string_named_props;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
uint32_t symbol_name_pos = prop_counter->symbol_named_props;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
uint32_t all_prop_count = (prop_counter->array_index_named_props) + (string_name_pos);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
all_prop_count += symbol_name_pos;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t *names_p = jmem_heap_alloc_block (all_prop_count * sizeof (ecma_value_t));
ecma_value_t *string_names_p = names_p + prop_counter->array_index_named_props;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t *symbol_names_p = string_names_p + string_name_pos;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
uint32_t array_index_name_pos = 0;
uint32_t lazy_string_name_pos = 0;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
uint32_t lazy_symbol_name_pos = 0;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
for (uint32_t i = 0; i < prop_names_p->item_count; i++)
{
@@ -2347,7 +2347,7 @@ ecma_object_sort_property_names (ecma_collection_t *prop_names_p, /**< prop name
names_p[insert_pos] = prop_name;
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* sort symbol named properites in creation order */
else if (ecma_prop_name_is_symbol (name_p))
{
@@ -2363,7 +2363,7 @@ ecma_object_sort_property_names (ecma_collection_t *prop_names_p, /**< prop name
symbol_names_p[--symbol_name_pos] = prop_name;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* sort string named properties in creation order */
else
{
@@ -2406,12 +2406,12 @@ ecma_object_sort_property_names (ecma_collection_t *prop_names_p, /**< prop name
ecma_collection_t *
ecma_op_object_own_property_keys (ecma_object_t *obj_p) /**< object */
{
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (obj_p))
{
return ecma_proxy_object_own_property_keys (obj_p);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
if (ecma_op_object_is_fast_array (obj_p))
{
@@ -2428,7 +2428,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p) /**< object */
jmem_cpointer_t prop_iter_cp = obj_p->u1.property_list_cp;
#if ENABLED (JERRY_PROPRETY_HASHMAP)
#if JERRY_PROPRETY_HASHMAP
if (prop_iter_cp != JMEM_CP_NULL)
{
ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
@@ -2438,7 +2438,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p) /**< object */
prop_iter_cp = prop_iter_p->next_property_cp;
}
}
#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */
#endif /* JERRY_PROPRETY_HASHMAP */
while (prop_iter_cp != JMEM_CP_NULL)
{
@@ -2469,12 +2469,12 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p) /**< object */
{
prop_counter.array_index_named_props++;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (ecma_prop_name_is_symbol (name_p))
{
prop_counter.symbol_named_props++;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else
{
prop_counter.string_named_props++;
@@ -2521,7 +2521,7 @@ ecma_op_object_enumerate (ecma_object_t *obj_p) /**< object */
{
ecma_collection_t *keys = ecma_op_object_own_property_keys (obj_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (keys == NULL))
{
ecma_collection_free (return_names_p);
@@ -2529,19 +2529,19 @@ ecma_op_object_enumerate (ecma_object_t *obj_p) /**< object */
ecma_deref_object (obj_p);
return keys;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
for (uint32_t i = 0; i < keys->item_count; i++)
{
ecma_value_t prop_name = keys->buffer_p[i];
ecma_string_t *name_p = ecma_get_prop_name_from_value (prop_name);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ecma_prop_name_is_symbol (name_p))
{
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_property_descriptor_t prop_desc;
ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (obj_p, name_p, &prop_desc);
@@ -2616,10 +2616,10 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */
{
#ifndef JERRY_NDEBUG
return (ecma_builtin_is_global (obj_p)
#if ENABLED (JERRY_BUILTIN_PROMISE)
#if JERRY_BUILTIN_PROMISE
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_PROMISE_PROTOTYPE)
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#endif /* JERRY_BUILTIN_PROMISE */
#if JERRY_BUILTIN_TYPEDARRAY
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE)
@@ -2630,15 +2630,15 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_FLOAT32ARRAY_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE)
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE)
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_BIGINT64ARRAY_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_BIGUINT64ARRAY_PROTOTYPE)
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#if ENABLED (JERRY_ESNEXT)
#endif /* JERRY_BUILTIN_BIGINT */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_ESNEXT
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ARRAY_PROTOTYPE_UNSCOPABLES)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ARRAY_ITERATOR_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE)
@@ -2656,28 +2656,28 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE)
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE)
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_MAP)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_MAP
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_MAP_PROTOTYPE)
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE)
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* ENABLED (JERRY_BUILTIN_MAP) */
#if ENABLED (JERRY_BUILTIN_SET)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_MAP */
#if JERRY_BUILTIN_SET
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SET_PROTOTYPE)
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE)
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* ENABLED (JERRY_BUILTIN_SET) */
#if ENABLED (JERRY_BUILTIN_WEAKMAP)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_SET */
#if JERRY_BUILTIN_WEAKMAP
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE)
#endif /* ENABLED (JERRY_BUILTIN_WEAKMAP) */
#if ENABLED (JERRY_BUILTIN_WEAKSET)
#endif /* JERRY_BUILTIN_WEAKMAP */
#if JERRY_BUILTIN_WEAKSET
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE)
#endif /* ENABLED (JERRY_BUILTIN_WEAKSET) */
#if ENABLED (JERRY_BUILTIN_DATAVIEW)
#endif /* JERRY_BUILTIN_WEAKSET */
#if JERRY_BUILTIN_DATAVIEW
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE)
#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW) */
#endif /* JERRY_BUILTIN_DATAVIEW */
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE));
#else /* JERRY_NDEBUG */
JERRY_UNUSED (obj_p);
@@ -2713,14 +2713,14 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
switch (ext_obj_p->u.pseudo_array.type)
{
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
case ECMA_PSEUDO_ARRAY_TYPEDARRAY:
case ECMA_PSEUDO_ARRAY_TYPEDARRAY_WITH_INFO:
{
return (lit_magic_string_id_t) ext_obj_p->u.pseudo_array.u1.class_id;
}
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#if ENABLED (JERRY_ESNEXT)
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_ESNEXT
case ECMA_PSEUDO_ARRAY_ITERATOR:
{
return LIT_MAGIC_STRING_ARRAY_ITERATOR_UL;
@@ -2733,8 +2733,8 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
{
return LIT_MAGIC_STRING_MAP_ITERATOR_UL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_ESNEXT)
#endif /* JERRY_ESNEXT */
#if JERRY_ESNEXT
case ECMA_PSEUDO_STRING_ITERATOR:
{
return LIT_MAGIC_STRING_STRING_ITERATOR_UL;
@@ -2743,7 +2743,7 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
{
return LIT_MAGIC_STRING_REGEXP_STRING_ITERATOR_UL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
JERRY_ASSERT (ext_obj_p->u.pseudo_array.type == ECMA_PSEUDO_ARRAY_ARGUMENTS);
@@ -2760,7 +2760,7 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
{
return LIT_MAGIC_STRING_FUNCTION_UL;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
case ECMA_OBJECT_TYPE_PROXY:
{
ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;
@@ -2772,7 +2772,7 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
}
return LIT_MAGIC_STRING_OBJECT_UL;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
default:
{
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_GENERAL || type == ECMA_OBJECT_TYPE_PROXY);
@@ -2783,19 +2783,19 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
switch (ext_obj_p->u.built_in.id)
{
#if ENABLED (JERRY_BUILTIN_MATH)
#if JERRY_BUILTIN_MATH
case ECMA_BUILTIN_ID_MATH:
{
return LIT_MAGIC_STRING_MATH_UL;
}
#endif /* ENABLED (JERRY_BUILTIN_MATH) */
#if ENABLED (JERRY_BUILTIN_REFLECT)
#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_REFLECT
case ECMA_BUILTIN_ID_REFLECT:
{
return LIT_MAGIC_STRING_REFLECT_UL;
}
#endif /* ENABLED (JERRY_BUILTIN_REFLECT) */
#if ENABLED (JERRY_ESNEXT)
#endif /* JERRY_BUILTIN_REFLECT */
#if JERRY_ESNEXT
case ECMA_BUILTIN_ID_GENERATOR:
{
return LIT_MAGIC_STRING_GENERATOR_UL;
@@ -2804,39 +2804,39 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
{
return LIT_MAGIC_STRING_ASYNC_GENERATOR_UL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_JSON)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_JSON
case ECMA_BUILTIN_ID_JSON:
{
return LIT_MAGIC_STRING_JSON_U;
}
#endif /* ENABLED (JERRY_BUILTIN_JSON) */
#if !ENABLED (JERRY_ESNEXT)
#if ENABLED (JERRY_BUILTIN_ERRORS)
#endif /* JERRY_BUILTIN_JSON */
#if !JERRY_ESNEXT
#if JERRY_BUILTIN_ERRORS
case ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE:
case ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE:
case ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE:
case ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE:
case ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE:
case ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE:
#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */
#endif /* JERRY_BUILTIN_ERRORS */
case ECMA_BUILTIN_ID_ERROR_PROTOTYPE:
{
return LIT_MAGIC_STRING_ERROR_UL;
}
#endif /* !ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_BUILTIN_PROXY)
#endif /* !JERRY_ESNEXT */
#if JERRY_BUILTIN_PROXY
case ECMA_BUILTIN_ID_PROXY:
{
return LIT_MAGIC_STRING_FUNCTION_UL;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_BIGINT
case ECMA_BUILTIN_ID_BIGINT:
{
return LIT_MAGIC_STRING_FUNCTION_UL;
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
default:
{
JERRY_ASSERT (ecma_object_check_class_name_is_object (obj_p));
@@ -2889,7 +2889,7 @@ ecma_object_is_regexp_object (ecma_value_t arg) /**< argument */
&& ecma_object_class_is (ecma_get_object_from_value (arg), LIT_MAGIC_STRING_REGEXP_UL));
} /* ecma_object_is_regexp_object */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Object's IsConcatSpreadable operation, used for Array.prototype.concat
* It checks the argument's [Symbol.isConcatSpreadable] property value
@@ -3036,7 +3036,7 @@ ecma_op_invoke_by_symbol_id (ecma_value_t object, /**< Object value */
return ret_value;
} /* ecma_op_invoke_by_symbol_id */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* 7.3.18 Abstract operation Invoke when property name is a magic string
@@ -3074,11 +3074,11 @@ ecma_op_invoke (ecma_value_t object, /**< Object value */
ecma_object_t *object_p = ecma_get_object_from_value (object_value);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t this_arg = object;
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
ecma_value_t this_arg = object_value;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t func = ecma_op_object_get_with_receiver (object_p, property_name_p, this_arg);
@@ -3186,12 +3186,12 @@ ecma_op_ordinary_object_set_prototype_of (ecma_object_t *obj_p, /**< base object
}
/* 8.c.i */
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (iter_p))
{
break;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
/* 8.c.ii */
iter_p = ECMA_GET_POINTER (ecma_object_t, ecma_op_ordinary_object_get_prototype_of (iter_p));
+6 -6
View File
@@ -40,12 +40,12 @@ ecma_value_t ecma_op_object_get_with_receiver (ecma_object_t *object_p, ecma_str
ecma_value_t ecma_op_object_get_length (ecma_object_t *object_p, ecma_length_t *length_p);
ecma_value_t ecma_op_object_get_by_index (ecma_object_t *object_p, ecma_length_t index);
ecma_value_t ecma_op_object_get_by_magic_id (ecma_object_t *object_p, lit_magic_string_id_t property_id);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_string_t *ecma_op_get_global_symbol (lit_magic_string_id_t property_id);
ecma_value_t ecma_op_object_get_by_symbol_id (ecma_object_t *object_p, lit_magic_string_id_t property_id);
ecma_value_t ecma_op_get_method_by_symbol_id (ecma_value_t value, lit_magic_string_id_t symbol_id);
ecma_value_t ecma_op_get_method_by_magic_id (ecma_value_t value, lit_magic_string_id_t magic_id);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t ecma_op_object_put_with_receiver (ecma_object_t *object_p, ecma_string_t *property_name_p,
ecma_value_t value, ecma_value_t receiver, bool is_throw);
ecma_value_t ecma_op_object_put (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t value,
@@ -73,13 +73,13 @@ ecma_collection_t *ecma_op_object_enumerate (ecma_object_t *obj_p);
lit_magic_string_id_t ecma_object_get_class_name (ecma_object_t *obj_p);
bool ecma_object_class_is (ecma_object_t *object_p, uint32_t class_id);
bool ecma_object_is_regexp_object (ecma_value_t arg);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t ecma_op_is_concat_spreadable (ecma_value_t arg);
ecma_value_t ecma_op_is_regexp (ecma_value_t arg);
ecma_value_t ecma_op_species_constructor (ecma_object_t *this_value, ecma_builtin_id_t default_constructor_id);
ecma_value_t ecma_op_invoke_by_symbol_id (ecma_value_t object, lit_magic_string_id_t magic_string_id,
ecma_value_t *args_p, uint32_t args_len);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t ecma_op_invoke (ecma_value_t object, ecma_string_t *property_name_p, ecma_value_t *args_p,
uint32_t args_len);
ecma_value_t ecma_op_invoke_by_magic_id (ecma_value_t object, lit_magic_string_id_t magic_string_id,
@@ -90,11 +90,11 @@ ecma_value_t ecma_op_ordinary_object_set_prototype_of (ecma_object_t *base_p, ec
bool JERRY_ATTR_PURE ecma_op_ordinary_object_is_extensible (ecma_object_t *object_p);
void ecma_op_ordinary_object_prevent_extensions (ecma_object_t *object_p);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
ecma_value_t ecma_op_get_own_property_descriptor (ecma_value_t target,
ecma_string_t *property_name_p,
ecma_property_descriptor_t *prop_desc_p);
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
/**
* @}
@@ -29,7 +29,7 @@
#include "ecma-promise-object.h"
#include "jcontext.h"
#if ENABLED (JERRY_BUILTIN_PROMISE)
#if JERRY_BUILTIN_PROMISE
/** \addtogroup ecma ECMA
* @{
@@ -1167,4 +1167,4 @@ ecma_promise_async_await (ecma_extended_object_t *async_generator_object_p, /**<
* @}
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
#endif /* JERRY_BUILTIN_PROMISE */
@@ -16,7 +16,7 @@
#ifndef ECMA_PROMISE_OBJECT_H
#define ECMA_PROMISE_OBJECT_H
#if ENABLED (JERRY_BUILTIN_PROMISE)
#if JERRY_BUILTIN_PROMISE
#include "ecma-globals.h"
/** \addtogroup ecma ECMA
@@ -156,5 +156,5 @@ ecma_value_t ecma_op_get_capabilities_executor_cb (const ecma_value_t function_o
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_PROMISE) */
#endif /* JERRY_BUILTIN_PROMISE */
#endif /* !ECMA_PROMISE_OBJECT_H */
@@ -35,7 +35,7 @@
* @{
*/
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
/**
* ProxyCreate operation for create a new proxy object
*
@@ -1814,7 +1814,7 @@ ecma_proxy_object_construct (ecma_object_t *obj_p, /**< proxy object */
return new_obj;
} /* ecma_proxy_object_construct */
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
/**
* @}
@@ -25,7 +25,7 @@
* @{
*/
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
ecma_object_t *
ecma_proxy_create (ecma_value_t target,
@@ -107,7 +107,7 @@ ecma_proxy_object_construct (ecma_object_t *obj_p,
const ecma_value_t *args_p,
uint32_t argc);
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
/**
* @}
+36 -36
View File
@@ -47,22 +47,22 @@ ecma_op_resolve_reference_base (ecma_object_t *lex_env_p, /**< starting lexical
while (true)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_HOME_OBJECT_BOUND)
{
JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);
lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t has_binding = ecma_op_has_binding (lex_env_p, name_p);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_IS_VALUE_ERROR (has_binding))
{
return ECMA_OBJECT_POINTER_ERROR;
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
if (ecma_is_value_true (has_binding))
{
@@ -78,7 +78,7 @@ ecma_op_resolve_reference_base (ecma_object_t *lex_env_p, /**< starting lexical
}
} /* ecma_op_resolve_reference_base */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Check if the passed lexical environment is a global lexical environment
@@ -90,14 +90,14 @@ static inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_op_is_global_environment (ecma_object_t *lex_env_p) /**< lexical environment */
{
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL
|| (ecma_make_object_value (ecma_get_lex_env_binding_object (lex_env_p))
== ((ecma_global_object_t *) ecma_builtin_get_global ())->this_binding));
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
#else /* !JERRY_BUILTIN_REALMS */
JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL
|| ecma_get_lex_env_binding_object (lex_env_p) == ecma_builtin_get_global ());
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
return lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL;
} /* ecma_op_is_global_environment */
@@ -122,12 +122,12 @@ ecma_op_resolve_super_base (ecma_object_t *lex_env_p) /**< starting lexical envi
{
ecma_object_t *home_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u1.home_object_cp);
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (home_p))
{
return ecma_proxy_object_get_prototype_of (home_p);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
jmem_cpointer_t proto_cp = ecma_op_ordinary_object_get_prototype_of (home_p);
@@ -197,7 +197,7 @@ ecma_op_is_prop_unscopable (ecma_object_t *binding_obj_p, /**< binding object */
return ECMA_VALUE_FALSE;
} /* ecma_op_is_prop_unscopable */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Helper method for HasBindig operation
@@ -229,7 +229,7 @@ ecma_op_object_bound_environment_resolve_reference_value (ecma_object_t *lex_env
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
ecma_value_t found_binding;
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (binding_obj_p))
{
found_binding = ecma_proxy_object_has (binding_obj_p, name_p);
@@ -241,7 +241,7 @@ ecma_op_object_bound_environment_resolve_reference_value (ecma_object_t *lex_env
}
else
{
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
found_binding = ecma_op_object_find (binding_obj_p, name_p);
if (ECMA_IS_VALUE_ERROR (found_binding) || !ecma_is_value_found (found_binding))
@@ -249,39 +249,39 @@ ecma_op_object_bound_environment_resolve_reference_value (ecma_object_t *lex_env
return found_binding;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_LIKELY (ecma_op_is_global_environment (lex_env_p)))
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
{
return found_binding;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t blocked = ecma_op_is_prop_unscopable (binding_obj_p, name_p);
if (ecma_is_value_false (blocked))
{
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (binding_obj_p))
{
return ecma_proxy_object_get (binding_obj_p, name_p, ecma_make_object_value (binding_obj_p));
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
return found_binding;
}
#if ENABLED (JERRY_BUILTIN_PROXY)
#if JERRY_BUILTIN_PROXY
if (!ECMA_OBJECT_IS_PROXY (binding_obj_p))
{
ecma_free_value (found_binding);
}
#endif /* ENABLED (JERRY_BUILTIN_PROXY) */
#endif /* JERRY_BUILTIN_PROXY */
return ECMA_IS_VALUE_ERROR (blocked) ? blocked : ECMA_VALUE_NOT_FOUND;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} /* ecma_op_object_bound_environment_resolve_reference_value */
/**
@@ -307,28 +307,28 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
{
ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))
{
return ecma_raise_reference_error (ECMA_ERR_MSG ("Variables declared by let/const must be"
" initialized before reading their value"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_fast_copy_value (property_value_p->value);
}
}
else if (lex_env_type == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
bool lcache_lookup_allowed = ecma_op_is_global_environment (lex_env_p);
#else /* !ENABLED (JERRY_ESNEXT)*/
#else /* !JERRY_ESNEXT*/
bool lcache_lookup_allowed = true;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (lcache_lookup_allowed)
{
#if ENABLED (JERRY_LCACHE)
#if JERRY_LCACHE
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
ecma_property_t *property_p = ecma_lcache_lookup (binding_obj_p, name_p);
@@ -355,7 +355,7 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
ecma_value_t base_value = ecma_make_object_value (binding_obj_p);
return ecma_op_function_call (getter_p, base_value, NULL, 0);
}
#endif /* ENABLED (JERRY_LCACHE) */
#endif /* JERRY_LCACHE */
}
ecma_value_t result = ecma_op_object_bound_environment_resolve_reference_value (lex_env_p, name_p);
@@ -368,11 +368,11 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
}
else
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_ASSERT (lex_env_type == ECMA_LEXICAL_ENVIRONMENT_HOME_OBJECT_BOUND);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
JERRY_UNREACHABLE ();
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
if (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL)
@@ -383,14 +383,14 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);
}
#if ENABLED (JERRY_ERROR_MESSAGES)
#if JERRY_ERROR_MESSAGES
ecma_value_t name_val = ecma_make_string_value (name_p);
ecma_value_t error_value = ecma_raise_standard_error_with_format (ECMA_ERROR_REFERENCE,
"% is not defined",
name_val);
#else /* ENABLED (JERRY_ERROR_MESSAGES) */
#else /* JERRY_ERROR_MESSAGES */
ecma_value_t error_value = ecma_raise_reference_error (NULL);
#endif /* !ENABLED (JERRY_ERROR_MESSAGES) */
#endif /* !JERRY_ERROR_MESSAGES */
return error_value;
} /* ecma_op_resolve_reference_value */
+2 -2
View File
@@ -29,9 +29,9 @@
ecma_object_t *ecma_op_resolve_reference_base (ecma_object_t *lex_env_p, ecma_string_t *name_p);
ecma_value_t ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, ecma_string_t *name_p);
ecma_value_t ecma_op_object_bound_environment_resolve_reference_value (ecma_object_t *lex_env_p, ecma_string_t *name_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t ecma_op_resolve_super_base (ecma_object_t *lex_env_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
+66 -67
View File
@@ -28,7 +28,7 @@
#include "lit-char-helpers.h"
#include "re-compiler.h"
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -97,13 +97,13 @@ ecma_regexp_parse_flags (ecma_string_t *flags_str_p, /**< Input string with flag
flag = RE_FLAG_UNICODE;
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case 's':
{
flag = RE_FLAG_DOTALL;
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
flag = RE_FLAG_EMPTY;
@@ -126,7 +126,7 @@ ecma_regexp_parse_flags (ecma_string_t *flags_str_p, /**< Input string with flag
return ret_value;
} /* ecma_regexp_parse_flags */
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
/*
* Create the properties of a RegExp instance.
*/
@@ -199,7 +199,7 @@ ecma_regexp_update_props (ecma_object_t *re_object_p, /**< RegExp object */
prop_value_p = ECMA_PROPERTY_VALUE_PTR (prop_p);
prop_value_p->value = ecma_make_boolean_value (flags & RE_FLAG_MULTILINE);
} /* ecma_regexp_update_props */
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
/**
* RegExpAlloc method
@@ -215,7 +215,7 @@ ecma_regexp_update_props (ecma_object_t *re_object_p, /**< RegExp object */
ecma_object_t *
ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ctr_obj_p == NULL)
{
ctr_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP);
@@ -229,18 +229,18 @@ ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer
return proto_obj_p;
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
JERRY_UNUSED (ctr_obj_p);
ecma_object_t *proto_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_object_t *new_object_p = ecma_create_object (proto_obj_p,
sizeof (ecma_extended_object_t),
ECMA_OBJECT_TYPE_CLASS);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_deref_object (proto_obj_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_extended_object_t *regexp_obj_p = (ecma_extended_object_t *) new_object_p;
@@ -268,7 +268,7 @@ ecma_op_regexp_initialize (ecma_object_t *regexp_obj_p, /**< RegExp object */
{
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) regexp_obj_p;
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
if (ext_obj_p->u.class_prop.class_id == LIT_MAGIC_STRING_UNDEFINED)
{
/* This instance has not been initialized before. */
@@ -278,12 +278,12 @@ ecma_op_regexp_initialize (ecma_object_t *regexp_obj_p, /**< RegExp object */
{
ecma_regexp_update_props (regexp_obj_p, pattern_str_p, flags);
}
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
JERRY_UNUSED (pattern_str_p);
JERRY_UNUSED (flags);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ext_obj_p->u.class_prop.class_id = LIT_MAGIC_STRING_REGEXP_UL;
ECMA_SET_INTERNAL_VALUE_POINTER (ext_obj_p->u.class_prop.u.value, bc_p);
@@ -409,7 +409,7 @@ lit_code_point_t
ecma_regexp_canonicalize_char (lit_code_point_t ch, /**< character */
bool unicode) /**< unicode */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (unicode)
{
/* In unicode mode the mappings contained in the CaseFolding.txt file should be used to canonicalize the character.
@@ -433,7 +433,7 @@ ecma_regexp_canonicalize_char (lit_code_point_t ch, /**< character */
return ch;
}
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
JERRY_UNUSED (unicode);
lit_code_point_t cu = lit_char_to_upper_case (ch, NULL);
@@ -523,7 +523,7 @@ ecma_regexp_advance (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */
JERRY_ASSERT (str_p != NULL);
lit_code_point_t cp = lit_cesu8_read_next (str_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (re_ctx_p->flags & RE_FLAG_UNICODE)
&& lit_is_code_point_utf16_high_surrogate ((ecma_char_t) cp)
&& *str_p < re_ctx_p->input_end_p)
@@ -535,12 +535,12 @@ ecma_regexp_advance (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */
*str_p += LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_regexp_canonicalize (cp, re_ctx_p->flags);
} /* ecma_regexp_advance */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Helper function to get current full unicode code point and advance the string pointer.
*
@@ -568,7 +568,7 @@ ecma_regexp_unicode_advance (const lit_utf8_byte_t **str_p, /**< reference to st
*str_p = current_p;
return ch;
} /* ecma_regexp_unicode_advance */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Helper function to revert the string pointer to the previous code point.
@@ -580,7 +580,7 @@ ecma_regexp_step_back (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */
const lit_utf8_byte_t *str_p) /**< reference to string pointer */
{
JERRY_ASSERT (str_p != NULL);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
lit_code_point_t ch = lit_cesu8_read_prev (&str_p);
if (JERRY_UNLIKELY (re_ctx_p->flags & RE_FLAG_UNICODE)
&& lit_is_code_point_utf16_low_surrogate (ch)
@@ -588,10 +588,10 @@ ecma_regexp_step_back (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */
{
str_p -= LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
JERRY_UNUSED (re_ctx_p);
lit_utf8_decr (&str_p);
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
return str_p;
} /* ecma_regexp_step_back */
@@ -612,7 +612,7 @@ ecma_regexp_is_word_boundary (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context *
{
left_cp = LIT_INVALID_CP;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (JERRY_UNLIKELY ((re_ctx_p->flags & (RE_FLAG_UNICODE | RE_FLAG_IGNORE_CASE))
== (RE_FLAG_UNICODE | RE_FLAG_IGNORE_CASE)))
{
@@ -620,7 +620,7 @@ ecma_regexp_is_word_boundary (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context *
left_cp = ecma_regexp_advance (re_ctx_p, &prev_p);
JERRY_ASSERT (prev_p == str_p);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else
{
left_cp = str_p[-1];
@@ -630,13 +630,13 @@ ecma_regexp_is_word_boundary (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context *
{
right_cp = LIT_INVALID_CP;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (JERRY_UNLIKELY ((re_ctx_p->flags & (RE_FLAG_UNICODE | RE_FLAG_IGNORE_CASE))
== (RE_FLAG_UNICODE | RE_FLAG_IGNORE_CASE)))
{
right_cp = ecma_regexp_advance (re_ctx_p, &str_p);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else
{
right_cp = str_p[0];
@@ -1501,7 +1501,7 @@ class_found:
bc_p = bc_p + escape_count + chars_size + ranges_size;
continue;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case RE_OP_UNICODE_PERIOD:
{
if (str_curr_p >= re_ctx_p->input_end_p)
@@ -1520,7 +1520,7 @@ class_found:
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
case RE_OP_PERIOD:
{
if (str_curr_p >= re_ctx_p->input_end_p)
@@ -1529,11 +1529,11 @@ class_found:
}
const ecma_char_t ch = lit_cesu8_read_next (&str_curr_p);
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
bool has_dot_all_flag = false;
#else /* ENABLED (JERRY_ESNEXT) */
#else /* JERRY_ESNEXT */
bool has_dot_all_flag = (re_ctx_p->flags & RE_FLAG_DOTALL) != 0;
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
if (!has_dot_all_flag && lit_char_is_line_terminator (ch))
{
@@ -1763,10 +1763,10 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
ecma_length_t index = 0;
ecma_value_t lastindex_value = ecma_op_object_get_by_magic_id (regexp_object_p, LIT_MAGIC_STRING_LASTINDEX_UL);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ret_value = ecma_op_to_length (lastindex_value, &index);
ecma_free_value (lastindex_value);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
ecma_number_t lastindex_num = 0.0f;
ret_value = ecma_op_to_integer (lastindex_value, &lastindex_num);
ecma_free_value (lastindex_value);
@@ -1780,7 +1780,7 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
}
index = ecma_number_to_uint32 (lastindex_num);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (ECMA_IS_VALUE_ERROR (ret_value))
{
@@ -1833,13 +1833,13 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
goto match_found;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* 12.c.i */
if (re_ctx.flags & RE_FLAG_STICKY)
{
goto fail_put_lastindex;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* 12.a */
if (input_curr_p >= input_end_p)
@@ -1857,7 +1857,7 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
/* 12.c.ii */
index++;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx.flags & RE_FLAG_UNICODE)
{
const lit_code_point_t cp = ecma_regexp_unicode_advance (&input_curr_p, input_end_p);
@@ -1869,7 +1869,7 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
lit_utf8_incr (&input_curr_p);
}
@@ -2097,7 +2097,7 @@ ecma_regexp_split_helper (ecma_value_t this_arg, /**< this value */
ecma_value_t string_arg, /**< string value */
ecma_value_t limit_arg) /**< limit value */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* 2. */
if (!ecma_is_value_object (this_arg))
{
@@ -2418,7 +2418,7 @@ cleanup_string:
ecma_deref_ecma_string (string_p);
return result;
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
ecma_value_t result = ECMA_VALUE_ERROR;
/* 2. */
@@ -2587,7 +2587,7 @@ cleanup_string:
ecma_deref_ecma_string (string_p);
return result;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} /* ecma_regexp_split_helper */
/**
@@ -2617,7 +2617,6 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
ecma_bytecode_ref ((ecma_compiled_code_t *) bc_p);
JERRY_ASSERT (bc_p != NULL);
ecma_value_t result = ECMA_VALUE_EMPTY;
uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII;
lit_utf8_size_t string_length;
@@ -2643,7 +2642,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
/* lastIndex must be accessed to remain consistent with the standard, even though we may not need the value. */
ecma_value_t lastindex_value = ecma_op_object_get_by_magic_id ((ecma_object_t *) re_obj_p,
LIT_MAGIC_STRING_LASTINDEX_UL);
result = ecma_op_to_length (lastindex_value, &index);
ecma_value_t result = ecma_op_to_length (lastindex_value, &index);
ecma_free_value (lastindex_value);
if (ECMA_IS_VALUE_ERROR (result))
@@ -2651,7 +2650,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
goto cleanup_context;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* Only non-global sticky matches use the lastIndex value, otherwise the starting index is 0. */
if (JERRY_UNLIKELY ((ctx_p->flags & RE_FLAG_GLOBAL) == 0 && (re_ctx.flags & RE_FLAG_STICKY) != 0))
{
@@ -2686,7 +2685,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
}
}
else
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
{
index = 0;
}
@@ -2770,7 +2769,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
if (!(ctx_p->flags & RE_FLAG_GLOBAL))
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY ((re_ctx.flags & RE_FLAG_STICKY) != 0))
{
ecma_value_t index_value = ecma_make_length_value (index);
@@ -2786,7 +2785,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
goto cleanup_builder;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
break;
}
@@ -2797,7 +2796,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
continue;
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (JERRY_UNLIKELY ((re_ctx.flags & RE_FLAG_STICKY) != 0))
{
result = ecma_op_object_put ((ecma_object_t *) re_obj_p,
@@ -2812,14 +2811,14 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (current_p >= string_end_p)
{
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if ((ctx_p->flags & RE_FLAG_UNICODE) != 0)
{
index++;
@@ -2833,7 +2832,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
index++;
lit_utf8_incr (&current_p);
@@ -2921,14 +2920,14 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
ecma_free_value (result);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
const lit_utf8_size_t string_length = ecma_string_get_length (string_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* 10. */
if (replace_ctx.flags & RE_FLAG_GLOBAL)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_UNICODE);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -2941,7 +2940,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
}
ecma_free_value (result);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
result = ecma_op_object_put (this_obj_p,
ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
@@ -2955,14 +2954,14 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
JERRY_ASSERT (ecma_is_value_boolean (result));
}
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
result = ecma_regexp_replace_helper_fast (&replace_ctx,
(ecma_extended_object_t *) this_obj_p,
string_p,
replace_arg);
goto cleanup_replace;
#else /* ENABLED (JERRY_ESNEXT) */
#else /* JERRY_ESNEXT */
result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_EXEC);
if (ECMA_IS_VALUE_ERROR (result))
@@ -3338,7 +3337,7 @@ cleanup_chars:
cleanup_results:
ecma_collection_free (results_p);
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
cleanup_replace:
if (replace_ctx.replace_str_p != NULL)
@@ -3398,7 +3397,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
return result;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t full_unicode_value = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_UNICODE);
if (ECMA_IS_VALUE_ERROR (full_unicode_value))
@@ -3410,7 +3409,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
bool full_unicode = ecma_op_to_boolean (full_unicode_value);
ecma_free_value (full_unicode_value);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_value_t set_status = ecma_op_object_put (obj_p,
ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
@@ -3485,7 +3484,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
goto result_cleanup;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_length_t index;
ecma_value_t length_value = ecma_op_to_length (last_index, &index);
@@ -3503,7 +3502,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
ecma_make_length_value (index),
true);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
ecma_number_t index = ecma_get_number_from_value (last_index);
ecma_free_value (last_index);
@@ -3513,7 +3512,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
last_index,
true);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_free_value (last_index);
if (ECMA_IS_VALUE_ERROR (next_set_status))
@@ -3546,7 +3545,7 @@ ecma_op_regexp_exec (ecma_value_t this_arg, /**< this argument */
{
ecma_object_t *arg_obj_p = ecma_get_object_from_value (this_arg);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_value_t exec = ecma_op_object_get_by_magic_id (arg_obj_p, LIT_MAGIC_STRING_EXEC);
if (ECMA_IS_VALUE_ERROR (exec))
@@ -3580,7 +3579,7 @@ ecma_op_regexp_exec (ecma_value_t this_arg, /**< this argument */
{
ecma_free_value (exec);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (!ecma_object_is_regexp_object (this_arg))
{
@@ -3595,4 +3594,4 @@ ecma_op_regexp_exec (ecma_value_t this_arg, /**< this argument */
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
@@ -16,7 +16,7 @@
#ifndef ECMA_REGEXP_OBJECT_H
#define ECMA_REGEXP_OBJECT_H
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
#include "ecma-globals.h"
#include "re-compiler.h"
@@ -164,9 +164,9 @@ typedef struct
ecma_value_t iterated_string; /**< [[IteratedString]] internal slot */
} ecma_regexp_string_iterator_t;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
lit_code_point_t ecma_regexp_unicode_advance (const lit_utf8_byte_t **str_p, const lit_utf8_byte_t *end_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_object_t *ecma_op_regexp_alloc (ecma_object_t *new_target_obj_p);
ecma_value_t ecma_regexp_exec_helper (ecma_object_t *regexp_object_p,
@@ -196,5 +196,5 @@ ecma_value_t ecma_op_create_regexp_with_flags (ecma_object_t *regexp_obj_p,
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
#endif /* !ECMA_REGEXP_OBJECT_H */
@@ -63,13 +63,13 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of
}
ecma_builtin_id_t proto_id;
#if ENABLED (JERRY_BUILTIN_STRING)
#if JERRY_BUILTIN_STRING
proto_id = ECMA_BUILTIN_ID_STRING_PROTOTYPE;
#else /* !ENABLED (JERRY_BUILTIN_STRING) */
#else /* !JERRY_BUILTIN_STRING */
proto_id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE;
#endif /* ENABLED (JERRY_BUILTIN_STRING) */
#endif /* JERRY_BUILTIN_STRING */
ecma_object_t *prototype_obj_p = ecma_builtin_get (proto_id);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_object_t *new_target = JERRY_CONTEXT (current_new_target_p);
if (new_target)
{
@@ -79,7 +79,7 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of
return ECMA_VALUE_ERROR;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
sizeof (ecma_extended_object_t),
ECMA_OBJECT_TYPE_CLASS);
@@ -88,12 +88,12 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of
ext_object_p->u.class_prop.class_id = LIT_MAGIC_STRING_STRING_UL;
ext_object_p->u.class_prop.u.value = prim_value;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (new_target)
{
ecma_deref_object (prototype_obj_p);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
return ecma_make_object_value (object_p);
} /* ecma_op_create_string_object */
@@ -24,7 +24,7 @@
#include "ecma-symbol-object.h"
#include "lit-char-helpers.h"
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/** \addtogroup ecma ECMA
* @{
@@ -176,7 +176,7 @@ ecma_symbol_this_value (ecma_value_t this_arg) /**< this argument value */
/* 3. */
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' must be a Symbol"));
} /* ecma_symbol_this_value */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
@@ -16,7 +16,7 @@
#ifndef ECMA_SYMBOL_H
#define ECMA_SYMBOL_H
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
#include "ecma-globals.h"
/** \addtogroup ecma ECMA
@@ -44,7 +44,7 @@ ecma_symbol_this_value (ecma_value_t this_arg);
ecma_value_t
ecma_get_symbol_descriptive_string (ecma_value_t symbol_value);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
* @}
@@ -30,7 +30,7 @@
#include "ecma-helpers.h"
#include "jcontext.h"
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
/** \addtogroup ecma ECMA
* @{
@@ -47,11 +47,11 @@
{ \
if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \
{ \
num = *(type *) src_p; \
num = *(type *) ((void*) src_p); \
} \
else \
{ \
memcpy (&num, src_p, sizeof (type)); \
memcpy (&num, (void *) src_p, sizeof (type)); \
} \
} \
while (0)
@@ -64,11 +64,11 @@
{ \
if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \
{ \
*(type *) src_p = num; \
*(type *) ((void*) src_p) = num; \
} \
else \
{ \
memcpy (src_p, &num, sizeof (type)); \
memcpy ((void*) src_p, &num, sizeof (type)); \
} \
} \
while (0)
@@ -159,7 +159,7 @@ ecma_typedarray_get_double_element (lit_utf8_byte_t *src) /**< the location in t
return ecma_make_number_value (num);
} /* ecma_typedarray_get_double_element */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Read a bigint64 value from the given arraybuffer
*/
@@ -188,7 +188,7 @@ ecma_typedarray_get_biguint64_element (lit_utf8_byte_t *src) /**< the location i
ECMA_TYPEDARRAY_GET_ELEMENT (src, num, uint64_t);
return ecma_bigint_create_from_digits (&num, 1, false);
} /* ecma_typedarray_get_biguint64_element */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
/**
* Normalize the given ecma_number_t to an uint32_t value
@@ -428,7 +428,7 @@ ecma_typedarray_set_float_element (lit_utf8_byte_t *dst_p, /**< the location in
return ECMA_VALUE_TRUE;
} /* ecma_typedarray_set_float_element */
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
/**
* Write a double value into the given arraybuffer
*
@@ -451,9 +451,9 @@ ecma_typedarray_set_double_element (lit_utf8_byte_t *dst_p, /**< the location in
ECMA_TYPEDARRAY_SET_ELEMENT (dst_p, num, double);
return ECMA_VALUE_TRUE;
} /* ecma_typedarray_set_double_element */
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Write a bigint64/biguint64 value into the given arraybuffer
*
@@ -486,29 +486,29 @@ ecma_typedarray_set_bigint_element (lit_utf8_byte_t *dst_p, /**< the location in
return ECMA_VALUE_TRUE;
} /* ecma_typedarray_set_bigint_element */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
/**
* Builtin id of the first %TypedArray% builtin routine intrinsic object
*/
#define ECMA_FIRST_TYPEDARRAY_BUILTIN_ROUTINE_ID ECMA_BUILTIN_ID_INT8ARRAY
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Builtin id of the last %TypedArray% builtin routine intrinsic object
*/
#define ECMA_LAST_TYPEDARRAY_BUILTIN_ROUTINE_ID ECMA_BUILTIN_ID_BIGUINT64ARRAY
#elif !ENABLED (JERRY_BUILTIN_BIGINT) && ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#elif !JERRY_BUILTIN_BIGINT && JERRY_NUMBER_TYPE_FLOAT64
/**
* Builtin id of the last %TypedArray% builtin routine intrinsic object
*/
#define ECMA_LAST_TYPEDARRAY_BUILTIN_ROUTINE_ID ECMA_BUILTIN_ID_FLOAT64ARRAY
#else /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Builtin id of the last %TypedArray% builtin routine intrinsic object
*/
#define ECMA_LAST_TYPEDARRAY_BUILTIN_ROUTINE_ID ECMA_BUILTIN_ID_FLOAT32ARRAY
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Builtin id of the first %TypedArray% builtin prototype intrinsic object
@@ -528,13 +528,13 @@ static const ecma_typedarray_getter_fn_t ecma_typedarray_getters[] =
ecma_typedarray_get_int32_element, /**< Uint32Array */
ecma_typedarray_get_uint32_element, /**< Uint32Array */
ecma_typedarray_get_float_element, /**< Float32Array */
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
ecma_typedarray_get_double_element, /**< Float64Array */
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
ecma_typedarray_get_bigint64_element, /**< BigInt64Array*/
ecma_typedarray_get_biguint64_element, /**< BigUint64Array */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
};
/**
@@ -550,13 +550,13 @@ static const ecma_typedarray_setter_fn_t ecma_typedarray_setters[] =
ecma_typedarray_set_int32_element, /**< Uint32Array */
ecma_typedarray_set_uint32_element, /**< Uint32Array */
ecma_typedarray_set_float_element, /**< Float32Array */
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
ecma_typedarray_set_double_element, /**< Float64Array */
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
ecma_typedarray_set_bigint_element, /**< BigInt64Array */
ecma_typedarray_set_bigint_element, /**< BigUInt64Array */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
};
/**
@@ -572,13 +572,13 @@ static const uint8_t ecma_typedarray_element_shift_sizes[] =
2, /**< Int32Array */
2, /**< Uint32Array */
2, /**< Float32Array */
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
3, /**< Float64Array */
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
3, /**< BigInt64Array */
3, /**< BigUInt64Array */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
};
/**
@@ -594,13 +594,13 @@ static const uint16_t ecma_typedarray_magic_string_list[] =
(uint16_t) LIT_MAGIC_STRING_INT32_ARRAY_UL, /**< Int32Array */
(uint16_t) LIT_MAGIC_STRING_UINT32_ARRAY_UL, /**< Uint32Array */
(uint16_t) LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, /**< Float32Array */
#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64)
#if JERRY_NUMBER_TYPE_FLOAT64
(uint16_t) LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, /**< Float64Array */
#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
(uint16_t) LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, /**< BigInt64Array */
(uint16_t) LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, /**< BigUInt64Array */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT */
#endif /* JERRY_BUILTIN_BIGINT */
};
/**
@@ -892,13 +892,13 @@ ecma_typedarray_create_object_with_typedarray (ecma_object_t *typedarray_p, /**<
}
else
{
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if ((ECMA_TYPEDARRAY_IS_BIGINT_TYPE (src_id) ^ ECMA_TYPEDARRAY_IS_BIGINT_TYPE (typedarray_id)) == 1)
{
ecma_deref_object (new_typedarray_p);
return ecma_raise_type_error (ECMA_ERR_MSG ("Incompatible TypedArray types"));
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
uint32_t src_element_size = 1u << ecma_typedarray_get_element_size_shift (typedarray_p);
uint32_t dst_element_size = 1u << element_size_shift;
@@ -1697,7 +1697,7 @@ ecma_typedarray_species_create (ecma_value_t this_arg, /**< this argument */
return result;
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
ecma_object_t *result_p = ecma_get_object_from_value (result);
ecma_typedarray_info_t result_info = ecma_typedarray_get_info (result_p);
/*
@@ -1709,7 +1709,7 @@ ecma_typedarray_species_create (ecma_value_t this_arg, /**< this argument */
ecma_free_value (result);
return ecma_raise_type_error (ECMA_ERR_MSG ("TypedArray returned by [[ContentType]] does not match source"));
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
return result;
} /* ecma_typedarray_species_create */
@@ -1760,4 +1760,4 @@ ecma_typedarray_get_info (ecma_object_t *typedarray_p)
* @}
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
@@ -19,7 +19,7 @@
#include "ecma-globals.h"
#include "ecma-builtins.h"
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
#if JERRY_BUILTIN_TYPEDARRAY
/** \addtogroup ecma ECMA
* @{
@@ -88,5 +88,5 @@ ecma_value_t ecma_typedarray_species_create (ecma_value_t this_arg,
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#endif /* !ECMA_TYPEDARRAY_OBJECT_H */