diff options
Diffstat (limited to 'jerry-core/ecma/operations')
40 files changed, 56 insertions, 917 deletions
diff --git a/jerry-core/ecma/operations/ecma-arguments-object.c b/jerry-core/ecma/operations/ecma-arguments-object.c index 4d289409..fd0c6798 100644 --- a/jerry-core/ecma/operations/ecma-arguments-object.c +++ b/jerry-core/ecma/operations/ecma-arguments-object.c @@ -297,25 +297,6 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object return prop_p; } -#if !JERRY_ESNEXT - if (property_name_p == ecma_get_magic_string (LIT_MAGIC_STRING_CALLER)) - { - if (arguments_p->header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED) - { - return NULL; - } - - ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER); - - ecma_create_named_accessor_property (object_p, - ecma_get_magic_string (LIT_MAGIC_STRING_CALLER), - thrower_p, - thrower_p, - ECMA_PROPERTY_BUILT_IN_FIXED, - &prop_p); - return prop_p; - } -#else /* JERRY_ESNEXT */ if (ecma_op_compare_string_to_global_symbol (property_name_p, LIT_GLOBAL_SYMBOL_ITERATOR) && !(flags & ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED)) { @@ -331,7 +312,6 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object ecma_deref_object (ecma_get_object_from_value (prop_value_p->value)); return prop_p; } -#endif /* !JERRY_ESNEXT */ return NULL; } /* ecma_op_arguments_object_try_to_lazy_instantiate_property */ @@ -362,7 +342,6 @@ ecma_op_arguments_delete_built_in_property (ecma_object_t *object_p, /**< the ob return; } -#if JERRY_ESNEXT if (ecma_prop_name_is_symbol (property_name_p)) { JERRY_ASSERT (!(arguments_p->header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED)); @@ -371,7 +350,6 @@ ecma_op_arguments_delete_built_in_property (ecma_object_t *object_p, /**< the ob arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED; return; } -#endif /* JERRY_ESNEXT */ uint32_t index = ecma_string_get_array_index (property_name_p); @@ -436,24 +414,14 @@ ecma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p, /**< ar ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLEE)); prop_counter_p->string_named_props++; } - -#if !JERRY_ESNEXT - if (!(flags & 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++; - } -#endif /* !JERRY_ESNEXT */ } -#if JERRY_ESNEXT if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS) && !(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 /* JERRY_ESNEXT */ } /* ecma_op_arguments_object_list_lazy_property_names */ /** diff --git a/jerry-core/ecma/operations/ecma-array-object.c b/jerry-core/ecma/operations/ecma-array-object.c index b150a980..5919ee6b 100644 --- a/jerry-core/ecma/operations/ecma-array-object.c +++ b/jerry-core/ecma/operations/ecma-array-object.c @@ -152,13 +152,11 @@ 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 JERRY_ESNEXT if (length > UINT32_MAX) { ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH); return NULL; } -#endif /* JERRY_ESNEXT */ return ecma_op_new_array_object ((uint32_t) length); } /* ecma_op_new_array_object_from_length */ @@ -663,7 +661,6 @@ 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 JERRY_ESNEXT /** * Array object creation with custom prototype. * @@ -783,7 +780,6 @@ ecma_op_create_array_iterator (ecma_object_t *obj_p, /**< array object */ ECMA_OBJECT_CLASS_ARRAY_ITERATOR, kind); } /* ecma_op_create_array_iterator */ -#endif /* JERRY_ESNEXT */ /** * Low level delete of array items from new_length to old_length diff --git a/jerry-core/ecma/operations/ecma-array-object.h b/jerry-core/ecma/operations/ecma-array-object.h index d2d55f90..73d65805 100644 --- a/jerry-core/ecma/operations/ecma-array-object.h +++ b/jerry-core/ecma/operations/ecma-array-object.h @@ -88,11 +88,9 @@ ecma_collection_t *ecma_fast_array_object_own_property_keys (ecma_object_t *obje void ecma_fast_array_convert_to_normal (ecma_object_t *object_p); -#if JERRY_ESNEXT ecma_object_t *ecma_op_array_species_create (ecma_object_t *original_array_p, ecma_length_t length); ecma_value_t ecma_op_create_array_iterator (ecma_object_t *obj_p, ecma_iterator_kind_t kind); -#endif /* JERRY_ESNEXT */ ecma_value_t ecma_op_array_object_set_length (ecma_object_t *object_p, ecma_value_t new_value, uint16_t flags); diff --git a/jerry-core/ecma/operations/ecma-async-generator-object.c b/jerry-core/ecma/operations/ecma-async-generator-object.c index f40dc5b1..f73e4e18 100644 --- a/jerry-core/ecma/operations/ecma-async-generator-object.c +++ b/jerry-core/ecma/operations/ecma-async-generator-object.c @@ -32,8 +32,6 @@ #include "vm-stack.h" #include "vm.h" -#if JERRY_ESNEXT - /** \addtogroup ecma ECMA * @{ * @@ -126,6 +124,9 @@ ecma_async_yield_call (ecma_value_t function, /**< function (takes reference) */ /** * Perform an exception throw and call the approprite handler + * + * @return ecma value + * Returned value must be freed with ecma_free_value. */ static ecma_value_t ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< async generator */ @@ -516,8 +517,6 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl } } /* ecma_await_continue */ -#endif /* JERRY_ESNEXT */ - /** * @} * @} diff --git a/jerry-core/ecma/operations/ecma-async-generator-object.h b/jerry-core/ecma/operations/ecma-async-generator-object.h index b5a94cf4..bcd58e0f 100644 --- a/jerry-core/ecma/operations/ecma-async-generator-object.h +++ b/jerry-core/ecma/operations/ecma-async-generator-object.h @@ -20,8 +20,6 @@ #include "vm-defines.h" -#if JERRY_ESNEXT - /** \addtogroup ecma ECMA * @{ * @@ -82,8 +80,6 @@ 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 /* JERRY_ESNEXT */ - /** * @} * @} diff --git a/jerry-core/ecma/operations/ecma-big-uint.c b/jerry-core/ecma/operations/ecma-big-uint.c index 990318e9..3d058209 100644 --- a/jerry-core/ecma/operations/ecma-big-uint.c +++ b/jerry-core/ecma/operations/ecma-big-uint.c @@ -1473,8 +1473,6 @@ ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left Bi return ecma_big_uint_increase_result (result_value_p); } /* ecma_big_uint_shift_right */ -#if JERRY_ESNEXT - /** * Compute the left value raised to the power of right value * @@ -1545,8 +1543,6 @@ ecma_big_uint_pow (ecma_extended_primitive_t *left_value_p, /**< left BigUInt va return result_p; } /* ecma_big_uint_pow */ -#endif /* JERRY_ESNEXT */ - /** * Perform bitwise operations on two BigUInt numbers * diff --git a/jerry-core/ecma/operations/ecma-big-uint.h b/jerry-core/ecma/operations/ecma-big-uint.h index 7eec2dd5..727d780f 100644 --- a/jerry-core/ecma/operations/ecma-big-uint.h +++ b/jerry-core/ecma/operations/ecma-big-uint.h @@ -124,9 +124,7 @@ 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 JERRY_ESNEXT ecma_extended_primitive_t *ecma_big_uint_pow (ecma_extended_primitive_t *left_value_p, uint32_t right_value); -#endif /* JERRY_ESNEXT */ ecma_extended_primitive_t *ecma_big_uint_bitwise_op (uint32_t operation_and_options, ecma_extended_primitive_t *left_value_p, diff --git a/jerry-core/ecma/operations/ecma-bigint.c b/jerry-core/ecma/operations/ecma-bigint.c index 8ce37788..7a4464e0 100644 --- a/jerry-core/ecma/operations/ecma-bigint.c +++ b/jerry-core/ecma/operations/ecma-bigint.c @@ -1438,8 +1438,6 @@ 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 JERRY_ESNEXT - /** * Compute the left value raised to the power of right value * @@ -1528,8 +1526,6 @@ 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 /* JERRY_ESNEXT */ - /** * Convert the result to an ecma value * diff --git a/jerry-core/ecma/operations/ecma-bigint.h b/jerry-core/ecma/operations/ecma-bigint.h index 33ad30d9..460ed769 100644 --- a/jerry-core/ecma/operations/ecma-bigint.h +++ b/jerry-core/ecma/operations/ecma-bigint.h @@ -70,9 +70,7 @@ 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 JERRY_ESNEXT ecma_value_t ecma_bigint_pow (ecma_value_t left_value, ecma_value_t right_value); -#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); diff --git a/jerry-core/ecma/operations/ecma-boolean-object.c b/jerry-core/ecma/operations/ecma-boolean-object.c index e33299c6..956aa4a7 100644 --- a/jerry-core/ecma/operations/ecma-boolean-object.c +++ b/jerry-core/ecma/operations/ecma-boolean-object.c @@ -56,7 +56,6 @@ ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boo ecma_object_t *prototype_obj_p = ecma_builtin_get (proto_id); -#if JERRY_ESNEXT ecma_object_t *new_target = JERRY_CONTEXT (current_new_target_p); if (new_target) { @@ -67,7 +66,7 @@ ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boo return ECMA_VALUE_ERROR; } } -#endif /* JERRY_ESNEXT */ + ecma_object_t *object_p = ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); @@ -75,12 +74,10 @@ ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boo ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BOOLEAN; ext_object_p->u.cls.u3.value = ecma_make_boolean_value (boolean_value); -#if JERRY_ESNEXT if (new_target) { ecma_deref_object (prototype_obj_p); } -#endif /* JERRY_ESNEXT */ return ecma_make_object_value (object_p); } /* ecma_op_create_boolean_object */ diff --git a/jerry-core/ecma/operations/ecma-comparison.c b/jerry-core/ecma/operations/ecma-comparison.c index 68135fa2..5a32a2c6 100644 --- a/jerry-core/ecma/operations/ecma-comparison.c +++ b/jerry-core/ecma/operations/ecma-comparison.c @@ -196,7 +196,6 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ return ecma_make_boolean_value (is_equal); } -#if JERRY_ESNEXT if (JERRY_UNLIKELY (ecma_is_value_symbol (x))) { if (!ecma_is_value_object (y)) @@ -209,14 +208,10 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ y ^= x; x ^= y; } -#endif /* JERRY_ESNEXT */ JERRY_ASSERT (ecma_is_value_object (x)); - if (ecma_is_value_string (y) -#if JERRY_ESNEXT - || ecma_is_value_symbol (y) -#endif /* JERRY_ESNEXT */ + if (ecma_is_value_string (y) || ecma_is_value_symbol (y) #if JERRY_BUILTIN_BIGINT || ecma_is_value_bigint (y) #endif /* JERRY_BUILTIN_BIGINT */ @@ -254,10 +249,7 @@ bool ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */ ecma_value_t y) /**< second operand */ { - if (ecma_is_value_direct (x) || ecma_is_value_direct (y) -#if JERRY_ESNEXT - || ecma_is_value_symbol (x) || ecma_is_value_symbol (y) -#endif /* JERRY_ESNEXT */ + if (ecma_is_value_direct (x) || ecma_is_value_direct (y) || ecma_is_value_symbol (x) || ecma_is_value_symbol (y) || ecma_is_value_object (x) || ecma_is_value_object (y)) { JERRY_ASSERT (!ecma_is_value_direct (x) || ecma_is_value_undefined (x) || ecma_is_value_null (x) diff --git a/jerry-core/ecma/operations/ecma-container-object.c b/jerry-core/ecma/operations/ecma-container-object.c index f975c39a..c9bc10cb 100644 --- a/jerry-core/ecma/operations/ecma-container-object.c +++ b/jerry-core/ecma/operations/ecma-container-object.c @@ -383,7 +383,6 @@ 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 JERRY_ESNEXT if (arguments_list_len == 0) { return result; @@ -525,7 +524,6 @@ cleanup_adder: ecma_deref_object (adder_func_p); cleanup_object: ecma_deref_object (object_p); -#endif /* JERRY_ESNEXT */ return result; } /* ecma_op_container_create */ @@ -875,8 +873,6 @@ 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.cls.u2.container_id); } /* ecma_op_container_remove_weak_entry */ -#if JERRY_ESNEXT - /** * The Create{Set, Map}Iterator Abstract operation * @@ -1137,8 +1133,6 @@ ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id, /**< built } } /* ecma_builtin_container_dispatch_routine */ -#endif /* JERRY_ESNEXT */ - /** * @} * @} diff --git a/jerry-core/ecma/operations/ecma-conversion.c b/jerry-core/ecma/operations/ecma-conversion.c index 9a71b2ff..cf0c9fde 100644 --- a/jerry-core/ecma/operations/ecma-conversion.c +++ b/jerry-core/ecma/operations/ecma-conversion.c @@ -337,12 +337,10 @@ ecma_op_to_numeric (ecma_value_t value, /**< ecma value */ return ECMA_VALUE_EMPTY; } -#if JERRY_ESNEXT if (ecma_is_value_symbol (value)) { return ecma_raise_type_error (ECMA_ERR_CONVERT_SYMBOL_TO_NUMBER); } -#endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_BIGINT if (ecma_is_value_bigint (value)) @@ -434,13 +432,11 @@ ecma_op_to_string (ecma_value_t value) /**< ecma value */ return ecma_get_magic_string (LIT_MAGIC_STRING_FALSE); } -#if JERRY_ESNEXT if (ecma_is_value_symbol (value)) { ecma_raise_type_error (ECMA_ERR_CONVERT_SYMBOL_TO_STRING); return NULL; } -#endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_BIGINT if (ecma_is_value_bigint (value)) @@ -489,7 +485,6 @@ ecma_op_to_property_key (ecma_value_t value) /**< ecma value */ return key_p; } -#if JERRY_ESNEXT ecma_value_t key = ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_STRING); if (ECMA_IS_VALUE_ERROR (key)) @@ -507,11 +502,6 @@ ecma_op_to_property_key (ecma_value_t value) /**< ecma value */ ecma_free_value (key); return result; -#else /* !JERRY_ESNEXT */ - ecma_check_value_type_is_spec_defined (value); - - return ecma_op_to_string (value); -#endif /* JERRY_ESNEXT */ } /* ecma_op_to_property_key */ /** @@ -548,13 +538,11 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */ { return ecma_copy_value (value); } -#if JERRY_ESNEXT else if (ecma_is_value_symbol (value)) { proto_id = ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE; class_type = ECMA_OBJECT_CLASS_SYMBOL; } -#endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_BIGINT else if (ecma_is_value_bigint (value)) { @@ -628,40 +616,33 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE), &prop_desc); JERRY_ASSERT (ecma_is_value_true (completion)); } - else + else if (src_prop_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)) { -#if !JERRY_ESNEXT - JERRY_ASSERT (src_prop_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)); -#else /* JERRY_ESNEXT */ - if (src_prop_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)) -#endif /* JERRY_ESNEXT */ + /* a. */ + if (src_prop_desc_p->get_p == NULL) + { + prop_desc.value = ECMA_VALUE_UNDEFINED; + } + else { - /* a. */ - if (src_prop_desc_p->get_p == NULL) - { - prop_desc.value = ECMA_VALUE_UNDEFINED; - } - else - { - prop_desc.value = ecma_make_object_value (src_prop_desc_p->get_p); - } - - completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_GET), &prop_desc); - JERRY_ASSERT (ecma_is_value_true (completion)); - - /* b. */ - if (src_prop_desc_p->set_p == NULL) - { - prop_desc.value = ECMA_VALUE_UNDEFINED; - } - else - { - prop_desc.value = ecma_make_object_value (src_prop_desc_p->set_p); - } - - completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_SET), &prop_desc); - JERRY_ASSERT (ecma_is_value_true (completion)); + prop_desc.value = ecma_make_object_value (src_prop_desc_p->get_p); } + + completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_GET), &prop_desc); + JERRY_ASSERT (ecma_is_value_true (completion)); + + /* b. */ + if (src_prop_desc_p->set_p == NULL) + { + prop_desc.value = ECMA_VALUE_UNDEFINED; + } + else + { + prop_desc.value = ecma_make_object_value (src_prop_desc_p->set_p); + } + + completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_SET), &prop_desc); + JERRY_ASSERT (ecma_is_value_true (completion)); } prop_desc.value = ecma_make_boolean_value (src_prop_desc_p->flags & JERRY_PROP_IS_ENUMERABLE); @@ -959,7 +940,6 @@ ecma_op_to_length (ecma_value_t value, /**< ecma value */ return value; } -#if JERRY_ESNEXT /* 2 */ ecma_number_t num; ecma_value_t length_num = ecma_op_to_integer (value, &num); @@ -987,23 +967,8 @@ ecma_op_to_length (ecma_value_t value, /**< ecma value */ /* 6 */ *length = (ecma_length_t) num; return ECMA_VALUE_EMPTY; -#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); - - /* 2 */ - if (ECMA_IS_VALUE_ERROR (to_number)) - { - return to_number; - } - - *length = ecma_number_to_uint32 (num); - return ECMA_VALUE_EMPTY; -#endif /* JERRY_ESNEXT */ } /* ecma_op_to_length */ -#if JERRY_ESNEXT /** * ToIndex operation. * @@ -1104,7 +1069,6 @@ 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 /* JERRY_ESNEXT */ /** * @} diff --git a/jerry-core/ecma/operations/ecma-conversion.h b/jerry-core/ecma/operations/ecma-conversion.h index 559b8552..a19ade54 100644 --- a/jerry-core/ecma/operations/ecma-conversion.h +++ b/jerry-core/ecma/operations/ecma-conversion.h @@ -62,10 +62,8 @@ ecma_value_t ecma_op_to_object (ecma_value_t value); bool ecma_op_is_integer (ecma_number_t value); 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 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 /* 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); diff --git a/jerry-core/ecma/operations/ecma-eval.c b/jerry-core/ecma/operations/ecma-eval.c index e4a2d734..ac8e2c40 100644 --- a/jerry-core/ecma/operations/ecma-eval.c +++ b/jerry-core/ecma/operations/ecma-eval.c @@ -81,9 +81,7 @@ ecma_op_eval_chars_buffer (void *source_p, /**< source code */ parse_opts |= ECMA_PARSE_EVAL; -#if JERRY_ESNEXT ECMA_CLEAR_LOCAL_PARSE_OPTS (); -#endif /* JERRY_ESNEXT */ ecma_compiled_code_t *bytecode_p = parser_parse_script (source_p, parse_opts, NULL); @@ -93,12 +91,6 @@ ecma_op_eval_chars_buffer (void *source_p, /**< source code */ } return vm_run_eval (bytecode_p, parse_opts); -#else /* !JERRY_PARSER */ - JERRY_UNUSED (code_p); - JERRY_UNUSED (code_buffer_size); - JERRY_UNUSED (parse_opts); - - return ecma_raise_syntax_error (ECMA_ERR_PARSER_NOT_SUPPORTED); #endif /* JERRY_PARSER */ } /* ecma_op_eval_chars_buffer */ diff --git a/jerry-core/ecma/operations/ecma-exceptions.c b/jerry-core/ecma/operations/ecma-exceptions.c index 9232a680..675aaf92 100644 --- a/jerry-core/ecma/operations/ecma-exceptions.c +++ b/jerry-core/ecma/operations/ecma-exceptions.c @@ -87,13 +87,12 @@ ecma_new_standard_error (jerry_error_t error_type, /**< native error type */ break; } -#if JERRY_ESNEXT case JERRY_ERROR_AGGREGATE: { prototype_id = ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE; break; } -#endif /* JERRY_ESNEXT */ + case JERRY_ERROR_URI: { prototype_id = ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE; @@ -169,7 +168,6 @@ ecma_new_standard_error (jerry_error_t error_type, /**< native error type */ return error_object_p; } /* ecma_new_standard_error */ -#if JERRY_ESNEXT /** * aggregate-error object constructor. * @@ -273,8 +271,6 @@ ecma_new_aggregate_error (ecma_value_t error_list_val, /**< errors list */ return ecma_make_object_value (new_error_object_p); } /* ecma_new_aggregate_error */ -#endif /* JERRY_ESNEXT */ - /** * Return the error type for an Error object. * @@ -364,13 +360,11 @@ ecma_raise_standard_error_with_format (jerry_error_t error_type, /**< error type 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 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 /* JERRY_ESNEXT */ else { arg_string_p = ecma_op_to_string (arg_val); @@ -504,8 +498,6 @@ ecma_raise_maximum_callstack_error (void) } /* ecma_raise_maximum_callstack_error */ #endif /* (JERRY_STACK_LIMIT != 0) */ -#if JERRY_ESNEXT - /** * Raise a AggregateError with the given errors and message. * @@ -522,8 +514,6 @@ ecma_raise_aggregate_error (ecma_value_t error_list_val, /**< errors list */ return ECMA_VALUE_ERROR; } /* ecma_raise_aggregate_error */ -#endif /* JERRY_ESNEXT */ - /** * @} * @} diff --git a/jerry-core/ecma/operations/ecma-exceptions.h b/jerry-core/ecma/operations/ecma-exceptions.h index d4e6477d..c367a6bf 100644 --- a/jerry-core/ecma/operations/ecma-exceptions.h +++ b/jerry-core/ecma/operations/ecma-exceptions.h @@ -42,10 +42,8 @@ ecma_value_t ecma_raise_uri_error (ecma_error_msg_t msg); #if (JERRY_STACK_LIMIT != 0) ecma_value_t ecma_raise_maximum_callstack_error (void); #endif /* (JERRY_STACK_LIMIT != 0) */ -#if JERRY_ESNEXT ecma_value_t ecma_new_aggregate_error (ecma_value_t error_list_val, ecma_value_t message_val); ecma_value_t ecma_raise_aggregate_error (ecma_value_t error_list_val, ecma_value_t message_val); -#endif /* JERRY_ESNEXT */ /** * @} diff --git a/jerry-core/ecma/operations/ecma-function-object.c b/jerry-core/ecma/operations/ecma-function-object.c index 243e31ad..1e24384c 100644 --- a/jerry-core/ecma/operations/ecma-function-object.c +++ b/jerry-core/ecma/operations/ecma-function-object.c @@ -41,7 +41,6 @@ * @{ */ -#if JERRY_ESNEXT /** * SetFunctionName operation * @@ -91,7 +90,6 @@ 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 /* JERRY_ESNEXT */ #if JERRY_BUILTIN_PROXY /** @@ -180,7 +178,6 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */ if (JERRY_LIKELY (type == ECMA_OBJECT_TYPE_FUNCTION)) { -#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)) @@ -226,7 +223,6 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */ return ECMA_ERR_EMPTY; #endif /* JERRY_ERROR_MESSAGES */ } -#endif /* JERRY_NEXT */ return ECMA_IS_VALID_CONSTRUCTOR; } @@ -253,9 +249,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */ return ECMA_ERR_BULTIN_ROUTINES_HAVE_NO_CONSTRUCTOR; } -#if JERRY_ESNEXT JERRY_ASSERT (((ecma_extended_object_t *) obj_p)->u.built_in.id != ECMA_BUILTIN_ID_HANDLER); -#endif /* !JERRY_ESNEXT */ } return ECMA_IS_VALID_CONSTRUCTOR; @@ -487,11 +481,9 @@ ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, /**< argu return ECMA_VALUE_ERROR; } -#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 /* JERRY_ESNEXT */ ecma_object_t *global_object_p = ecma_builtin_get_global (); @@ -501,8 +493,6 @@ ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, /**< argu 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 JERRY_ESNEXT ecma_object_t *new_target_p = JERRY_CONTEXT (current_new_target_p); ecma_builtin_id_t fallback_ctor = ECMA_BUILTIN_ID_FUNCTION; @@ -535,14 +525,11 @@ ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, /**< argu ecma_bytecode_deref (bytecode_p); return ECMA_VALUE_ERROR; } -#endif /* JERRY_ESNEXT */ ecma_object_t *func_obj_p = ecma_op_create_function_object (global_env_p, bytecode_p, fallback_proto); -#if JERRY_ESNEXT ECMA_SET_NON_NULL_POINTER (func_obj_p->u2.prototype_cp, proto); ecma_deref_object (proto); -#endif /* JERRY_ESNEXT */ ecma_bytecode_deref (bytecode_p); return ecma_make_object_value (func_obj_p); @@ -562,8 +549,6 @@ 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 JERRY_ESNEXT - /** * Create a function object with the appropriate prototype. * @@ -666,8 +651,6 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc return func_p; } /* ecma_op_create_arrow_function_object */ -#endif /* JERRY_ESNEXT */ - /** * External function object creation operation. * @@ -700,8 +683,6 @@ ecma_op_create_external_function_object (ecma_native_handler_t handler_cb) /**< return function_obj_p; } /* ecma_op_create_external_function_object */ -#if JERRY_ESNEXT - /** * Create built-in native handler object. * @@ -727,8 +708,6 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */ return function_obj_p; } /* ecma_op_create_native_handler */ -#endif /* JERRY_ESNEXT */ - /** * Get compiled code of a function object. * @@ -809,7 +788,6 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value); } -#if JERRY_ESNEXT if (type == ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION) { ecma_value_t script_value = ((ecma_extended_object_t *) func_obj_p)->u.constructor_function.script_value; @@ -817,7 +795,6 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob return (ecma_global_object_t *) script_p->realm_p; } -#endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_PROXY if (ECMA_OBJECT_IS_PROXY (func_obj_p)) @@ -935,8 +912,6 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object * return result; } /* ecma_op_function_has_instance */ -#if JERRY_ESNEXT - /** * GetSuperConstructor operation for class methods * @@ -965,7 +940,6 @@ 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 /* JERRY_ESNEXT */ /** * Ordinary internal method: GetPrototypeFromConstructor (constructor, intrinsicDefaultProto) @@ -1024,7 +998,6 @@ ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, /**< construc return proto_obj_p; } /* ecma_op_get_prototype_from_constructor */ -#if JERRY_ESNEXT /** * Perform a JavaScript class function object method call. * @@ -1092,8 +1065,6 @@ exit: return ret_value; } /* ecma_op_function_call_constructor */ -#endif /* JERRY_ESNEXT */ - /** * Perform a JavaScript function object method call. * @@ -1140,7 +1111,6 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */ /* 1. */ switch (CBC_FUNCTION_GET_TYPE (status_flags)) { -#if JERRY_ESNEXT case CBC_FUNCTION_CONSTRUCTOR: { return ecma_op_function_call_constructor (&shared_args, scope_p, this_binding); @@ -1168,13 +1138,9 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */ } break; } - -#endif /* JERRY_ESNEXT */ default: { -#if JERRY_ESNEXT shared_args.header.status_flags |= VM_FRAME_CTX_SHARED_NON_ARROW_FUNC; -#endif /* JERRY_ESNEXT */ if (status_flags & CBC_CODE_FLAGS_STRICT_MODE) { @@ -1281,12 +1247,8 @@ ecma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */ call_info.function = ecma_make_object_value (func_obj_p); call_info.this_value = this_arg_value; -#if JERRY_ESNEXT ecma_object_t *new_target_p = JERRY_CONTEXT (current_new_target_p); call_info.new_target = (new_target_p == NULL) ? ECMA_VALUE_UNDEFINED : ecma_make_object_value (new_target_p); -#else /* JERRY_ESNEXT */ - call_info.new_target = ECMA_VALUE_UNDEFINED; -#endif /* JERRY_ESNEXT */ JERRY_ASSERT (native_function_p->native_handler_cb != NULL); ecma_value_t ret_value = native_function_p->native_handler_cb (&call_info, arguments_list_p, arguments_list_len); @@ -1428,14 +1390,12 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */ ECMA_CHECK_STACK_USAGE (); -#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 /* JERRY_ESNEXT */ ecma_value_t result; @@ -1458,13 +1418,11 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */ break; } #endif /* JERRY_BUILTIN_PROXY */ -#if JERRY_ESNEXT case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION: { result = ecma_raise_type_error (ECMA_ERR_CLASS_CONSTRUCTOR_NEW); break; } -#endif /* JERRY_ESNEXT */ case ECMA_OBJECT_TYPE_NATIVE_FUNCTION: { result = ecma_op_function_call_native (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len); @@ -1482,9 +1440,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */ } } -#if JERRY_ESNEXT JERRY_CONTEXT (current_new_target_p) = old_new_target_p; -#endif /* JERRY_ESNEXT */ return result; } /* ecma_op_function_call */ @@ -1506,13 +1462,11 @@ ecma_op_function_construct_simple (ecma_object_t *func_obj_p, /**< Function obje ecma_object_t *new_this_obj_p = NULL; ecma_value_t this_arg; -#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 /* JERRY_ESNEXT */ /* 5.a */ ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (new_target_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE); @@ -1525,7 +1479,6 @@ ecma_op_function_construct_simple (ecma_object_t *func_obj_p, /**< Function obje 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 JERRY_ESNEXT } else { @@ -1535,25 +1488,19 @@ ecma_op_function_construct_simple (ecma_object_t *func_obj_p, /**< Function obje /* 6. */ ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p); JERRY_CONTEXT (current_new_target_p) = new_target_p; -#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 JERRY_ESNEXT JERRY_CONTEXT (current_new_target_p) = old_new_target_p; -#endif /* JERRY_ESNEXT */ /* 13.a */ if (ECMA_IS_VALUE_ERROR (ret_value) || ecma_is_value_object (ret_value)) { -#if JERRY_ESNEXT if (new_this_obj_p != NULL) { ecma_deref_object (new_this_obj_p); } -#else /* !JERRY_ESNEXT */ - ecma_deref_object (new_this_obj_p); -#endif /* JERRY_ESNEXT */ + return ret_value; } @@ -1584,16 +1531,12 @@ ecma_op_function_construct_built_in (ecma_object_t *func_obj_p, /**< Function ob JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, realm_value); #endif /* JERRY_BUILTIN_REALMS */ -#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 /* JERRY_ESNEXT */ ecma_value_t ret_value = ecma_builtin_dispatch_construct (func_obj_p, arguments_list_p, arguments_list_len); -#if JERRY_ESNEXT JERRY_CONTEXT (current_new_target_p) = old_new_target; -#endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_REALMS JERRY_CONTEXT (global_object_p) = saved_global_object_p; @@ -1637,8 +1580,6 @@ ecma_op_function_construct_bound (ecma_object_t *func_obj_p, /**< Function objec return ret_value; } /* ecma_op_function_construct_bound */ -#if JERRY_ESNEXT - /** * [[Construct]] internal method for class implicit constructor objects * @@ -1704,8 +1645,6 @@ ecma_op_function_construct_constructor (ecma_object_t *func_obj_p, /**< Function return result; } /* ecma_op_function_construct_constructor */ -#endif /* JERRY_ESNEXT */ - /** * [[Construct]] internal method for external function objects * @@ -1731,16 +1670,12 @@ 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 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 /* JERRY_ESNEXT */ ecma_value_t ret_value = ecma_op_function_call_native (func_obj_p, this_arg, arguments_list_p, arguments_list_len); -#if JERRY_ESNEXT JERRY_CONTEXT (current_new_target_p) = old_new_target_p; -#endif /* JERRY_ESNEXT */ if (ECMA_IS_VALUE_ERROR (ret_value) || ecma_is_value_object (ret_value)) { @@ -1787,12 +1722,10 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */ return ecma_proxy_object_construct (func_obj_p, new_target_p, arguments_list_p, arguments_list_len); } #endif /* JERRY_BUILTIN_PROXY */ -#if JERRY_ESNEXT case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION: { return ecma_op_function_construct_constructor (func_obj_p, new_target_p, arguments_list_p, arguments_list_len); } -#endif /* JERRY_ESNEXT */ case ECMA_OBJECT_TYPE_BOUND_FUNCTION: { return ecma_op_function_construct_bound (func_obj_p, new_target_p, arguments_list_p, arguments_list_len); @@ -1844,7 +1777,6 @@ ecma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the fun ecma_object_t *proto_object_p = NULL; bool init_constructor = true; -#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); @@ -1882,11 +1814,8 @@ ecma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the fun init_constructor = false; } } -#endif /* JERRY_ESNEXT */ -#if JERRY_ESNEXT if (proto_object_p == NULL) -#endif /* JERRY_ESNEXT */ { ecma_object_t *prototype_p; @@ -1943,7 +1872,6 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< { JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION); -#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; @@ -2011,7 +1939,6 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< value_p->value = ecma_copy_value (value); return value_prop_p; } -#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) @@ -2026,7 +1953,6 @@ 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 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) { @@ -2037,22 +1963,6 @@ 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 /* !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); - - ecma_property_t *caller_prop_p; - /* The property_name_p argument contains the name. */ - ecma_create_named_accessor_property (object_p, - property_name_p, - thrower_p, - thrower_p, - ECMA_PROPERTY_BUILT_IN_FIXED, - &caller_prop_p); - return caller_prop_p; - } -#endif /* JERRY_ESNEXT */ } return NULL; @@ -2109,7 +2019,6 @@ 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 JERRY_ESNEXT if (ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (bound_func_p->header.u.bound_function.target_function)) { return NULL; @@ -2117,24 +2026,6 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p length_attributes = ECMA_PROPERTY_BUILT_IN_CONFIGURABLE; length = ecma_get_number_from_value (bound_func_p->target_length) - (args_length - 1); -#else /* !JERRY_ESNEXT */ - length_attributes = ECMA_PROPERTY_BUILT_IN_FIXED; - - ecma_object_t *target_func_p; - target_func_p = - ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function); - - if (ecma_object_get_class_name (target_func_p) == LIT_MAGIC_STRING_FUNCTION_UL) - { - /* The property_name_p argument contains the 'length' string. */ - ecma_value_t get_len_value = ecma_op_object_get (target_func_p, property_name_p); - - JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (get_len_value)); - JERRY_ASSERT (ecma_is_value_integer_number (get_len_value)); - - length = (ecma_number_t) (ecma_get_integer_from_value (get_len_value) - (args_length - 1)); - } -#endif /* JERRY_ESNEXT */ if (length < 0) { @@ -2149,29 +2040,9 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p return len_prop_p; } -#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)) - { - ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER); - - ecma_property_t *caller_prop_p; - /* The string_p argument contans the name. */ - ecma_create_named_accessor_property (object_p, - property_name_p, - thrower_p, - thrower_p, - ECMA_PROPERTY_BUILT_IN_FIXED, - &caller_prop_p); - return caller_prop_p; - } -#endif /* !JERRY_ESNEXT */ - return NULL; } /* ecma_op_bound_function_try_to_lazy_instantiate_property */ -#if JERRY_ESNEXT - /** * Delete configurable properties of functions. */ @@ -2211,8 +2082,6 @@ ecma_op_bound_function_delete_built_in_property (ecma_object_t *object_p, /**< o ECMA_SET_FIRST_BIT_TO_POINTER_TAG (bound_func_p->header.u.bound_function.target_function); } /* ecma_op_bound_function_delete_built_in_property */ -#endif /* JERRY_ESNEXT */ - /** * List names of a Function object's lazy instantiated properties, * adding them to corresponding string collections @@ -2234,7 +2103,6 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio const ecma_compiled_code_t *bytecode_data_p; bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p); -#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)) @@ -2251,25 +2119,14 @@ 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_NAME)); prop_counter_p->string_named_props++; } -#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 /* JERRY_ESNEXT */ -#if JERRY_ESNEXT if (!CBC_FUNCTION_HAS_PROTOTYPE (bytecode_data_p->status_flags) || (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_CONSTRUCTOR)) { return; } - bool append_caller_and_arguments = !(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE); -#else /* !JERRY_ESNEXT */ - bool append_caller_and_arguments = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE); -#endif /* JERRY_ESNEXT */ - - if (append_caller_and_arguments) + if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)) { /* 'arguments' 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_ARGUMENTS)); @@ -2329,7 +2186,6 @@ ecma_op_bound_function_list_lazy_property_names (ecma_object_t *object_p, /**< b return; } -#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)) @@ -2337,12 +2193,6 @@ 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 /* !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 /* 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)); diff --git a/jerry-core/ecma/operations/ecma-function-object.h b/jerry-core/ecma/operations/ecma-function-object.h index 3f9c602d..08300f57 100644 --- a/jerry-core/ecma/operations/ecma-function-object.h +++ b/jerry-core/ecma/operations/ecma-function-object.h @@ -29,9 +29,7 @@ * @{ */ -#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 /* JERRY_ESNEXT */ bool ecma_op_is_callable (ecma_value_t value); #if JERRY_BUILTIN_PROXY @@ -67,7 +65,6 @@ ecma_value_t ecma_op_create_dynamic_function (const ecma_value_t *arguments_list uint32_t arguments_list_len, ecma_parse_opts_t opts); -#if JERRY_ESNEXT ecma_value_t ecma_op_function_get_super_constructor (ecma_object_t *func_obj_p); ecma_object_t *ecma_op_create_any_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p); @@ -78,8 +75,6 @@ ecma_object_t *ecma_op_create_arrow_function_object (ecma_object_t *scope_p, ecma_object_t *ecma_op_create_native_handler (ecma_native_handler_id_t id, size_t object_size); -#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); ecma_value_t ecma_op_function_has_instance (ecma_object_t *func_obj_p, ecma_value_t value); @@ -108,11 +103,9 @@ ecma_property_t *ecma_op_external_function_try_to_lazy_instantiate_property (ecm ecma_property_t *ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p); -#if JERRY_ESNEXT void ecma_op_function_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p); void ecma_op_bound_function_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p); -#endif /* JERRY_ESNEXT */ void ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, ecma_collection_t *prop_names_p, diff --git a/jerry-core/ecma/operations/ecma-get-put-value.c b/jerry-core/ecma/operations/ecma-get-put-value.c index 41bdf37d..39d4d373 100644 --- a/jerry-core/ecma/operations/ecma-get-put-value.c +++ b/jerry-core/ecma/operations/ecma-get-put-value.c @@ -62,18 +62,15 @@ 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 JERRY_ESNEXT if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED)) { return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED); } -#endif /* JERRY_ESNEXT */ return ecma_fast_copy_value (property_value_p->value); } break; } -#if JERRY_ESNEXT case ECMA_LEXICAL_ENVIRONMENT_CLASS: { #if JERRY_MODULE_SYSTEM @@ -102,7 +99,6 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme #endif /* JERRY_MODULE_SYSTEM */ break; } -#endif /* JERRY_ESNEXT */ default: { JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND); @@ -188,12 +184,10 @@ ecma_op_get_value_object_base (ecma_value_t base_value, /**< base value */ id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE; #endif /* JERRY_BUILTIN_NUMBER */ } -#if JERRY_ESNEXT else if (ecma_is_value_symbol (base_value)) { id = ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE; } -#endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_BIGINT else if (ecma_is_value_bigint (base_value)) { @@ -234,7 +228,6 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme { switch (ecma_get_lex_env_type (lex_env_p)) { -#if JERRY_ESNEXT case ECMA_LEXICAL_ENVIRONMENT_CLASS: { if (!ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p)) @@ -243,14 +236,12 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme } /* FALLTHRU */ } -#endif /* JERRY_ESNEXT */ case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p); if (property_p != NULL) { -#if JERRY_ESNEXT ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p); JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_WRITABLE) || (*property_p & ECMA_PROPERTY_FLAG_DATA)); @@ -260,14 +251,6 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme ecma_named_data_property_assign_value (lex_env_p, property_value_p, value); return ECMA_VALUE_EMPTY; } -#else /* JERRY_ESNEXT */ - if (ecma_is_property_writable (*property_p)) - { - ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p); - ecma_named_data_property_assign_value (lex_env_p, property_value_p, value); - return ECMA_VALUE_EMPTY; - } -#endif /* JERRY_ESNEXT */ return ecma_op_raise_set_binding_error (property_p, is_strict); } diff --git a/jerry-core/ecma/operations/ecma-iterator-object.c b/jerry-core/ecma/operations/ecma-iterator-object.c index 21d88724..3e8ef7ea 100644 --- a/jerry-core/ecma/operations/ecma-iterator-object.c +++ b/jerry-core/ecma/operations/ecma-iterator-object.c @@ -36,8 +36,6 @@ * @{ */ -#if JERRY_ESNEXT - /** * Implementation of 'CreateArrayFromList' specialized for iterators * @@ -715,8 +713,6 @@ ecma_async_from_sync_iterator_unwrap_cb (ecma_object_t *function_obj_p, /**< fun return ecma_create_iter_result_object (arg, done); } /* ecma_async_from_sync_iterator_unwrap_cb */ -#endif /* JERRY_ESNEXT */ - /** * @} * @} diff --git a/jerry-core/ecma/operations/ecma-iterator-object.h b/jerry-core/ecma/operations/ecma-iterator-object.h index f0903508..0963b03f 100644 --- a/jerry-core/ecma/operations/ecma-iterator-object.h +++ b/jerry-core/ecma/operations/ecma-iterator-object.h @@ -18,8 +18,6 @@ #include "ecma-globals.h" -#if JERRY_ESNEXT - /** \addtogroup ecma ECMA * @{ * @@ -78,8 +76,6 @@ ecma_value_t ecma_async_from_sync_iterator_unwrap_cb (ecma_object_t *function_ob const ecma_value_t args_p[], const uint32_t args_count); -#endif /* JERRY_ESNEXT */ - /** * @} * @} diff --git a/jerry-core/ecma/operations/ecma-jobqueue.c b/jerry-core/ecma/operations/ecma-jobqueue.c index 990e3b7a..3cccfa9b 100644 --- a/jerry-core/ecma/operations/ecma-jobqueue.c +++ b/jerry-core/ecma/operations/ecma-jobqueue.c @@ -26,8 +26,6 @@ #include "opcodes.h" #include "vm-stack.h" -#if JERRY_ESNEXT - /** * Mask for job queue type. */ @@ -637,4 +635,3 @@ ecma_free_all_enqueued_jobs (void) * @} * @} */ -#endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/operations/ecma-jobqueue.h b/jerry-core/ecma/operations/ecma-jobqueue.h index 72128c2e..b56027ca 100644 --- a/jerry-core/ecma/operations/ecma-jobqueue.h +++ b/jerry-core/ecma/operations/ecma-jobqueue.h @@ -18,8 +18,6 @@ #include "ecma-globals.h" -#if JERRY_ESNEXT - /** \addtogroup ecma ECMA * @{ * @@ -61,5 +59,5 @@ ecma_value_t ecma_process_all_enqueued_jobs (void); * @} * @} */ -#endif /* JERRY_ESNEXT */ + #endif /* !ECMA_JOB_QUEUE_H */ diff --git a/jerry-core/ecma/operations/ecma-lex-env.c b/jerry-core/ecma/operations/ecma-lex-env.c index ea1e8e29..0b04a38f 100644 --- a/jerry-core/ecma/operations/ecma-lex-env.c +++ b/jerry-core/ecma/operations/ecma-lex-env.c @@ -69,7 +69,6 @@ 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 JERRY_ESNEXT /** * Create the global lexical block on top of the global environment. */ @@ -88,7 +87,6 @@ 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 /* JERRY_ESNEXT */ /** * Raise the appropriate error when setting a binding is failed @@ -101,7 +99,6 @@ ecma_op_raise_set_binding_error (ecma_property_t *property_p, /**< property */ { JERRY_UNUSED (property_p); -#if JERRY_ESNEXT const ecma_property_t expected_bits = (ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_FLAG_ENUMERABLE); if ((*property_p & expected_bits) == expected_bits) @@ -117,7 +114,6 @@ ecma_op_raise_set_binding_error (ecma_property_t *property_p, /**< property */ return ecma_raise_type_error (ECMA_ERR_CONSTANT_BINDINGS_CANNOT_BE_REASSIGNED); } -#endif /* JERRY_ESNEXT */ if (is_strict) { @@ -135,12 +131,8 @@ ecma_op_raise_set_binding_error (ecma_property_t *property_p, /**< property */ ecma_object_t * ecma_get_global_scope (ecma_object_t *global_object_p) /**< global object */ { -#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 /* !JERRY_ESNEXT */ - return ecma_get_global_environment (global_object_p); -#endif /* !JERRY_ESNEXT */ } /* ecma_get_global_scope */ /** @@ -164,7 +156,6 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */ switch (lex_env_type) { -#if JERRY_ESNEXT case ECMA_LEXICAL_ENVIRONMENT_CLASS: { if (!ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p)) @@ -173,7 +164,6 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */ } /* FALLTHRU */ } -#endif /* JERRY_ESNEXT */ case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p); @@ -294,7 +284,6 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment switch (ecma_get_lex_env_type (lex_env_p)) { -#if JERRY_ESNEXT case ECMA_LEXICAL_ENVIRONMENT_CLASS: { if (!ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p)) @@ -303,7 +292,6 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment } /* FALLTHRU */ } -#endif /* JERRY_ESNEXT */ case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE: { ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p); @@ -502,7 +490,6 @@ 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 JERRY_ESNEXT /** * InitializeBinding operation. * @@ -650,8 +637,6 @@ ecma_op_get_this_binding (ecma_object_t *lex_env_p) /**< lexical environment */ return this_value; } /* ecma_op_get_this_binding */ -#endif /* JERRY_ESNEXT */ - /** * @} * @} diff --git a/jerry-core/ecma/operations/ecma-lex-env.h b/jerry-core/ecma/operations/ecma-lex-env.h index 5b59559c..e71d729f 100644 --- a/jerry-core/ecma/operations/ecma-lex-env.h +++ b/jerry-core/ecma/operations/ecma-lex-env.h @@ -35,9 +35,7 @@ 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 JERRY_ESNEXT void ecma_create_global_lexical_block (ecma_object_t *global_object_p); -#endif /* JERRY_ESNEXT */ ecma_value_t ecma_op_raise_set_binding_error (ecma_property_t *property_p, bool is_strict); #if JERRY_MODULE_SYSTEM @@ -70,7 +68,6 @@ 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 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, ecma_object_t *func_obj_p); @@ -79,7 +76,6 @@ 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 /* JERRY_ESNEXT */ /** * @} diff --git a/jerry-core/ecma/operations/ecma-number-object.c b/jerry-core/ecma/operations/ecma-number-object.c index 4160e765..548f2f73 100644 --- a/jerry-core/ecma/operations/ecma-number-object.c +++ b/jerry-core/ecma/operations/ecma-number-object.c @@ -61,7 +61,7 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb proto_id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE; #endif /* JERRY_BUILTIN_NUMBER */ ecma_object_t *prototype_obj_p = ecma_builtin_get (proto_id); -#if JERRY_ESNEXT + ecma_object_t *new_target = JERRY_CONTEXT (current_new_target_p); if (new_target) { @@ -71,7 +71,7 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb return ECMA_VALUE_ERROR; } } -#endif /* JERRY_ESNEXT */ + ecma_object_t *object_p = ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); @@ -80,12 +80,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.cls.u3.value = conv_to_num_completion; -#if JERRY_ESNEXT + if (new_target) { ecma_deref_object (prototype_obj_p); } -#endif /* JERRY_ESNEXT */ + return ecma_make_object_value (object_p); } /* ecma_op_create_number_object */ diff --git a/jerry-core/ecma/operations/ecma-objects-general.c b/jerry-core/ecma/operations/ecma-objects-general.c index a6c8f036..eef9f134 100644 --- a/jerry-core/ecma/operations/ecma-objects-general.c +++ b/jerry-core/ecma/operations/ecma-objects-general.c @@ -131,7 +131,6 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */ if (property & ECMA_PROPERTY_FLAG_BUILT_IN) { -#if JERRY_ESNEXT switch (type) { case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION: @@ -172,17 +171,6 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */ break; } } -#else /* !JERRY_ESNEXT */ - if (type == ECMA_OBJECT_TYPE_CLASS) - { - JERRY_ASSERT (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARGUMENTS)); - ecma_op_arguments_delete_built_in_property (obj_p, property_name_p); - } - else - { - ecma_builtin_delete_built_in_property (obj_p, property_name_p); - } -#endif /* JERRY_ESNEXT */ } /* b. */ @@ -205,7 +193,6 @@ static const lit_magic_string_id_t to_primitive_non_string_hint_method_names[2] LIT_MAGIC_STRING_TO_STRING_UL, /**< toString operation */ }; -#if JERRY_ESNEXT /** * Hints for the ecma general object's toPrimitve operation */ @@ -214,7 +201,6 @@ static const lit_magic_string_id_t hints[3] = { LIT_MAGIC_STRING_NUMBER, /**< "number" hint */ LIT_MAGIC_STRING_STRING, /**< "string" hint */ }; -#endif /* JERRY_ESNEXT */ /** * [[DefaultValue]] ecma general object's operation @@ -232,7 +218,6 @@ 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 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, LIT_GLOBAL_SYMBOL_TO_PRIMITIVE); @@ -267,19 +252,6 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */ { hint = ECMA_PREFERRED_TYPE_NUMBER; } -#else /* !JERRY_ESNEXT */ - if (hint == ECMA_PREFERRED_TYPE_NO) - { - hint = ECMA_PREFERRED_TYPE_NUMBER; - -#if JERRY_BUILTIN_DATE - if (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_DATE)) - { - hint = ECMA_PREFERRED_TYPE_STRING; - } -#endif /* JERRY_BUILTIN_DATE */ - } -#endif /* JERRY_ESNEXT */ return ecma_op_general_object_ordinary_value (obj_p, hint); } /* ecma_op_general_object_default_value */ @@ -637,7 +609,6 @@ 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 JERRY_ESNEXT /** * The IsCompatiblePropertyDescriptor method for Proxy object internal methods * @@ -775,7 +746,6 @@ ecma_op_to_complete_property_descriptor (ecma_property_descriptor_t *desc_p) /** desc_p->flags |= (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED); } } /* ecma_op_to_complete_property_descriptor */ -#endif /* JERRY_ESNEXT */ /** * @} diff --git a/jerry-core/ecma/operations/ecma-objects-general.h b/jerry-core/ecma/operations/ecma-objects-general.h index aea9959d..210f176c 100644 --- a/jerry-core/ecma/operations/ecma-objects-general.h +++ b/jerry-core/ecma/operations/ecma-objects-general.h @@ -36,13 +36,11 @@ 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 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 /* JERRY_ESNEXT */ /** * @} diff --git a/jerry-core/ecma/operations/ecma-objects.c b/jerry-core/ecma/operations/ecma-objects.c index 59b8ecde..dfe7215e 100644 --- a/jerry-core/ecma/operations/ecma-objects.c +++ b/jerry-core/ecma/operations/ecma-objects.c @@ -315,34 +315,6 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */ } case ECMA_OBJECT_TYPE_FUNCTION: { -#if !JERRY_ESNEXT - if (ecma_string_is_length (property_name_p)) - { - if (options & ECMA_PROPERTY_GET_VALUE) - { - /* Get length virtual property. */ - ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p; - const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p); - - uint32_t len; - if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS) - { - cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_data_p; - len = args_p->argument_end; - } - else - { - cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_data_p; - len = args_p->argument_end; - } - - property_ref_p->virtual_value = ecma_make_uint32_value (len); - } - - return ECMA_PROPERTY_VIRTUAL; - } -#endif /* !JERRY_ESNEXT */ - /* Get prototype physical property. */ property_p = ecma_op_function_try_to_lazy_instantiate_property (object_p, property_name_p); break; @@ -690,29 +662,6 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */ } case ECMA_OBJECT_TYPE_FUNCTION: { -#if !JERRY_ESNEXT - if (ecma_string_is_length (property_name_p)) - { - /* Get length virtual property. */ - ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p; - const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p); - - uint32_t len; - if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS) - { - cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_data_p; - len = args_p->argument_end; - } - else - { - cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_data_p; - len = args_p->argument_end; - } - - return ecma_make_uint32_value (len); - } -#endif /* !JERRY_ESNEXT */ - /* Get prototype physical property. */ property_p = ecma_op_function_try_to_lazy_instantiate_property (object_p, property_name_p); break; @@ -966,8 +915,6 @@ 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 JERRY_ESNEXT - /** * Descriptor string for each global symbol */ @@ -1064,7 +1011,7 @@ ecma_op_object_get_by_symbol_id (ecma_object_t *object_p, /**< the object */ */ static ecma_value_t ecma_op_get_method (ecma_value_t value, /**< ecma value */ - ecma_string_t *prop_name_p) /** property name */ + ecma_string_t *prop_name_p) /**< property name */ { /* 2. */ ecma_value_t obj_value = ecma_op_to_object (value); @@ -1142,7 +1089,6 @@ 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 /* JERRY_ESNEXT */ /** * [[Put]] ecma general object's operation specialized for property index @@ -1201,7 +1147,6 @@ ecma_op_object_put (ecma_object_t *object_p, /**< the object */ is_throw); } /* ecma_op_object_put */ -#if JERRY_ESNEXT /** * [[Set]] ( P, V, Receiver) operation part for ordinary objects * @@ -1302,7 +1247,6 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */ return ECMA_VALUE_TRUE; } /* ecma_op_object_put_apply_receiver */ -#endif /* JERRY_ESNEXT */ /** * [[Put]] ecma general object's operation with given receiver @@ -1503,9 +1447,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */ if (ecma_string_is_length (property_name_p)) { /* Uninitialized 'length' property is non-writable (ECMA-262 v6, 19.2.4.1) */ -#if JERRY_ESNEXT if (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (((ecma_extended_object_t *) object_p)->u.function.scope_cp)) -#endif /* JERRY_ESNEXT */ { return ecma_raise_readonly_assignment (property_name_p, is_throw); } @@ -1542,12 +1484,10 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */ { if (ecma_is_property_writable (*property_p)) { -#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 /* 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. */ @@ -1652,9 +1592,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */ } } -#if JERRY_ESNEXT return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw); -#endif /* JERRY_ESNEXT */ ecma_property_value_t *new_prop_value_p; new_prop_value_p = ecma_create_named_data_property (object_p, @@ -2374,9 +2312,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ uint32_t array_index_named_props = 0; uint32_t string_named_props = 0; -#if JERRY_ESNEXT uint32_t symbol_named_props = 0; -#endif /* JERRY_ESNEXT */ while (counter_prop_iter_cp != JMEM_CP_NULL) { @@ -2407,7 +2343,6 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ { array_index_named_props++; } -#if JERRY_ESNEXT else if (ecma_prop_name_is_symbol (name_p)) { if (!(name_p->u.hash & ECMA_SYMBOL_FLAG_PRIVATE_KEY)) @@ -2415,7 +2350,6 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ symbol_named_props++; } } -#endif /* JERRY_ESNEXT */ else { string_named_props++; @@ -2439,7 +2373,6 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ string_named_props = 0; } -#if JERRY_ESNEXT if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS) { JERRY_ASSERT (prop_counter.symbol_named_props == 0); @@ -2447,9 +2380,6 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ } uint32_t total = array_index_named_props + string_named_props + symbol_named_props; -#else /* !JERRY_ESNEXT */ - uint32_t total = array_index_named_props + string_named_props; -#endif /* JERRY_ESNEXT */ if (total == 0) { @@ -2463,7 +2393,6 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ ecma_value_t *array_index_current_p = buffer_p + array_index_named_props + prop_counter.array_index_named_props; ecma_value_t *string_current_p = array_index_current_p + string_named_props + prop_counter.string_named_props; -#if JERRY_ESNEXT ecma_value_t *symbol_current_p = string_current_p + symbol_named_props + prop_counter.symbol_named_props; if (prop_counter.symbol_named_props > 0 && (array_index_named_props + string_named_props) > 0) @@ -2472,7 +2401,6 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ (void *) (buffer_p + prop_counter.array_index_named_props + prop_counter.string_named_props), prop_counter.symbol_named_props * sizeof (ecma_value_t)); } -#endif /* JERRY_ESNEXT */ if (prop_counter.string_named_props > 0 && array_index_named_props > 0) { @@ -2514,7 +2442,6 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ continue; } } -#if JERRY_ESNEXT else if (ecma_prop_name_is_symbol (name_p)) { if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS) && !(name_p->u.hash & ECMA_SYMBOL_FLAG_PRIVATE_KEY)) @@ -2523,7 +2450,6 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ continue; } } -#endif /* JERRY_ESNEXT */ else { if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS)) @@ -2606,7 +2532,6 @@ ecma_op_object_enumerate (ecma_object_t *obj_p) /**< object */ { ecma_collection_t *keys = ecma_op_object_own_property_keys (obj_p, JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS); -#if JERRY_ESNEXT if (JERRY_UNLIKELY (keys == NULL)) { ecma_collection_free (return_names_p); @@ -2614,19 +2539,16 @@ ecma_op_object_enumerate (ecma_object_t *obj_p) /**< object */ ecma_deref_object (obj_p); return keys; } -#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 JERRY_ESNEXT if (ecma_prop_name_is_symbol (name_p)) { continue; } -#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); @@ -2767,7 +2689,6 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */ || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_BIGUINT64ARRAY_PROTOTYPE) #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) @@ -2787,16 +2708,13 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */ || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE) || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE) || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_PROMISE_PROTOTYPE) -#endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_CONTAINER || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_MAP_PROTOTYPE) || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SET_PROTOTYPE) || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE) || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE) -#if JERRY_ESNEXT || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE) || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE) -#endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_CONTAINER */ #if JERRY_BUILTIN_WEAKREF || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE) @@ -2825,8 +2743,7 @@ static const uint16_t ecma_class_object_magic_string_id[] = { LIT_MAGIC_STRING_MODULE_UL, /**< magic string id of ECMA_OBJECT_CLASS_MODULE_NAMESPACE */ #endif /* JERRY_MODULE_SYSTEM */ -/* These objects are marked by Garbage Collector. */ -#if JERRY_ESNEXT + /* These objects are marked by Garbage Collector. */ LIT_MAGIC_STRING_GENERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_GENERATOR */ LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_ASYNC_GENERATOR */ LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_ARRAY_ITERATOR */ @@ -2835,15 +2752,12 @@ static const uint16_t ecma_class_object_magic_string_id[] = { #if JERRY_BUILTIN_REGEXP LIT_MAGIC_STRING_REGEXP_STRING_ITERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR */ #endif /* JERRY_BUILTIN_REGEXP */ -#endif /* JERRY_ESNEXT */ #if JERRY_MODULE_SYSTEM LIT_MAGIC_STRING_MODULE_UL, /**< magic string id of ECMA_OBJECT_CLASS_MODULE */ #endif /* JERRY_MODULE_SYSTEM */ -#if JERRY_ESNEXT LIT_MAGIC_STRING_PROMISE_UL, /**< magic string id of ECMA_OBJECT_CLASS_PROMISE */ LIT_MAGIC_STRING_OBJECT_UL, /**< magic string id of ECMA_OBJECT_CLASS_PROMISE_CAPABILITY */ LIT_MAGIC_STRING_OBJECT_UL, /**< magic string id of ECMA_OBJECT_CLASS_ASYNC_FROM_SYNC_ITERATOR */ -#endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_DATAVIEW LIT_MAGIC_STRING_DATAVIEW_UL, /**< magic string id of ECMA_OBJECT_CLASS_DATAVIEW */ #endif /* JERRY_BUILTIN_DATAVIEW */ @@ -2865,10 +2779,8 @@ static const uint16_t ecma_class_object_magic_string_id[] = { #if JERRY_BUILTIN_REGEXP LIT_MAGIC_STRING_REGEXP_UL, /**< magic string id of ECMA_OBJECT_CLASS_REGEXP */ #endif /* JERRY_BUILTIN_REGEXP */ -#if JERRY_ESNEXT LIT_MAGIC_STRING_SYMBOL_UL, /**< magic string id of ECMA_OBJECT_CLASS_SYMBOL */ LIT_MAGIC_STRING_STRING_ITERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_STRING_ITERATOR */ -#endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_TYPEDARRAY LIT_MAGIC_STRING_ARRAY_BUFFER_UL, /**< magic string id of ECMA_OBJECT_CLASS_ARRAY_BUFFER */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ @@ -2972,7 +2884,6 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */ return LIT_MAGIC_STRING_REFLECT_UL; } #endif /* JERRY_BUILTIN_REFLECT */ -#if JERRY_ESNEXT case ECMA_BUILTIN_ID_GENERATOR: { return LIT_MAGIC_STRING_GENERATOR_UL; @@ -2981,7 +2892,6 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */ { return LIT_MAGIC_STRING_ASYNC_GENERATOR_UL; } -#endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_JSON case ECMA_BUILTIN_ID_JSON: { @@ -2994,20 +2904,6 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */ return LIT_MAGIC_STRING_ATOMICS_U; } #endif /* JERRY_BUILTIN_ATOMICS */ -#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 /* JERRY_BUILTIN_ERRORS */ - case ECMA_BUILTIN_ID_ERROR_PROTOTYPE: - { - return LIT_MAGIC_STRING_ERROR_UL; - } -#endif /* !JERRY_ESNEXT */ default: { break; @@ -3041,7 +2937,6 @@ ecma_object_is_regexp_object (ecma_value_t arg) /**< argument */ } /* ecma_object_is_regexp_object */ #endif /* JERRY_BUILTIN_REGEXP */ -#if JERRY_ESNEXT /** * Object's IsConcatSpreadable operation, used for Array.prototype.concat * It checks the argument's [Symbol.isConcatSpreadable] property value @@ -3187,7 +3082,6 @@ ecma_op_invoke_by_symbol_id (ecma_value_t object, /**< Object value */ return ret_value; } /* ecma_op_invoke_by_symbol_id */ -#endif /* JERRY_ESNEXT */ /** * 7.3.18 Abstract operation Invoke when property name is a magic string @@ -3225,13 +3119,7 @@ ecma_op_invoke (ecma_value_t object, /**< Object value */ ecma_object_t *object_p = ecma_get_object_from_value (object_value); -#if JERRY_ESNEXT - ecma_value_t this_arg = object; -#else /* !JERRY_ESNEXT */ - ecma_value_t this_arg = object_value; -#endif /* JERRY_ESNEXT */ - - ecma_value_t func = ecma_op_object_get_with_receiver (object_p, property_name_p, this_arg); + ecma_value_t func = ecma_op_object_get_with_receiver (object_p, property_name_p, object); if (ECMA_IS_VALUE_ERROR (func)) { @@ -3240,7 +3128,7 @@ ecma_op_invoke (ecma_value_t object, /**< Object value */ } /* 4. */ - ecma_value_t call_result = ecma_op_function_validated_call (func, this_arg, args_p, args_len); + ecma_value_t call_result = ecma_op_function_validated_call (func, object, args_p, args_len); ecma_free_value (func); ecma_deref_object (object_p); diff --git a/jerry-core/ecma/operations/ecma-objects.h b/jerry-core/ecma/operations/ecma-objects.h index 31c51faf..87e25388 100644 --- a/jerry-core/ecma/operations/ecma-objects.h +++ b/jerry-core/ecma/operations/ecma-objects.h @@ -69,13 +69,11 @@ ecma_op_object_get_with_receiver (ecma_object_t *object_p, ecma_string_t *proper 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 JERRY_ESNEXT ecma_string_t *ecma_op_get_global_symbol (lit_magic_string_id_t property_id); bool ecma_op_compare_string_to_global_symbol (ecma_string_t *string_p, 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 /* 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, @@ -112,7 +110,6 @@ lit_magic_string_id_t ecma_object_get_class_name (ecma_object_t *obj_p); #if JERRY_BUILTIN_REGEXP bool ecma_object_is_regexp_object (ecma_value_t arg); #endif /* JERRY_BUILTIN_REGEXP */ -#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); @@ -120,7 +117,6 @@ 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 /* JERRY_ESNEXT */ #if JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER void ecma_op_object_set_weak (ecma_object_t *object_p, ecma_object_t *target_p); void ecma_op_object_unref_weak (ecma_object_t *object_p, ecma_value_t ref_holder); diff --git a/jerry-core/ecma/operations/ecma-promise-object.c b/jerry-core/ecma/operations/ecma-promise-object.c index 746a841e..092ed773 100644 --- a/jerry-core/ecma/operations/ecma-promise-object.c +++ b/jerry-core/ecma/operations/ecma-promise-object.c @@ -31,8 +31,6 @@ #include "jcontext.h" -#if JERRY_ESNEXT - /** \addtogroup ecma ECMA * @{ * @@ -1331,4 +1329,3 @@ ecma_promise_perform_then (ecma_value_t promise, /**< the promise which call 'th * @} * @} */ -#endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/operations/ecma-promise-object.h b/jerry-core/ecma/operations/ecma-promise-object.h index 54c88d9a..8cfaa454 100644 --- a/jerry-core/ecma/operations/ecma-promise-object.h +++ b/jerry-core/ecma/operations/ecma-promise-object.h @@ -18,8 +18,6 @@ #include "ecma-globals.h" -#if JERRY_ESNEXT - /** \addtogroup ecma ECMA * @{ * @@ -46,8 +44,8 @@ typedef enum */ typedef struct { - ecma_extended_object_t header; - ecma_value_t promise; + ecma_extended_object_t header; /**< extended object part */ + ecma_value_t promise; /**< [[Promise]] internal slot */ } ecma_promise_resolver_t; /** @@ -145,5 +143,4 @@ ecma_value_t ecma_promise_perform_then (ecma_value_t promise, * @} */ -#endif /* JERRY_ESNEXT */ #endif /* !ECMA_PROMISE_OBJECT_H */ diff --git a/jerry-core/ecma/operations/ecma-reference.c b/jerry-core/ecma/operations/ecma-reference.c index d5e970b2..bf279440 100644 --- a/jerry-core/ecma/operations/ecma-reference.c +++ b/jerry-core/ecma/operations/ecma-reference.c @@ -72,8 +72,6 @@ ecma_op_resolve_reference_base (ecma_object_t *lex_env_p, /**< starting lexical } } /* ecma_op_resolve_reference_base */ -#if JERRY_ESNEXT - /** * Check if the passed lexical environment is a global lexical environment * @@ -192,8 +190,6 @@ ecma_op_is_prop_unscopable (ecma_object_t *binding_obj_p, /**< binding object */ return ECMA_VALUE_FALSE; } /* ecma_op_is_prop_unscopable */ -#endif /* JERRY_ESNEXT */ - /** * Helper method for HasBindig operation * @@ -244,9 +240,7 @@ ecma_op_object_bound_environment_resolve_reference_value (ecma_object_t *lex_env return found_binding; } -#if JERRY_ESNEXT if (JERRY_LIKELY (ecma_op_is_global_environment (lex_env_p))) -#endif /* JERRY_ESNEXT */ { return found_binding; } @@ -254,7 +248,6 @@ ecma_op_object_bound_environment_resolve_reference_value (ecma_object_t *lex_env } #endif /* JERRY_BUILTIN_PROXY */ -#if JERRY_ESNEXT ecma_value_t blocked = ecma_op_is_prop_unscopable (binding_obj_p, name_p); if (ecma_is_value_false (blocked)) @@ -276,7 +269,6 @@ ecma_op_object_bound_environment_resolve_reference_value (ecma_object_t *lex_env #endif /* JERRY_BUILTIN_PROXY */ return ECMA_IS_VALUE_ERROR (blocked) ? blocked : ECMA_VALUE_NOT_FOUND; -#endif /* JERRY_ESNEXT */ } /* ecma_op_object_bound_environment_resolve_reference_value */ /** @@ -305,16 +297,13 @@ 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 JERRY_ESNEXT if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED)) { return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED); } -#endif /* JERRY_ESNEXT */ return ecma_fast_copy_value (property_value_p->value); } -#if JERRY_ESNEXT case ECMA_LEXICAL_ENVIRONMENT_CLASS: { #if JERRY_MODULE_SYSTEM @@ -344,17 +333,11 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical #endif /* JERRY_MODULE_SYSTEM */ break; } -#endif /* JERRY_ESNEXT */ default: { JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND); -#if JERRY_ESNEXT - bool lcache_lookup_allowed = ecma_op_is_global_environment (lex_env_p); -#else /* !JERRY_ESNEXT*/ - bool lcache_lookup_allowed = true; -#endif /* JERRY_ESNEXT */ - if (lcache_lookup_allowed) + if (ecma_op_is_global_environment (lex_env_p)) { #if JERRY_LCACHE ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p); diff --git a/jerry-core/ecma/operations/ecma-reference.h b/jerry-core/ecma/operations/ecma-reference.h index ece9b497..e1d4ae79 100644 --- a/jerry-core/ecma/operations/ecma-reference.h +++ b/jerry-core/ecma/operations/ecma-reference.h @@ -30,9 +30,7 @@ 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 JERRY_ESNEXT ecma_value_t ecma_op_resolve_super_base (ecma_object_t *lex_env_p); -#endif /* JERRY_ESNEXT */ /** * @} diff --git a/jerry-core/ecma/operations/ecma-regexp-object.c b/jerry-core/ecma/operations/ecma-regexp-object.c index 31a479cb..e5b276ae 100644 --- a/jerry-core/ecma/operations/ecma-regexp-object.c +++ b/jerry-core/ecma/operations/ecma-regexp-object.c @@ -98,13 +98,11 @@ ecma_regexp_parse_flags (ecma_string_t *flags_str_p, /**< Input string with flag flag = RE_FLAG_UNICODE; break; } -#if JERRY_ESNEXT case 's': { flag = RE_FLAG_DOTALL; break; } -#endif /* JERRY_ESNEXT */ default: { flag = RE_FLAG_EMPTY; @@ -127,81 +125,6 @@ ecma_regexp_parse_flags (ecma_string_t *flags_str_p, /**< Input string with flag return ret_value; } /* ecma_regexp_parse_flags */ -#if !JERRY_ESNEXT -/* - * Create the properties of a RegExp instance. - */ -static void -ecma_regexp_create_props (ecma_object_t *re_object_p, /**< RegExp object */ - ecma_string_t *source_p, /**< source string */ - uint16_t flags) /**< flags */ -{ - ecma_property_value_t *prop_value_p; - - prop_value_p = ecma_create_named_data_property (re_object_p, - ecma_get_magic_string (LIT_MAGIC_STRING_SOURCE), - ECMA_PROPERTY_FIXED, - NULL); - - ecma_ref_ecma_string (source_p); - prop_value_p->value = ecma_make_string_value (source_p); - - prop_value_p = ecma_create_named_data_property (re_object_p, - ecma_get_magic_string (LIT_MAGIC_STRING_GLOBAL), - ECMA_PROPERTY_FIXED, - NULL); - - prop_value_p->value = ecma_make_boolean_value (flags & RE_FLAG_GLOBAL); - - prop_value_p = ecma_create_named_data_property (re_object_p, - ecma_get_magic_string (LIT_MAGIC_STRING_IGNORECASE_UL), - ECMA_PROPERTY_FIXED, - NULL); - - prop_value_p->value = ecma_make_boolean_value (flags & RE_FLAG_IGNORE_CASE); - - prop_value_p = ecma_create_named_data_property (re_object_p, - ecma_get_magic_string (LIT_MAGIC_STRING_MULTILINE), - ECMA_PROPERTY_FIXED, - NULL); - - prop_value_p->value = ecma_make_boolean_value (flags & RE_FLAG_MULTILINE); -} /* ecma_regexp_create_props */ - -/* - * Update the properties of a RegExp instance. - */ -static void -ecma_regexp_update_props (ecma_object_t *re_object_p, /**< RegExp object */ - ecma_string_t *source_p, /**< source string */ - uint16_t flags) /**< flags */ -{ - ecma_property_t *prop_p; - - prop_p = ecma_find_named_property (re_object_p, ecma_get_magic_string (LIT_MAGIC_STRING_SOURCE)); - JERRY_ASSERT (prop_p != NULL); - ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (prop_p); - ecma_free_value (prop_value_p->value); - ecma_ref_ecma_string (source_p); - prop_value_p->value = ecma_make_string_value (source_p); - - prop_p = ecma_find_named_property (re_object_p, ecma_get_magic_string (LIT_MAGIC_STRING_GLOBAL)); - JERRY_ASSERT (prop_p != NULL); - prop_value_p = ECMA_PROPERTY_VALUE_PTR (prop_p); - prop_value_p->value = ecma_make_boolean_value (flags & RE_FLAG_GLOBAL); - - prop_p = ecma_find_named_property (re_object_p, ecma_get_magic_string (LIT_MAGIC_STRING_IGNORECASE_UL)); - JERRY_ASSERT (prop_p != NULL); - prop_value_p = ECMA_PROPERTY_VALUE_PTR (prop_p); - prop_value_p->value = ecma_make_boolean_value (flags & RE_FLAG_IGNORE_CASE); - - prop_p = ecma_find_named_property (re_object_p, ecma_get_magic_string (LIT_MAGIC_STRING_MULTILINE)); - JERRY_ASSERT (prop_p != NULL); - 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 /* !JERRY_ESNEXT */ - /** * RegExpAlloc method * @@ -216,7 +139,6 @@ 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 JERRY_ESNEXT if (ctr_obj_p == NULL) { ctr_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP); @@ -229,17 +151,10 @@ ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer return proto_obj_p; } -#else /* !JERRY_ESNEXT */ - JERRY_UNUSED (ctr_obj_p); - ecma_object_t *proto_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE); -#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 JERRY_ESNEXT ecma_deref_object (proto_obj_p); -#endif /* JERRY_ESNEXT */ ecma_extended_object_t *regexp_obj_p = (ecma_extended_object_t *) new_object_p; @@ -259,31 +174,11 @@ ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer /** * Helper method for initializing an aready existing RegExp object. */ -static void +static inline void JERRY_ATTR_ALWAYS_INLINE ecma_op_regexp_initialize (ecma_object_t *regexp_obj_p, /**< RegExp object */ - const re_compiled_code_t *bc_p, /**< bytecode */ - ecma_string_t *pattern_str_p, /**< pattern */ - uint16_t flags) /**< flags */ + const re_compiled_code_t *bc_p) /**< bytecode */ { ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) regexp_obj_p; - -#if !JERRY_ESNEXT - if (ext_obj_p->u.cls.type == ECMA_OBJECT_CLASS__MAX) - { - /* This instance has not been initialized before. */ - ecma_regexp_create_props (regexp_obj_p, pattern_str_p, flags); - } - else - { - ecma_regexp_update_props (regexp_obj_p, pattern_str_p, flags); - } -#endif /* !JERRY_ESNEXT */ - -#if JERRY_ESNEXT - JERRY_UNUSED (pattern_str_p); - JERRY_UNUSED (flags); -#endif /* JERRY_ESNEXT */ - ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_REGEXP; ECMA_SET_INTERNAL_VALUE_POINTER (ext_obj_p->u.cls.u3.value, bc_p); } /* ecma_op_regexp_initialize */ @@ -339,7 +234,7 @@ ecma_op_create_regexp_from_pattern (ecma_object_t *regexp_obj_p, /**< RegExp obj return ECMA_VALUE_ERROR; } - ecma_op_regexp_initialize (regexp_obj_p, bc_p, pattern_str_p, flags); + ecma_op_regexp_initialize (regexp_obj_p, bc_p); ecma_deref_ecma_string (pattern_str_p); return ecma_make_object_value (regexp_obj_p); @@ -358,10 +253,8 @@ ecma_op_create_regexp_from_bytecode (ecma_object_t *regexp_obj_p, /**< RegExp ob re_compiled_code_t *bc_p) /**< bytecode */ { ecma_bytecode_ref ((ecma_compiled_code_t *) bc_p); - ecma_string_t *pattern_str_p = ecma_get_string_from_value (bc_p->source); - uint16_t flags = bc_p->header.status_flags; - ecma_op_regexp_initialize (regexp_obj_p, bc_p, pattern_str_p, flags); + ecma_op_regexp_initialize (regexp_obj_p, bc_p); return ecma_make_object_value (regexp_obj_p); } /* ecma_op_create_regexp_from_bytecode */ @@ -394,7 +287,7 @@ ecma_op_create_regexp_with_flags (ecma_object_t *regexp_obj_p, /**< RegExp objec return ECMA_VALUE_ERROR; } - ecma_op_regexp_initialize (regexp_obj_p, bc_p, pattern_str_p, flags); + ecma_op_regexp_initialize (regexp_obj_p, bc_p); return ecma_make_object_value (regexp_obj_p); } /* ecma_op_create_regexp_with_flags */ @@ -408,7 +301,6 @@ lit_code_point_t ecma_regexp_canonicalize_char (lit_code_point_t ch, /**< character */ bool unicode) /**< unicode */ { -#if JERRY_ESNEXT if (unicode) { /* In unicode mode the mappings contained in the CaseFolding.txt file should be used to canonicalize the character. @@ -432,7 +324,6 @@ ecma_regexp_canonicalize_char (lit_code_point_t ch, /**< character */ return ch; } -#endif /* !JERRY_ESNEXT */ JERRY_UNUSED (unicode); lit_code_point_t cu = lit_char_to_upper_case (ch, NULL); @@ -520,7 +411,6 @@ 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 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) { @@ -531,12 +421,10 @@ ecma_regexp_advance (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */ *str_p += LIT_UTF8_MAX_BYTES_IN_CODE_UNIT; } } -#endif /* JERRY_ESNEXT */ return ecma_regexp_canonicalize (cp, re_ctx_p->flags); } /* ecma_regexp_advance */ -#if JERRY_ESNEXT /** * Helper function to get current full unicode code point and advance the string pointer. * @@ -563,7 +451,6 @@ 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 /* JERRY_ESNEXT */ /** * Helper function to revert the string pointer to the previous code point. @@ -575,17 +462,14 @@ 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 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) && lit_is_code_point_utf16_high_surrogate (lit_cesu8_peek_prev (str_p))) { str_p -= LIT_UTF8_MAX_BYTES_IN_CODE_UNIT; } -#else /* !JERRY_ESNEXT */ - JERRY_UNUSED (re_ctx_p); - lit_utf8_decr (&str_p); -#endif /* !JERRY_ESNEXT */ + return str_p; } /* ecma_regexp_step_back */ @@ -606,7 +490,6 @@ ecma_regexp_is_word_boundary (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context * { left_cp = LIT_INVALID_CP; } -#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))) { @@ -614,7 +497,6 @@ 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 /* JERRY_ESNEXT */ else { left_cp = str_p[-1]; @@ -624,13 +506,11 @@ ecma_regexp_is_word_boundary (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context * { right_cp = LIT_INVALID_CP; } -#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 /* JERRY_ESNEXT */ else { right_cp = str_p[0]; @@ -1494,7 +1374,6 @@ class_found: bc_p = bc_p + escape_count + chars_size + ranges_size; continue; } -#if JERRY_ESNEXT case RE_OP_UNICODE_PERIOD: { if (str_curr_p >= re_ctx_p->input_end_p) @@ -1512,7 +1391,6 @@ class_found: continue; } -#endif /* JERRY_ESNEXT */ case RE_OP_PERIOD: { if (str_curr_p >= re_ctx_p->input_end_p) @@ -1521,13 +1399,8 @@ class_found: } const ecma_char_t ch = lit_cesu8_read_next (&str_curr_p); -#if !JERRY_ESNEXT - bool has_dot_all_flag = false; -#else /* JERRY_ESNEXT */ - bool has_dot_all_flag = (re_ctx_p->flags & RE_FLAG_DOTALL) != 0; -#endif /* !JERRY_ESNEXT */ - if (!has_dot_all_flag && lit_char_is_line_terminator (ch)) + if (!(re_ctx_p->flags & RE_FLAG_DOTALL) && lit_char_is_line_terminator (ch)) { goto fail; } @@ -1744,24 +1617,8 @@ 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 JERRY_ESNEXT ret_value = ecma_op_to_length (lastindex_value, &index); ecma_free_value (lastindex_value); -#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); - - /* The ToInteger operation might have thrown an error, however in that case lastindex_num will still be zero, - * and the error will be handled later after the uint32 coercion. */ - if ((re_ctx.flags & RE_FLAG_GLOBAL) && lastindex_num < 0.0f) - { - JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (ret_value)); - goto fail_put_lastindex; - } - - index = ecma_number_to_uint32 (lastindex_num); -#endif /* JERRY_ESNEXT */ if (ECMA_IS_VALUE_ERROR (ret_value)) { @@ -1814,13 +1671,11 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */ goto match_found; } -#if JERRY_ESNEXT /* 12.c.i */ if (re_ctx.flags & RE_FLAG_STICKY) { goto fail_put_lastindex; } -#endif /* JERRY_ESNEXT */ /* 12.a */ if (input_curr_p >= input_end_p) @@ -1838,7 +1693,6 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */ /* 12.c.ii */ index++; -#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); @@ -1850,7 +1704,6 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */ continue; } -#endif /* JERRY_ESNEXT */ lit_utf8_incr (&input_curr_p); } @@ -2075,7 +1928,6 @@ 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 JERRY_ESNEXT /* 2. */ if (!ecma_is_value_object (this_arg)) { @@ -2389,169 +2241,6 @@ cleanup_string: ecma_deref_ecma_string (string_p); return result; -#else /* !JERRY_ESNEXT */ - ecma_value_t result = ECMA_VALUE_ERROR; - - /* 2. */ - ecma_string_t *string_p = ecma_op_to_string (string_arg); - if (JERRY_UNLIKELY (string_p == NULL)) - { - return result; - } - - /* 5. */ - uint32_t limit = UINT32_MAX; - if (!ecma_is_value_undefined (limit_arg)) - { - if (ECMA_IS_VALUE_ERROR (ecma_op_to_length (limit_arg, &limit))) - { - goto cleanup_string; - } - } - - /* 15. */ - ecma_object_t *const array_p = ecma_op_new_array_object (0); - ecma_value_t array = ecma_make_object_value (array_p); - - /* 21. */ - if (limit == 0) - { - result = array; - goto cleanup_string; - } - - uint32_t array_length = 0; - - ecma_object_t *const regexp_p = ecma_get_object_from_value (this_arg); - ecma_extended_object_t *const ext_object_p = (ecma_extended_object_t *) regexp_p; - re_compiled_code_t *const bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, ext_object_p->u.cls.u3.value); - - lit_utf8_size_t string_size; - lit_utf8_size_t string_length; - uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII; - const lit_utf8_byte_t *string_buffer_p = - ecma_string_get_chars (string_p, &string_size, &string_length, NULL, &string_flags); - - const lit_utf8_byte_t *current_str_p = string_buffer_p; - const lit_utf8_byte_t *previous_str_p = string_buffer_p; - const lit_utf8_byte_t *const string_end_p = string_buffer_p + string_size; - - ecma_regexp_ctx_t re_ctx; - ecma_regexp_initialize_context (&re_ctx, bc_p, string_buffer_p, string_buffer_p + string_size); - - uint8_t *const bc_start_p = (uint8_t *) (bc_p + 1); - - if (string_length == 0) - { - const lit_utf8_byte_t *const matched_p = ecma_regexp_match (&re_ctx, bc_start_p, current_str_p); - - if (ECMA_RE_STACK_LIMIT_REACHED (matched_p)) - { - result = ecma_raise_range_error (ECMA_ERR_STACK_LIMIT_EXCEEDED); - goto cleanup_array; - } - - if (matched_p == NULL) - { - result = ecma_builtin_helper_def_prop_by_index (array_p, - array_length, - ecma_make_string_value (string_p), - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); - JERRY_ASSERT (ecma_is_value_true (result)); - } - - result = array; - goto cleanup_context; - } - - /* 13. */ - while (current_str_p < string_end_p) - { - /* 13.a. */ - const lit_utf8_byte_t *const matched_p = ecma_regexp_match (&re_ctx, bc_start_p, current_str_p); - - if (ECMA_RE_STACK_LIMIT_REACHED (matched_p)) - { - result = ecma_raise_range_error (ECMA_ERR_STACK_LIMIT_EXCEEDED); - goto cleanup_array; - } - - if (matched_p == NULL || matched_p == previous_str_p) - { - lit_utf8_incr (¤t_str_p); - continue; - } - - /* 13.c.iii.1. */ - ecma_string_t *const str_p = - ecma_new_ecma_string_from_utf8 (previous_str_p, (lit_utf8_size_t) (current_str_p - previous_str_p)); - - result = ecma_builtin_helper_def_prop_by_index (array_p, - array_length++, - ecma_make_string_value (str_p), - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); - JERRY_ASSERT (ecma_is_value_true (result)); - ecma_deref_ecma_string (str_p); - - if (array_length == limit) - { - result = array; - goto cleanup_context; - } - - /* 13.c.iii.5. */ - previous_str_p = matched_p; - - uint32_t index = 1; - while (index < re_ctx.captures_count) - { - const ecma_value_t capture = ecma_regexp_get_capture_value (re_ctx.captures_p + index); - result = ecma_builtin_helper_def_prop_by_index (array_p, - array_length++, - capture, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); - JERRY_ASSERT (ecma_is_value_true (result)); - ecma_free_value (capture); - - if (array_length == limit) - { - result = array; - goto cleanup_context; - } - - index++; - } - - /* 13.c.iii.8. */ - current_str_p = matched_p; - } - - ecma_string_t *const str_p = - ecma_new_ecma_string_from_utf8 (previous_str_p, (lit_utf8_size_t) (string_end_p - previous_str_p)); - - result = ecma_builtin_helper_def_prop_by_index (array_p, - array_length++, - ecma_make_string_value (str_p), - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); - JERRY_ASSERT (ecma_is_value_true (result)); - ecma_deref_ecma_string (str_p); - - result = array; - goto cleanup_context; - -cleanup_array: - ecma_deref_object (array_p); -cleanup_context: - ecma_regexp_cleanup_context (&re_ctx); - if (string_flags & ECMA_STRING_FLAG_MUST_BE_FREED) - { - jmem_heap_free_block ((void *) string_buffer_p, string_size); - } -cleanup_string: - ecma_deref_ecma_string (string_p); - - return result; -#endif /* JERRY_ESNEXT */ } /* ecma_regexp_split_helper */ /** @@ -2606,7 +2295,6 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont goto cleanup_context; } -#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)) { @@ -2641,7 +2329,6 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont } } else -#endif /* JERRY_ESNEXT */ { index = 0; } @@ -2723,7 +2410,6 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont if (!(ctx_p->flags & RE_FLAG_GLOBAL)) { -#if JERRY_ESNEXT if (JERRY_UNLIKELY ((re_ctx.flags & RE_FLAG_STICKY) != 0)) { ecma_value_t index_value = ecma_make_length_value (index); @@ -2739,7 +2425,6 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont goto cleanup_builder; } } -#endif /* JERRY_ESNEXT */ break; } @@ -2750,7 +2435,6 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont continue; } } -#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, @@ -2765,14 +2449,12 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont break; } -#endif /* JERRY_ESNEXT */ if (current_p >= string_end_p) { break; } -#if JERRY_ESNEXT if ((ctx_p->flags & RE_FLAG_UNICODE) != 0) { index++; @@ -2785,7 +2467,6 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont continue; } -#endif /* JERRY_ESNEXT */ index++; lit_utf8_incr (¤t_p); @@ -2873,14 +2554,11 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */ ecma_free_value (result); -#if JERRY_ESNEXT const lit_utf8_size_t string_length = ecma_string_get_length (string_p); -#endif /* JERRY_ESNEXT */ /* 10. */ if (replace_ctx.flags & RE_FLAG_GLOBAL) { -#if JERRY_ESNEXT result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_UNICODE); if (ECMA_IS_VALUE_ERROR (result)) { @@ -2893,7 +2571,6 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */ } ecma_free_value (result); -#endif /* JERRY_ESNEXT */ result = ecma_op_object_put (this_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), @@ -2907,11 +2584,6 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */ JERRY_ASSERT (ecma_is_value_boolean (result)); } -#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 /* JERRY_ESNEXT */ result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_EXEC); if (ECMA_IS_VALUE_ERROR (result)) @@ -3276,7 +2948,6 @@ cleanup_chars: cleanup_results: ecma_collection_free (results_p); -#endif /* !JERRY_ESNEXT */ cleanup_replace: if (replace_ctx.replace_str_p != NULL) @@ -3336,7 +3007,6 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */ return result; } -#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)) @@ -3348,7 +3018,6 @@ 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 /* JERRY_ESNEXT */ ecma_value_t set_status = ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), ecma_make_uint32_value (0), true); @@ -3421,7 +3090,6 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */ goto result_cleanup; } -#if JERRY_ESNEXT ecma_length_t index; ecma_value_t length_value = ecma_op_to_length (last_index, &index); @@ -3437,15 +3105,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */ last_index = ecma_make_length_value (index); ecma_value_t next_set_status = ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index, true); -#else /* !JERRY_ESNEXT */ - ecma_number_t index = ecma_get_number_from_value (last_index); - ecma_free_value (last_index); - - last_index = ecma_make_number_value (index + 1); - ecma_value_t next_set_status = - ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index, true); -#endif /* JERRY_ESNEXT */ ecma_free_value (last_index); if (ECMA_IS_VALUE_ERROR (next_set_status)) @@ -3478,7 +3138,6 @@ 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 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)) @@ -3512,7 +3171,6 @@ ecma_op_regexp_exec (ecma_value_t this_arg, /**< this argument */ { ecma_free_value (exec); } -#endif /* JERRY_ESNEXT */ if (!ecma_object_is_regexp_object (this_arg)) { diff --git a/jerry-core/ecma/operations/ecma-regexp-object.h b/jerry-core/ecma/operations/ecma-regexp-object.h index 5c97049f..89815897 100644 --- a/jerry-core/ecma/operations/ecma-regexp-object.h +++ b/jerry-core/ecma/operations/ecma-regexp-object.h @@ -164,10 +164,7 @@ typedef struct ecma_value_t iterated_string; /**< [[IteratedString]] internal slot */ } ecma_regexp_string_iterator_t; -#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 /* 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, ecma_string_t *input_string_p); ecma_string_t *ecma_regexp_read_pattern_str_helper (ecma_value_t pattern_arg); diff --git a/jerry-core/ecma/operations/ecma-string-object.c b/jerry-core/ecma/operations/ecma-string-object.c index 72f7f3aa..597d1868 100644 --- a/jerry-core/ecma/operations/ecma-string-object.c +++ b/jerry-core/ecma/operations/ecma-string-object.c @@ -70,7 +70,7 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of proto_id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE; #endif /* JERRY_BUILTIN_STRING */ ecma_object_t *prototype_obj_p = ecma_builtin_get (proto_id); -#if JERRY_ESNEXT + ecma_object_t *new_target = JERRY_CONTEXT (current_new_target_p); if (new_target) { @@ -80,7 +80,7 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of return ECMA_VALUE_ERROR; } } -#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,11 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_STRING; ext_object_p->u.cls.u3.value = prim_value; -#if JERRY_ESNEXT if (new_target) { ecma_deref_object (prototype_obj_p); } -#endif /* JERRY_ESNEXT */ + return ecma_make_object_value (object_p); } /* ecma_op_create_string_object */ diff --git a/jerry-core/ecma/operations/ecma-symbol-object.c b/jerry-core/ecma/operations/ecma-symbol-object.c index 99d62562..adf84367 100644 --- a/jerry-core/ecma/operations/ecma-symbol-object.c +++ b/jerry-core/ecma/operations/ecma-symbol-object.c @@ -26,8 +26,6 @@ #include "lit-char-helpers.h" -#if JERRY_ESNEXT - /** \addtogroup ecma ECMA * @{ * @@ -172,7 +170,6 @@ ecma_symbol_this_value (ecma_value_t this_arg) /**< this argument value */ /* 3. */ return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_SYMBOL); } /* ecma_symbol_this_value */ -#endif /* JERRY_ESNEXT */ /** * @} diff --git a/jerry-core/ecma/operations/ecma-symbol-object.h b/jerry-core/ecma/operations/ecma-symbol-object.h index 1ca59930..4f27e02a 100644 --- a/jerry-core/ecma/operations/ecma-symbol-object.h +++ b/jerry-core/ecma/operations/ecma-symbol-object.h @@ -18,8 +18,6 @@ #include "ecma-globals.h" -#if JERRY_ESNEXT - /** \addtogroup ecma ECMA * @{ * @@ -39,7 +37,6 @@ ecma_value_t ecma_symbol_this_value (ecma_value_t this_arg); ecma_value_t ecma_get_symbol_descriptive_string (ecma_value_t symbol_value); -#endif /* JERRY_ESNEXT */ /** * @} * @} |