diff options
Diffstat (limited to 'jerry-core/ecma')
303 files changed, 3418 insertions, 5357 deletions
diff --git a/jerry-core/ecma/base/ecma-alloc.c b/jerry-core/ecma/base/ecma-alloc.c index 6d5d8d9b..970b05ee 100644 --- a/jerry-core/ecma/base/ecma-alloc.c +++ b/jerry-core/ecma/base/ecma-alloc.c @@ -14,10 +14,12 @@ */ #include "ecma-alloc.h" -#include "ecma-globals.h" + #include "ecma-gc.h" -#include "jrt.h" +#include "ecma-globals.h" + #include "jmem.h" +#include "jrt.h" JERRY_STATIC_ASSERT (sizeof (ecma_property_value_t) == sizeof (ecma_value_t), size_of_ecma_property_value_t_must_be_equal_to_size_of_ecma_value_t); @@ -51,7 +53,7 @@ JERRY_STATIC_ASSERT (sizeof (ecma_extended_object_t) - sizeof (ecma_object_t) <= * * @return pointer to allocated memory */ -extern inline ecma_number_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_number_t *JERRY_ATTR_ALWAYS_INLINE ecma_alloc_number (void) { return (ecma_number_t *) jmem_pools_alloc (sizeof (ecma_number_t)); @@ -71,7 +73,7 @@ ecma_dealloc_number (ecma_number_t *number_p) /**< number to be freed */ * * @return pointer to allocated memory */ -extern inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE ecma_alloc_object (void) { #if JERRY_MEM_STATS @@ -99,7 +101,7 @@ ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */ * * @return pointer to allocated memory */ -extern inline ecma_extended_object_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_extended_object_t *JERRY_ATTR_ALWAYS_INLINE ecma_alloc_extended_object (size_t size) /**< size of object */ { #if JERRY_MEM_STATS @@ -128,7 +130,7 @@ ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */ * * @return pointer to allocated memory */ -extern inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE ecma_alloc_string (void) { #if JERRY_MEM_STATS @@ -156,7 +158,7 @@ ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */ * * @return pointer to allocated memory */ -extern inline ecma_extended_string_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_extended_string_t *JERRY_ATTR_ALWAYS_INLINE ecma_alloc_extended_string (void) { #if JERRY_MEM_STATS @@ -184,7 +186,7 @@ ecma_dealloc_extended_string (ecma_extended_string_t *ext_string_p) /**< extende * * @return pointer to allocated memory */ -extern inline ecma_external_string_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_external_string_t *JERRY_ATTR_ALWAYS_INLINE ecma_alloc_external_string (void) { #if JERRY_MEM_STATS @@ -212,7 +214,7 @@ ecma_dealloc_external_string (ecma_external_string_t *ext_string_p) /**< externa * * @return pointer to allocated memory */ -extern inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE ecma_alloc_string_buffer (size_t size) /**< size of string */ { #if JERRY_MEM_STATS @@ -241,7 +243,7 @@ ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */ * * @return pointer to allocated memory */ -extern inline ecma_property_pair_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_property_pair_t *JERRY_ATTR_ALWAYS_INLINE ecma_alloc_property_pair (void) { #if JERRY_MEM_STATS diff --git a/jerry-core/ecma/base/ecma-errors.c b/jerry-core/ecma/base/ecma-errors.c index 27189eaf..eea386bd 100644 --- a/jerry-core/ecma/base/ecma-errors.c +++ b/jerry-core/ecma/base/ecma-errors.c @@ -11,7 +11,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + */ #include "ecma-errors.h" @@ -20,114 +20,114 @@ /** * Error message, if an argument is has an error flag */ -const char * const ecma_error_value_msg_p = "Argument cannot be marked as error"; +const char* const ecma_error_value_msg_p = "Argument cannot be marked as error"; /** * Error message, if an argument has a wrong type */ -const char * const ecma_error_wrong_args_msg_p = "This type of argument is not allowed"; +const char* const ecma_error_wrong_args_msg_p = "This type of argument is not allowed"; #if !JERRY_PARSER /** * Error message, if parsing is disabled */ -const char * const ecma_error_parser_not_supported_p = "Source code parsing is disabled"; +const char* const ecma_error_parser_not_supported_p = "Source code parsing is disabled"; #endif /* !JERRY_PARSER */ #if !JERRY_BUILTIN_JSON /** * Error message, if JSON support is disabled */ -const char * const ecma_error_json_not_supported_p = "JSON support is disabled"; +const char* const ecma_error_json_not_supported_p = "JSON support is disabled"; #endif /* !JERRY_BUILTIN_JSON */ #if !JERRY_ESNEXT /** * Error message, if Symbol support is disabled */ -const char * const ecma_error_symbol_not_supported_p = "Symbol support is disabled"; +const char* const ecma_error_symbol_not_supported_p = "Symbol support is disabled"; /** * Error message, if Promise support is disabled */ -const char * const ecma_error_promise_not_supported_p = "Promise support is disabled"; +const char* const ecma_error_promise_not_supported_p = "Promise support is disabled"; #endif /* !JERRY_ESNEXT */ #if !JERRY_BUILTIN_TYPEDARRAY /** * Error message, if TypedArray support is disabled */ -const char * const ecma_error_typed_array_not_supported_p = "TypedArray support is disabled"; +const char* const ecma_error_typed_array_not_supported_p = "TypedArray support is disabled"; #endif /* !JERRY_BUILTIN_TYPEDARRAY */ #if !JERRY_BUILTIN_SHAREDARRAYBUFFER /** * Error message, if SharedArrayBuffer support is disabled */ -const char * const ecma_error_shared_arraybuffer_not_supported_p = "SharedArrayBuffer support is disabled"; +const char* const ecma_error_shared_arraybuffer_not_supported_p = "SharedArrayBuffer support is disabled"; #endif /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */ #if !JERRY_BUILTIN_DATAVIEW /** * Error message, if DataView support is disabled */ -const char * const ecma_error_data_view_not_supported_p = "DataView support is disabled"; +const char* const ecma_error_data_view_not_supported_p = "DataView support is disabled"; #endif /* !JERRY_BUILTIN_DATAVIEW */ #if !JERRY_BUILTIN_BIGINT /** * Error message, if BigInt support is disabled */ -const char * const ecma_error_bigint_not_supported_p = "BigInt support is disabled"; +const char* const ecma_error_bigint_not_supported_p = "BigInt support is disabled"; #endif /* !JERRY_BUILTIN_BIGINT */ #if !JERRY_BUILTIN_CONTAINER /** * Error message, if Container support is disabled */ -const char * const ecma_error_container_not_supported_p = "Container support is disabled"; +const char* const ecma_error_container_not_supported_p = "Container support is disabled"; #endif /* JERRY_BUILTIN_CONTAINER */ #if JERRY_MODULE_SYSTEM /** * Error message, if argument is not a module */ -const char * const ecma_error_not_module_p = "Argument is not a module"; +const char* const ecma_error_not_module_p = "Argument is not a module"; /** * Error message, if a native module export is not found */ -const char * const ecma_error_unknown_export_p = "Native module export not found"; +const char* const ecma_error_unknown_export_p = "Native module export not found"; #else /* !JERRY_MODULE_SYSTEM */ /** * Error message, if Module support is disabled */ -const char * const ecma_error_module_not_supported_p = "Module support is disabled"; +const char* const ecma_error_module_not_supported_p = "Module support is disabled"; #endif /* JERRY_MODULE_SYSTEM */ /** - * Error message, if callback function is not callable - */ -const char * const ecma_error_callback_is_not_callable = "Callback function is not callable"; + * Error message, if callback function is not callable + */ +const char* const ecma_error_callback_is_not_callable = "Callback function is not callable"; /** * Error message, if arrayBuffer is detached */ -const char * const ecma_error_arraybuffer_is_detached = "ArrayBuffer has been detached"; +const char* const ecma_error_arraybuffer_is_detached = "ArrayBuffer has been detached"; /** * Error message, cannot convert undefined or null to object */ -const char * const ecma_error_cannot_convert_to_object = "Cannot convert undefined or null to object"; +const char* const ecma_error_cannot_convert_to_object = "Cannot convert undefined or null to object"; /** * Error message, prototype property of a class is non-configurable */ -const char * const ecma_error_class_is_non_configurable = "Prototype property of a class is non-configurable"; +const char* const ecma_error_class_is_non_configurable = "Prototype property of a class is non-configurable"; /** * Error message, argument is not an object */ -const char * const ecma_error_argument_is_not_an_object = "Argument is not an object"; +const char* const ecma_error_argument_is_not_an_object = "Argument is not an object"; /** * Error message length of 'ecma_error_argument_is_not_an_object' @@ -137,45 +137,45 @@ const int ecma_error_argument_is_not_an_object_length = 25; /** * Error message, argument is not a Proxy object */ -const char * const ecma_error_argument_is_not_a_proxy = "Argument is not a Proxy object"; +const char* const ecma_error_argument_is_not_a_proxy = "Argument is not a Proxy object"; /** * Error message, target is not a constructor */ -const char * const ecma_error_target_is_not_a_constructor = "Target is not a constructor"; +const char* const ecma_error_target_is_not_a_constructor = "Target is not a constructor"; /** * Error message, argument is not an regexp */ -const char * const ecma_error_argument_is_not_an_regexp = "Argument 'this' is not a RegExp object"; +const char* const ecma_error_argument_is_not_an_regexp = "Argument 'this' is not a RegExp object"; /** * Error message, invalid array length */ -const char * const ecma_error_invalid_array_length = "Invalid Array length"; +const char* const ecma_error_invalid_array_length = "Invalid Array length"; /** * Error message, local variable is redeclared */ -const char * const ecma_error_local_variable_is_redeclared = "Local variable is redeclared"; +const char* const ecma_error_local_variable_is_redeclared = "Local variable is redeclared"; /** * Error message, expected a function */ -const char * const ecma_error_expected_a_function = "Expected a function"; +const char* const ecma_error_expected_a_function = "Expected a function"; #if JERRY_ESNEXT /** * Error message, class constructor invoked without new keyword */ -const char * const ecma_error_class_constructor_new = "Class constructor cannot be invoked without 'new'"; +const char* const ecma_error_class_constructor_new = "Class constructor cannot be invoked without 'new'"; /** * Error message, variables declared by let/const must be initialized before reading their value */ -const char * const ecma_error_let_const_not_initialized = ("Variables declared by let/const must be" - " initialized before reading their value"); +const char* const ecma_error_let_const_not_initialized = ("Variables declared by let/const must be" + " initialized before reading their value"); #endif /* JERRY_ESNEXT */ @@ -186,31 +186,31 @@ const char * const ecma_error_let_const_not_initialized = ("Variables declared b /** * Error message, maximum snapshot size reached */ -const char * const ecma_error_maximum_snapshot_size = "Maximum snapshot size reached"; +const char* const ecma_error_maximum_snapshot_size = "Maximum snapshot size reached"; /** * Error message, regular expressions literals are not supported */ -const char * const ecma_error_regular_expression_not_supported = "Regular expression literals are not supported"; +const char* const ecma_error_regular_expression_not_supported = "Regular expression literals are not supported"; /** * Error message, snapshot buffer too small */ -const char * const ecma_error_snapshot_buffer_small = "Snapshot buffer too small"; +const char* const ecma_error_snapshot_buffer_small = "Snapshot buffer too small"; /** * Error message, Unsupported generate snapshot flags specified */ -const char * const ecma_error_snapshot_flag_not_supported = "Unsupported generate snapshot flags specified"; +const char* const ecma_error_snapshot_flag_not_supported = "Unsupported generate snapshot flags specified"; /** * Error message, Cannot allocate memory for literals */ -const char * const ecma_error_cannot_allocate_memory_literals = "Cannot allocate memory for literals"; +const char* const ecma_error_cannot_allocate_memory_literals = "Cannot allocate memory for literals"; /** * Error message, Unsupported feature: tagged template literals */ -const char * const ecma_error_tagged_template_literals = "Unsupported feature: tagged template literals"; +const char* const ecma_error_tagged_template_literals = "Unsupported feature: tagged template literals"; #endif /* JERRY_SNAPSHOT_SAVE || JERRY_SNAPSHOT_EXEC */ diff --git a/jerry-core/ecma/base/ecma-errors.h b/jerry-core/ecma/base/ecma-errors.h index 8cab743e..6adba1d5 100644 --- a/jerry-core/ecma/base/ecma-errors.h +++ b/jerry-core/ecma/base/ecma-errors.h @@ -20,75 +20,75 @@ #if JERRY_ERROR_MESSAGES -extern const char * const ecma_error_value_msg_p; -extern const char * const ecma_error_wrong_args_msg_p; +extern const char* const ecma_error_value_msg_p; +extern const char* const ecma_error_wrong_args_msg_p; #if !JERRY_PARSER -extern const char * const ecma_error_parser_not_supported_p; +extern const char* const ecma_error_parser_not_supported_p; #endif /* !JERRY_PARSER */ #if !JERRY_BUILTIN_JSON -extern const char * const ecma_error_json_not_supported_p; +extern const char* const ecma_error_json_not_supported_p; #endif /* !JERRY_BUILTIN_JSON */ #if !JERRY_ESNEXT -extern const char * const ecma_error_symbol_not_supported_p; +extern const char* const ecma_error_symbol_not_supported_p; -extern const char * const ecma_error_promise_not_supported_p; +extern const char* const ecma_error_promise_not_supported_p; #endif /* !JERRY_ESNEXT */ #if !JERRY_BUILTIN_TYPEDARRAY -extern const char * const ecma_error_typed_array_not_supported_p; +extern const char* const ecma_error_typed_array_not_supported_p; #endif /* !JERRY_BUILTIN_TYPEDARRAY */ #if !JERRY_BUILTIN_SHAREDARRAYBUFFER -extern const char * const ecma_error_shared_arraybuffer_not_supported_p; +extern const char* const ecma_error_shared_arraybuffer_not_supported_p; #endif /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */ #if !JERRY_BUILTIN_DATAVIEW -extern const char * const ecma_error_data_view_not_supported_p; +extern const char* const ecma_error_data_view_not_supported_p; #endif /* !JERRY_BUILTIN_DATAVIEW */ #if !JERRY_BUILTIN_BIGINT -extern const char * const ecma_error_bigint_not_supported_p; +extern const char* const ecma_error_bigint_not_supported_p; #endif /* !JERRY_BUILTIN_BIGINT */ #if !JERRY_BUILTIN_CONTAINER -extern const char * const ecma_error_container_not_supported_p; +extern const char* const ecma_error_container_not_supported_p; #endif /* !JERRY_BUILTIN_CONTAINER */ #if JERRY_MODULE_SYSTEM -extern const char * const ecma_error_not_module_p; -extern const char * const ecma_error_unknown_export_p; +extern const char* const ecma_error_not_module_p; +extern const char* const ecma_error_unknown_export_p; #else /* !JERRY_MODULE_SYSTEM */ -extern const char * const ecma_error_module_not_supported_p; +extern const char* const ecma_error_module_not_supported_p; #endif /* JERRY_MODULE_SYSTEM */ -extern const char * const ecma_error_callback_is_not_callable; -extern const char * const ecma_error_arraybuffer_is_detached; -extern const char * const ecma_error_cannot_convert_to_object; -extern const char * const ecma_error_class_is_non_configurable; -extern const char * const ecma_error_argument_is_not_an_object; +extern const char* const ecma_error_callback_is_not_callable; +extern const char* const ecma_error_arraybuffer_is_detached; +extern const char* const ecma_error_cannot_convert_to_object; +extern const char* const ecma_error_class_is_non_configurable; +extern const char* const ecma_error_argument_is_not_an_object; extern const int ecma_error_argument_is_not_an_object_length; -extern const char * const ecma_error_argument_is_not_a_proxy; -extern const char * const ecma_error_target_is_not_a_constructor; -extern const char * const ecma_error_argument_is_not_an_regexp; -extern const char * const ecma_error_invalid_array_length; -extern const char * const ecma_error_local_variable_is_redeclared; -extern const char * const ecma_error_expected_a_function; +extern const char* const ecma_error_argument_is_not_a_proxy; +extern const char* const ecma_error_target_is_not_a_constructor; +extern const char* const ecma_error_argument_is_not_an_regexp; +extern const char* const ecma_error_invalid_array_length; +extern const char* const ecma_error_local_variable_is_redeclared; +extern const char* const ecma_error_expected_a_function; #if JERRY_ESNEXT -extern const char * const ecma_error_class_constructor_new; -extern const char * const ecma_error_let_const_not_initialized; +extern const char* const ecma_error_class_constructor_new; +extern const char* const ecma_error_let_const_not_initialized; #endif /* JERRY_ESNEXT */ #endif /* JERRY_ERROR_MESSAGES */ /* snapshot errors */ -extern const char * const ecma_error_maximum_snapshot_size; -extern const char * const ecma_error_regular_expression_not_supported; -extern const char * const ecma_error_snapshot_buffer_small; -extern const char * const ecma_error_snapshot_flag_not_supported; -extern const char * const ecma_error_cannot_allocate_memory_literals; -extern const char * const ecma_error_tagged_template_literals; -#endif /* !ECMA_ERRORS_H */ +extern const char* const ecma_error_maximum_snapshot_size; +extern const char* const ecma_error_regular_expression_not_supported; +extern const char* const ecma_error_snapshot_buffer_small; +extern const char* const ecma_error_snapshot_flag_not_supported; +extern const char* const ecma_error_cannot_allocate_memory_literals; +extern const char* const ecma_error_tagged_template_literals; +#endif /* !ECMA_ERRORS_H */ diff --git a/jerry-core/ecma/base/ecma-extended-info.c b/jerry-core/ecma/base/ecma-extended-info.c index b5fabf58..75181612 100644 --- a/jerry-core/ecma/base/ecma-extended-info.c +++ b/jerry-core/ecma/base/ecma-extended-info.c @@ -13,10 +13,12 @@ * limitations under the License. */ -#include "byte-code.h" -#include "ecma-helpers.h" #include "ecma-extended-info.h" +#include "ecma-helpers.h" + +#include "byte-code.h" + #if JERRY_ESNEXT || JERRY_FUNCTION_TO_STRING /** \addtogroup ecma ECMA @@ -41,8 +43,7 @@ ecma_extended_info_decode_vlq (uint8_t **buffer_p) /**< [in/out] target buffer * { source_p--; value = (value << ECMA_EXTENDED_INFO_VLQ_SHIFT) | (*source_p & ECMA_EXTENDED_INFO_VLQ_MASK); - } - while (*source_p & ECMA_EXTENDED_INFO_VLQ_CONTINUE); + } while (*source_p & ECMA_EXTENDED_INFO_VLQ_CONTINUE); *buffer_p = source_p; return value; @@ -71,8 +72,7 @@ ecma_extended_info_encode_vlq (uint8_t **buffer_p, /**< target buffer */ { current_value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT; length++; - } - while (current_value > 0); + } while (current_value > 0); destination_p -= length; *buffer_p = destination_p; @@ -81,8 +81,7 @@ ecma_extended_info_encode_vlq (uint8_t **buffer_p, /**< target buffer */ { *destination_p++ = (uint8_t) (value | ECMA_EXTENDED_INFO_VLQ_CONTINUE); value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT; - } - while (value > 0); + } while (value > 0); **buffer_p &= ECMA_EXTENDED_INFO_VLQ_MASK; } /* ecma_extended_info_encode_vlq */ @@ -101,8 +100,7 @@ ecma_extended_info_get_encoded_length (uint32_t value) /**< encoded value */ { value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT; length++; - } - while (value > 0); + } while (value > 0); return length; } /* ecma_extended_info_get_encoded_length */ diff --git a/jerry-core/ecma/base/ecma-extended-info.h b/jerry-core/ecma/base/ecma-extended-info.h index c9fc1c90..95fbcab4 100644 --- a/jerry-core/ecma/base/ecma-extended-info.h +++ b/jerry-core/ecma/base/ecma-extended-info.h @@ -23,10 +23,10 @@ * @{ */ -#if JERRY_ESNEXT || JERRY_FUNCTION_TO_STRING - #include "ecma-globals.h" +#if JERRY_ESNEXT || JERRY_FUNCTION_TO_STRING + /** * Vlq encoding: flag which is set for all bytes except the last one. */ diff --git a/jerry-core/ecma/base/ecma-gc.c b/jerry-core/ecma/base/ecma-gc.c index 2bd2e7fc..83dc808b 100644 --- a/jerry-core/ecma/base/ecma-gc.c +++ b/jerry-core/ecma/base/ecma-gc.c @@ -17,6 +17,8 @@ * Garbage collector implementation */ +#include "ecma-gc.h" + #include "ecma-alloc.h" #include "ecma-array-object.h" #include "ecma-arraybuffer-object.h" @@ -24,16 +26,16 @@ #include "ecma-container-object.h" #include "ecma-function-object.h" #include "ecma-globals.h" -#include "ecma-gc.h" #include "ecma-helpers.h" #include "ecma-lcache.h" #include "ecma-objects.h" #include "ecma-property-hashmap.h" #include "ecma-proxy-object.h" + #include "jcontext.h" -#include "jrt.h" -#include "jrt-libc-includes.h" #include "jrt-bit-fields.h" +#include "jrt-libc-includes.h" +#include "jrt.h" #include "re-compiler.h" #include "vm-defines.h" #include "vm-stack.h" @@ -300,8 +302,7 @@ ecma_gc_mark_properties (ecma_object_t *object_p, /**< object */ if (!ECMA_PROPERTY_IS_INTERNAL (property)) { - JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_DELETED - || property == ECMA_PROPERTY_TYPE_HASHMAP); + JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_DELETED || property == ECMA_PROPERTY_TYPE_HASHMAP); continue; } @@ -314,8 +315,8 @@ ecma_gc_mark_properties (ecma_object_t *object_p, /**< object */ case LIT_INTERNAL_MAGIC_STRING_ENVIRONMENT_RECORD: { ecma_environment_record_t *environment_record_p; - environment_record_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_environment_record_t, - property_pair_p->values[index].value); + environment_record_p = + ECMA_GET_INTERNAL_VALUE_POINTER (ecma_environment_record_t, property_pair_p->values[index].value); if (environment_record_p->this_binding != ECMA_VALUE_UNINITIALIZED) { @@ -397,8 +398,7 @@ ecma_gc_mark_properties (ecma_object_t *object_p, /**< object */ { ecma_gc_set_object_visited (ecma_get_object_from_value (*value_p)); } - } - while (++value_p < end_p); + } while (++value_p < end_p); if (property & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL) { @@ -406,8 +406,7 @@ ecma_gc_mark_properties (ecma_object_t *object_p, /**< object */ } item_p = &(((ecma_native_pointer_chain_t *) item_p)->next_p->data); - } - while (item_p != NULL); + } while (item_p != NULL); break; } @@ -460,8 +459,8 @@ ecma_gc_mark_bound_function_object (ecma_object_t *object_p) /**< bound function ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) object_p; 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); + target_func_p = + ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function); ecma_gc_set_object_visited (target_func_p); @@ -547,12 +546,11 @@ ecma_gc_mark_map_object (ecma_object_t *object_p) /**< object */ JERRY_ASSERT (object_p != NULL); ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p; - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); ecma_value_t *start_p = ECMA_CONTAINER_START (container_p); uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p); - for (uint32_t i = 0; i < entry_count; i+= ECMA_CONTAINER_PAIR_SIZE) + for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_PAIR_SIZE) { ecma_container_pair_t *entry_p = (ecma_container_pair_t *) (start_p + i); @@ -582,12 +580,11 @@ ecma_gc_mark_weakmap_object (ecma_object_t *object_p) /**< object */ JERRY_ASSERT (object_p != NULL); ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p; - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); ecma_value_t *start_p = ECMA_CONTAINER_START (container_p); uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p); - for (uint32_t i = 0; i < entry_count; i+= ECMA_CONTAINER_PAIR_SIZE) + for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_PAIR_SIZE) { ecma_container_pair_t *entry_p = (ecma_container_pair_t *) (start_p + i); @@ -598,8 +595,7 @@ ecma_gc_mark_weakmap_object (ecma_object_t *object_p) /**< object */ JERRY_ASSERT (ecma_is_value_object (entry_p->key)); - if (ecma_is_value_object (entry_p->value) - && ecma_gc_is_object_visited (ecma_get_object_from_value (entry_p->key))) + if (ecma_is_value_object (entry_p->value) && ecma_gc_is_object_visited (ecma_get_object_from_value (entry_p->key))) { ecma_gc_set_object_visited (ecma_get_object_from_value (entry_p->value)); } @@ -615,12 +611,11 @@ ecma_gc_mark_set_object (ecma_object_t *object_p) /**< object */ JERRY_ASSERT (object_p != NULL); ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p; - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); ecma_value_t *start_p = ECMA_CONTAINER_START (container_p); uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p); - for (uint32_t i = 0; i < entry_count; i+= ECMA_CONTAINER_VALUE_SIZE) + for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_VALUE_SIZE) { ecma_value_t *entry_p = start_p + i; @@ -728,8 +723,7 @@ ecma_gc_mark_executable_object (ecma_object_t *object_p) /**< object */ do { ecma_gc_set_object_visited (ecma_get_object_from_value (*(--context_top_p))); - } - while (context_top_p > last_item_p); + } while (context_top_p > last_item_p); continue; } @@ -750,8 +744,7 @@ ecma_gc_mark_executable_object (ecma_object_t *object_p) /**< object */ JERRY_ASSERT (context_top_p >= context_end_p + offsets); context_top_p -= offsets; - } - while (context_top_p > context_end_p); + } while (context_top_p > context_end_p); } register_end_p = executable_object_p->frame_ctx.stack_top_p; @@ -891,8 +884,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */ case ECMA_OBJECT_CLASS_SCRIPT: { const ecma_compiled_code_t *compiled_code_p; - compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, - ext_object_p->u.cls.u3.value); + compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value); JERRY_ASSERT (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)); ecma_gc_mark_compiled_code (((cbc_uint8_arguments_t *) compiled_code_p)->script_value); @@ -910,8 +902,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */ case ECMA_OBJECT_CLASS_MODULE_NAMESPACE: { JERRY_ASSERT (proto_cp == JMEM_CP_NULL); - ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, - ext_object_p->u.cls.u3.value)); + ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, ext_object_p->u.cls.u3.value)); ecma_gc_mark_properties (object_p, true); return; } @@ -1114,8 +1105,8 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */ case ECMA_OBJECT_TYPE_FUNCTION: { ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p; - ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, - ext_func_p->u.function.scope_cp)); + ecma_gc_set_object_visited ( + ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_func_p->u.function.scope_cp)); const ecma_compiled_code_t *compiled_code_p = ecma_op_function_get_compiled_code (ext_func_p); @@ -1249,8 +1240,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */ case ECMA_OBJECT_TYPE_NATIVE_FUNCTION: { ecma_native_function_t *native_function_p = (ecma_native_function_t *) object_p; - ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, - native_function_p->realm_value)); + ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, native_function_p->realm_value)); break; } #endif /* JERRY_BUILTIN_REALMS */ @@ -1322,8 +1312,7 @@ ecma_gc_free_native_pointer (ecma_property_t property, /**< property descriptor jmem_heap_free_block (item_p, sizeof (ecma_native_pointer_chain_t)); item_p = next_p; - } - while (item_p != NULL); + } while (item_p != NULL); } /* ecma_gc_free_native_pointer */ /** @@ -1347,8 +1336,8 @@ ecma_free_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments if (!(mapped_arguments_p->unmapped.header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE)) #endif /* JERRY_SNAPSHOT_EXEC */ { - ecma_compiled_code_t *byte_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, - mapped_arguments_p->u.byte_code); + ecma_compiled_code_t *byte_code_p = + ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, mapped_arguments_p->u.byte_code); ecma_bytecode_deref (byte_code_p); } @@ -1363,8 +1352,7 @@ ecma_free_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments ecma_free_value_if_not_object (argv_p[i]); } - uint32_t saved_argument_count = JERRY_MAX (arguments_number, - arguments_p->header.u.cls.u2.formal_params_number); + uint32_t saved_argument_count = JERRY_MAX (arguments_number, arguments_p->header.u.cls.u2.formal_params_number); return object_size + (saved_argument_count * sizeof (ecma_value_t)); } /* ecma_free_arguments_object */ @@ -1485,8 +1473,7 @@ ecma_gc_free_executable_object (ecma_object_t *object_p) /**< object */ do { ecma_free_value_if_not_object (*(--context_top_p)); - } - while (context_top_p > last_item_p); + } while (context_top_p > last_item_p); continue; } @@ -1506,8 +1493,7 @@ ecma_gc_free_executable_object (ecma_object_t *object_p) /**< object */ } context_top_p = vm_stack_context_abort (&executable_object_p->frame_ctx, context_top_p); - } - while (context_top_p > context_end_p); + } while (context_top_p > context_end_p); } register_end_p = executable_object_p->frame_ctx.stack_top_p; @@ -1526,8 +1512,7 @@ JERRY_STATIC_ASSERT (!ECMA_PROPERTY_IS_RAW (ECMA_PROPERTY_TYPE_DELETED), ecma_property_type_deleted_must_not_be_raw_property); JERRY_STATIC_ASSERT ((ECMA_PROPERTY_TYPE_DELETED & ECMA_PROPERTY_FLAG_LCACHED) == 0, ecma_property_type_deleted_must_not_have_lcached_flag); -JERRY_STATIC_ASSERT (ECMA_GC_FREE_SECOND_PROPERTY == 1, - ecma_gc_free_second_must_be_one); +JERRY_STATIC_ASSERT (ECMA_GC_FREE_SECOND_PROPERTY == 1, ecma_gc_free_second_must_be_one); /** * Free property of an object @@ -1575,8 +1560,8 @@ ecma_gc_free_property (ecma_object_t *object_p, /**< object */ #if JERRY_CPOINTER_32_BIT ecma_getter_setter_pointers_t *getter_setter_pair_p; - getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, - prop_pair_p->values[index].getter_setter_pair_cp); + getter_setter_pair_p = + ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_pair_p->values[index].getter_setter_pair_cp); jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t)); #endif /* JERRY_CPOINTER_32_BIT */ return; @@ -1655,8 +1640,7 @@ ecma_gc_free_properties (ecma_object_t *object_p, /**< object */ #if JERRY_PROPERTY_HASHMAP if (prop_iter_cp != JMEM_CP_NULL) { - ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - prop_iter_cp); + ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp); if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP) { ecma_property_hashmap_free (object_p); @@ -1791,8 +1775,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */ case ECMA_OBJECT_CLASS_SCRIPT: { ecma_compiled_code_t *compiled_code_p; - compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, - ext_object_p->u.cls.u3.value); + compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value); ecma_bytecode_deref (compiled_code_p); break; @@ -1813,8 +1796,8 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */ #if JERRY_BUILTIN_REGEXP case ECMA_OBJECT_CLASS_REGEXP: { - ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_ANY_POINTER (ecma_compiled_code_t, - ext_object_p->u.cls.u3.value); + ecma_compiled_code_t *bytecode_p = + ECMA_GET_INTERNAL_VALUE_ANY_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value); ecma_bytecode_deref (bytecode_p); @@ -1886,8 +1869,8 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */ case ECMA_OBJECT_CLASS_CONTAINER: { ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p; - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = + ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); ecma_op_container_free_entries (object_p); ecma_collection_destroy (container_p); break; @@ -1978,8 +1961,8 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */ if (ext_func_p->u.function.bytecode_cp != ECMA_NULL_POINTER) { #endif /* JERRY_SNAPSHOT_EXEC */ - ecma_compiled_code_t *byte_code_p = (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, - ext_func_p->u.function.bytecode_cp)); + ecma_compiled_code_t *byte_code_p = + (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_func_p->u.function.bytecode_cp)); #if JERRY_ESNEXT if (CBC_FUNCTION_IS_ARROW (byte_code_p->status_flags)) @@ -2227,8 +2210,7 @@ ecma_gc_run (void) obj_iter_cp = obj_next_cp; } - } - while (marked_anything_during_current_iteration); + } while (marked_anything_during_current_iteration); black_end_p->gc_next_cp = JMEM_CP_NULL; JERRY_CONTEXT (ecma_gc_objects_cp) = black_list_head.gc_next_cp; @@ -2320,8 +2302,7 @@ ecma_free_unused_memory (jmem_pressure_t pressure) /**< current pressure */ if (!ecma_is_lexical_environment (obj_iter_p) || ecma_get_lex_env_type (obj_iter_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) { - if (!ecma_is_lexical_environment (obj_iter_p) - && ecma_op_object_is_fast_array (obj_iter_p)) + if (!ecma_is_lexical_environment (obj_iter_p) && ecma_op_object_is_fast_array (obj_iter_p)) { obj_iter_cp = obj_iter_p->gc_next_cp; continue; @@ -2338,7 +2319,6 @@ ecma_free_unused_memory (jmem_pressure_t pressure) /**< current pressure */ ecma_property_hashmap_free (obj_iter_p); } } - } obj_iter_cp = obj_iter_p->gc_next_cp; diff --git a/jerry-core/ecma/base/ecma-gc.h b/jerry-core/ecma/base/ecma-gc.h index 8ae76b8a..94a6d2a9 100644 --- a/jerry-core/ecma/base/ecma-gc.h +++ b/jerry-core/ecma/base/ecma-gc.h @@ -17,6 +17,7 @@ #define ECMA_GC_H #include "ecma-globals.h" + #include "jmem.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/base/ecma-globals.h b/jerry-core/ecma/base/ecma-globals.h index b4678a32..b7a38de5 100644 --- a/jerry-core/ecma/base/ecma-globals.h +++ b/jerry-core/ecma/base/ecma-globals.h @@ -17,10 +17,11 @@ #define ECMA_GLOBALS_H #include "ecma-errors.h" + #include "config.h" +#include "jmem.h" #include "jrt.h" #include "lit-magic-strings.h" -#include "jmem.h" /** \addtogroup ecma ECMA * @{ @@ -37,7 +38,7 @@ */ #define ECMA_NULL_POINTER JMEM_CP_NULL -#if defined (JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY) +#if defined(JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY) /** * JMEM_ALIGNMENT_LOG aligned pointers can be stored directly in ecma_value_t @@ -55,16 +56,16 @@ */ typedef enum { - ECMA_STATUS_API_AVAILABLE = (1u << 0), /**< api available */ - ECMA_STATUS_DIRECT_EVAL = (1u << 1), /**< eval is called directly */ + ECMA_STATUS_API_AVAILABLE = (1u << 0), /**< api available */ + ECMA_STATUS_DIRECT_EVAL = (1u << 1), /**< eval is called directly */ #if JERRY_PROPERTY_HASHMAP - ECMA_STATUS_HIGH_PRESSURE_GC = (1u << 2), /**< last gc was under high pressure */ + ECMA_STATUS_HIGH_PRESSURE_GC = (1u << 2), /**< last gc was under high pressure */ #endif /* JERRY_PROPERTY_HASHMAP */ - ECMA_STATUS_EXCEPTION = (1u << 3), /**< last exception is a normal exception */ - ECMA_STATUS_ABORT = (1u << 4), /**< last exception is an abort */ - ECMA_STATUS_ERROR_UPDATE = (1u << 5), /**< the error_object_created_callback_p is called */ + ECMA_STATUS_EXCEPTION = (1u << 3), /**< last exception is a normal exception */ + ECMA_STATUS_ABORT = (1u << 4), /**< last exception is an abort */ + ECMA_STATUS_ERROR_UPDATE = (1u << 5), /**< the error_object_created_callback_p is called */ #if JERRY_VM_THROW - ECMA_STATUS_ERROR_THROWN = (1u << 6), /**< the vm_throw_callback_p is called */ + ECMA_STATUS_ERROR_THROWN = (1u << 6), /**< the vm_throw_callback_p is called */ #endif /* JERRY_VM_THROW */ } ecma_status_flag_t; @@ -190,8 +191,7 @@ typedef int32_t ecma_integer_value_t; /** * ECMA make simple value */ -#define ECMA_MAKE_VALUE(value) \ - ((((ecma_value_t) (value)) << ECMA_DIRECT_SHIFT) | ECMA_DIRECT_TYPE_SIMPLE_VALUE) +#define ECMA_MAKE_VALUE(value) ((((ecma_value_t) (value)) << ECMA_DIRECT_SHIFT) | ECMA_DIRECT_TYPE_SIMPLE_VALUE) /** * Simple ecma values @@ -237,7 +237,7 @@ enum /** * Maximum integer number for an ecma value */ -#define ECMA_INTEGER_NUMBER_MAX 0x7fffff +#define ECMA_INTEGER_NUMBER_MAX 0x7fffff /** * Maximum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT) */ @@ -257,7 +257,7 @@ enum /** * Minimum integer number for an ecma value */ -#define ECMA_INTEGER_NUMBER_MIN -0x7fffff +#define ECMA_INTEGER_NUMBER_MIN -0x7fffff /** * Minimum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT) */ @@ -275,13 +275,12 @@ enum #if ECMA_DIRECT_SHIFT != 4 #error "Please update ECMA_INTEGER_NUMBER_MIN/MAX_SHIFTED according to the new value of ECMA_DIRECT_SHIFT." -#endif +#endif /* ECMA_DIRECT_SHIFT != 4 */ /** * Checks whether the integer number is in the integer number range. */ -#define ECMA_IS_INTEGER_NUMBER(num) \ - (ECMA_INTEGER_NUMBER_MIN <= (num) && (num) <= ECMA_INTEGER_NUMBER_MAX) +#define ECMA_IS_INTEGER_NUMBER(num) (ECMA_INTEGER_NUMBER_MIN <= (num) && (num) <= ECMA_INTEGER_NUMBER_MAX) /** * Maximum integer number, which if squared, still fits in ecma_integer_value_t @@ -295,8 +294,7 @@ enum /** * Checks whether the error flag is set. */ -#define ECMA_IS_VALUE_ERROR(value) \ - (JERRY_UNLIKELY ((value) == ECMA_VALUE_ERROR)) +#define ECMA_IS_VALUE_ERROR(value) (JERRY_UNLIKELY ((value) == ECMA_VALUE_ERROR)) /** * Callback which tells whether the ECMAScript execution should be stopped. @@ -422,32 +420,27 @@ typedef enum /** * Property flags configurable, enumerable. */ -#define ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE \ - (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_ENUMERABLE) +#define ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_ENUMERABLE) /** * Property flags configurable, enumerable. */ -#define ECMA_PROPERTY_CONFIGURABLE_WRITABLE \ - (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_WRITABLE) +#define ECMA_PROPERTY_CONFIGURABLE_WRITABLE (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_WRITABLE) /** * Property flag built-in. */ -#define ECMA_PROPERTY_BUILT_IN_FIXED \ - (ECMA_PROPERTY_FLAG_BUILT_IN) +#define ECMA_PROPERTY_BUILT_IN_FIXED (ECMA_PROPERTY_FLAG_BUILT_IN) /** * Property flags enumerable, writable. */ -#define ECMA_PROPERTY_ENUMERABLE_WRITABLE \ - (ECMA_PROPERTY_FLAG_ENUMERABLE | ECMA_PROPERTY_FLAG_WRITABLE) +#define ECMA_PROPERTY_ENUMERABLE_WRITABLE (ECMA_PROPERTY_FLAG_ENUMERABLE | ECMA_PROPERTY_FLAG_WRITABLE) /** * Property flags built-in, configurable. */ -#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE \ - (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_FLAG_CONFIGURABLE) +#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_FLAG_CONFIGURABLE) /** * Property flags built-in, configurable, enumerable. @@ -458,14 +451,12 @@ typedef enum /** * Property flags built-in, configurable, writable. */ -#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE \ - (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /** * Property flags built-in, writable. */ -#define ECMA_PROPERTY_BUILT_IN_WRITABLE \ - (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_FLAG_WRITABLE) +#define ECMA_PROPERTY_BUILT_IN_WRITABLE (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_FLAG_WRITABLE) /** * Property flags built-in, configurable, enumerable, writable. @@ -495,8 +486,7 @@ typedef enum /** * Type of hash-map property. */ -#define ECMA_PROPERTY_TYPE_HASHMAP \ - (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT) +#define ECMA_PROPERTY_TYPE_HASHMAP (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT) /** * Type of deleted property. @@ -523,7 +513,7 @@ typedef enum /** * Checks whether a property is not found. */ -#define ECMA_PROPERTY_IS_FOUND(property) \ +#define ECMA_PROPERTY_IS_FOUND(property) \ (((property) & (ECMA_PROPERTY_FLAG_DATA | (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))) \ != (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT)) @@ -606,20 +596,17 @@ typedef struct /** * Get property name type. */ -#define ECMA_PROPERTY_GET_NAME_TYPE(property) \ - ((property) >> ECMA_PROPERTY_NAME_TYPE_SHIFT) +#define ECMA_PROPERTY_GET_NAME_TYPE(property) ((property) >> ECMA_PROPERTY_NAME_TYPE_SHIFT) /** * Returns true if the property pointer is a property pair. */ -#define ECMA_PROPERTY_IS_PROPERTY_PAIR(property_header_p) \ - ((property_header_p)->types[0] != ECMA_PROPERTY_TYPE_HASHMAP) +#define ECMA_PROPERTY_IS_PROPERTY_PAIR(property_header_p) ((property_header_p)->types[0] != ECMA_PROPERTY_TYPE_HASHMAP) /** * Property value of all internal properties */ -#define ECMA_PROPERTY_INTERNAL \ - (ECMA_PROPERTY_FLAG_DATA | (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT)) +#define ECMA_PROPERTY_INTERNAL (ECMA_PROPERTY_FLAG_DATA | (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT)) /** * Checks whether a property is internal property @@ -629,25 +616,23 @@ typedef struct /** * Checks whether a property is raw data or accessor property */ -#define ECMA_PROPERTY_IS_RAW(property) \ - ((property) < (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT)) +#define ECMA_PROPERTY_IS_RAW(property) ((property) < (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT)) /** * Checks whether a property is raw data property (should only be used in assertions) */ #define ECMA_PROPERTY_IS_RAW_DATA(property) \ - (((property) & ECMA_PROPERTY_FLAG_DATA) && (property) < ECMA_PROPERTY_INTERNAL) + (((property) &ECMA_PROPERTY_FLAG_DATA) && (property) < ECMA_PROPERTY_INTERNAL) /** * Create internal property. */ -#define ECMA_CREATE_INTERNAL_PROPERTY(object_p, name_p, property_p, property_value_p) \ - do \ - { \ +#define ECMA_CREATE_INTERNAL_PROPERTY(object_p, name_p, property_p, property_value_p) \ + do \ + { \ (property_value_p) = ecma_create_named_data_property ((object_p), (name_p), 0, &(property_p)); \ - JERRY_ASSERT (*(property_p) == ECMA_PROPERTY_INTERNAL); \ - } \ - while (0) + JERRY_ASSERT (*(property_p) == ECMA_PROPERTY_INTERNAL); \ + } while (0) /** * Property type of all virtual properties @@ -657,7 +642,7 @@ typedef struct /** * Checks whether a property is virtual property */ -#define ECMA_PROPERTY_IS_VIRTUAL(property) ECMA_PROPERTY_IS_INTERNAL(property) +#define ECMA_PROPERTY_IS_VIRTUAL(property) ECMA_PROPERTY_IS_INTERNAL (property) /** * Returns true if the property is named property. @@ -681,8 +666,7 @@ typedef struct * Compute the property data pointer of a property. * The property must be part of a property pair. */ -#define ECMA_PROPERTY_VALUE_PTR(property_p) \ - ((ecma_property_value_t *) ECMA_PROPERTY_VALUE_DATA_PTR (property_p)) +#define ECMA_PROPERTY_VALUE_PTR(property_p) ((ecma_property_value_t *) ECMA_PROPERTY_VALUE_DATA_PTR (property_p)) /** * Property reference. It contains the value pointer @@ -768,7 +752,7 @@ typedef enum ECMA_OBJECT_CLASS_MODULE_NAMESPACE, /**< Module Namespace (ECMAScript v11, 9.4.6) */ #endif /* JERRY_MODULE_SYSTEM */ - /* These objects are marked by Garbage Collector. */ +/* These objects are marked by Garbage Collector. */ #if JERRY_ESNEXT ECMA_OBJECT_CLASS_GENERATOR, /**< Generator object (ECMAScript v6, 25.2) */ ECMA_OBJECT_CLASS_ASYNC_GENERATOR, /**< Async generator object (ECMAScript v11, 25.3) */ @@ -781,7 +765,7 @@ typedef enum #endif /* JERRY_ESNEXT */ #if JERRY_MODULE_SYSTEM ECMA_OBJECT_CLASS_MODULE, /**< Module (ECMAScript v6, 15.2) */ -#endif +#endif /* JERRY_MODULE_SYSTEM */ #if JERRY_ESNEXT ECMA_OBJECT_CLASS_PROMISE, /**< Promise (ECMAScript v6, 25.4) */ ECMA_OBJECT_CLASS_PROMISE_CAPABILITY, /**< Promise capability (ECMAScript v6, 25.4.1.1) */ @@ -852,10 +836,10 @@ typedef enum */ typedef enum { - ECMA_ITERATOR_KEYS, /**< keys iterator */ - ECMA_ITERATOR_VALUES, /**< values iterator */ - ECMA_ITERATOR_ENTRIES, /**< entries iterator */ - ECMA_ITERATOR__COUNT, /**< number of iterator kinds */ + ECMA_ITERATOR_KEYS, /**< keys iterator */ + ECMA_ITERATOR_VALUES, /**< values iterator */ + ECMA_ITERATOR_ENTRIES, /**< entries iterator */ + ECMA_ITERATOR__COUNT, /**< number of iterator kinds */ } ecma_iterator_kind_t; #endif /* JERRY_ESNEXT */ @@ -868,9 +852,9 @@ typedef enum /** * Set JERRY_CONTEXT (status_flags) top 8 bits to the specified 'opts'. */ -#define ECMA_SET_LOCAL_PARSE_OPTS(opts) \ - do \ - { \ +#define ECMA_SET_LOCAL_PARSE_OPTS(opts) \ + do \ + { \ JERRY_CONTEXT (status_flags) |= ((uint32_t) opts << ECMA_LOCAL_PARSE_OPTS_OFFSET) | ECMA_STATUS_DIRECT_EVAL; \ } while (0) @@ -883,9 +867,9 @@ typedef enum /** * Clear JERRY_CONTEXT (status_flags) top 8 bits. */ -#define ECMA_CLEAR_LOCAL_PARSE_OPTS() \ - do \ - { \ +#define ECMA_CLEAR_LOCAL_PARSE_OPTS() \ + do \ + { \ JERRY_CONTEXT (status_flags) &= ((1 << ECMA_LOCAL_PARSE_OPTS_OFFSET) - 1); \ } while (0) @@ -971,8 +955,8 @@ typedef struct { jmem_cpointer_t property_list_cp; /**< compressed pointer to object's * or declerative lexical environments's property list */ - jmem_cpointer_t bound_object_cp; /**< compressed pointer to lexical environments's the bound object */ - jmem_cpointer_t home_object_cp; /**< compressed pointer to lexical environments's the home object */ + jmem_cpointer_t bound_object_cp; /**< compressed pointer to lexical environments's the bound object */ + jmem_cpointer_t home_object_cp; /**< compressed pointer to lexical environments's the home object */ } u1; /** object prototype or outer reference */ @@ -1038,11 +1022,11 @@ typedef ecma_value_t (*ecma_builtin_handler_t) (ecma_object_t *function_obj_p, */ typedef enum { - ECMA_BUILTIN_ROUTINE_NO_OPTS = 0, /**< No options are provided */ - ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED = (1u << 0), /**< 'length' property has been initialized */ - ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED = (1u << 1), /**< 'name' property has been initialized */ - ECMA_BUILTIN_ROUTINE_GETTER = (1u << 2), /**< this routine is getter */ - ECMA_BUILTIN_ROUTINE_SETTER = (1u << 3), /**< this routine is setter */ + ECMA_BUILTIN_ROUTINE_NO_OPTS = 0, /**< No options are provided */ + ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED = (1u << 0), /**< 'length' property has been initialized */ + ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED = (1u << 1), /**< 'name' property has been initialized */ + ECMA_BUILTIN_ROUTINE_GETTER = (1u << 2), /**< this routine is getter */ + ECMA_BUILTIN_ROUTINE_SETTER = (1u << 3), /**< this routine is setter */ } ecma_builtin_routine_flags_t; /** @@ -1239,13 +1223,13 @@ typedef struct */ typedef struct { - uint16_t size; /**< real size >> JMEM_ALIGNMENT_LOG */ - uint16_t refs; /**< reference counter for the byte code */ - uint16_t status_flags; /**< various status flags: - * CBC_IS_FUNCTION check tells whether the byte code - * is function or regular expression. - * If function, the other flags must be CBC_CODE_FLAGS... - * If regexp, the other flags must be RE_FLAG... */ + uint16_t size; /**< real size >> JMEM_ALIGNMENT_LOG */ + uint16_t refs; /**< reference counter for the byte code */ + uint16_t status_flags; /**< various status flags: + * CBC_IS_FUNCTION check tells whether the byte code + * is function or regular expression. + * If function, the other flags must be CBC_CODE_FLAGS... + * If regexp, the other flags must be RE_FLAG... */ } ecma_compiled_code_t; /** @@ -1331,26 +1315,22 @@ typedef struct /** * Size of the internal buffer. */ -#define ECMA_CONTAINER_GET_SIZE(container_p) \ - (container_p->buffer_p[0]) +#define ECMA_CONTAINER_GET_SIZE(container_p) (container_p->buffer_p[0]) /** * Remove the size field of the internal buffer. */ -#define ECMA_CONTAINER_SET_SIZE(container_p, size) \ - (container_p->buffer_p[0] = (ecma_value_t) (size)) +#define ECMA_CONTAINER_SET_SIZE(container_p, size) (container_p->buffer_p[0] = (ecma_value_t) (size)) /** * Number of entries of the internal buffer. */ -#define ECMA_CONTAINER_ENTRY_COUNT(collection_p) \ - (collection_p->item_count - 1) +#define ECMA_CONTAINER_ENTRY_COUNT(collection_p) (collection_p->item_count - 1) /** * Pointer to the first entry of the internal buffer. */ -#define ECMA_CONTAINER_START(collection_p) \ - (collection_p->buffer_p + 1) +#define ECMA_CONTAINER_START(collection_p) (collection_p->buffer_p + 1) #endif /* JERRY_BUILTIN_CONTAINER */ @@ -1380,17 +1360,15 @@ typedef struct * - is_value_defined : true * - is_configurable_defined, is_writable_defined, is_enumerable_defined : true */ -#define ECMA_NAME_DATA_PROPERTY_DESCRIPTOR_BITS ((uint16_t) (JERRY_PROP_IS_VALUE_DEFINED \ - | JERRY_PROP_IS_CONFIGURABLE_DEFINED \ - | JERRY_PROP_IS_ENUMERABLE_DEFINED \ - | JERRY_PROP_IS_WRITABLE_DEFINED)) +#define ECMA_NAME_DATA_PROPERTY_DESCRIPTOR_BITS \ + ((uint16_t) (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE_DEFINED \ + | JERRY_PROP_IS_WRITABLE_DEFINED)) /** * Bitmask to get a the physical property flags from an ecma_property_descriptor */ -#define ECMA_PROPERTY_FLAGS_MASK ((uint16_t) (JERRY_PROP_IS_CONFIGURABLE \ - | JERRY_PROP_IS_ENUMERABLE \ - | JERRY_PROP_IS_WRITABLE)) +#define ECMA_PROPERTY_FLAGS_MASK \ + ((uint16_t) (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_WRITABLE)) #if !JERRY_NUMBER_TYPE_FLOAT64 /** @@ -1412,7 +1390,7 @@ typedef union /** * Maximum number of significant digits that ecma-number can store */ -#define ECMA_NUMBER_MAX_DIGITS (9) +#define ECMA_NUMBER_MAX_DIGITS (9) /** * Width of sign field @@ -1420,7 +1398,7 @@ typedef union * See also: * IEEE-754 2008, 3.6, Table 3.5 */ -#define ECMA_NUMBER_SIGN_WIDTH (1) +#define ECMA_NUMBER_SIGN_WIDTH (1) /** * Width of biased exponent field @@ -1436,7 +1414,7 @@ typedef union * See also: * IEEE-754 2008, 3.6, Table 3.5 */ -#define ECMA_NUMBER_FRACTION_WIDTH (23) +#define ECMA_NUMBER_FRACTION_WIDTH (23) #elif JERRY_NUMBER_TYPE_FLOAT64 /** * Description of an ecma-number @@ -1457,7 +1435,7 @@ typedef union /** * Maximum number of significant digits that ecma-number can store */ -#define ECMA_NUMBER_MAX_DIGITS (19) +#define ECMA_NUMBER_MAX_DIGITS (19) /** * Width of sign field @@ -1465,7 +1443,7 @@ typedef union * See also: * IEEE-754 2008, 3.6, Table 3.5 */ -#define ECMA_NUMBER_SIGN_WIDTH (1) +#define ECMA_NUMBER_SIGN_WIDTH (1) /** * Width of biased exponent field @@ -1473,7 +1451,7 @@ typedef union * See also: * IEEE-754 2008, 3.6, Table 3.5 */ -#define ECMA_NUMBER_BIASED_EXP_WIDTH (11) +#define ECMA_NUMBER_BIASED_EXP_WIDTH (11) /** * Width of fraction field @@ -1481,7 +1459,7 @@ typedef union * See also: * IEEE-754 2008, 3.6, Table 3.5 */ -#define ECMA_NUMBER_FRACTION_WIDTH (52) +#define ECMA_NUMBER_FRACTION_WIDTH (52) #endif /* !JERRY_NUMBER_TYPE_FLOAT64 */ /** @@ -1492,12 +1470,12 @@ typedef union /** * Value '1' of ecma_number_t */ -#define ECMA_NUMBER_ONE ((ecma_number_t) 1) +#define ECMA_NUMBER_ONE ((ecma_number_t) 1) /** * Value '2' of ecma_number_t */ -#define ECMA_NUMBER_TWO ((ecma_number_t) 2) +#define ECMA_NUMBER_TWO ((ecma_number_t) 2) /** * Value '0.5' of ecma_number_t @@ -1515,74 +1493,74 @@ typedef union * * See also: ECMA_262 v5, 15.7.3.3 */ -# define ECMA_NUMBER_MIN_VALUE (FLT_MIN) +#define ECMA_NUMBER_MIN_VALUE (FLT_MIN) /** * Number.MAX_VALUE (i.e., the maximum value of ecma-number) * * See also: ECMA_262 v5, 15.7.3.2 */ -# define ECMA_NUMBER_MAX_VALUE (FLT_MAX) +#define ECMA_NUMBER_MAX_VALUE (FLT_MAX) /** * Number.EPSILON * * See also: ECMA_262 v6, 20.1.2.1 */ -# define ECMA_NUMBER_EPSILON ((ecma_number_t) 1.1920928955078125e-7) +#define ECMA_NUMBER_EPSILON ((ecma_number_t) 1.1920928955078125e-7) /** * Number.MAX_SAFE_INTEGER * * See also: ECMA_262 v6, 20.1.2.6 */ -# define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0xFFFFFF) +#define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0xFFFFFF) /** * Number.MIN_SAFE_INTEGER * * See also: ECMA_262 v6, 20.1.2.8 */ -# define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0xFFFFFF) +#define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0xFFFFFF) #elif JERRY_NUMBER_TYPE_FLOAT64 /** * Number.MAX_VALUE (i.e., the maximum value of ecma-number) * * See also: ECMA_262 v5, 15.7.3.2 */ -# define ECMA_NUMBER_MAX_VALUE ((ecma_number_t) 1.7976931348623157e+308) +#define ECMA_NUMBER_MAX_VALUE ((ecma_number_t) 1.7976931348623157e+308) /** * Number.MIN_VALUE (i.e., the smallest positive value of ecma-number) * * See also: ECMA_262 v5, 15.7.3.3 */ -# define ECMA_NUMBER_MIN_VALUE ((ecma_number_t) 5e-324) +#define ECMA_NUMBER_MIN_VALUE ((ecma_number_t) 5e-324) /** * Number.EPSILON * * See also: ECMA_262 v6, 20.1.2.1 */ -# define ECMA_NUMBER_EPSILON ((ecma_number_t) 2.2204460492503130808472633361816e-16) +#define ECMA_NUMBER_EPSILON ((ecma_number_t) 2.2204460492503130808472633361816e-16) /** * Number.MAX_SAFE_INTEGER * * See also: ECMA_262 v6, 20.1.2.6 */ -# define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0x1FFFFFFFFFFFFF) +#define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0x1FFFFFFFFFFFFF) /** * Number.MIN_SAFE_INTEGER * * See also: ECMA_262 v6, 20.1.2.8 */ -# define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0x1FFFFFFFFFFFFF) +#define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0x1FFFFFFFFFFFFF) #endif /* !JERRY_NUMBER_TYPE_FLOAT64 */ /** * Euler number */ -#define ECMA_NUMBER_E ((ecma_number_t) 2.7182818284590452354) +#define ECMA_NUMBER_E ((ecma_number_t) 2.7182818284590452354) /** * Natural logarithm of 10 @@ -1607,17 +1585,17 @@ typedef union /** * Pi number */ -#define ECMA_NUMBER_PI ((ecma_number_t) 3.1415926535897932) +#define ECMA_NUMBER_PI ((ecma_number_t) 3.1415926535897932) /** * Square root of 0.5 */ -#define ECMA_NUMBER_SQRT_1_2 ((ecma_number_t) 0.7071067811865476) +#define ECMA_NUMBER_SQRT_1_2 ((ecma_number_t) 0.7071067811865476) /** * Square root of 2 */ -#define ECMA_NUMBER_SQRT2 ((ecma_number_t) 1.4142135623730951) +#define ECMA_NUMBER_SQRT2 ((ecma_number_t) 1.4142135623730951) /** * Maximum number of characters in string representation of ecma-number @@ -1657,8 +1635,7 @@ typedef struct /** * Compute the total allocated size of the collection based on it's capacity */ -#define ECMA_COLLECTION_ALLOCATED_SIZE(capacity) \ - (uint32_t) (capacity * sizeof (ecma_value_t)) +#define ECMA_COLLECTION_ALLOCATED_SIZE(capacity) (uint32_t) (capacity * sizeof (ecma_value_t)) /** * Initial allocated size of an ecma-collection @@ -1724,8 +1701,7 @@ typedef enum /** * Checks whether the string is direct. */ -#define ECMA_IS_DIRECT_STRING(string_p) \ - ((((uintptr_t) (string_p)) & 0x1) != 0) +#define ECMA_IS_DIRECT_STRING(string_p) ((((uintptr_t) (string_p)) & 0x1) != 0) /** * Checks whether the string is direct. @@ -1736,8 +1712,7 @@ typedef enum /** * Returns the type of a direct string. */ -#define ECMA_GET_DIRECT_STRING_TYPE(string_p) \ - ((((uintptr_t) (string_p)) >> ECMA_VALUE_SHIFT) & 0x3) +#define ECMA_GET_DIRECT_STRING_TYPE(string_p) ((((uintptr_t) (string_p)) >> ECMA_VALUE_SHIFT) & 0x3) /** * Shift applied to type conversions. @@ -1753,8 +1728,7 @@ typedef enum /** * Returns the value of a direct string. */ -#define ECMA_GET_DIRECT_STRING_VALUE(string_p) \ - (((uintptr_t) (string_p)) >> ECMA_DIRECT_STRING_SHIFT) +#define ECMA_GET_DIRECT_STRING_VALUE(string_p) (((uintptr_t) (string_p)) >> ECMA_DIRECT_STRING_SHIFT) /** * Maximum number of bytes that a long-utf8-string is able to store @@ -1799,14 +1773,12 @@ typedef enum /** * Set an ecma-string as static string */ -#define ECMA_SET_STRING_AS_STATIC(string_p) \ - (string_p)->refs_and_container |= ECMA_STATIC_STRING_FLAG +#define ECMA_SET_STRING_AS_STATIC(string_p) (string_p)->refs_and_container |= ECMA_STATIC_STRING_FLAG /** * Checks whether the ecma-string is static string */ -#define ECMA_STRING_IS_STATIC(string_p) \ - ((string_p)->refs_and_container & ECMA_STATIC_STRING_FLAG) +#define ECMA_STRING_IS_STATIC(string_p) ((string_p)->refs_and_container & ECMA_STATIC_STRING_FLAG) /** * Returns with the container type of a string. @@ -1817,8 +1789,7 @@ typedef enum /** * Checks whether the reference counter is 1 of a string. */ -#define ECMA_STRING_IS_REF_EQUALS_TO_ONE(string_desc_p) \ - (((string_desc_p)->refs_and_container >> 4) == 1) +#define ECMA_STRING_IS_REF_EQUALS_TO_ONE(string_desc_p) (((string_desc_p)->refs_and_container >> 4) == 1) /** * Checks whether the reference counter is 1 of an extended primitive. @@ -1878,38 +1849,34 @@ typedef struct /** * Header size of an ecma ASCII string */ -#define ECMA_ASCII_STRING_HEADER_SIZE \ - ((lit_utf8_size_t) (sizeof (ecma_string_t) + sizeof (uint8_t))) +#define ECMA_ASCII_STRING_HEADER_SIZE ((lit_utf8_size_t) (sizeof (ecma_string_t) + sizeof (uint8_t))) /** * Get the size of an ecma ASCII string */ #define ECMA_ASCII_STRING_GET_SIZE(string_p) \ - ((lit_utf8_size_t) *((lit_utf8_byte_t *) (string_p) + sizeof (ecma_string_t)) + 1) + ((lit_utf8_size_t) * ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_string_t)) + 1) /** * Set the size of an ecma ASCII string */ #define ECMA_ASCII_STRING_SET_SIZE(string_p, size) \ - (*((lit_utf8_byte_t *) (string_p) + sizeof (ecma_string_t)) = (uint8_t) ((size) - 1)) + (*((lit_utf8_byte_t *) (string_p) + sizeof (ecma_string_t)) = (uint8_t) ((size) -1)) /** * Get the start position of the string buffer of an ecma ASCII string */ -#define ECMA_ASCII_STRING_GET_BUFFER(string_p) \ - ((lit_utf8_byte_t *) (string_p) + ECMA_ASCII_STRING_HEADER_SIZE) +#define ECMA_ASCII_STRING_GET_BUFFER(string_p) ((lit_utf8_byte_t *) (string_p) + ECMA_ASCII_STRING_HEADER_SIZE) /** * Get the start position of the string buffer of an ecma UTF8 string */ -#define ECMA_SHORT_STRING_GET_BUFFER(string_p) \ - ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_short_string_t)) +#define ECMA_SHORT_STRING_GET_BUFFER(string_p) ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_short_string_t)) /** * Get the start position of the string buffer of an ecma long CESU8 string */ -#define ECMA_LONG_STRING_BUFFER_START(string_p) \ - ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_long_string_t)) +#define ECMA_LONG_STRING_BUFFER_START(string_p) ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_long_string_t)) /** * ECMA extended string-value descriptor @@ -2074,18 +2041,18 @@ typedef ecma_value_t (*ecma_typedarray_setter_fn_t) (lit_utf8_byte_t *src, ecma_ */ typedef enum { - ECMA_INT8_ARRAY, /**< Int8Array */ - ECMA_UINT8_ARRAY, /**< Uint8Array */ + ECMA_INT8_ARRAY, /**< Int8Array */ + ECMA_UINT8_ARRAY, /**< Uint8Array */ ECMA_UINT8_CLAMPED_ARRAY, /**< Uint8ClampedArray */ - ECMA_INT16_ARRAY, /**< Int16Array */ - ECMA_UINT16_ARRAY, /**< Uint16Array */ - ECMA_INT32_ARRAY, /**< Int32Array */ - ECMA_UINT32_ARRAY, /**< Uint32Array */ - ECMA_FLOAT32_ARRAY, /**< Float32Array */ - ECMA_FLOAT64_ARRAY, /**< Float64Array */ + ECMA_INT16_ARRAY, /**< Int16Array */ + ECMA_UINT16_ARRAY, /**< Uint16Array */ + ECMA_INT32_ARRAY, /**< Int32Array */ + ECMA_UINT32_ARRAY, /**< Uint32Array */ + ECMA_FLOAT32_ARRAY, /**< Float32Array */ + ECMA_FLOAT64_ARRAY, /**< Float64Array */ /* ECMA_TYPEDARRAY_IS_BIGINT_TYPE macro should be updated when new types are added */ - ECMA_BIGINT64_ARRAY, /**< BigInt64Array */ - ECMA_BIGUINT64_ARRAY, /**< BigUInt64Array */ + ECMA_BIGINT64_ARRAY, /**< BigInt64Array */ + ECMA_BIGUINT64_ARRAY, /**< BigUInt64Array */ } ecma_typedarray_type_t; /** @@ -2145,8 +2112,7 @@ typedef struct /** * Checks whether a given typedarray is BigInt type or not. **/ -#define ECMA_TYPEDARRAY_IS_BIGINT_TYPE(id) \ - ((id) >= ECMA_BIGINT64_ARRAY) +#define ECMA_TYPEDARRAY_IS_BIGINT_TYPE(id) ((id) >= ECMA_BIGINT64_ARRAY) #endif /* JERRY_BUILTIN_BIGINT */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ @@ -2187,7 +2153,7 @@ typedef enum /** * Checks whether the executable object is waiting for resuming. */ -#define ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED(executable_object_p) \ +#define ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED(executable_object_p) \ (!((executable_object_p)->extended_object.u.cls.u2.executable_obj_flags \ & (ECMA_EXECUTABLE_OBJECT_COMPLETED | ECMA_EXECUTABLE_OBJECT_RUNNING))) @@ -2306,21 +2272,21 @@ typedef struct * Check the current stack usage. If the limit is reached a RangeError is raised. * The macro argument specifies the return value which is usally ECMA_VALUE_ERROR or NULL. */ -#define ECMA_CHECK_STACK_USAGE_RETURN(RETURN_VALUE) \ -do \ -{ \ - if (ecma_get_current_stack_usage () > CONFIG_MEM_STACK_LIMIT) \ - { \ - ecma_raise_range_error (ECMA_ERR_MSG ("Maximum call stack size exceeded")); \ - return RETURN_VALUE; \ - } \ -} while (0) +#define ECMA_CHECK_STACK_USAGE_RETURN(RETURN_VALUE) \ + do \ + { \ + if (ecma_get_current_stack_usage () > CONFIG_MEM_STACK_LIMIT) \ + { \ + ecma_raise_range_error (ECMA_ERR_MSG ("Maximum call stack size exceeded")); \ + return RETURN_VALUE; \ + } \ + } while (0) /** * Specialized version of ECMA_CHECK_STACK_USAGE_RETURN which returns ECMA_VALUE_ERROR. * This version should be used in most cases. */ -#define ECMA_CHECK_STACK_USAGE() ECMA_CHECK_STACK_USAGE_RETURN(ECMA_VALUE_ERROR) +#define ECMA_CHECK_STACK_USAGE() ECMA_CHECK_STACK_USAGE_RETURN (ECMA_VALUE_ERROR) #else /* JERRY_STACK_LIMIT == 0) */ /** * If the stack limit is unlimited, this check is an empty macro. @@ -2446,11 +2412,11 @@ typedef struct */ typedef enum { - ECMA_ARGUMENTS_OBJECT_NO_FLAGS = 0, /* unmapped arguments object */ - ECMA_ARGUMENTS_OBJECT_MAPPED = (1 << 0), /* mapped arguments object */ - ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE = (1 << 1), /* static mapped arguments object */ - ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED = (1 << 2), /* 'callee' property has been lazy initialized */ - ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED = (1 << 3), /* 'length' property has been lazy initialized */ + ECMA_ARGUMENTS_OBJECT_NO_FLAGS = 0, /* unmapped arguments object */ + ECMA_ARGUMENTS_OBJECT_MAPPED = (1 << 0), /* mapped arguments object */ + ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE = (1 << 1), /* static mapped arguments object */ + ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED = (1 << 2), /* 'callee' property has been lazy initialized */ + ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED = (1 << 3), /* 'length' property has been lazy initialized */ ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED = (1 << 4), /* 'Symbol.iterator' property has been lazy initialized */ } ecma_arguments_object_flags_t; @@ -2522,4 +2488,4 @@ typedef struct * @} */ -#endif /* !ECMA_GLOBALS_H */ +#endif /* !ECMA_GLOBALS_H */ diff --git a/jerry-core/ecma/base/ecma-helpers-collection.c b/jerry-core/ecma/base/ecma-helpers-collection.c index e3b17fd6..d140ab93 100644 --- a/jerry-core/ecma/base/ecma-helpers-collection.c +++ b/jerry-core/ecma/base/ecma-helpers-collection.c @@ -18,6 +18,7 @@ #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" + #include "jrt.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/base/ecma-helpers-conversion.c b/jerry-core/ecma/base/ecma-helpers-conversion.c index d42f49af..8a7a9d10 100644 --- a/jerry-core/ecma/base/ecma-helpers-conversion.c +++ b/jerry-core/ecma/base/ecma-helpers-conversion.c @@ -17,6 +17,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" + #include "jrt-libc-includes.h" #include "lit-char-helpers.h" #include "lit-magic-strings.h" @@ -55,8 +56,7 @@ ecma_round_high_to_uint64 (ecma_uint128_t *num_p) uint64_t masked_lo = num_p->lo & ~(1ULL << 63u); uint64_t masked_hi = num_p->hi & 0x1; - if ((num_p->lo >> 63u != 0) - && (masked_lo > 0 || masked_hi != 0)) + if ((num_p->lo >> 63u != 0) && (masked_lo > 0 || masked_hi != 0)) { return (num_p->hi + 1); } @@ -66,53 +66,52 @@ ecma_round_high_to_uint64 (ecma_uint128_t *num_p) /** * Check if 128-bit integer is zero */ -#define ECMA_UINT128_IS_ZERO(name) \ - (name.hi == 0 && name.lo == 0) +#define ECMA_UINT128_IS_ZERO(name) (name.hi == 0 && name.lo == 0) /** * Left shift 128-bit integer by max 63 bits */ -#define ECMA_UINT128_LEFT_SHIFT_MAX63(name, shift) \ -{ \ - name.hi = (name.hi << (shift)) | (name.lo >> (64 - (shift))); \ - name.lo <<= (shift); \ -} +#define ECMA_UINT128_LEFT_SHIFT_MAX63(name, shift) \ + { \ + name.hi = (name.hi << (shift)) | (name.lo >> (64 - (shift))); \ + name.lo <<= (shift); \ + } /** * Right shift 128-bit integer by max 63 bits */ -#define ECMA_UINT128_RIGHT_SHIFT_MAX63(name, shift) \ -{ \ - name.lo = (name.lo >> (shift)) | (name.hi << (64 - (shift))); \ - name.hi >>= (shift); \ -} +#define ECMA_UINT128_RIGHT_SHIFT_MAX63(name, shift) \ + { \ + name.lo = (name.lo >> (shift)) | (name.hi << (64 - (shift))); \ + name.hi >>= (shift); \ + } /** * Add 128-bit integer */ #define ECMA_UINT128_ADD(name_add_to, name_to_add) \ -{ \ - name_add_to.hi += name_to_add.hi; \ - name_add_to.lo += name_to_add.lo; \ - if (name_add_to.lo < name_to_add.lo) \ - { \ - name_add_to.hi++; \ - } \ -} + { \ + name_add_to.hi += name_to_add.hi; \ + name_add_to.lo += name_to_add.lo; \ + if (name_add_to.lo < name_to_add.lo) \ + { \ + name_add_to.hi++; \ + } \ + } /** * Multiply 128-bit integer by 10 */ -#define ECMA_UINT128_MUL10(name) \ -{ \ - ECMA_UINT128_LEFT_SHIFT_MAX63 (name, 1u); \ - \ - ecma_uint128_t name ## _tmp = name; \ - \ - ECMA_UINT128_LEFT_SHIFT_MAX63 (name ## _tmp, 2u); \ - \ - ECMA_UINT128_ADD (name, name ## _tmp); \ -} +#define ECMA_UINT128_MUL10(name) \ + { \ + ECMA_UINT128_LEFT_SHIFT_MAX63 (name, 1u); \ + \ + ecma_uint128_t name##_tmp = name; \ + \ + ECMA_UINT128_LEFT_SHIFT_MAX63 (name##_tmp, 2u); \ + \ + ECMA_UINT128_ADD (name, name##_tmp); \ + } /** * Divide 128-bit integer by 10 @@ -129,84 +128,82 @@ ecma_round_high_to_uint64 (ecma_uint128_t *num_p) * * Q = Q3 *2^96 + Q2 *2^64 + Q1 *2^32 + Q0 *2^0 // 128-bit quotient */ -#define ECMA_UINT128_DIV10(name) \ -{ \ - /* estimation of reciprocal of 10, 128 bits right of the binary point (T1 == T2) */ \ - const uint64_t tenth_l = 0x9999999aul; \ - const uint64_t tenth_m = 0x99999999ul; \ - const uint64_t tenth_h = 0x19999999ul; \ - \ - uint64_t l0 = ((uint32_t) name.lo) * tenth_l; \ - uint64_t l1 = (name.lo >> 32u) * tenth_l; \ - uint64_t l2 = ((uint32_t) name.hi) * tenth_l; \ - uint64_t l3 = (name.hi >> 32u) * tenth_l; \ - uint64_t m0 = ((uint32_t) name.lo) * tenth_m; \ - uint64_t m1 = (name.lo >> 32u) * tenth_m; \ - uint64_t m2 = ((uint32_t) name.hi) * tenth_m; \ - uint64_t m3 = (name.hi >> 32u) * tenth_m; \ - uint64_t h0 = ((uint32_t) name.lo) * tenth_h; \ - uint64_t h1 = (name.lo >> 32u) * tenth_h; \ - uint64_t h2 = ((uint32_t) name.hi) * tenth_h; \ - uint64_t h3 = (name.hi >> 32u) * tenth_h; \ - \ - uint64_t q0 = l0 >> 32u; \ - q0 += (uint32_t) l1; \ - q0 += (uint32_t) m0; \ - \ - q0 >>= 32u; \ - q0 += l1 >> 32u; \ - q0 += m0 >> 32u; \ - q0 += (uint32_t) l2; \ - q0 += (uint32_t) m1; \ - q0 += (uint32_t) m0; \ - \ - q0 >>= 32u; \ - q0 += l2 >> 32u; \ - q0 += m1 >> 32u; \ - q0 += m0 >> 32u; \ - q0 += (uint32_t) l3; \ - q0 += (uint32_t) m2; \ - q0 += (uint32_t) m1; \ - q0 += (uint32_t) h0; \ - \ - q0 >>=32u; \ - q0 += l3 >> 32u; \ - q0 += m2 >> 32u; \ - q0 += m1 >> 32u; \ - q0 += h0 >> 32u; \ - q0 += (uint32_t) m3; \ - q0 += (uint32_t) m2; \ - q0 += (uint32_t) h1; \ - \ - uint64_t q1 = q0 >> 32u; \ - q1 += m3 >> 32u; \ - q1 += m2 >> 32u; \ - q1 += h1 >> 32u; \ - q1 += (uint32_t) m3; \ - q1 += (uint32_t) h2; \ - \ - uint64_t q32 = q1 >> 32u; \ - q32 += m3 >> 32u; \ - q32 += h2 >> 32u; \ - q32 += h3; \ - \ - name.lo = (q1 << 32u) | ((uint32_t) q0); \ - name.hi = q32; \ -} - -#if defined (__GNUC__) || defined (__clang__) +#define ECMA_UINT128_DIV10(name) \ + { \ + /* estimation of reciprocal of 10, 128 bits right of the binary point (T1 == T2) */ \ + const uint64_t tenth_l = 0x9999999aul; \ + const uint64_t tenth_m = 0x99999999ul; \ + const uint64_t tenth_h = 0x19999999ul; \ + \ + uint64_t l0 = ((uint32_t) name.lo) * tenth_l; \ + uint64_t l1 = (name.lo >> 32u) * tenth_l; \ + uint64_t l2 = ((uint32_t) name.hi) * tenth_l; \ + uint64_t l3 = (name.hi >> 32u) * tenth_l; \ + uint64_t m0 = ((uint32_t) name.lo) * tenth_m; \ + uint64_t m1 = (name.lo >> 32u) * tenth_m; \ + uint64_t m2 = ((uint32_t) name.hi) * tenth_m; \ + uint64_t m3 = (name.hi >> 32u) * tenth_m; \ + uint64_t h0 = ((uint32_t) name.lo) * tenth_h; \ + uint64_t h1 = (name.lo >> 32u) * tenth_h; \ + uint64_t h2 = ((uint32_t) name.hi) * tenth_h; \ + uint64_t h3 = (name.hi >> 32u) * tenth_h; \ + \ + uint64_t q0 = l0 >> 32u; \ + q0 += (uint32_t) l1; \ + q0 += (uint32_t) m0; \ + \ + q0 >>= 32u; \ + q0 += l1 >> 32u; \ + q0 += m0 >> 32u; \ + q0 += (uint32_t) l2; \ + q0 += (uint32_t) m1; \ + q0 += (uint32_t) m0; \ + \ + q0 >>= 32u; \ + q0 += l2 >> 32u; \ + q0 += m1 >> 32u; \ + q0 += m0 >> 32u; \ + q0 += (uint32_t) l3; \ + q0 += (uint32_t) m2; \ + q0 += (uint32_t) m1; \ + q0 += (uint32_t) h0; \ + \ + q0 >>= 32u; \ + q0 += l3 >> 32u; \ + q0 += m2 >> 32u; \ + q0 += m1 >> 32u; \ + q0 += h0 >> 32u; \ + q0 += (uint32_t) m3; \ + q0 += (uint32_t) m2; \ + q0 += (uint32_t) h1; \ + \ + uint64_t q1 = q0 >> 32u; \ + q1 += m3 >> 32u; \ + q1 += m2 >> 32u; \ + q1 += h1 >> 32u; \ + q1 += (uint32_t) m3; \ + q1 += (uint32_t) h2; \ + \ + uint64_t q32 = q1 >> 32u; \ + q32 += m3 >> 32u; \ + q32 += h2 >> 32u; \ + q32 += h3; \ + \ + name.lo = (q1 << 32u) | ((uint32_t) q0); \ + name.hi = q32; \ + } + +#if defined(__GNUC__) || defined(__clang__) /** * Count leading zeros in the topmost 64 bits of a 128-bit integer. */ -#define ECMA_UINT128_CLZ_MAX63(name) \ - __builtin_clzll (name.hi) +#define ECMA_UINT128_CLZ_MAX63(name) __builtin_clzll (name.hi) /** * Count leading zeros in the topmost 4 bits of a 128-bit integer. */ -#define ECMA_UINT128_CLZ_MAX4(name) \ - __builtin_clzll (name.hi) +#define ECMA_UINT128_CLZ_MAX4(name) __builtin_clzll (name.hi) #else /* !__GNUC__ && !__clang__ */ @@ -238,14 +235,12 @@ static const uint8_t ecma_uint4_clz[] = { 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, /** * Count leading zeros in the topmost 64 bits of a 128-bit integer. */ -#define ECMA_UINT128_CLZ_MAX63(name) \ - ecma_uint64_clz (name.hi) +#define ECMA_UINT128_CLZ_MAX63(name) ecma_uint64_clz (name.hi) /** * Count leading zeros in the topmost 4 bits of a 128-bit integer. */ -#define ECMA_UINT128_CLZ_MAX4(name) \ - ecma_uint4_clz[name.hi >> 60] +#define ECMA_UINT128_CLZ_MAX4(name) ecma_uint4_clz[name.hi >> 60] #endif /* __GNUC__ || __clang__ */ @@ -308,7 +303,7 @@ ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 st { lit_code_point_t upper_limit = LIT_CHAR_0 + radix; - for (const lit_utf8_byte_t * iter_p = str_p; iter_p <= end_p; iter_p++) + for (const lit_utf8_byte_t *iter_p = str_p; iter_p <= end_p; iter_p++) { int32_t digit_value; @@ -328,22 +323,19 @@ ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 st } #endif /* JERRY_ESNEXT */ - for (const lit_utf8_byte_t * iter_p = str_p; iter_p <= end_p; iter_p++) + for (const lit_utf8_byte_t *iter_p = str_p; iter_p <= end_p; iter_p++) { int32_t digit_value; - if (*iter_p >= LIT_CHAR_0 - && *iter_p <= LIT_CHAR_9) + if (*iter_p >= LIT_CHAR_0 && *iter_p <= LIT_CHAR_9) { digit_value = (*iter_p - LIT_CHAR_0); } - else if (*iter_p >= LIT_CHAR_LOWERCASE_A - && *iter_p <= LIT_CHAR_LOWERCASE_F) + else if (*iter_p >= LIT_CHAR_LOWERCASE_A && *iter_p <= LIT_CHAR_LOWERCASE_F) { digit_value = 10 + (*iter_p - LIT_CHAR_LOWERCASE_A); } - else if (*iter_p >= LIT_CHAR_UPPERCASE_A - && *iter_p <= LIT_CHAR_UPPERCASE_F) + else if (*iter_p >= LIT_CHAR_UPPERCASE_A && *iter_p <= LIT_CHAR_UPPERCASE_F) { digit_value = 10 + (*iter_p - LIT_CHAR_UPPERCASE_A); } @@ -393,20 +385,19 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */ return ECMA_NUMBER_ZERO; } - if (end_p >= str_p + 2 - && str_p[0] == LIT_CHAR_0) + if (end_p >= str_p + 2 && str_p[0] == LIT_CHAR_0) { switch (LEXER_TO_ASCII_LOWERCASE (str_p[1])) { - case LIT_CHAR_LOWERCASE_X : + case LIT_CHAR_LOWERCASE_X: { return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 16 | options); } - case LIT_CHAR_LOWERCASE_O : + case LIT_CHAR_LOWERCASE_O: { return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 8 | options); } - case LIT_CHAR_LOWERCASE_B : + case LIT_CHAR_LOWERCASE_B: { return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 2 | options); } @@ -455,8 +446,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */ { int32_t digit_value; - if (*str_p >= LIT_CHAR_0 - && *str_p <= LIT_CHAR_9) + if (*str_p >= LIT_CHAR_0 && *str_p <= LIT_CHAR_9) { digit_seen = true; digit_value = (*str_p - LIT_CHAR_0); @@ -489,8 +479,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */ str_p++; } - if (str_p <= end_p - && *str_p == LIT_CHAR_DOT) + if (str_p <= end_p && *str_p == LIT_CHAR_DOT) { str_p++; @@ -504,8 +493,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */ { int32_t digit_value; - if (*str_p >= LIT_CHAR_0 - && *str_p <= LIT_CHAR_9) + if (*str_p >= LIT_CHAR_0 && *str_p <= LIT_CHAR_9) { digit_seen = true; digit_value = (*str_p - LIT_CHAR_0); @@ -539,9 +527,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */ int32_t e_in_lit = 0; bool e_in_lit_sign = false; - if (str_p <= end_p - && (*str_p == LIT_CHAR_LOWERCASE_E - || *str_p == LIT_CHAR_UPPERCASE_E)) + if (str_p <= end_p && (*str_p == LIT_CHAR_LOWERCASE_E || *str_p == LIT_CHAR_UPPERCASE_E)) { str_p++; @@ -569,8 +555,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */ { int32_t digit_value; - if (*str_p >= LIT_CHAR_0 - && *str_p <= LIT_CHAR_9) + if (*str_p >= LIT_CHAR_0 && *str_p <= LIT_CHAR_9) { digit_value = (*str_p - LIT_CHAR_0); } @@ -587,7 +572,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */ } e_in_lit = e_in_lit * 10 + digit_value; - int32_t e_check = e + (int32_t) digits - 1 + (e_in_lit_sign ? -e_in_lit : e_in_lit); + int32_t e_check = e + (int32_t) digits - 1 + (e_in_lit_sign ? -e_in_lit : e_in_lit); if (e_check > NUMBER_MAX_DECIMAL_EXPONENT) { @@ -764,8 +749,7 @@ ecma_uint32_to_utf8_string (uint32_t value, /**< value to convert */ buf_p--; *buf_p = (lit_utf8_byte_t) ((value % 10) + LIT_CHAR_0); value /= 10; - } - while (value != 0); + } while (value != 0); JERRY_ASSERT (buf_p >= out_buffer_p); @@ -807,8 +791,7 @@ ecma_number_to_uint32 (ecma_number_t num) /**< ecma-number */ if (abs_num >= num_2_pow_32) { - num_in_uint32_range = ecma_number_calc_remainder (abs_num, - num_2_pow_32); + num_in_uint32_range = ecma_number_calc_remainder (abs_num, num_2_pow_32); } else { @@ -822,8 +805,7 @@ ecma_number_to_uint32 (ecma_number_t num) /**< ecma-number */ const uint32_t ret = sign ? -uint32_num : uint32_num; #ifndef JERRY_NDEBUG - if (sign - && uint32_num != 0) + if (sign && uint32_num != 0) { JERRY_ASSERT (ret == uint64_2_pow_32 - uint32_num); } @@ -885,16 +867,16 @@ ecma_number_to_int32 (ecma_number_t num) /**< ecma-number */ } /* ecma_number_to_int32 */ /** - * Perform conversion of ecma-number to decimal representation with decimal exponent. - * - * Note: - * The calculated values correspond to s, n, k parameters in ECMA-262 v5, 9.8.1, item 5: - * - parameter out_digits_p corresponds to s, the digits of the number; - * - parameter out_decimal_exp_p corresponds to n, the decimal exponent; - * - return value corresponds to k, the number of digits. - * - * @return the number of digits - */ + * Perform conversion of ecma-number to decimal representation with decimal exponent. + * + * Note: + * The calculated values correspond to s, n, k parameters in ECMA-262 v5, 9.8.1, item 5: + * - parameter out_digits_p corresponds to s, the digits of the number; + * - parameter out_decimal_exp_p corresponds to n, the decimal exponent; + * - return value corresponds to k, the number of digits. + * + * @return the number of digits + */ lit_utf8_size_t ecma_number_to_decimal (ecma_number_t num, /**< ecma-number */ lit_utf8_byte_t *out_digits_p, /**< [out] buffer to fill with digits */ @@ -951,7 +933,8 @@ ecma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */ if (ecma_number_is_infinity (num)) { /* 4. */ - dst_p = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_INFINITY_UL, dst_p, + dst_p = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_INFINITY_UL, + dst_p, (lit_utf8_size_t) (buffer_p + buffer_size - dst_p)); JERRY_ASSERT (dst_p <= buffer_p + buffer_size); return (lit_utf8_size_t) (dst_p - buffer_p); diff --git a/jerry-core/ecma/base/ecma-helpers-external-pointers.c b/jerry-core/ecma/base/ecma-helpers-external-pointers.c index 23372219..66d542a0 100644 --- a/jerry-core/ecma/base/ecma-helpers-external-pointers.c +++ b/jerry-core/ecma/base/ecma-helpers-external-pointers.c @@ -16,9 +16,9 @@ #include "ecma-alloc.h" #include "ecma-array-object.h" #include "ecma-globals.h" -#include "ecma-objects.h" -#include "ecma-objects-general.h" #include "ecma-helpers.h" +#include "ecma-objects-general.h" +#include "ecma-objects.h" /** \addtogroup ecma ECMA * @{ @@ -185,8 +185,7 @@ ecma_get_native_pointer_value (ecma_object_t *obj_p, /**< object to get property if (JERRY_LIKELY (*property_p & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL)) { - ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, - value_p->value); + ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value_p->value); if (native_pointer_p->native_info_p == native_info_p) { @@ -215,8 +214,7 @@ ecma_get_native_pointer_value (ecma_object_t *obj_p, /**< object to get property } item_p = item_p->next_p; - } - while (item_p != NULL); + } while (item_p != NULL); return NULL; } /* ecma_get_native_pointer_value */ @@ -259,8 +257,7 @@ ecma_delete_native_pointer_property (ecma_object_t *obj_p, /**< object to delete if (JERRY_LIKELY (*property_p & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL)) { - ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, - value_p->value); + ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value_p->value); if (native_pointer_p->native_info_p != native_info_p) { @@ -326,8 +323,7 @@ ecma_delete_native_pointer_property (ecma_object_t *obj_p, /**< object to delete prev_p = item_p; item_p = item_p->next_p; - } - while (item_p != NULL); + } while (item_p != NULL); return false; } /* ecma_delete_native_pointer_property */ diff --git a/jerry-core/ecma/base/ecma-helpers-number.c b/jerry-core/ecma/base/ecma-helpers-number.c index 0e998f2b..a7921436 100644 --- a/jerry-core/ecma/base/ecma-helpers-number.c +++ b/jerry-core/ecma/base/ecma-helpers-number.c @@ -16,6 +16,7 @@ #include <math.h> #include "ecma-conversion.h" + #include "lit-char-helpers.h" /** \addtogroup ecma ECMA @@ -28,20 +29,17 @@ JERRY_STATIC_ASSERT (sizeof (ecma_value_t) == sizeof (ecma_integer_value_t), size_of_ecma_value_t_must_be_equal_to_the_size_of_ecma_integer_value_t); -JERRY_STATIC_ASSERT (ECMA_DIRECT_SHIFT == ECMA_VALUE_SHIFT + 1, - currently_directly_encoded_values_has_one_extra_flag); +JERRY_STATIC_ASSERT (ECMA_DIRECT_SHIFT == ECMA_VALUE_SHIFT + 1, currently_directly_encoded_values_has_one_extra_flag); JERRY_STATIC_ASSERT (((1 << (ECMA_DIRECT_SHIFT - 1)) | ECMA_TYPE_DIRECT) == ECMA_DIRECT_TYPE_SIMPLE_VALUE, currently_directly_encoded_values_start_after_direct_type_simple_value); /** * Position of the sign bit in ecma-numbers */ -#define ECMA_NUMBER_SIGN_POS (ECMA_NUMBER_FRACTION_WIDTH + \ - ECMA_NUMBER_BIASED_EXP_WIDTH) +#define ECMA_NUMBER_SIGN_POS (ECMA_NUMBER_FRACTION_WIDTH + ECMA_NUMBER_BIASED_EXP_WIDTH) #if !JERRY_NUMBER_TYPE_FLOAT64 -JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint32_t), - size_of_ecma_number_t_must_be_equal_to_4_bytes); +JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint32_t), size_of_ecma_number_t_must_be_equal_to_4_bytes); /** * Packing sign, fraction and biased exponent to ecma-number @@ -56,9 +54,8 @@ ecma_number_pack (bool sign, /**< sign */ JERRY_ASSERT ((biased_exp & ~((1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1)) == 0); JERRY_ASSERT ((fraction & ~((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1)) == 0); - uint32_t packed_value = (((sign ? 1u : 0u) << ECMA_NUMBER_SIGN_POS) | - (biased_exp << ECMA_NUMBER_FRACTION_WIDTH) | - ((uint32_t) fraction)); + uint32_t packed_value = + (((sign ? 1u : 0u) << ECMA_NUMBER_SIGN_POS) | (biased_exp << ECMA_NUMBER_FRACTION_WIDTH) | ((uint32_t) fraction)); ecma_number_accessor_t u; u.as_uint32_t = packed_value; @@ -103,8 +100,7 @@ ecma_number_unpack (ecma_number_t num, /**< ecma-number */ const int32_t ecma_number_exponent_bias = 127; #elif JERRY_NUMBER_TYPE_FLOAT64 -JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint64_t), - size_of_ecma_number_t_must_be_equal_to_8_bytes); +JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint64_t), size_of_ecma_number_t_must_be_equal_to_8_bytes); /** * Packing sign, fraction and biased exponent to ecma-number @@ -116,9 +112,8 @@ ecma_number_pack (bool sign, /**< sign */ uint32_t biased_exp, /**< biased exponent */ uint64_t fraction) /**< fraction */ { - uint64_t packed_value = (((sign ? 1ull : 0ull) << ECMA_NUMBER_SIGN_POS) | - (((uint64_t) biased_exp) << ECMA_NUMBER_FRACTION_WIDTH) | - fraction); + uint64_t packed_value = (((sign ? 1ull : 0ull) << ECMA_NUMBER_SIGN_POS) + | (((uint64_t) biased_exp) << ECMA_NUMBER_FRACTION_WIDTH) | fraction); JERRY_ASSERT ((biased_exp & ~((1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1)) == 0); JERRY_ASSERT ((fraction & ~((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1)) == 0); @@ -228,9 +223,8 @@ ecma_number_is_nan (ecma_number_t num) /**< ecma-number */ uint32_t biased_exp = ecma_number_get_biased_exponent_field (num); uint64_t fraction = ecma_number_get_fraction_field (num); - /* IEEE-754 2008, 3.4, a */ - bool is_nan_ieee754 = ((biased_exp == (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1) - && (fraction != 0)); + /* IEEE-754 2008, 3.4, a */ + bool is_nan_ieee754 = ((biased_exp == (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1) && (fraction != 0)); JERRY_ASSERT (is_nan == is_nan_ieee754); #endif /* !JERRY_NDEBUG */ @@ -251,7 +245,7 @@ ecma_number_make_nan (void) #if JERRY_NUMBER_TYPE_FLOAT64 f.as_uint64_t = 0x7ff8000000000000ull; /* double QNaN, same as the C99 nan("") returns. */ #else /* !JERRY_NUMBER_TYPE_FLOAT64 */ - f.as_uint32_t = 0x7fc00000u; /* float QNaN, same as the C99 nanf("") returns. */ + f.as_uint32_t = 0x7fc00000u; /* float QNaN, same as the C99 nanf("") returns. */ #endif /* JERRY_NUMBER_TYPE_FLOAT64 */ return f.as_ecma_number_t; } /* ecma_number_make_nan */ @@ -304,8 +298,8 @@ ecma_number_is_zero (ecma_number_t num) /**< ecma-number */ #ifndef JERRY_NDEBUG /* IEEE-754 2008, 3.4, e */ - bool is_zero_ieee754 = (ecma_number_get_fraction_field (num) == 0 - && ecma_number_get_biased_exponent_field (num) == 0); + bool is_zero_ieee754 = + (ecma_number_get_fraction_field (num) == 0 && ecma_number_get_biased_exponent_field (num) == 0); JERRY_ASSERT (is_zero == is_zero_ieee754); #endif /* !JERRY_NDEBUG */ @@ -327,8 +321,7 @@ ecma_number_is_infinity (ecma_number_t num) /**< ecma-number */ uint64_t fraction = ecma_number_get_fraction_field (num); /* IEEE-754 2008, 3.4, b */ - return ((biased_exp == (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1) - && (fraction == 0)); + return ((biased_exp == (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1) && (fraction == 0)); } /* ecma_number_is_infinity */ /** @@ -340,11 +333,11 @@ ecma_number_is_infinity (ecma_number_t num) /**< ecma-number */ extern inline bool JERRY_ATTR_ALWAYS_INLINE ecma_number_is_finite (ecma_number_t num) /**< ecma-number */ { -#if defined (__GNUC__) || defined (__clang__) +#if defined(__GNUC__) || defined(__clang__) return __builtin_isfinite (num); -#elif defined (_WIN32) +#elif defined(_WIN32) return isfinite (num); -#else +#else /* !(defined(__GNUC__) || defined(__clang__) || defined(_WIN32)) */ return !ecma_number_is_nan (num) && !ecma_number_is_infinity (num); #endif /* defined (__GNUC__) || defined (__clang__) */ } /* ecma_number_is_finite */ @@ -422,9 +415,7 @@ ecma_number_make_normal_positive_from_fraction_and_exponent (uint64_t fraction, JERRY_ASSERT ((fraction & ~((1ull << (ECMA_NUMBER_FRACTION_WIDTH + 1)) - 1)) == 0); JERRY_ASSERT ((fraction & (1ull << ECMA_NUMBER_FRACTION_WIDTH)) != 0); - return ecma_number_pack (false, - biased_exp, - fraction & ~(1ull << ECMA_NUMBER_FRACTION_WIDTH)); + return ecma_number_pack (false, biased_exp, fraction & ~(1ull << ECMA_NUMBER_FRACTION_WIDTH)); } /* ecma_number_make_normal_positive_from_fraction_and_exponent */ /** @@ -463,8 +454,7 @@ ecma_number_make_from_sign_mantissa_and_exponent (bool sign, /**< true - for neg } /* Normalizing mantissa */ - while (mantissa != 0 - && ((mantissa & (1ull << ECMA_NUMBER_FRACTION_WIDTH)) == 0)) + while (mantissa != 0 && ((mantissa & (1ull << ECMA_NUMBER_FRACTION_WIDTH)) == 0)) { exponent--; mantissa <<= 1; @@ -507,9 +497,7 @@ ecma_number_make_from_sign_mantissa_and_exponent (bool sign, /**< true - for neg JERRY_ASSERT (biased_exp < (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1); JERRY_ASSERT ((mantissa & ~((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1)) == 0); - return ecma_number_pack (sign, - biased_exp, - mantissa); + return ecma_number_pack (sign, biased_exp, mantissa); } /* ecma_number_make_from_sign_mantissa_and_exponent */ /** @@ -542,9 +530,7 @@ ecma_number_get_prev (ecma_number_t num) /**< ecma-number */ fraction--; } - return ecma_number_pack (false, - biased_exp, - fraction); + return ecma_number_pack (false, biased_exp, fraction); } /* ecma_number_get_prev */ /** @@ -581,9 +567,7 @@ ecma_number_get_next (ecma_number_t num) /**< ecma-number */ fraction &= ~(1ull << ECMA_NUMBER_FRACTION_WIDTH); - return ecma_number_pack (false, - biased_exp, - fraction); + return ecma_number_pack (false, biased_exp, fraction); } /* ecma_number_get_next */ /** @@ -609,8 +593,7 @@ ecma_number_trunc (ecma_number_t num) /**< ecma-number */ { fraction &= ~((1ull << (dot_shift - exponent)) - 1); - ecma_number_t tmp = ecma_number_make_normal_positive_from_fraction_and_exponent (fraction, - exponent); + ecma_number_t tmp = ecma_number_make_normal_positive_from_fraction_and_exponent (fraction, exponent); if (sign) { return -tmp; @@ -639,18 +622,15 @@ ecma_number_t ecma_number_calc_remainder (ecma_number_t left_num, /**< left operand */ ecma_number_t right_num) /**< right operand */ { - JERRY_ASSERT (!ecma_number_is_nan (left_num) - && !ecma_number_is_zero (left_num) + JERRY_ASSERT (!ecma_number_is_nan (left_num) && !ecma_number_is_zero (left_num) && !ecma_number_is_infinity (left_num)); - JERRY_ASSERT (!ecma_number_is_nan (right_num) - && !ecma_number_is_zero (right_num) + JERRY_ASSERT (!ecma_number_is_nan (right_num) && !ecma_number_is_zero (right_num) && !ecma_number_is_infinity (right_num)); const ecma_number_t q = ecma_number_trunc (left_num / right_num); ecma_number_t r = left_num - right_num * q; - if (ecma_number_is_zero (r) - && ecma_number_is_negative (left_num)) + if (ecma_number_is_zero (r) && ecma_number_is_negative (left_num)) { r = -r; } @@ -667,8 +647,7 @@ ecma_number_t ecma_number_pow (ecma_number_t x, /**< left operand */ ecma_number_t y) /**< right operand */ { - if (ecma_number_is_nan (y) || - (ecma_number_is_infinity (y) && (x == 1.0 || x == -1.0))) + if (ecma_number_is_nan (y) || (ecma_number_is_infinity (y) && (x == 1.0 || x == -1.0))) { /* Handle differences between ES5.1 and ISO C standards for pow. */ return ecma_number_make_nan (); @@ -692,7 +671,7 @@ extern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE ecma_integer_multiply (ecma_integer_value_t left_integer, /**< left operand */ ecma_integer_value_t right_integer) /**< right operand */ { -#if defined (__GNUC__) || defined (__clang__) +#if defined(__GNUC__) || defined(__clang__) /* Check if left_integer is power of 2 */ if (JERRY_UNLIKELY ((left_integer & (left_integer - 1)) == 0)) { @@ -720,16 +699,16 @@ ecma_integer_multiply (ecma_integer_value_t left_integer, /**< left operand */ ecma_value_t ecma_number_parse_int (const lit_utf8_byte_t *string_buff, /**< routine's first argument's * string buffer */ - lit_utf8_size_t string_buff_size, /**< routine's first argument's - * string buffer's size */ - ecma_value_t radix) /**< routine's second argument */ + lit_utf8_size_t string_buff_size, /**< routine's first argument's + * string buffer's size */ + ecma_value_t radix) /**< routine's second argument */ { if (string_buff_size == 0) { return ecma_make_nan_value (); } - /* 2. Remove leading whitespace. */ + /* 2. Remove leading whitespace. */ const lit_utf8_byte_t *string_end_p = string_buff + string_buff_size; const lit_utf8_byte_t *start_p = ecma_string_trim_front (string_buff, string_end_p); @@ -796,9 +775,7 @@ ecma_number_parse_int (const lit_utf8_byte_t *string_buff, /**< routine's first } /* 10. */ - if (strip_prefix - && ((end_p - start_p) >= 2) - && (current == LIT_CHAR_0)) + if (strip_prefix && ((end_p - start_p) >= 2) && (current == LIT_CHAR_0)) { ecma_char_t next = *string_curr_p; if (next == LIT_CHAR_LOWERCASE_X || next == LIT_CHAR_UPPERCASE_X) @@ -896,8 +873,8 @@ ecma_number_parse_int (const lit_utf8_byte_t *string_buff, /**< routine's first ecma_value_t ecma_number_parse_float (const lit_utf8_byte_t *string_buff, /**< routine's first argument's * string buffer */ - lit_utf8_size_t string_buff_size) /**< routine's first argument's - * string buffer's size */ + lit_utf8_size_t string_buff_size) /**< routine's first argument's + * string buffer's size */ { if (string_buff_size == 0) { @@ -937,8 +914,7 @@ ecma_number_parse_float (const lit_utf8_byte_t *string_buff, /**< routine's firs /* The input string should be at least the length of "Infinity" to be correctly processed as * the infinity value. */ - if ((str_end_p - str_curr_p) >= (int) infinity_length - && memcmp (infinity_str_p, str_curr_p, infinity_length) == 0) + if ((str_end_p - str_curr_p) >= (int) infinity_length && memcmp (infinity_str_p, str_curr_p, infinity_length) == 0) { /* String matched Infinity. */ return ecma_make_number_value (ecma_number_make_infinity (sign)); @@ -1021,15 +997,13 @@ ecma_number_parse_float (const lit_utf8_byte_t *string_buff, /**< routine's firs } /* Check exponent. */ - if ((current == LIT_CHAR_LOWERCASE_E || current == LIT_CHAR_UPPERCASE_E) - && (has_whole_part || has_fraction_part) + if ((current == LIT_CHAR_LOWERCASE_E || current == LIT_CHAR_UPPERCASE_E) && (has_whole_part || has_fraction_part) && str_curr_p < str_end_p) { current = *str_curr_p++; /* Check sign of exponent. */ - if ((current == LIT_CHAR_PLUS || current == LIT_CHAR_MINUS) - && str_curr_p < str_end_p) + if ((current == LIT_CHAR_PLUS || current == LIT_CHAR_MINUS) && str_curr_p < str_end_p) { current = *str_curr_p++; } diff --git a/jerry-core/ecma/base/ecma-helpers-string.c b/jerry-core/ecma/base/ecma-helpers-string.c index aa9dfa4f..a4d6749b 100644 --- a/jerry-core/ecma/base/ecma-helpers-string.c +++ b/jerry-core/ecma/base/ecma-helpers-string.c @@ -19,9 +19,10 @@ #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" + #include "jcontext.h" -#include "jrt.h" #include "jrt-libc-includes.h" +#include "jrt.h" #include "lit-char-helpers.h" #include "lit-magic-strings.h" @@ -41,8 +42,7 @@ JERRY_STATIC_ASSERT ((ECMA_STRING_MAX_REF | ECMA_STRING_CONTAINER_MASK | ECMA_ST JERRY_STATIC_ASSERT (ECMA_STRING_NOT_ARRAY_INDEX == UINT32_MAX, ecma_string_not_array_index_must_be_equal_to_uint32_max); -JERRY_STATIC_ASSERT ((ECMA_TYPE_DIRECT_STRING & 0x1) != 0, - ecma_type_direct_string_must_be_odd_number); +JERRY_STATIC_ASSERT ((ECMA_TYPE_DIRECT_STRING & 0x1) != 0, ecma_type_direct_string_must_be_odd_number); JERRY_STATIC_ASSERT (LIT_MAGIC_STRING__COUNT <= ECMA_DIRECT_STRING_MAX_IMM, all_magic_strings_must_be_encoded_as_direct_string); @@ -96,8 +96,7 @@ ecma_string_to_array_index (const lit_utf8_byte_t *string_p, /**< utf-8 string * } index = (index * 10) + (uint32_t) (*string_p++ - LIT_CHAR_0); - } - while (string_p < string_end_p); + } while (string_p < string_end_p); if (string_size < ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32) { @@ -107,9 +106,7 @@ ecma_string_to_array_index (const lit_utf8_byte_t *string_p, /**< utf-8 string * /* Overflow must be checked as well when size is * equal to ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32. */ - if (*string_p > LIT_CHAR_9 - || *string_p < LIT_CHAR_0 - || index > (UINT32_MAX / 10) + if (*string_p > LIT_CHAR_9 || *string_p < LIT_CHAR_0 || index > (UINT32_MAX / 10) || (index == (UINT32_MAX / 10) && *string_p > LIT_CHAR_5)) { return false; @@ -241,8 +238,7 @@ ecma_prop_name_is_symbol (ecma_string_t *string_p) /**< ecma-string */ { JERRY_ASSERT (string_p != NULL); - return (!ECMA_IS_DIRECT_STRING (string_p) - && ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_SYMBOL); + return (!ECMA_IS_DIRECT_STRING (string_p) && ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_SYMBOL); } /* ecma_prop_name_is_symbol */ #endif /* JERRY_ESNEXT */ @@ -251,7 +247,7 @@ ecma_prop_name_is_symbol (ecma_string_t *string_p) /**< ecma-string */ * * @return pointer to ecma-string descriptor */ -static inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE +static inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE ecma_new_ecma_string_from_utf8_buffer (lit_utf8_size_t length, /**< length of the buffer */ lit_utf8_size_t size, /**< size of the buffer */ lit_utf8_byte_t **data_p) /**< [out] pointer to the start of the string buffer */ @@ -382,9 +378,8 @@ ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, /**< utf-8 stri } lit_utf8_byte_t *data_p; - string_desc_p = ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (string_p, string_size), - string_size, - &data_p); + string_desc_p = + ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (string_p, string_size), string_size, &data_p); string_desc_p->u.hash = lit_utf8_string_calc_hash (string_p, string_size); memcpy (data_p, string_p, string_size); @@ -446,9 +441,8 @@ ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string JERRY_ASSERT (lit_is_valid_utf8_string (string_p, string_size, false)); lit_utf8_byte_t *data_p; - ecma_string_t *string_desc_p = ecma_new_ecma_string_from_utf8_buffer (converted_string_length, - converted_string_size, - &data_p); + ecma_string_t *string_desc_p = + ecma_new_ecma_string_from_utf8_buffer (converted_string_length, converted_string_size, &data_p); const lit_utf8_byte_t *const begin_data_p = data_p; pos = 0; @@ -661,8 +655,8 @@ ecma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */ if (ecma_number_is_infinity (num)) { - lit_magic_string_id_t id = (ecma_number_is_negative (num) ? LIT_MAGIC_STRING_NEGATIVE_INFINITY_UL - : LIT_MAGIC_STRING_INFINITY_UL); + lit_magic_string_id_t id = + (ecma_number_is_negative (num) ? LIT_MAGIC_STRING_NEGATIVE_INFINITY_UL : LIT_MAGIC_STRING_INFINITY_UL); return ecma_get_magic_string (id); } @@ -676,9 +670,8 @@ ecma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */ #endif /* !JERRY_NDEBUG */ lit_utf8_byte_t *data_p; - ecma_string_t *string_desc_p = ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (str_buf, str_size), - str_size, - &data_p); + ecma_string_t *string_desc_p = + ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (str_buf, str_size), str_size, &data_p); string_desc_p->u.hash = lit_utf8_string_calc_hash (str_buf, str_size); memcpy (data_p, str_buf, str_size); @@ -694,7 +687,7 @@ ecma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */ * * @return pointer to ecma-string descriptor */ -extern inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE ecma_get_magic_string (lit_magic_string_id_t id) /**< identifier of magic string */ { JERRY_ASSERT (id < LIT_MAGIC_STRING__COUNT); @@ -709,7 +702,7 @@ ecma_get_magic_string (lit_magic_string_id_t id) /**< identifier of magic string * * @return pointer to ecma-string descriptor */ -extern inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE ecma_get_internal_string (lit_magic_string_id_t id) /**< identifier of magic string */ { JERRY_ASSERT (id >= LIT_NON_INTERNAL_MAGIC_STRING__COUNT && id < LIT_MAGIC_STRING__COUNT); @@ -743,11 +736,8 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */ uint8_t flags = ECMA_STRING_FLAG_IS_ASCII; lit_utf8_byte_t uint32_to_string_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32]; - const lit_utf8_byte_t *cesu8_string1_p = ecma_string_get_chars (string1_p, - &cesu8_string1_size, - &cesu8_string1_length, - uint32_to_string_buffer, - &flags); + const lit_utf8_byte_t *cesu8_string1_p = + ecma_string_get_chars (string1_p, &cesu8_string1_size, &cesu8_string1_length, uint32_to_string_buffer, &flags); JERRY_ASSERT (!(flags & ECMA_STRING_FLAG_MUST_BE_FREED)); JERRY_ASSERT (cesu8_string1_length > 0); @@ -762,10 +752,8 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */ } lit_magic_string_id_t magic_string_id; - magic_string_id = lit_is_utf8_string_pair_magic (cesu8_string1_p, - cesu8_string1_size, - cesu8_string2_p, - cesu8_string2_size); + magic_string_id = + lit_is_utf8_string_pair_magic (cesu8_string1_p, cesu8_string1_size, cesu8_string2_p, cesu8_string2_size); if (magic_string_id != LIT_MAGIC_STRING__COUNT) { @@ -789,10 +777,8 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */ if (lit_get_magic_string_ex_count () > 0) { lit_magic_string_ex_id_t magic_string_ex_id; - magic_string_ex_id = lit_is_ex_utf8_string_pair_magic (cesu8_string1_p, - cesu8_string1_size, - cesu8_string2_p, - cesu8_string2_size); + magic_string_ex_id = + lit_is_ex_utf8_string_pair_magic (cesu8_string1_p, cesu8_string1_size, cesu8_string2_p, cesu8_string2_size); if (magic_string_ex_id < lit_get_magic_string_ex_count ()) { @@ -802,9 +788,8 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */ } lit_utf8_byte_t *data_p; - ecma_string_t *string_desc_p = ecma_new_ecma_string_from_utf8_buffer (cesu8_string1_length + cesu8_string2_length, - new_size, - &data_p); + ecma_string_t *string_desc_p = + ecma_new_ecma_string_from_utf8_buffer (cesu8_string1_length + cesu8_string2_length, new_size, &data_p); lit_string_hash_t hash_start; @@ -857,18 +842,13 @@ ecma_concat_ecma_strings (ecma_string_t *string1_p, /**< first ecma-string */ lit_utf8_byte_t uint32_to_string_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32]; uint8_t flags = ECMA_STRING_FLAG_IS_ASCII; - const lit_utf8_byte_t *cesu8_string2_p = ecma_string_get_chars (string2_p, - &cesu8_string2_size, - &cesu8_string2_length, - uint32_to_string_buffer, - &flags); + const lit_utf8_byte_t *cesu8_string2_p = + ecma_string_get_chars (string2_p, &cesu8_string2_size, &cesu8_string2_length, uint32_to_string_buffer, &flags); JERRY_ASSERT (cesu8_string2_p != NULL); - ecma_string_t *result_p = ecma_append_chars_to_string (string1_p, - cesu8_string2_p, - cesu8_string2_size, - cesu8_string2_length); + ecma_string_t *result_p = + ecma_append_chars_to_string (string1_p, cesu8_string2_p, cesu8_string2_size, cesu8_string2_length); JERRY_ASSERT (!(flags & ECMA_STRING_FLAG_MUST_BE_FREED)); @@ -1200,10 +1180,7 @@ ecma_string_copy_to_utf8_buffer (const ecma_string_t *string_p, /**< ecma-string return size; } - size = lit_convert_cesu8_string_to_utf8_string (chars_p, - size, - buffer_p, - buffer_size); + size = lit_convert_cesu8_string_to_utf8_string (chars_p, size, buffer_p, buffer_size); if (flags & ECMA_STRING_FLAG_MUST_BE_FREED) { @@ -1606,7 +1583,6 @@ ecma_string_get_chars (const ecma_string_t *string_p, /**< ecma-string */ JERRY_ASSERT (length == size); *flags_p |= ECMA_STRING_FLAG_IS_UINT32 | ECMA_STRING_FLAG_REHASH_NEEDED; break; - } default: { @@ -1634,8 +1610,7 @@ ecma_string_get_chars (const ecma_string_t *string_p, /**< ecma-string */ *length_p = length; } - if ((*flags_p & ECMA_STRING_FLAG_IS_ASCII) - && length != size) + if ((*flags_p & ECMA_STRING_FLAG_IS_ASCII) && length != size) { *flags_p = (uint8_t) (*flags_p & (uint8_t) ~ECMA_STRING_FLAG_IS_ASCII); } @@ -1685,7 +1660,7 @@ ecma_string_is_length (const ecma_string_t *string_p) /**< property name */ * * @return pointer to the converted ecma string */ -static inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE +static inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE ecma_property_to_string (ecma_property_t property, /**< property name type */ jmem_cpointer_t prop_name_cp) /**< property name compressed pointer */ { @@ -1964,8 +1939,7 @@ bool ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-string */ const ecma_string_t *string2_p) /**< ecma-string */ { - if (ecma_compare_ecma_strings (string1_p, - string2_p)) + if (ecma_compare_ecma_strings (string1_p, string2_p)) { return false; } @@ -2038,10 +2012,7 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma- } } - return lit_compare_utf8_strings_relational (utf8_string1_p, - utf8_string1_size, - utf8_string2_p, - utf8_string2_size); + return lit_compare_utf8_strings_relational (utf8_string1_p, utf8_string1_size, utf8_string2_p, utf8_string2_size); } /* ecma_compare_ecma_strings_relational */ /** @@ -2071,8 +2042,7 @@ ecma_string_get_ascii_size (const ecma_string_t *string_p) /**< ecma-string */ return ECMA_STRING_NO_ASCII_SIZE; } - JERRY_ASSERT (ECMA_STRING_IS_ASCII (lit_get_magic_string_utf8 (id), - lit_get_magic_string_size (id))); + JERRY_ASSERT (ECMA_STRING_IS_ASCII (lit_get_magic_string_utf8 (id), lit_get_magic_string_size (id))); return lit_get_magic_string_size (id); } @@ -2120,8 +2090,7 @@ ecma_string_get_length (const ecma_string_t *string_p) /**< ecma-string */ JERRY_ASSERT ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) >= LIT_MAGIC_STRING__COUNT); uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) - LIT_MAGIC_STRING__COUNT; - return lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id), - lit_get_magic_string_ex_size (id)); + return lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id)); } if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_UTF8_STRING) @@ -2137,8 +2106,7 @@ ecma_string_get_length (const ecma_string_t *string_p) /**< ecma-string */ JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX); lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id; - return lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id), - lit_get_magic_string_ex_size (id)); + return lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id)); } /* ecma_string_get_length */ /** @@ -2162,8 +2130,7 @@ ecma_string_get_utf8_length (const ecma_string_t *string_p) /**< ecma-string */ JERRY_ASSERT ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) >= LIT_MAGIC_STRING__COUNT); uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) - LIT_MAGIC_STRING__COUNT; - return lit_get_utf8_length_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), - lit_get_magic_string_ex_size (id)); + return lit_get_utf8_length_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id)); } if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_UTF8_STRING) @@ -2196,8 +2163,7 @@ ecma_string_get_utf8_length (const ecma_string_t *string_p) /**< ecma-string */ lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id; - return lit_get_utf8_length_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), - lit_get_magic_string_ex_size (id)); + return lit_get_utf8_length_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id)); } /* ecma_string_get_utf8_length */ /** @@ -2259,8 +2225,7 @@ ecma_string_get_utf8_size (const ecma_string_t *string_p) /**< ecma-string */ JERRY_ASSERT ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) >= LIT_MAGIC_STRING__COUNT); uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) - LIT_MAGIC_STRING__COUNT; - return lit_get_utf8_size_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), - lit_get_magic_string_ex_size (id)); + return lit_get_utf8_size_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id)); } if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_UTF8_STRING) @@ -2291,8 +2256,7 @@ ecma_string_get_utf8_size (const ecma_string_t *string_p) /**< ecma-string */ JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX); lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id; - return lit_get_utf8_size_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), - lit_get_magic_string_ex_size (id)); + return lit_get_utf8_size_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id)); } /* ecma_string_get_utf8_size */ /** @@ -2511,7 +2475,7 @@ ecma_string_substr (const ecma_string_t *string_p, /**< pointer to an ecma strin */ const lit_utf8_byte_t * ecma_string_trim_front (const lit_utf8_byte_t *start_p, /**< current string's start position */ - const lit_utf8_byte_t *end_p) /**< current string's end position */ + const lit_utf8_byte_t *end_p) /**< current string's end position */ { ecma_char_t ch; @@ -2540,7 +2504,7 @@ ecma_string_trim_front (const lit_utf8_byte_t *start_p, /**< current string's st */ const lit_utf8_byte_t * ecma_string_trim_back (const lit_utf8_byte_t *start_p, /**< current string's start position */ - const lit_utf8_byte_t *end_p) /**< current string's end position */ + const lit_utf8_byte_t *end_p) /**< current string's end position */ { ecma_char_t ch; @@ -2568,7 +2532,7 @@ ecma_string_trim_back (const lit_utf8_byte_t *start_p, /**< current string's sta */ extern inline void JERRY_ATTR_ALWAYS_INLINE ecma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p, /**< [in, out] current string position */ - lit_utf8_size_t *utf8_str_size) /**< [in, out] size of the given string */ + lit_utf8_size_t *utf8_str_size) /**< [in, out] size of the given string */ { const lit_utf8_byte_t *end_p = *utf8_str_p + *utf8_str_size; const lit_utf8_byte_t *start_p = *utf8_str_p; @@ -2622,11 +2586,10 @@ ecma_string_trim (const ecma_string_t *string_p) /**< pointer to an ecma string ecma_value_t ecma_string_pad (ecma_value_t original_string_p, /**< Input ecma string */ ecma_value_t max_length, /**< Length to pad to, including original length */ - ecma_value_t fill_string, /**< The string to pad with */ + ecma_value_t fill_string, /**< The string to pad with */ bool pad_on_start) /**< true - if we are padding to the start, calling with padStart false - if we are padding to the end, calling with padEnd */ { - /* 3 */ ecma_length_t int_max_length; if (ECMA_IS_VALUE_ERROR (ecma_op_to_length (max_length, &int_max_length))) @@ -2723,7 +2686,7 @@ ecma_stringbuilder_create (void) jmem_stats_allocate_string_bytes (initial_size); #endif /* JERRY_MEM_STATS */ - ecma_stringbuilder_t ret = {.header_p = header_p}; + ecma_stringbuilder_t ret = { .header_p = header_p }; return ret; } /* ecma_stringbuilder_create */ @@ -2744,12 +2707,11 @@ ecma_stringbuilder_create_from (ecma_string_t *string_p) /**< ecma string */ jmem_stats_allocate_string_bytes (initial_size); #endif /* JERRY_MEM_STATS */ - size_t copied_size = ecma_string_copy_to_cesu8_buffer (string_p, - ECMA_STRINGBUILDER_STRING_PTR (header_p), - string_size); + size_t copied_size = + ecma_string_copy_to_cesu8_buffer (string_p, ECMA_STRINGBUILDER_STRING_PTR (header_p), string_size); JERRY_ASSERT (copied_size == string_size); - ecma_stringbuilder_t ret = {.header_p = header_p}; + ecma_stringbuilder_t ret = { .header_p = header_p }; return ret; } /* ecma_stringbuilder_create_from */ @@ -2772,7 +2734,7 @@ ecma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p, /**< pointer to da memcpy (ECMA_STRINGBUILDER_STRING_PTR (header_p), data_p, data_size); - ecma_stringbuilder_t ret = {.header_p = header_p}; + ecma_stringbuilder_t ret = { .header_p = header_p }; return ret; } /* ecma_stringbuilder_create_raw */ @@ -2797,7 +2759,7 @@ ecma_stringbuilder_grow (ecma_stringbuilder_t *builder_p, /**< string builder */ jmem_stats_allocate_string_bytes (required_size); #endif /* JERRY_MEM_STATS */ - return ((lit_utf8_byte_t *) header_p) + header_p->current_size - required_size; + return ((lit_utf8_byte_t *) header_p) + header_p->current_size - required_size; } /* ecma_stringbuilder_grow */ /** @@ -2860,9 +2822,7 @@ ecma_stringbuilder_append (ecma_stringbuilder_t *builder_p, /**< string builder const lit_utf8_size_t string_size = ecma_string_get_size (string_p); lit_utf8_byte_t *dest_p = ecma_stringbuilder_grow (builder_p, string_size); - size_t copied_size = ecma_string_copy_to_cesu8_buffer (string_p, - dest_p, - string_size); + size_t copied_size = ecma_string_copy_to_cesu8_buffer (string_p, dest_p, string_size); JERRY_ASSERT (copied_size == string_size); } /* ecma_stringbuilder_append */ @@ -2953,7 +2913,7 @@ ecma_stringbuilder_finalize (ecma_stringbuilder_t *builder_p) /**< string builde #ifndef JERRY_NDEBUG builder_p->header_p = NULL; -#endif +#endif /* !defined (JERRY_NDEBUG) */ size_t container_size = sizeof (ecma_short_string_t); const lit_string_hash_t hash = lit_utf8_string_calc_hash (string_begin_p, string_size); @@ -2978,9 +2938,7 @@ ecma_stringbuilder_finalize (ecma_stringbuilder_t *builder_p) /**< string builde const size_t utf8_string_size = string_size + container_size; header_p = jmem_heap_realloc_block (header_p, header_p->current_size, utf8_string_size); - memmove (((lit_utf8_byte_t *) header_p + container_size), - ECMA_STRINGBUILDER_STRING_PTR (header_p), - string_size); + memmove (((lit_utf8_byte_t *) header_p + container_size), ECMA_STRINGBUILDER_STRING_PTR (header_p), string_size); #if JERRY_MEM_STATS jmem_stats_allocate_string_bytes (container_size - ECMA_ASCII_STRING_HEADER_SIZE); @@ -3021,7 +2979,7 @@ ecma_stringbuilder_destroy (ecma_stringbuilder_t *builder_p) /**< string builder #ifndef JERRY_NDEBUG builder_p->header_p = NULL; -#endif +#endif /* !defined (JERRY_NDEBUG) */ #if JERRY_MEM_STATS jmem_stats_free_string_bytes (size); diff --git a/jerry-core/ecma/base/ecma-helpers-value.c b/jerry-core/ecma/base/ecma-helpers-value.c index a10c9188..8b3598a9 100644 --- a/jerry-core/ecma/base/ecma-helpers-value.c +++ b/jerry-core/ecma/base/ecma-helpers-value.c @@ -15,20 +15,18 @@ #include "ecma-alloc.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "jrt.h" + #include "jrt-bit-fields.h" +#include "jrt.h" #include "vm-defines.h" -#include "ecma-function-object.h" - -JERRY_STATIC_ASSERT (ECMA_TYPE___MAX <= ECMA_VALUE_TYPE_MASK, - ecma_types_must_be_less_than_mask); +JERRY_STATIC_ASSERT (ECMA_TYPE___MAX <= ECMA_VALUE_TYPE_MASK, ecma_types_must_be_less_than_mask); -JERRY_STATIC_ASSERT ((ECMA_VALUE_TYPE_MASK + 1) == (1 << ECMA_VALUE_SHIFT), - ecma_value_part_must_start_after_flags); +JERRY_STATIC_ASSERT ((ECMA_VALUE_TYPE_MASK + 1) == (1 << ECMA_VALUE_SHIFT), ecma_value_part_must_start_after_flags); JERRY_STATIC_ASSERT (ECMA_VALUE_SHIFT <= JMEM_ALIGNMENT_LOG, ecma_value_shift_must_be_less_than_or_equal_than_mem_alignment_log); @@ -42,18 +40,16 @@ JERRY_STATIC_ASSERT (sizeof (jmem_cpointer_t) <= sizeof (jmem_cpointer_tag_t), #ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY /* cppcheck-suppress zerodiv */ -JERRY_STATIC_ASSERT (sizeof (uintptr_t) <= sizeof (ecma_value_t), - uintptr_t_must_fit_in_ecma_value_t); +JERRY_STATIC_ASSERT (sizeof (uintptr_t) <= sizeof (ecma_value_t), uintptr_t_must_fit_in_ecma_value_t); #else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */ -JERRY_STATIC_ASSERT (sizeof (uintptr_t) > sizeof (ecma_value_t), - uintptr_t_must_not_fit_in_ecma_value_t); +JERRY_STATIC_ASSERT (sizeof (uintptr_t) > sizeof (ecma_value_t), uintptr_t_must_not_fit_in_ecma_value_t); #endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */ JERRY_STATIC_ASSERT ((ECMA_VALUE_FALSE | (1 << ECMA_DIRECT_SHIFT)) == ECMA_VALUE_TRUE - && ECMA_VALUE_FALSE != ECMA_VALUE_TRUE, + && ECMA_VALUE_FALSE != ECMA_VALUE_TRUE, only_the_lowest_bit_must_be_different_for_simple_value_true_and_false); #if JERRY_BUILTIN_BIGINT @@ -110,7 +106,7 @@ ecma_pointer_to_ecma_value (const void *ptr) /**< pointer */ * * @return pointer */ -static inline void * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE +static inline void *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE ecma_get_pointer_from_ecma_value (ecma_value_t value) /**< value */ { #ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY @@ -277,8 +273,7 @@ extern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE ecma_are_values_integer_numbers (ecma_value_t first_value, /**< first ecma value */ ecma_value_t second_value) /**< second ecma value */ { - JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_INTEGER_VALUE == 0, - ecma_direct_type_integer_value_must_be_zero); + JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_INTEGER_VALUE == 0, ecma_direct_type_integer_value_must_be_zero); return ((first_value | second_value) & ECMA_DIRECT_TYPE_MASK) == ECMA_DIRECT_TYPE_INTEGER_VALUE; } /* ecma_are_values_integer_numbers */ @@ -304,8 +299,7 @@ ecma_is_value_float_number (ecma_value_t value) /**< ecma value */ extern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE ecma_is_value_number (ecma_value_t value) /**< ecma value */ { - return (ecma_is_value_integer_number (value) - || ecma_is_value_float_number (value)); + return (ecma_is_value_integer_number (value) || ecma_is_value_float_number (value)); } /* ecma_is_value_number */ JERRY_STATIC_ASSERT ((ECMA_TYPE_STRING | 0x4) == ECMA_TYPE_DIRECT_STRING, @@ -362,12 +356,12 @@ ecma_is_value_magic_string (ecma_value_t value, /**< ecma value */ extern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE ecma_is_value_bigint (ecma_value_t value) /**< ecma value */ { - #if JERRY_BUILTIN_BIGINT +#if JERRY_BUILTIN_BIGINT return (ecma_get_value_type_field (value) == ECMA_TYPE_BIGINT); - #else /* !JERRY_BUILTIN_BIGINT */ +#else /* !JERRY_BUILTIN_BIGINT */ JERRY_UNUSED (value); return false; - #endif /* JERRY_BUILTIN_BIGINT */ +#endif /* JERRY_BUILTIN_BIGINT */ } /* ecma_is_value_bigint */ /** @@ -441,14 +435,9 @@ ecma_is_value_error_reference (ecma_value_t value) /**< ecma value */ void ecma_check_value_type_is_spec_defined (ecma_value_t value) /**< ecma value */ { - JERRY_ASSERT (ecma_is_value_undefined (value) - || ecma_is_value_null (value) - || ecma_is_value_boolean (value) - || ecma_is_value_number (value) - || ecma_is_value_string (value) - || ecma_is_value_bigint (value) - || ecma_is_value_symbol (value) - || ecma_is_value_object (value)); + JERRY_ASSERT (ecma_is_value_undefined (value) || ecma_is_value_null (value) || ecma_is_value_boolean (value) + || ecma_is_value_number (value) || ecma_is_value_string (value) || ecma_is_value_bigint (value) + || ecma_is_value_symbol (value) || ecma_is_value_object (value)); } /* ecma_check_value_type_is_spec_defined */ /** @@ -768,7 +757,7 @@ ecma_get_float_from_value (ecma_value_t value) /**< ecma value */ * * @return floating point value */ -extern inline ecma_number_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_number_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE ecma_get_pointer_from_float_value (ecma_value_t value) /**< ecma value */ { JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_FLOAT); @@ -797,7 +786,7 @@ ecma_get_number_from_value (ecma_value_t value) /**< ecma value */ * * @return the string pointer */ -extern inline ecma_string_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_string_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE ecma_get_string_from_value (ecma_value_t value) /**< ecma value */ { JERRY_ASSERT (ecma_is_value_string (value)); @@ -816,7 +805,7 @@ ecma_get_string_from_value (ecma_value_t value) /**< ecma value */ * * @return the string pointer */ -extern inline ecma_string_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_string_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE ecma_get_symbol_from_value (ecma_value_t value) /**< ecma value */ { JERRY_ASSERT (ecma_is_value_symbol (value)); @@ -830,7 +819,7 @@ ecma_get_symbol_from_value (ecma_value_t value) /**< ecma value */ * * @return the string pointer */ -extern inline ecma_string_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_string_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE ecma_get_prop_name_from_value (ecma_value_t value) /**< ecma value */ { JERRY_ASSERT (ecma_is_value_prop_name (value)); @@ -848,7 +837,7 @@ ecma_get_prop_name_from_value (ecma_value_t value) /**< ecma value */ * * @return the pointer */ -extern inline ecma_object_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_object_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE ecma_get_object_from_value (ecma_value_t value) /**< ecma value */ { JERRY_ASSERT (ecma_is_value_object (value)); @@ -861,7 +850,7 @@ ecma_get_object_from_value (ecma_value_t value) /**< ecma value */ * * @return the pointer */ -extern inline ecma_extended_primitive_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_extended_primitive_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE ecma_get_extended_primitive_from_value (ecma_value_t value) /**< ecma value */ { #if JERRY_BUILTIN_BIGINT @@ -892,7 +881,7 @@ ecma_invert_boolean_value (ecma_value_t value) /**< ecma value */ * @return copy of the given value */ ecma_value_t -ecma_copy_value (ecma_value_t value) /**< value description */ +ecma_copy_value (ecma_value_t value) /**< value description */ { switch (ecma_get_value_type_field (value)) { @@ -951,7 +940,7 @@ ecma_copy_value (ecma_value_t value) /**< value description */ * @return copy of the given value */ extern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE -ecma_fast_copy_value (ecma_value_t value) /**< value description */ +ecma_fast_copy_value (ecma_value_t value) /**< value description */ { return (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT) ? value : ecma_copy_value (value); } /* ecma_fast_copy_value */ @@ -1006,8 +995,7 @@ void ecma_value_assign_value (ecma_value_t *value_p, /**< [in, out] ecma value */ ecma_value_t ecma_value) /**< value to assign */ { - JERRY_STATIC_ASSERT (ECMA_TYPE_DIRECT == 0, - ecma_type_direct_must_be_zero_for_the_next_check); + JERRY_STATIC_ASSERT (ECMA_TYPE_DIRECT == 0, ecma_type_direct_must_be_zero_for_the_next_check); if (*value_p == ecma_value) { @@ -1018,8 +1006,7 @@ ecma_value_assign_value (ecma_value_t *value_p, /**< [in, out] ecma value */ { *value_p = ecma_value; } - else if (ecma_is_value_float_number (ecma_value) - && ecma_is_value_float_number (*value_p)) + else if (ecma_is_value_float_number (ecma_value) && ecma_is_value_float_number (*value_p)) { const ecma_number_t *num_src_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (ecma_value); ecma_number_t *num_dst_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (*value_p); diff --git a/jerry-core/ecma/base/ecma-helpers.c b/jerry-core/ecma/base/ecma-helpers.c index efa1a112..b47e1535 100644 --- a/jerry-core/ecma/base/ecma-helpers.c +++ b/jerry-core/ecma/base/ecma-helpers.c @@ -13,20 +13,22 @@ * limitations under the License. */ +#include "ecma-helpers.h" + #include "ecma-alloc.h" #include "ecma-array-object.h" +#include "ecma-builtins.h" #include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" -#include "ecma-helpers.h" #include "ecma-lcache.h" #include "ecma-line-info.h" #include "ecma-property-hashmap.h" + +#include "byte-code.h" #include "jcontext.h" #include "jrt-bit-fields.h" -#include "byte-code.h" #include "re-compiler.h" -#include "ecma-builtins.h" #if JERRY_DEBUGGER #include "debugger.h" @@ -62,13 +64,13 @@ JERRY_STATIC_ASSERT (ECMA_PROPERTY_FLAGS_MASK == ECMA_PROPERTY_CONFIGURABLE_ENUM /* These checks are needed by ecma_get_object_base_type. */ JERRY_STATIC_ASSERT ((int) ECMA_OBJECT_TYPE_BUILT_IN_GENERAL == ((int) ECMA_OBJECT_TYPE_GENERAL | 0x1) - && ((int) ECMA_OBJECT_TYPE_GENERAL & 0x1) == 0, + && ((int) ECMA_OBJECT_TYPE_GENERAL & 0x1) == 0, ecma_object_type_built_in_general_has_unexpected_value); JERRY_STATIC_ASSERT ((int) ECMA_OBJECT_TYPE_BUILT_IN_CLASS == ((int) ECMA_OBJECT_TYPE_CLASS | 0x1) - && ((int) ECMA_OBJECT_TYPE_CLASS & 0x1) == 0, + && ((int) ECMA_OBJECT_TYPE_CLASS & 0x1) == 0, ecma_object_type_built_in_class_has_unexpected_value); JERRY_STATIC_ASSERT ((int) ECMA_OBJECT_TYPE_BUILT_IN_ARRAY == ((int) ECMA_OBJECT_TYPE_ARRAY | 0x1) - && ((int) ECMA_OBJECT_TYPE_ARRAY & 0x1) == 0, + && ((int) ECMA_OBJECT_TYPE_ARRAY & 0x1) == 0, ecma_object_type_built_in_array_has_unexpected_value); /** @@ -147,8 +149,7 @@ ecma_object_t * ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< outer lexical environment */ ecma_object_t *binding_obj_p) /**< binding object */ { - JERRY_ASSERT (binding_obj_p != NULL - && !ecma_is_lexical_environment (binding_obj_p)); + JERRY_ASSERT (binding_obj_p != NULL && !ecma_is_lexical_environment (binding_obj_p)); ecma_object_t *new_lexical_environment_p = ecma_alloc_object (); @@ -156,8 +157,7 @@ ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< out ecma_init_gc_info (new_lexical_environment_p); - ECMA_SET_NON_NULL_POINTER (new_lexical_environment_p->u1.bound_object_cp, - binding_obj_p); + ECMA_SET_NON_NULL_POINTER (new_lexical_environment_p->u1.bound_object_cp, binding_obj_p); ECMA_SET_POINTER (new_lexical_environment_p->u2.outer_reference_cp, outer_lexical_environment_p); @@ -298,7 +298,7 @@ ecma_get_lex_env_type (const ecma_object_t *object_p) /**< lexical environment * * * @return pointer to ecma object */ -extern inline ecma_object_t * JERRY_ATTR_PURE +extern inline ecma_object_t *JERRY_ATTR_PURE ecma_get_lex_env_binding_object (const ecma_object_t *object_p) /**< object-bound lexical environment */ { JERRY_ASSERT (object_p != NULL); @@ -381,8 +381,7 @@ ecma_clone_decl_lexical_environment (ecma_object_t *lex_env_p, /**< declarative } prop_iter_cp = prop_iter_p->next_property_cp; - } - while (prop_iter_cp != JMEM_CP_NULL); + } while (prop_iter_cp != JMEM_CP_NULL); ecma_deref_object (lex_env_p); return new_lex_env_p; @@ -411,8 +410,8 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */ if (*property_list_head_p != ECMA_NULL_POINTER) { /* If the first entry is free (deleted), it is reused. */ - ecma_property_header_t *first_property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - *property_list_head_p); + ecma_property_header_t *first_property_p = + ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, *property_list_head_p); #if JERRY_PROPERTY_HASHMAP bool has_hashmap = false; @@ -420,8 +419,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */ if (first_property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP) { property_list_head_p = &first_property_p->next_property_cp; - first_property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - *property_list_head_p); + first_property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, *property_list_head_p); has_hashmap = true; } #endif /* JERRY_PROPERTY_HASHMAP */ @@ -433,8 +431,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */ ecma_property_pair_t *first_property_pair_p = (ecma_property_pair_t *) first_property_p; ecma_property_t name_type; - first_property_pair_p->names_cp[0] = ecma_string_to_property_name (name_p, - &name_type); + first_property_pair_p->names_cp[0] = ecma_string_to_property_name (name_p, &name_type); first_property_p->types[0] = (ecma_property_t) (type_and_flags | name_type); ecma_property_t *property_p = first_property_p->types + 0; @@ -456,10 +453,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */ if (has_hashmap) { - ecma_property_hashmap_insert (object_p, - name_p, - first_property_pair_p, - 0); + ecma_property_hashmap_insert (object_p, name_p, first_property_pair_p, 0); } #endif /* JERRY_PROPERTY_HASHMAP */ @@ -478,8 +472,8 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */ if (*property_list_head_p != ECMA_NULL_POINTER) { - ecma_property_header_t *first_property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - *property_list_head_p); + ecma_property_header_t *first_property_p = + ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, *property_list_head_p); if (first_property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP) { @@ -495,8 +489,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */ first_property_pair_p->names_cp[0] = LIT_INTERNAL_MAGIC_STRING_DELETED; ecma_property_t name_type; - first_property_pair_p->names_cp[1] = ecma_string_to_property_name (name_p, - &name_type); + first_property_pair_p->names_cp[1] = ecma_string_to_property_name (name_p, &name_type); first_property_pair_p->header.types[1] = (ecma_property_t) (type_and_flags | name_type); @@ -518,10 +511,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */ if (has_hashmap) { - ecma_property_hashmap_insert (object_p, - name_p, - first_property_pair_p, - 1); + ecma_property_hashmap_insert (object_p, name_p, first_property_pair_p, 1); } #endif /* JERRY_PROPERTY_HASHMAP */ @@ -542,8 +532,7 @@ ecma_create_named_data_property (ecma_object_t *object_p, /**< object */ * if this field is non-NULL */ { JERRY_ASSERT (object_p != NULL && name_p != NULL); - JERRY_ASSERT (ecma_is_lexical_environment (object_p) - || !ecma_op_object_is_fast_array (object_p)); + JERRY_ASSERT (ecma_is_lexical_environment (object_p) || !ecma_op_object_is_fast_array (object_p)); JERRY_ASSERT (ecma_find_named_property (object_p, name_p) == NULL); JERRY_ASSERT ((prop_attributes & ~ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_ENUMERABLE_WRITABLE) == 0); @@ -570,8 +559,7 @@ ecma_create_named_accessor_property (ecma_object_t *object_p, /**< object */ * if this field is non-NULL */ { JERRY_ASSERT (object_p != NULL && name_p != NULL); - JERRY_ASSERT (ecma_is_lexical_environment (object_p) - || !ecma_op_object_is_fast_array (object_p)); + JERRY_ASSERT (ecma_is_lexical_environment (object_p) || !ecma_op_object_is_fast_array (object_p)); JERRY_ASSERT (ecma_find_named_property (object_p, name_p) == NULL); JERRY_ASSERT ((prop_attributes & ~ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_ENUMERABLE) == 0); @@ -630,8 +618,7 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in { JERRY_ASSERT (obj_p != NULL); JERRY_ASSERT (name_p != NULL); - JERRY_ASSERT (ecma_is_lexical_environment (obj_p) - || !ecma_op_object_is_fast_array (obj_p)); + JERRY_ASSERT (ecma_is_lexical_environment (obj_p) || !ecma_op_object_is_fast_array (obj_p)); #if JERRY_LCACHE ecma_property_t *property_p = ecma_lcache_lookup (obj_p, name_p); @@ -648,17 +635,13 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in #if JERRY_PROPERTY_HASHMAP if (prop_iter_cp != JMEM_CP_NULL) { - ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - prop_iter_cp); + ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp); if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP) { jmem_cpointer_t property_real_name_cp; - property_p = ecma_property_hashmap_find ((ecma_property_hashmap_t *) prop_iter_p, - name_p, - &property_real_name_cp); + property_p = ecma_property_hashmap_find ((ecma_property_hashmap_t *) prop_iter_p, name_p, &property_real_name_cp); #if JERRY_LCACHE - if (property_p != NULL - && !ecma_is_property_lcached (property_p)) + if (property_p != NULL && !ecma_is_property_lcached (property_p)) { ecma_lcache_insert (obj_p, property_real_name_cp, property_p); } @@ -682,8 +665,7 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in while (prop_iter_cp != JMEM_CP_NULL) { - ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - prop_iter_cp); + ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp); JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p)); @@ -717,8 +699,7 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in { while (prop_iter_cp != JMEM_CP_NULL) { - ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - prop_iter_cp); + ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp); JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p)); @@ -763,8 +744,7 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in #endif /* JERRY_PROPERTY_HASHMAP */ #if JERRY_LCACHE - if (property_p != NULL - && !ecma_is_property_lcached (property_p)) + if (property_p != NULL && !ecma_is_property_lcached (property_p)) { ecma_lcache_insert (obj_p, property_name_cp, property_p); } @@ -788,8 +768,7 @@ ecma_get_named_data_property (ecma_object_t *obj_p, /**< object to find property { JERRY_ASSERT (obj_p != NULL); JERRY_ASSERT (name_p != NULL); - JERRY_ASSERT (ecma_is_lexical_environment (obj_p) - || !ecma_op_object_is_fast_array (obj_p)); + JERRY_ASSERT (ecma_is_lexical_environment (obj_p) || !ecma_op_object_is_fast_array (obj_p)); ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p); @@ -816,8 +795,7 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */ if (cur_prop_cp != JMEM_CP_NULL) { - ecma_property_header_t *cur_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - cur_prop_cp); + ecma_property_header_t *cur_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, cur_prop_cp); if (cur_prop_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP) { @@ -830,8 +808,7 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */ while (cur_prop_cp != JMEM_CP_NULL) { - ecma_property_header_t *cur_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - cur_prop_cp); + ecma_property_header_t *cur_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, cur_prop_cp); JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (cur_prop_p)); @@ -846,9 +823,7 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */ #if JERRY_PROPERTY_HASHMAP if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP) { - hashmap_status = ecma_property_hashmap_delete (object_p, - prop_pair_p->names_cp[i], - cur_prop_p->types + i); + hashmap_status = ecma_property_hashmap_delete (object_p, prop_pair_p->names_cp[i], cur_prop_p->types + i); } #endif /* JERRY_PROPERTY_HASHMAP */ @@ -988,8 +963,7 @@ ecma_set_named_accessor_property_getter (ecma_object_t *object_p, /**< the prope #if JERRY_CPOINTER_32_BIT ecma_getter_setter_pointers_t *getter_setter_pair_p; - getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, - prop_value_p->getter_setter_pair_cp); + getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp); ECMA_SET_POINTER (getter_setter_pair_p->getter_cp, getter_p); #else /* !JERRY_CPOINTER_32_BIT */ ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_cp, getter_p); @@ -1008,8 +982,7 @@ ecma_set_named_accessor_property_setter (ecma_object_t *object_p, /**< the prope #if JERRY_CPOINTER_32_BIT ecma_getter_setter_pointers_t *getter_setter_pair_p; - getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, - prop_value_p->getter_setter_pair_cp); + getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp); ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, setter_p); #else /* !JERRY_CPOINTER_32_BIT */ ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_cp, setter_p); @@ -1059,7 +1032,7 @@ ecma_property_to_reference (ecma_property_t *property_p) /**< data or reference * * @return pointer to the value */ -extern inline ecma_property_value_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_property_value_t *JERRY_ATTR_ALWAYS_INLINE ecma_get_property_value_from_named_reference (ecma_property_value_t *reference_p) /**< data property reference */ { ecma_value_t value = reference_p->value; @@ -1248,14 +1221,12 @@ ecma_free_property_descriptor (ecma_property_descriptor_t *prop_desc_p) /**< pro ecma_free_value (prop_desc_p->value); } - if ((prop_desc_p->flags & JERRY_PROP_IS_GET_DEFINED) - && prop_desc_p->get_p != NULL) + if ((prop_desc_p->flags & JERRY_PROP_IS_GET_DEFINED) && prop_desc_p->get_p != NULL) { ecma_deref_object (prop_desc_p->get_p); } - if ((prop_desc_p->flags & JERRY_PROP_IS_SET_DEFINED) - && prop_desc_p->set_p != NULL) + if ((prop_desc_p->flags & JERRY_PROP_IS_SET_DEFINED) && prop_desc_p->set_p != NULL) { ecma_deref_object (prop_desc_p->set_p); } @@ -1551,8 +1522,8 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */ for (uint32_t i = const_literal_end; i < literal_end; i++) { - ecma_compiled_code_t *bytecode_literal_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, - literal_start_p[i]); + ecma_compiled_code_t *bytecode_literal_p = + ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_start_p[i]); /* Self references are ignored. */ if (bytecode_literal_p != bytecode_p) @@ -1606,8 +1577,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */ { jerry_debugger_byte_code_free_t *first_byte_code_free_p; - first_byte_code_free_p = JMEM_CP_GET_NON_NULL_POINTER (jerry_debugger_byte_code_free_t, - byte_code_free_head); + first_byte_code_free_p = JMEM_CP_GET_NON_NULL_POINTER (jerry_debugger_byte_code_free_t, byte_code_free_head); first_byte_code_free_p->prev_cp = byte_code_free_cp; } @@ -1629,8 +1599,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */ #endif /* JERRY_BUILTIN_REGEXP */ } - jmem_heap_free_block (bytecode_p, - ((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG); + jmem_heap_free_block (bytecode_p, ((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG); } /* ecma_bytecode_deref */ /** @@ -1659,8 +1628,7 @@ ecma_script_get_from_value (ecma_value_t value) /**< compiled code */ if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_SCRIPT) { - bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, - ext_object_p->u.cls.u3.value); + bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value); break; } @@ -1687,8 +1655,8 @@ ecma_script_get_from_value (ecma_value_t value) /**< compiled code */ { ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p; - object_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, - ext_object_p->u.bound_function.target_function); + object_p = + ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_object_p->u.bound_function.target_function); continue; } #if JERRY_ESNEXT @@ -1741,7 +1709,7 @@ ecma_compiled_code_resolve_arguments_start (const ecma_compiled_code_t *bytecode * * @return position of the function name of the compiled code */ -extern inline ecma_value_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_value_t *JERRY_ATTR_ALWAYS_INLINE ecma_compiled_code_resolve_function_name (const ecma_compiled_code_t *bytecode_header_p) /**< compiled code */ { JERRY_ASSERT (bytecode_header_p != NULL); diff --git a/jerry-core/ecma/base/ecma-helpers.h b/jerry-core/ecma/base/ecma-helpers.h index f96d1e00..609cf62e 100644 --- a/jerry-core/ecma/base/ecma-helpers.h +++ b/jerry-core/ecma/base/ecma-helpers.h @@ -17,6 +17,7 @@ #define ECMA_HELPERS_H #include "ecma-globals.h" + #include "jmem.h" #include "lit-strings.h" @@ -47,8 +48,8 @@ * Set value of non-null compressed pointer so that it will correspond * to specified non_compressed_pointer. */ -#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) JMEM_CP_SET_NON_NULL_POINTER (field, \ - non_compressed_pointer) +#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) \ + JMEM_CP_SET_NON_NULL_POINTER (field, non_compressed_pointer) /** * Set value of pointer-tag value so that it will correspond @@ -88,42 +89,38 @@ */ typedef enum { - ECMA_STRING_FLAG_EMPTY = 0, /**< No options are provided. */ - ECMA_STRING_FLAG_IS_ASCII = (1 << 0), /**< The string contains only ASCII characters. */ + ECMA_STRING_FLAG_EMPTY = 0, /**< No options are provided. */ + ECMA_STRING_FLAG_IS_ASCII = (1 << 0), /**< The string contains only ASCII characters. */ ECMA_STRING_FLAG_REHASH_NEEDED = (1 << 1), /**< The hash of the string must be recalculated. * For more details see ecma_append_chars_to_string */ - ECMA_STRING_FLAG_IS_UINT32 = (1 << 2), /**< The string repesents an UINT32 number */ + ECMA_STRING_FLAG_IS_UINT32 = (1 << 2), /**< The string repesents an UINT32 number */ ECMA_STRING_FLAG_MUST_BE_FREED = (1 << 3), /**< The returned buffer must be freed */ } ecma_string_flag_t; /** * Underscore is ignored when this option is passed. */ - #define ECMA_CONVERSION_ALLOW_UNDERSCORE 0x1 +#define ECMA_CONVERSION_ALLOW_UNDERSCORE 0x1 /** * Convert ecma-string's contents to a cesu-8 string and put it into a buffer. */ -#define ECMA_STRING_TO_UTF8_STRING(ecma_str_ptr, /**< ecma string pointer */ \ - utf8_ptr, /**< [out] output buffer pointer */ \ +#define ECMA_STRING_TO_UTF8_STRING(ecma_str_ptr, /**< ecma string pointer */ \ + utf8_ptr, /**< [out] output buffer pointer */ \ utf8_str_size) /**< [out] output buffer size */ \ - lit_utf8_size_t utf8_str_size; \ - uint8_t utf8_ptr ## flags = ECMA_STRING_FLAG_EMPTY; \ - const lit_utf8_byte_t *utf8_ptr = ecma_string_get_chars (ecma_str_ptr, \ - &utf8_str_size, \ - NULL, \ - NULL, \ - &utf8_ptr ## flags); + lit_utf8_size_t utf8_str_size; \ + uint8_t utf8_ptr##flags = ECMA_STRING_FLAG_EMPTY; \ + const lit_utf8_byte_t *utf8_ptr = ecma_string_get_chars (ecma_str_ptr, &utf8_str_size, NULL, NULL, &utf8_ptr##flags); /** * Free the cesu-8 string buffer allocated by 'ECMA_STRING_TO_UTF8_STRING' */ #define ECMA_FINALIZE_UTF8_STRING(utf8_ptr, /**< pointer to character buffer */ \ - utf8_str_size) /**< buffer size */ \ - if (utf8_ptr ## flags & ECMA_STRING_FLAG_MUST_BE_FREED) \ - { \ - JERRY_ASSERT (utf8_ptr != NULL); \ - jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \ + utf8_str_size) /**< buffer size */ \ + if (utf8_ptr##flags & ECMA_STRING_FLAG_MUST_BE_FREED) \ + { \ + JERRY_ASSERT (utf8_ptr != NULL); \ + jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \ } #ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY @@ -131,64 +128,54 @@ typedef enum /** * Set an internal property value from pointer. */ -#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) \ - ((field) = ((ecma_value_t) pointer)) +#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) ((field) = ((ecma_value_t) pointer)) /** * Set an internal property value from pointer. Pointer can be NULL. */ -#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) \ - ((field) = ((ecma_value_t) pointer)) +#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) ((field) = ((ecma_value_t) pointer)) /** * Convert an internal property value to pointer. */ -#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \ - ((type *) field) +#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) ((type *) field) /** * Convert an internal property value to pointer. Result can be NULL. */ -#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) \ - ((type *) field) +#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) ((type *) field) /** * Checks whether an internal property is NULL. */ -#define ECMA_IS_INTERNAL_VALUE_NULL(field) \ - ((field) == ((ecma_value_t) NULL)) +#define ECMA_IS_INTERNAL_VALUE_NULL(field) ((field) == ((ecma_value_t) NULL)) #else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */ /** * Set an internal property value from pointer. */ -#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) \ - ECMA_SET_NON_NULL_POINTER (field, pointer) +#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) ECMA_SET_NON_NULL_POINTER (field, pointer) /** * Set an internal property value from pointer. Pointer can be NULL. */ -#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) \ - ECMA_SET_POINTER (field, pointer) +#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) ECMA_SET_POINTER (field, pointer) /** * Convert an internal property value to pointer. */ -#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \ - ECMA_GET_NON_NULL_POINTER (type, field) +#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) ECMA_GET_NON_NULL_POINTER (type, field) /** * Convert an internal property value to pointer. Result can be NULL. */ -#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) \ - ECMA_GET_POINTER (type, field) +#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) ECMA_GET_POINTER (type, field) /** * Checks whether an internal property is NULL. */ -#define ECMA_IS_INTERNAL_VALUE_NULL(field) \ - ((field) == ((ecma_value_t) JMEM_CP_NULL)) +#define ECMA_IS_INTERNAL_VALUE_NULL(field) ((field) == ((ecma_value_t) JMEM_CP_NULL)) #endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */ @@ -264,7 +251,7 @@ ecma_value_t JERRY_ATTR_PURE ecma_make_extended_primitive_value (const ecma_exte uint32_t type); ecma_integer_value_t JERRY_ATTR_CONST ecma_get_integer_from_value (ecma_value_t value); ecma_number_t JERRY_ATTR_PURE ecma_get_float_from_value (ecma_value_t value); -ecma_number_t * ecma_get_pointer_from_float_value (ecma_value_t value); +ecma_number_t *ecma_get_pointer_from_float_value (ecma_value_t value); ecma_number_t JERRY_ATTR_PURE ecma_get_number_from_value (ecma_value_t value); ecma_string_t JERRY_ATTR_PURE *ecma_get_string_from_value (ecma_value_t value); #if JERRY_ESNEXT @@ -299,14 +286,12 @@ ecma_length_t ecma_op_advance_string_index (ecma_string_t *str_p, ecma_length_t ecma_string_t *ecma_new_map_key_string (ecma_value_t value); bool ecma_prop_name_is_map_key (ecma_string_t *string_p); #endif /* JERRY_BUILTIN_CONTAINER */ -ecma_string_t *ecma_new_ecma_string_from_ascii (const lit_utf8_byte_t *string_p, - lit_utf8_size_t string_size); -ecma_string_t *ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, - lit_utf8_size_t string_size); +ecma_string_t *ecma_new_ecma_string_from_ascii (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size); +ecma_string_t *ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size); ecma_string_t *ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size); -ecma_string_t *ecma_new_ecma_external_string_from_cesu8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size, - void *user_p); +ecma_string_t * +ecma_new_ecma_external_string_from_cesu8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size, void *user_p); ecma_string_t *ecma_new_ecma_string_from_code_unit (ecma_char_t code_unit); #if JERRY_ESNEXT ecma_string_t *ecma_new_ecma_string_from_code_units (ecma_char_t first_code_unit, ecma_char_t second_code_unit); @@ -331,28 +316,24 @@ void ecma_destroy_ecma_string (ecma_string_t *string_p); ecma_number_t ecma_string_to_number (const ecma_string_t *str_p); uint32_t ecma_string_get_array_index (const ecma_string_t *str_p); -lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT -ecma_string_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p, - lit_utf8_byte_t *buffer_p, - lit_utf8_size_t buffer_size); -lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT -ecma_string_copy_to_utf8_buffer (const ecma_string_t *string_desc_p, - lit_utf8_byte_t *buffer_p, - lit_utf8_size_t buffer_size); -lit_utf8_size_t -ecma_substring_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p, - lit_utf8_size_t start_pos, - lit_utf8_size_t end_pos, - lit_utf8_byte_t *buffer_p, - lit_utf8_size_t buffer_size); -lit_utf8_size_t -ecma_substring_copy_to_utf8_buffer (const ecma_string_t *string_desc_p, - lit_utf8_size_t start_pos, - lit_utf8_size_t end_pos, - lit_utf8_byte_t *buffer_p, - lit_utf8_size_t buffer_size); -void ecma_string_to_utf8_bytes (const ecma_string_t *string_desc_p, lit_utf8_byte_t *buffer_p, - lit_utf8_size_t buffer_size); +lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT ecma_string_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p, + lit_utf8_byte_t *buffer_p, + lit_utf8_size_t buffer_size); +lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT ecma_string_copy_to_utf8_buffer (const ecma_string_t *string_desc_p, + lit_utf8_byte_t *buffer_p, + lit_utf8_size_t buffer_size); +lit_utf8_size_t ecma_substring_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p, + lit_utf8_size_t start_pos, + lit_utf8_size_t end_pos, + lit_utf8_byte_t *buffer_p, + lit_utf8_size_t buffer_size); +lit_utf8_size_t ecma_substring_copy_to_utf8_buffer (const ecma_string_t *string_desc_p, + lit_utf8_size_t start_pos, + lit_utf8_size_t end_pos, + lit_utf8_byte_t *buffer_p, + lit_utf8_size_t buffer_size); +void +ecma_string_to_utf8_bytes (const ecma_string_t *string_desc_p, lit_utf8_byte_t *buffer_p, lit_utf8_size_t buffer_size); const lit_utf8_byte_t *ecma_string_get_chars (const ecma_string_t *string_p, lit_utf8_size_t *size_p, lit_utf8_size_t *length_p, @@ -369,7 +350,8 @@ jmem_cpointer_t ecma_string_to_property_name (ecma_string_t *prop_name_p, ecma_p ecma_string_t *ecma_string_from_property_name (ecma_property_t property, jmem_cpointer_t prop_name_cp); lit_string_hash_t ecma_string_get_property_name_hash (ecma_property_t property, jmem_cpointer_t prop_name_cp); uint32_t ecma_string_get_property_index (ecma_property_t property, jmem_cpointer_t prop_name_cp); -bool ecma_string_compare_to_property_name (ecma_property_t property, jmem_cpointer_t prop_name_cp, +bool ecma_string_compare_to_property_name (ecma_property_t property, + jmem_cpointer_t prop_name_cp, const ecma_string_t *string_p); bool ecma_compare_ecma_strings (const ecma_string_t *string1_p, const ecma_string_t *string2_p); @@ -387,20 +369,16 @@ lit_string_hash_t ecma_string_hash (const ecma_string_t *string_p); ecma_string_t *ecma_string_substr (const ecma_string_t *string_p, lit_utf8_size_t start_pos, lit_utf8_size_t end_pos); const lit_utf8_byte_t *ecma_string_trim_front (const lit_utf8_byte_t *start_p, const lit_utf8_byte_t *end_p); const lit_utf8_byte_t *ecma_string_trim_back (const lit_utf8_byte_t *start_p, const lit_utf8_byte_t *end_p); -void ecma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p, - lit_utf8_size_t *utf8_str_size); +void ecma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p, lit_utf8_size_t *utf8_str_size); ecma_string_t *ecma_string_trim (const ecma_string_t *string_p); #if JERRY_ESNEXT -ecma_value_t ecma_string_pad (ecma_value_t original_string_p, - ecma_value_t max_length, - ecma_value_t fill_string, - bool pad_on_start); +ecma_value_t +ecma_string_pad (ecma_value_t original_string_p, ecma_value_t max_length, ecma_value_t fill_string, bool pad_on_start); #endif /* JERRY_ESNEXT */ ecma_stringbuilder_t ecma_stringbuilder_create (void); ecma_stringbuilder_t ecma_stringbuilder_create_from (ecma_string_t *string_p); -ecma_stringbuilder_t ecma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p, - const lit_utf8_size_t data_size); +ecma_stringbuilder_t ecma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p, const lit_utf8_size_t data_size); lit_utf8_size_t ecma_stringbuilder_get_size (ecma_stringbuilder_t *builder_p); lit_utf8_byte_t *ecma_stringbuilder_get_data (ecma_stringbuilder_t *builder_p); void ecma_stringbuilder_revert (ecma_stringbuilder_t *builder_p, const lit_utf8_size_t size); @@ -425,18 +403,15 @@ bool ecma_number_is_negative (ecma_number_t num); bool ecma_number_is_zero (ecma_number_t num); bool ecma_number_is_infinity (ecma_number_t num); bool ecma_number_is_finite (ecma_number_t num); -ecma_number_t -ecma_number_make_from_sign_mantissa_and_exponent (bool sign, uint64_t mantissa, int32_t exponent); +ecma_number_t ecma_number_make_from_sign_mantissa_and_exponent (bool sign, uint64_t mantissa, int32_t exponent); ecma_number_t ecma_number_get_prev (ecma_number_t num); ecma_number_t ecma_number_get_next (ecma_number_t num); ecma_number_t ecma_number_trunc (ecma_number_t num); ecma_number_t ecma_number_calc_remainder (ecma_number_t left_num, ecma_number_t right_num); ecma_number_t ecma_number_pow (ecma_number_t x, ecma_number_t y); -ecma_value_t ecma_number_parse_int (const lit_utf8_byte_t *string_buff, - lit_utf8_size_t string_buff_size, - ecma_value_t radix); -ecma_value_t ecma_number_parse_float (const lit_utf8_byte_t *string_buff, - lit_utf8_size_t string_buff_size); +ecma_value_t +ecma_number_parse_int (const lit_utf8_byte_t *string_buff, lit_utf8_size_t string_buff_size, ecma_value_t radix); +ecma_value_t ecma_number_parse_float (const lit_utf8_byte_t *string_buff, lit_utf8_size_t string_buff_size); ecma_value_t ecma_integer_multiply (ecma_integer_value_t left_integer, ecma_integer_value_t right_integer); lit_utf8_size_t ecma_number_to_decimal (ecma_number_t num, lit_utf8_byte_t *out_digits_p, int32_t *out_decimal_exp_p); @@ -476,30 +451,33 @@ ecma_lexical_environment_type_t JERRY_ATTR_PURE ecma_get_lex_env_type (const ecm ecma_object_t JERRY_ATTR_PURE *ecma_get_lex_env_binding_object (const ecma_object_t *object_p); ecma_object_t *ecma_clone_decl_lexical_environment (ecma_object_t *lex_env_p, bool copy_values); -ecma_property_value_t * -ecma_create_named_data_property (ecma_object_t *object_p, ecma_string_t *name_p, uint8_t prop_attributes, - ecma_property_t **out_prop_p); -ecma_property_value_t * -ecma_create_named_accessor_property (ecma_object_t *object_p, ecma_string_t *name_p, ecma_object_t *get_p, - ecma_object_t *set_p, uint8_t prop_attributes, ecma_property_t **out_prop_p); +ecma_property_value_t *ecma_create_named_data_property (ecma_object_t *object_p, + ecma_string_t *name_p, + uint8_t prop_attributes, + ecma_property_t **out_prop_p); +ecma_property_value_t *ecma_create_named_accessor_property (ecma_object_t *object_p, + ecma_string_t *name_p, + ecma_object_t *get_p, + ecma_object_t *set_p, + uint8_t prop_attributes, + ecma_property_t **out_prop_p); #if JERRY_MODULE_SYSTEM void ecma_create_named_reference_property (ecma_object_t *object_p, ecma_string_t *name_p, ecma_value_t reference); #endif /* JERRY_MODULE_SYSTEM */ -ecma_property_t * -ecma_find_named_property (ecma_object_t *obj_p, ecma_string_t *name_p); -ecma_property_value_t * -ecma_get_named_data_property (ecma_object_t *obj_p, ecma_string_t *name_p); +ecma_property_t *ecma_find_named_property (ecma_object_t *obj_p, ecma_string_t *name_p); +ecma_property_value_t *ecma_get_named_data_property (ecma_object_t *obj_p, ecma_string_t *name_p); void ecma_delete_property (ecma_object_t *object_p, ecma_property_value_t *prop_value_p); -void ecma_named_data_property_assign_value (ecma_object_t *obj_p, ecma_property_value_t *prop_value_p, - ecma_value_t value); +void +ecma_named_data_property_assign_value (ecma_object_t *obj_p, ecma_property_value_t *prop_value_p, ecma_value_t value); -ecma_getter_setter_pointers_t * -ecma_get_named_accessor_property (const ecma_property_value_t *prop_value_p); -void ecma_set_named_accessor_property_getter (ecma_object_t *object_p, ecma_property_value_t *prop_value_p, +ecma_getter_setter_pointers_t *ecma_get_named_accessor_property (const ecma_property_value_t *prop_value_p); +void ecma_set_named_accessor_property_getter (ecma_object_t *object_p, + ecma_property_value_t *prop_value_p, ecma_object_t *getter_p); -void ecma_set_named_accessor_property_setter (ecma_object_t *object_p, ecma_property_value_t *prop_value_p, +void ecma_set_named_accessor_property_setter (ecma_object_t *object_p, + ecma_property_value_t *prop_value_p, ecma_object_t *setter_p); #if JERRY_MODULE_SYSTEM ecma_value_t ecma_property_to_reference (ecma_property_t *property_p); @@ -549,15 +527,15 @@ uintptr_t ecma_get_current_stack_usage (void); #endif /* (JERRY_STACK_LIMIT != 0) */ /* ecma-helpers-external-pointers.c */ -bool ecma_create_native_pointer_property (ecma_object_t *obj_p, void *native_p, +bool ecma_create_native_pointer_property (ecma_object_t *obj_p, + void *native_p, const jerry_object_native_info_t *native_info_p); ecma_native_pointer_t *ecma_get_native_pointer_value (ecma_object_t *obj_p, const jerry_object_native_info_t *native_info_p); bool ecma_delete_native_pointer_property (ecma_object_t *obj_p, const jerry_object_native_info_t *native_info_p); /* ecma-helpers-conversion.c */ -ecma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, lit_utf8_size_t str_size, - uint32_t option); +ecma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, lit_utf8_size_t str_size, uint32_t option); lit_utf8_size_t ecma_uint32_to_utf8_string (uint32_t value, lit_utf8_byte_t *out_buffer_p, lit_utf8_size_t buffer_size); uint32_t ecma_number_to_uint32 (ecma_number_t num); int32_t ecma_number_to_int32 (ecma_number_t num); diff --git a/jerry-core/ecma/base/ecma-init-finalize.c b/jerry-core/ecma/base/ecma-init-finalize.c index 5ae409bf..acfb0422 100644 --- a/jerry-core/ecma/base/ecma-init-finalize.c +++ b/jerry-core/ecma/base/ecma-init-finalize.c @@ -13,14 +13,16 @@ * limitations under the License. */ +#include "ecma-init-finalize.h" + #include "ecma-builtins.h" #include "ecma-gc.h" #include "ecma-helpers.h" -#include "ecma-init-finalize.h" #include "ecma-lex-env.h" #include "ecma-literal-storage.h" -#include "jmem.h" + #include "jcontext.h" +#include "jmem.h" /** \addtogroup ecma ECMA * @{ @@ -89,8 +91,7 @@ ecma_finalize (void) { jerry_fatal (ERR_UNTERMINATED_GC_LOOPS); } - } - while (JERRY_CONTEXT (ecma_gc_new_objects) != 0); + } while (JERRY_CONTEXT (ecma_gc_new_objects) != 0); #if JERRY_ESNEXT jmem_cpointer_t *global_symbols_cp = JERRY_CONTEXT (global_symbols_cp); diff --git a/jerry-core/ecma/base/ecma-lcache.c b/jerry-core/ecma/base/ecma-lcache.c index e4e69ede..d1a52372 100644 --- a/jerry-core/ecma/base/ecma-lcache.c +++ b/jerry-core/ecma/base/ecma-lcache.c @@ -13,10 +13,12 @@ * limitations under the License. */ +#include "ecma-lcache.h" + #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-lcache.h" + #include "jcontext.h" /** \addtogroup ecma ECMA @@ -98,7 +100,7 @@ ecma_lcache_insert (const ecma_object_t *object_p, /**< object */ ECMA_SET_NON_NULL_POINTER (object_cp, object_p); size_t row_index = ecma_lcache_row_index (object_cp, name_cp); - ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache) [row_index]; + ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index]; ecma_lcache_hash_entry_t *entry_end_p = entry_p + ECMA_LCACHE_HASH_ROW_LENGTH; do @@ -109,8 +111,7 @@ ecma_lcache_insert (const ecma_object_t *object_p, /**< object */ } entry_p++; - } - while (entry_p < entry_end_p); + } while (entry_p < entry_end_p); /* Invalidate the last entry. */ ecma_lcache_invalidate_entry (--entry_p); @@ -136,7 +137,7 @@ insert: * @return a pointer to an ecma_property_t if the lookup is successful * NULL otherwise */ -extern inline ecma_property_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_property_t *JERRY_ATTR_ALWAYS_INLINE ecma_lcache_lookup (const ecma_object_t *object_p, /**< object */ const ecma_string_t *prop_name_p) /**< property's name */ { @@ -161,7 +162,7 @@ ecma_lcache_lookup (const ecma_object_t *object_p, /**< object */ size_t row_index = ecma_lcache_row_index (object_cp, prop_name_cp); - ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache) [row_index]; + ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index]; ecma_lcache_hash_entry_t *entry_end_p = entry_p + ECMA_LCACHE_HASH_ROW_LENGTH; ecma_lcache_hash_entry_id_t id = ECMA_LCACHE_CREATE_ID (object_cp, prop_name_cp); @@ -173,8 +174,7 @@ ecma_lcache_lookup (const ecma_object_t *object_p, /**< object */ return entry_p->prop_p; } entry_p++; - } - while (entry_p < entry_end_p); + } while (entry_p < entry_end_p); return NULL; } /* ecma_lcache_lookup */ @@ -195,12 +195,12 @@ ecma_lcache_invalidate (const ecma_object_t *object_p, /**< object */ ECMA_SET_NON_NULL_POINTER (object_cp, object_p); size_t row_index = ecma_lcache_row_index (object_cp, name_cp); - ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache) [row_index]; + ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index]; while (true) { /* The property must be present. */ - JERRY_ASSERT (entry_p - JERRY_CONTEXT (lcache) [row_index] < ECMA_LCACHE_HASH_ROW_LENGTH); + JERRY_ASSERT (entry_p - JERRY_CONTEXT (lcache)[row_index] < ECMA_LCACHE_HASH_ROW_LENGTH); if (entry_p->id != 0 && entry_p->prop_p == prop_p) { diff --git a/jerry-core/ecma/base/ecma-lcache.h b/jerry-core/ecma/base/ecma-lcache.h index dbea603d..818e410b 100644 --- a/jerry-core/ecma/base/ecma-lcache.h +++ b/jerry-core/ecma/base/ecma-lcache.h @@ -23,6 +23,8 @@ * @{ */ +#include "ecma-globals.h" + #if JERRY_LCACHE void ecma_lcache_insert (const ecma_object_t *object_p, const jmem_cpointer_t name_cp, ecma_property_t *prop_p); ecma_property_t *ecma_lcache_lookup (const ecma_object_t *object_p, const ecma_string_t *prop_name_p); diff --git a/jerry-core/ecma/base/ecma-line-info.c b/jerry-core/ecma/base/ecma-line-info.c index 6678d9cb..db561c46 100644 --- a/jerry-core/ecma/base/ecma-line-info.c +++ b/jerry-core/ecma/base/ecma-line-info.c @@ -13,9 +13,10 @@ * limitations under the License. */ -#include "ecma-helpers.h" #include "ecma-line-info.h" +#include "ecma-helpers.h" + #if JERRY_LINE_INFO /** \addtogroup ecma ECMA @@ -45,8 +46,7 @@ ecma_line_info_decode_vlq (uint8_t **buffer_p) /**< [in/out] target buffer */ do { value = (value << ECMA_LINE_INFO_VLQ_SHIFT) | (*source_p & ECMA_LINE_INFO_VLQ_MASK); - } - while (*source_p++ & ECMA_LINE_INFO_VLQ_CONTINUE); + } while (*source_p++ & ECMA_LINE_INFO_VLQ_CONTINUE); *buffer_p = source_p; return value; @@ -169,8 +169,7 @@ ecma_line_info_get (uint8_t *line_info_p, /**< line info buffer */ column = ecma_line_info_difference_update (column, value); end_offset += end_offset_increase; - } - while (end_offset_increase != 0 && end_offset <= offset); + } while (end_offset_increase != 0 && end_offset <= offset); location_p->line = line; location_p->column = column; diff --git a/jerry-core/ecma/base/ecma-line-info.h b/jerry-core/ecma/base/ecma-line-info.h index 0402f979..f2094018 100644 --- a/jerry-core/ecma/base/ecma-line-info.h +++ b/jerry-core/ecma/base/ecma-line-info.h @@ -90,8 +90,7 @@ /** * Minimum size of a stream (except the last one). */ -#define ECMA_LINE_INFO_STREAM_SIZE_MIN \ - ((2 * ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX) - 1) +#define ECMA_LINE_INFO_STREAM_SIZE_MIN ((2 * ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX) - 1) /* Helper functions for parser/js/js-parser-line-info-create.c. */ uint32_t ecma_line_info_decode_vlq (uint8_t **buffer_p); @@ -99,8 +98,7 @@ uint32_t ecma_line_info_difference_update (uint32_t current_value, uint32_t diff /* General functions. */ void ecma_line_info_free (uint8_t *line_info_p); -void ecma_line_info_get (uint8_t *line_info_p, uint32_t offset, - jerry_backtrace_location_t *location_p); +void ecma_line_info_get (uint8_t *line_info_p, uint32_t offset, jerry_backtrace_location_t *location_p); #if JERRY_PARSER_DUMP_BYTE_CODE void ecma_line_info_dump (uint8_t *line_info_p); diff --git a/jerry-core/ecma/base/ecma-literal-storage.c b/jerry-core/ecma/base/ecma-literal-storage.c index 37fd9bb4..5e69b00d 100644 --- a/jerry-core/ecma/base/ecma-literal-storage.c +++ b/jerry-core/ecma/base/ecma-literal-storage.c @@ -13,11 +13,13 @@ * limitations under the License. */ +#include "ecma-literal-storage.h" + #include "ecma-alloc.h" -#include "ecma-bigint.h" #include "ecma-big-uint.h" -#include "ecma-literal-storage.h" +#include "ecma-bigint.h" #include "ecma-helpers.h" + #include "jcontext.h" /** \addtogroup ecma ECMA @@ -42,8 +44,7 @@ ecma_free_symbol_list (jmem_cpointer_t symbol_list_cp) /**< symbol list */ { if (symbol_list_p->values[i] != JMEM_CP_NULL) { - ecma_string_t *string_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, - symbol_list_p->values[i]); + ecma_string_t *string_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, symbol_list_p->values[i]); JERRY_ASSERT (ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)); ecma_deref_ecma_string (string_p); @@ -71,8 +72,7 @@ ecma_free_string_list (jmem_cpointer_t string_list_cp) /**< string list */ { if (string_list_p->values[i] != JMEM_CP_NULL) { - ecma_string_t *string_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, - string_list_p->values[i]); + ecma_string_t *string_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, string_list_p->values[i]); JERRY_ASSERT (ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)); ecma_destroy_ecma_string (string_p); @@ -93,8 +93,7 @@ ecma_free_number_list (jmem_cpointer_t number_list_cp) /**< number list */ { while (number_list_cp != JMEM_CP_NULL) { - ecma_lit_storage_item_t *number_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, - number_list_cp); + ecma_lit_storage_item_t *number_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, number_list_cp); for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++) { @@ -120,15 +119,14 @@ ecma_free_bigint_list (jmem_cpointer_t bigint_list_cp) /**< bigint list */ { while (bigint_list_cp != JMEM_CP_NULL) { - ecma_lit_storage_item_t *bigint_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, - bigint_list_cp); + ecma_lit_storage_item_t *bigint_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, bigint_list_cp); for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++) { if (bigint_list_p->values[i] != JMEM_CP_NULL) { - ecma_extended_primitive_t *bigint_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_extended_primitive_t, - bigint_list_p->values[i]); + ecma_extended_primitive_t *bigint_p = + JMEM_CP_GET_NON_NULL_POINTER (ecma_extended_primitive_t, bigint_list_p->values[i]); JERRY_ASSERT (ECMA_EXTENDED_PRIMITIVE_IS_REF_EQUALS_TO_ONE (bigint_p)); ecma_deref_bigint (bigint_p); } @@ -168,8 +166,8 @@ ecma_find_or_create_literal_string (const lit_utf8_byte_t *chars_p, /**< string lit_utf8_size_t size, /**< size of the string */ bool is_ascii) /**< encode of the string */ { - ecma_string_t *string_p = (is_ascii ? ecma_new_ecma_string_from_ascii (chars_p, size) - : ecma_new_ecma_string_from_utf8 (chars_p, size)); + ecma_string_t *string_p = + (is_ascii ? ecma_new_ecma_string_from_ascii (chars_p, size) : ecma_new_ecma_string_from_utf8 (chars_p, size)); if (ECMA_IS_DIRECT_STRING (string_p)) { @@ -194,8 +192,7 @@ ecma_find_or_create_literal_string (const lit_utf8_byte_t *chars_p, /**< string } else { - ecma_string_t *value_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, - string_list_p->values[i]); + ecma_string_t *value_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, string_list_p->values[i]); if (ecma_compare_ecma_strings (string_p, value_p)) { @@ -256,8 +253,7 @@ ecma_find_or_create_literal_number (ecma_number_t number_arg) /**< number to be while (number_list_cp != JMEM_CP_NULL) { - ecma_lit_storage_item_t *number_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, - number_list_cp); + ecma_lit_storage_item_t *number_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, number_list_cp); for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++) { @@ -270,8 +266,7 @@ ecma_find_or_create_literal_number (ecma_number_t number_arg) /**< number to be } else { - ecma_number_t *number_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_number_t, - number_list_p->values[i]); + ecma_number_t *number_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_number_t, number_list_p->values[i]); if (*number_p == number_arg) { @@ -330,8 +325,7 @@ ecma_find_or_create_literal_bigint (ecma_value_t bigint) /**< bigint to be searc while (bigint_list_cp != JMEM_CP_NULL) { - ecma_lit_storage_item_t *bigint_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, - bigint_list_cp); + ecma_lit_storage_item_t *bigint_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, bigint_list_cp); for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++) { @@ -344,8 +338,8 @@ ecma_find_or_create_literal_bigint (ecma_value_t bigint) /**< bigint to be searc } else { - ecma_extended_primitive_t *other_bigint_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_extended_primitive_t, - bigint_list_p->values[i]); + ecma_extended_primitive_t *other_bigint_p = + JMEM_CP_GET_NON_NULL_POINTER (ecma_extended_primitive_t, bigint_list_p->values[i]); ecma_value_t other_bigint = ecma_make_extended_primitive_value (other_bigint_p, ECMA_TYPE_BIGINT); if (ecma_bigint_is_equal_to_bigint (bigint, other_bigint)) @@ -417,8 +411,9 @@ ecma_find_or_create_literal_bigint (ecma_value_t bigint) /**< bigint to be searc /** * Append the value at the end of the appropriate list if it is not present there. */ -void ecma_save_literals_append_value (ecma_value_t value, /**< value to be appended */ - ecma_collection_t *lit_pool_p) /**< list of known values */ +void +ecma_save_literals_append_value (ecma_value_t value, /**< value to be appended */ + ecma_collection_t *lit_pool_p) /**< list of known values */ { /* Unlike direct numbers, direct strings are converted to character literals. */ if (!ecma_is_value_string (value) @@ -498,11 +493,9 @@ ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_ for (uint32_t i = const_literal_end; i < literal_end; i++) { - ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, - literal_p[i]); + ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_p[i]); - if (CBC_IS_FUNCTION (bytecode_p->status_flags) - && bytecode_p != compiled_code_p) + if (CBC_IS_FUNCTION (bytecode_p->status_flags) && bytecode_p != compiled_code_p) { ecma_save_literals_add_compiled_code (bytecode_p, lit_pool_p); } diff --git a/jerry-core/ecma/base/ecma-literal-storage.h b/jerry-core/ecma/base/ecma-literal-storage.h index d9cf6b28..6850a868 100644 --- a/jerry-core/ecma/base/ecma-literal-storage.h +++ b/jerry-core/ecma/base/ecma-literal-storage.h @@ -17,6 +17,7 @@ #define ECMA_LIT_STORAGE_H #include "ecma-globals.h" + #include "jmem.h" #include "lit-globals.h" @@ -48,18 +49,19 @@ ecma_value_t ecma_find_or_create_literal_bigint (ecma_value_t bigint); #if JERRY_SNAPSHOT_SAVE void ecma_save_literals_append_value (ecma_value_t value, ecma_collection_t *lit_pool_p); -void ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, - ecma_collection_t *lit_pool_p); -bool ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p, uint32_t *buffer_p, size_t buffer_size, - size_t *in_out_buffer_offset_p, lit_mem_to_snapshot_id_map_entry_t **out_map_p, +void ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, ecma_collection_t *lit_pool_p); +bool ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p, + uint32_t *buffer_p, + size_t buffer_size, + size_t *in_out_buffer_offset_p, + lit_mem_to_snapshot_id_map_entry_t **out_map_p, uint32_t *out_map_len_p); #endif /* JERRY_SNAPSHOT_SAVE */ #if JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE -ecma_value_t -ecma_snapshot_get_literal (const uint8_t *literal_base_p, ecma_value_t literal_value); -ecma_value_t * -ecma_snapshot_resolve_serializable_values (const ecma_compiled_code_t *compiled_code_p, uint8_t *byte_code_end_p); +ecma_value_t ecma_snapshot_get_literal (const uint8_t *literal_base_p, ecma_value_t literal_value); +ecma_value_t *ecma_snapshot_resolve_serializable_values (const ecma_compiled_code_t *compiled_code_p, + uint8_t *byte_code_end_p); #endif /* JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE */ /** diff --git a/jerry-core/ecma/base/ecma-module.c b/jerry-core/ecma/base/ecma-module.c index 878e9a73..fdff9031 100644 --- a/jerry-core/ecma/base/ecma-module.c +++ b/jerry-core/ecma/base/ecma-module.c @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "jcontext.h" +#include "ecma-module.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" @@ -21,8 +21,9 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-lex-env.h" -#include "ecma-module.h" #include "ecma-objects.h" + +#include "jcontext.h" #include "lit-char-helpers.h" #include "vm.h" @@ -104,15 +105,15 @@ ecma_module_set_error_state (ecma_module_t *module_p) /**< module */ { module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_ERROR; - if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL - && !jcontext_has_pending_abort ()) + if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL && !jcontext_has_pending_abort ()) { jerry_value_t exception = jcontext_take_exception (); - JERRY_CONTEXT (module_state_changed_callback_p) (JERRY_MODULE_STATE_ERROR, - ecma_make_object_value (&module_p->header.object), - exception, - JERRY_CONTEXT (module_state_changed_callback_user_p)); + JERRY_CONTEXT (module_state_changed_callback_p) + (JERRY_MODULE_STATE_ERROR, + ecma_make_object_value (&module_p->header.object), + exception, + JERRY_CONTEXT (module_state_changed_callback_user_p)); jcontext_raise_exception (exception); } } /* ecma_module_set_error_state */ @@ -122,7 +123,7 @@ ecma_module_set_error_state (ecma_module_t *module_p) /**< module */ * * @return module pointer */ -static inline ecma_module_t * JERRY_ATTR_ALWAYS_INLINE +static inline ecma_module_t *JERRY_ATTR_ALWAYS_INLINE ecma_module_get_from_object (ecma_value_t module_val) /**< module */ { JERRY_ASSERT (ecma_is_value_object (module_val)); @@ -210,8 +211,7 @@ ecma_module_resolve_set_append (ecma_module_resolve_set_t *set_p, /**< resolve s while (true) { - if (current_p->module_p == module_p - && ecma_compare_ecma_strings (current_p->name_p, export_name_p)) + if (current_p->module_p == module_p && ecma_compare_ecma_strings (current_p->name_p, export_name_p)) { return false; } @@ -339,16 +339,14 @@ ecma_module_resolve_import (ecma_module_resolve_result_t *resolve_result_p, /**< { JERRY_ASSERT (import_node_p != NULL); - for (ecma_module_names_t *import_names_p = import_node_p->module_names_p; - import_names_p != NULL; + for (ecma_module_names_t *import_names_p = import_node_p->module_names_p; import_names_p != NULL; import_names_p = import_names_p->next_p) { if (ecma_compare_ecma_strings (local_name_p, import_names_p->local_name_p)) { ecma_module_t *imported_module_p = ecma_module_get_from_object (import_node_p->u.path_or_module); - if (ecma_compare_ecma_string_to_magic_id (import_names_p->imex_name_p, - LIT_MAGIC_STRING_ASTERIX_CHAR)) + if (ecma_compare_ecma_string_to_magic_id (import_names_p->imex_name_p, LIT_MAGIC_STRING_ASTERIX_CHAR)) { /* Namespace import. */ ecma_value_t namespace = ecma_make_object_value (imported_module_p->namespace_object_p); @@ -401,19 +399,18 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */ if (current_module_p->header.u.cls.u2.module_flags & ECMA_MODULE_HAS_NAMESPACE) { - ecma_property_t *property_p = ecma_find_named_property (current_module_p->namespace_object_p, - current_export_name_p); + ecma_property_t *property_p = + ecma_find_named_property (current_module_p->namespace_object_p, current_export_name_p); if (property_p != NULL) { ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p); - JERRY_ASSERT ((!(*property_p & ECMA_PROPERTY_FLAG_DATA) - && !(property_value_p->value & ECMA_MODULE_NAMESPACE_RESULT_FLAG)) - || ((*property_p & ECMA_PROPERTY_FLAG_DATA) - && ecma_is_value_object (property_value_p->value) - && ecma_object_class_is (ecma_get_object_from_value (property_value_p->value), - ECMA_OBJECT_CLASS_MODULE_NAMESPACE))); + JERRY_ASSERT ( + (!(*property_p & ECMA_PROPERTY_FLAG_DATA) && !(property_value_p->value & ECMA_MODULE_NAMESPACE_RESULT_FLAG)) + || ((*property_p & ECMA_PROPERTY_FLAG_DATA) && ecma_is_value_object (property_value_p->value) + && ecma_object_class_is (ecma_get_object_from_value (property_value_p->value), + ECMA_OBJECT_CLASS_MODULE_NAMESPACE))); if (!ecma_module_resolve_update (resolve_result_p, property_value_p->value)) { @@ -432,8 +429,8 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */ { if (ecma_compare_ecma_strings (current_export_name_p, export_names_p->imex_name_p)) { - ecma_property_t *property_p = ecma_find_named_property (current_module_p->scope_p, - export_names_p->local_name_p); + ecma_property_t *property_p = + ecma_find_named_property (current_module_p->scope_p, export_names_p->local_name_p); if (property_p != NULL) { @@ -473,8 +470,7 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */ { ecma_module_t *target_module_p = ecma_module_get_from_object (*indirect_export_p->u.module_object_p); - if (ecma_compare_ecma_string_to_magic_id (export_names_p->local_name_p, - LIT_MAGIC_STRING_ASTERIX_CHAR)) + if (ecma_compare_ecma_string_to_magic_id (export_names_p->local_name_p, LIT_MAGIC_STRING_ASTERIX_CHAR)) { /* Namespace export. */ ecma_value_t namespace = ecma_make_object_value (target_module_p->namespace_object_p); @@ -525,10 +521,9 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */ star_export_p = star_export_p->next_p; } -next_iteration: + next_iteration: current_set_p = current_set_p->next_p; - } - while (current_set_p != NULL); + } while (current_set_p != NULL); exit: ecma_module_resolve_set_cleanup (resolve_set_p); @@ -586,10 +581,11 @@ ecma_module_evaluate (ecma_module_t *module_p) /**< module */ if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL) { - JERRY_CONTEXT (module_state_changed_callback_p) (JERRY_MODULE_STATE_EVALUATED, - ecma_make_object_value (&module_p->header.object), - ret_value, - JERRY_CONTEXT (module_state_changed_callback_user_p)); + JERRY_CONTEXT (module_state_changed_callback_p) + (JERRY_MODULE_STATE_EVALUATED, + ecma_make_object_value (&module_p->header.object), + ret_value, + JERRY_CONTEXT (module_state_changed_callback_user_p)); } } else @@ -746,8 +742,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */ #if JERRY_PROPERTY_HASHMAP if (prop_iter_cp != JMEM_CP_NULL) { - ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - prop_iter_cp); + ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp); if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP) { prop_iter_cp = prop_iter_p->next_property_cp; @@ -802,8 +797,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */ } export_names_p = export_names_p->next_p; - } - while (export_names_p != NULL); + } while (export_names_p != NULL); } ecma_module_node_t *indirect_export_p = current_module_p->indirect_exports_p; @@ -848,8 +842,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */ } current_set_p = current_set_p->next_p; - } - while (current_set_p != NULL); + } while (current_set_p != NULL); ecma_value_t *buffer_p = properties_p->buffer_p; uint32_t item_count = properties_p->item_count; @@ -863,8 +856,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */ { end -= 2; ecma_module_heap_sort_shift_down (buffer_p, item_count, end); - } - while (end > 0); + } while (end > 0); end = item_count - 2; @@ -880,8 +872,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */ ecma_module_heap_sort_shift_down (buffer_p, end, 0); end -= 2; - } - while (end > 0); + } while (end > 0); } ecma_value_t *buffer_end_p = properties_p->buffer_p + item_count; @@ -989,15 +980,12 @@ ecma_module_connect_imports (ecma_module_t *module_p) while (import_names_p != NULL) { - if (ecma_compare_ecma_string_to_magic_id (import_names_p->imex_name_p, - LIT_MAGIC_STRING_ASTERIX_CHAR)) + if (ecma_compare_ecma_string_to_magic_id (import_names_p->imex_name_p, LIT_MAGIC_STRING_ASTERIX_CHAR)) { /* Namespace import. */ ecma_property_value_t *value_p; - value_p = ecma_create_named_data_property (module_p->scope_p, - import_names_p->local_name_p, - ECMA_PROPERTY_FIXED, - NULL); + value_p = + ecma_create_named_data_property (module_p->scope_p, import_names_p->local_name_p, ECMA_PROPERTY_FIXED, NULL); value_p->value = ecma_make_object_value (imported_module_p->namespace_object_p); } else @@ -1021,9 +1009,7 @@ ecma_module_connect_imports (ecma_module_t *module_p) } else { - ecma_create_named_reference_property (module_p->scope_p, - import_names_p->local_name_p, - resolve_result.result); + ecma_create_named_reference_property (module_p->scope_p, import_names_p->local_name_p, resolve_result.result); } } @@ -1253,9 +1239,8 @@ restart: if (current_module_p->namespace_object_p == NULL) { - ecma_object_t *namespace_object_p = ecma_create_object (NULL, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *namespace_object_p = + ecma_create_object (NULL, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); namespace_object_p->type_flags_refs &= (ecma_object_descriptor_t) ~ECMA_OBJECT_FLAG_EXTENSIBLE; @@ -1297,8 +1282,7 @@ restart: } iterator_p = iterator_p->prev_p; - } - while (iterator_p != end_p); + } while (iterator_p != end_p); iterator_p = last_p; @@ -1313,8 +1297,7 @@ restart: } iterator_p = iterator_p->prev_p; - } - while (iterator_p != end_p); + } while (iterator_p != end_p); do { @@ -1325,16 +1308,16 @@ restart: if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL) { - JERRY_CONTEXT (module_state_changed_callback_p) (JERRY_MODULE_STATE_LINKED, - ecma_make_object_value (&last_p->module_p->header.object), - ECMA_VALUE_UNDEFINED, - JERRY_CONTEXT (module_state_changed_callback_user_p)); + JERRY_CONTEXT (module_state_changed_callback_p) + (JERRY_MODULE_STATE_LINKED, + ecma_make_object_value (&last_p->module_p->header.object), + ECMA_VALUE_UNDEFINED, + JERRY_CONTEXT (module_state_changed_callback_user_p)); } jmem_heap_free_block (last_p, sizeof (ecma_module_stack_item_t)); last_p = prev_p; - } - while (last_p != end_p); + } while (last_p != end_p); if (current_p == NULL) { @@ -1357,8 +1340,7 @@ error: jmem_heap_free_block (last_p, sizeof (ecma_module_stack_item_t)); last_p = prev_p; - } - while (last_p != NULL); + } while (last_p != NULL); return ECMA_VALUE_ERROR; } /* ecma_module_link */ @@ -1397,8 +1379,7 @@ ecma_module_import (ecma_value_t specifier, /**< module specifier */ goto error; } - if (ecma_is_value_object (result) - && ecma_is_promise (ecma_get_object_from_value (result))) + if (ecma_is_value_object (result) && ecma_is_promise (ecma_get_object_from_value (result))) { return result; } diff --git a/jerry-core/ecma/base/ecma-module.h b/jerry-core/ecma/base/ecma-module.h index 1a590e29..dd76f57c 100644 --- a/jerry-core/ecma/base/ecma-module.h +++ b/jerry-core/ecma/base/ecma-module.h @@ -16,9 +16,10 @@ #ifndef ECMA_MODULE_H #define ECMA_MODULE_H -#include "common.h" #include "ecma-globals.h" +#include "common.h" + #if JERRY_MODULE_SYSTEM #define ECMA_MODULE_MAX_PATH 255u @@ -40,8 +41,8 @@ typedef enum typedef struct ecma_module_names { struct ecma_module_names *next_p; /**< next linked list node */ - ecma_string_t *imex_name_p; /**< Import/export name of the item */ - ecma_string_t *local_name_p; /**< Local name of the item */ + ecma_string_t *imex_name_p; /**< Import/export name of the item */ + ecma_string_t *local_name_p; /**< Local name of the item */ } ecma_module_names_t; /** @@ -54,19 +55,19 @@ typedef struct ecma_module_names typedef struct ecma_module { /* Note: state is stored in header.u.class_prop.extra_info */ - ecma_extended_object_t header; /**< header part */ + ecma_extended_object_t header; /**< header part */ /* TODO(dbatyai): These could be compressed pointers */ - ecma_object_t *scope_p; /**< lexical lenvironment of the module */ - ecma_object_t *namespace_object_p; /**< namespace object of the module */ - struct ecma_module_node *imports_p; /**< import requests of the module */ - ecma_module_names_t *local_exports_p; /**< local exports of the module */ - struct ecma_module_node *indirect_exports_p; /**< indirect exports of the module */ - struct ecma_module_node *star_exports_p; /**< star exports of the module */ + ecma_object_t *scope_p; /**< lexical lenvironment of the module */ + ecma_object_t *namespace_object_p; /**< namespace object of the module */ + struct ecma_module_node *imports_p; /**< import requests of the module */ + ecma_module_names_t *local_exports_p; /**< local exports of the module */ + struct ecma_module_node *indirect_exports_p; /**< indirect exports of the module */ + struct ecma_module_node *star_exports_p; /**< star exports of the module */ /* Code used for evaluating a module */ union { - ecma_compiled_code_t *compiled_code_p; /**< compiled code for the module */ + ecma_compiled_code_t *compiled_code_p; /**< compiled code for the module */ jerry_native_module_evaluate_callback_t callback; /**< callback for evaluating native modules */ } u; } ecma_module_t; @@ -98,8 +99,8 @@ typedef struct ecma_module_node typedef struct ecma_module_resolve_set { struct ecma_module_resolve_set *next_p; /**< next in linked list */ - ecma_module_t *module_p; /**< module */ - ecma_string_t *name_p; /**< identifier name */ + ecma_module_t *module_p; /**< module */ + ecma_string_t *name_p; /**< identifier name */ } ecma_module_resolve_set_t; /** @@ -108,17 +109,15 @@ typedef struct ecma_module_resolve_set typedef struct ecma_module_resolve_stack { struct ecma_module_resolve_stack *next_p; /**< next in linked list */ - ecma_module_t *module_p; /**< module request */ - ecma_string_t *export_name_p; /**< export identifier name */ - bool resolving; /**< flag storing wether the current frame started resolving */ + ecma_module_t *module_p; /**< module request */ + ecma_string_t *export_name_p; /**< export identifier name */ + bool resolving; /**< flag storing wether the current frame started resolving */ } ecma_module_resolve_stack_t; ecma_value_t ecma_module_initialize (ecma_module_t *module_p); ecma_module_t *ecma_module_get_resolved_module (ecma_value_t module_val); -ecma_value_t ecma_module_link (ecma_module_t *module_p, - jerry_module_resolve_callback_t callback_p, - void *user_p); +ecma_value_t ecma_module_link (ecma_module_t *module_p, jerry_module_resolve_callback_t callback_p, void *user_p); ecma_value_t ecma_module_evaluate (ecma_module_t *module_p); ecma_value_t ecma_module_import (ecma_value_t specifier, ecma_value_t user_value); diff --git a/jerry-core/ecma/base/ecma-property-hashmap.c b/jerry-core/ecma/base/ecma-property-hashmap.c index 1c80de4f..370b1fc7 100644 --- a/jerry-core/ecma/base/ecma-property-hashmap.c +++ b/jerry-core/ecma/base/ecma-property-hashmap.c @@ -13,11 +13,13 @@ * limitations under the License. */ +#include "ecma-property-hashmap.h" + #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-property-hashmap.h" -#include "jrt-libc-includes.h" + #include "jcontext.h" +#include "jrt-libc-includes.h" /** \addtogroup ecma ECMA * @{ @@ -42,28 +44,26 @@ /** * Stepping values for searching items in the hashmap. */ -static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS] JERRY_ATTR_CONST_DATA = -{ +static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS] JERRY_ATTR_CONST_DATA = { 3, 5, 7, 11, 13, 17, 19, 23 }; /** * Get the value of a bit in a bitmap. */ -#define ECMA_PROPERTY_HASHMAP_GET_BIT(byte_p, index) \ - ((byte_p)[(index) >> 3] & (1 << ((index) & 0x7))) +#define ECMA_PROPERTY_HASHMAP_GET_BIT(byte_p, index) ((byte_p)[(index) >> 3] & (1 << ((index) &0x7))) /** * Clear the value of a bit in a bitmap. */ #define ECMA_PROPERTY_HASHMAP_CLEAR_BIT(byte_p, index) \ - ((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] & ~(1 << ((index) & 0x7)))) + ((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] & ~(1 << ((index) &0x7)))) /** * Set the value of a bit in a bitmap. */ #define ECMA_PROPERTY_HASHMAP_SET_BIT(byte_p, index) \ - ((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] | (1 << ((index) & 0x7)))) + ((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] | (1 << ((index) &0x7)))) /** * Create a new property hashmap for the object. @@ -156,8 +156,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */ ecma_property_pair_t *property_pair_p = (ecma_property_pair_t *) prop_iter_p; - uint32_t entry_index = ecma_string_get_property_name_hash (prop_iter_p->types[i], - property_pair_p->names_cp[i]); + uint32_t entry_index = ecma_string_get_property_name_hash (prop_iter_p->types[i], property_pair_p->names_cp[i]); uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)]; entry_index &= mask; @@ -202,8 +201,8 @@ ecma_property_hashmap_free (ecma_object_t *object_p) /**< object */ /* Property hash must be exists and must be the first property. */ JERRY_ASSERT (object_p->u1.property_list_cp != JMEM_CP_NULL); - ecma_property_header_t *property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, - object_p->u1.property_list_cp); + ecma_property_header_t *property_p = + ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, object_p->u1.property_list_cp); JERRY_ASSERT (property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP); @@ -211,8 +210,7 @@ ecma_property_hashmap_free (ecma_object_t *object_p) /**< object */ object_p->u1.property_list_cp = property_p->next_property_cp; - jmem_heap_free_block (hashmap_p, - ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count)); + jmem_heap_free_block (hashmap_p, ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count)); } /* ecma_property_hashmap_free */ /** @@ -226,8 +224,8 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */ { JERRY_ASSERT (property_pair_p != NULL); - ecma_property_hashmap_t *hashmap_p = ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t, - object_p->u1.property_list_cp); + ecma_property_hashmap_t *hashmap_p = + ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t, object_p->u1.property_list_cp); JERRY_ASSERT (hashmap_p->header.types[0] == ECMA_PROPERTY_TYPE_HASHMAP); @@ -300,8 +298,8 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */ jmem_cpointer_t name_cp, /**< property name */ ecma_property_t *property_p) /**< property */ { - ecma_property_hashmap_t *hashmap_p = ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t, - object_p->u1.property_list_cp); + ecma_property_hashmap_t *hashmap_p = + ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t, object_p->u1.property_list_cp); JERRY_ASSERT (hashmap_p->header.types[0] == ECMA_PROPERTY_TYPE_HASHMAP); @@ -337,8 +335,8 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */ offset = 1; } - ecma_property_pair_t *property_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, - pair_list_p[entry_index]); + ecma_property_pair_t *property_pair_p = + ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]); if ((property_pair_p->header.types + offset) == property_p) { @@ -393,9 +391,7 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */ { if (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[i])) { - if (ecma_string_compare_to_property_name (prop_iter_p->types[i], - prop_pair_p->names_cp[i], - name_p)) + if (ecma_string_compare_to_property_name (prop_iter_p->types[i], prop_pair_p->names_cp[i], name_p)) { /* Property is found */ property_found = true; @@ -437,8 +433,8 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */ offset = 1; } - ecma_property_pair_t *property_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, - pair_list_p[entry_index]); + ecma_property_pair_t *property_pair_p = + ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]); ecma_property_t *property_p = property_pair_p->header.types + offset; @@ -486,8 +482,8 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */ offset = 1; } - ecma_property_pair_t *property_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, - pair_list_p[entry_index]); + ecma_property_pair_t *property_pair_p = + ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]); ecma_property_t *property_p = property_pair_p->header.types + offset; diff --git a/jerry-core/ecma/base/ecma-property-hashmap.h b/jerry-core/ecma/base/ecma-property-hashmap.h index 8aafd24c..265075e9 100644 --- a/jerry-core/ecma/base/ecma-property-hashmap.h +++ b/jerry-core/ecma/base/ecma-property-hashmap.h @@ -16,6 +16,8 @@ #ifndef ECMA_PROPERTY_HASHMAP_H #define ECMA_PROPERTY_HASHMAP_H +#include "ecma-globals.h" + /** \addtogroup ecma ECMA * @{ * @@ -67,12 +69,15 @@ typedef enum void ecma_property_hashmap_create (ecma_object_t *object_p); void ecma_property_hashmap_free (ecma_object_t *object_p); -void ecma_property_hashmap_insert (ecma_object_t *object_p, ecma_string_t *name_p, - ecma_property_pair_t *property_pair_p, int property_index); -ecma_property_hashmap_delete_status ecma_property_hashmap_delete (ecma_object_t *object_p, jmem_cpointer_t name_cp, - ecma_property_t *property_p); +void ecma_property_hashmap_insert (ecma_object_t *object_p, + ecma_string_t *name_p, + ecma_property_pair_t *property_pair_p, + int property_index); +ecma_property_hashmap_delete_status +ecma_property_hashmap_delete (ecma_object_t *object_p, jmem_cpointer_t name_cp, ecma_property_t *property_p); -ecma_property_t *ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, ecma_string_t *name_p, +ecma_property_t *ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, + ecma_string_t *name_p, jmem_cpointer_t *property_real_name_cp); #endif /* JERRY_PROPERTY_HASHMAP */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c index 3fe7ff1b..84956daf 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c @@ -22,6 +22,7 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" + #include "jrt.h" #if JERRY_ESNEXT @@ -30,7 +31,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-aggregateerror-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID aggregate_error_prototype +#define BUILTIN_UNDERSCORED_ID aggregate_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h index e5fa5d49..f03cb638 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h @@ -25,19 +25,13 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_AGGREGATE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_AGGREGATE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c index c2df08bf..e1c25618 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c @@ -14,19 +14,20 @@ */ #include "ecma-alloc.h" +#include "ecma-array-object.h" +#include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtin-helpers.h" -#include "ecma-objects.h" -#include "ecma-function-object.h" #include "ecma-iterator-object.h" -#include "ecma-array-object.h" -#include "jrt.h" +#include "ecma-objects.h" + #include "jcontext.h" +#include "jrt.h" #if JERRY_ESNEXT @@ -34,7 +35,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-aggregateerror.inc.h" -#define BUILTIN_UNDERSCORED_ID aggregate_error +#define BUILTIN_UNDERSCORED_ID aggregate_error #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h index 475efac0..c343b41d 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h @@ -24,21 +24,15 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 2, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED) -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c index 203a826c..3c0c49bd 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c @@ -13,11 +13,11 @@ * limitations under the License. */ +#include "ecma-arraybuffer-object.h" #include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-iterator-object.h" #include "ecma-typedarray-object.h" -#include "ecma-arraybuffer-object.h" #if JERRY_ESNEXT @@ -39,7 +39,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-iterator-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID array_iterator_prototype +#define BUILTIN_UNDERSCORED_ID array_iterator_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -130,10 +130,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t index = (ecma_length_t) (ecma_get_number_from_value (index_value) + 1); } - ecma_value_t put_result = ecma_op_object_put (obj_p, - prop_name_p, - ecma_make_length_value (index), - true); + ecma_value_t put_result = ecma_op_object_put (obj_p, prop_name_p, ecma_make_length_value (index), true); JERRY_ASSERT (ecma_is_value_true (put_result)); @@ -183,8 +180,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t /* 17.b */ ecma_value_t entry_array_value; - entry_array_value = ecma_create_array_from_iter_element (get_value, - ecma_make_length_value (index)); + entry_array_value = ecma_create_array_from_iter_element (get_value, ecma_make_length_value (index)); result = ecma_create_iter_result_object (entry_array_value, ECMA_VALUE_FALSE); ecma_free_value (entry_array_value); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h index aa4f4179..1338fb44 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h @@ -21,9 +21,7 @@ #if JERRY_ESNEXT -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c index ff99558f..2caad899 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c @@ -22,7 +22,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-prototype-unscopables.inc.h" -#define BUILTIN_UNDERSCORED_ID array_prototype_unscopables +#define BUILTIN_UNDERSCORED_ID array_prototype_unscopables #include "ecma-builtin-internal-routines-template.inc.h" #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h index 932c3d4c..d4d79db8 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h @@ -21,49 +21,27 @@ #if JERRY_ESNEXT -SIMPLE_VALUE (LIT_MAGIC_STRING_AT, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_AT, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) -SIMPLE_VALUE (LIT_MAGIC_STRING_COPY_WITHIN, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_COPY_WITHIN, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) -SIMPLE_VALUE (LIT_MAGIC_STRING_ENTRIES, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_ENTRIES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) -SIMPLE_VALUE (LIT_MAGIC_STRING_FILL, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_FILL, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) -SIMPLE_VALUE (LIT_MAGIC_STRING_FIND, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_FIND, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) -SIMPLE_VALUE (LIT_MAGIC_STRING_FIND_INDEX, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_FIND_INDEX, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) -SIMPLE_VALUE (LIT_MAGIC_STRING_FLAT, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_FLAT, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) -SIMPLE_VALUE (LIT_MAGIC_STRING_FLATMAP, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_FLATMAP, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) -SIMPLE_VALUE (LIT_MAGIC_STRING_INCLUDES, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_INCLUDES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) -SIMPLE_VALUE (LIT_MAGIC_STRING_KEYS, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_KEYS, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) -SIMPLE_VALUE (LIT_MAGIC_STRING_VALUES, - ECMA_VALUE_TRUE, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_VALUES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE) #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c index cc064f76..70cad898 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c @@ -26,8 +26,9 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" -#include "lit-char-helpers.h" + #include "jrt.h" +#include "lit-char-helpers.h" #if JERRY_BUILTIN_ARRAY @@ -45,7 +46,7 @@ enum { ECMA_ARRAY_PROTOTYPE_ROUTINE_START = 0, - /* Note: these 2 routine ids must be in this order */ +/* Note: these 2 routine ids must be in this order */ #if !JERRY_ESNEXT ECMA_ARRAY_PROTOTYPE_TO_STRING, #endif /* !JERRY_ESNEXT */ @@ -85,7 +86,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID array_prototype +#define BUILTIN_UNDERSCORED_ID array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -109,15 +110,12 @@ ecma_builtin_array_prototype_helper_set_length (ecma_object_t *object, /**< obje ecma_number_t length) /**< new length */ { ecma_value_t length_value = ecma_make_number_value (length); - ecma_value_t ret_value = ecma_op_object_put (object, - ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), - length_value, - true); + ecma_value_t ret_value = + ecma_op_object_put (object, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), length_value, true); ecma_free_value (length_value); - JERRY_ASSERT (ecma_is_value_boolean (ret_value) - || ecma_is_value_empty (ret_value) + JERRY_ASSERT (ecma_is_value_boolean (ret_value) || ecma_is_value_empty (ret_value) || ECMA_IS_VALUE_ERROR (ret_value)); return ret_value; } /* ecma_builtin_array_prototype_helper_set_length */ @@ -202,9 +200,8 @@ ecma_builtin_array_prototype_object_concat (const ecma_value_t args[], /**< argu ecma_length_t new_length = 0; /* 5.b - 5.c for this_arg */ - ecma_value_t concat_this_value = ecma_builtin_helper_array_concat_value (new_array_p, - &new_length, - ecma_make_object_value (obj_p)); + ecma_value_t concat_this_value = + ecma_builtin_helper_array_concat_value (new_array_p, &new_length, ecma_make_object_value (obj_p)); if (ECMA_IS_VALUE_ERROR (concat_this_value)) { ecma_deref_object (new_array_p); @@ -227,8 +224,8 @@ ecma_builtin_array_prototype_object_concat (const ecma_value_t args[], /**< argu JERRY_ASSERT (ecma_is_value_empty (concat_value)); } - ecma_value_t set_length_value = ecma_builtin_array_prototype_helper_set_length (new_array_p, - ((ecma_number_t) new_length)); + ecma_value_t set_length_value = + ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) new_length)); if (ECMA_IS_VALUE_ERROR (set_length_value)) { ecma_deref_object (new_array_p); @@ -279,8 +276,7 @@ ecma_op_array_get_to_string_at_index (ecma_object_t *obj_p, /**< this object */ return NULL; } - if (ecma_is_value_undefined (index_value) - || ecma_is_value_null (index_value)) + if (ecma_is_value_undefined (index_value) || ecma_is_value_null (index_value)) { return ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY); } @@ -370,7 +366,7 @@ static ecma_value_t ecma_builtin_array_prototype_object_pop (ecma_object_t *obj_p, /**< object */ ecma_length_t len) /**< object's length */ { - /* 4. */ + /* 4. */ if (len == 0) { /* 4.a */ @@ -523,14 +519,12 @@ ecma_builtin_array_prototype_object_reverse (ecma_value_t this_arg, /**< this ar ecma_object_t *obj_p, /**< object */ ecma_length_t len) /**< object's length */ { - if (ecma_op_object_is_fast_array (obj_p)) { uint32_t middle = (uint32_t) len / 2; ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p; - if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE - && len != 0) + if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0) { ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp); @@ -674,7 +668,7 @@ ecma_builtin_array_prototype_object_reverse (ecma_value_t this_arg, /**< this ar ret_value = ECMA_VALUE_EMPTY; -clean_up: + clean_up: ecma_free_value (upper_value); ecma_free_value (lower_value); ecma_deref_ecma_string (lower_str_p); @@ -714,8 +708,7 @@ ecma_builtin_array_prototype_object_shift (ecma_object_t *obj_p, /**< object */ { ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p; - if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE - && len != 0) + if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0) { ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp); ecma_value_t ret_value = buffer_p[0]; @@ -817,9 +810,7 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t arg1, /**< start */ ecma_length_t start = 0, end = len; /* 5. 6.*/ - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg1, - len, - &start))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg1, len, &start))) { return ECMA_VALUE_ERROR; } @@ -832,9 +823,7 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t arg1, /**< start */ else { /* 7. part 2, 8.*/ - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg2, - len, - &end))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg2, len, &end))) { return ECMA_VALUE_ERROR; } @@ -946,10 +935,7 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t arg1, /**< start */ #else /* !JERRY_ESNEXT */ const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE; #endif /* JERRY_ESNEXT */ - put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, - n, - get_value, - prop_flags); + put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, n, get_value, prop_flags); ecma_free_value (get_value); #if JERRY_ESNEXT @@ -1057,10 +1043,7 @@ ecma_builtin_array_prototype_object_sort_compare_helper (ecma_value_t lhs, /**< ecma_value_t compare_args[] = { lhs, rhs }; - ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p, - ECMA_VALUE_UNDEFINED, - compare_args, - 2); + ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p, ECMA_VALUE_UNDEFINED, compare_args, 2); if (ECMA_IS_VALUE_ERROR (call_value)) { return call_value; @@ -1178,11 +1161,8 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum if (copied_num > 1) { const ecma_builtin_helper_sort_compare_fn_t sort_cb = &ecma_builtin_array_prototype_object_sort_compare_helper; - ecma_value_t sort_value = ecma_builtin_helper_array_merge_sort_helper (values_buffer, - (uint32_t) (copied_num), - arg1, - sort_cb, - NULL); + ecma_value_t sort_value = + ecma_builtin_helper_array_merge_sort_helper (values_buffer, (uint32_t) (copied_num), arg1, sort_cb, NULL); if (ECMA_IS_VALUE_ERROR (sort_value)) { goto clean_up; @@ -1271,9 +1251,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu if (args_number > 0) { /* ES5.1: 6, ES11: 4. */ - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[0], - len, - &actual_start))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[0], len, &actual_start))) { return ECMA_VALUE_ERROR; } @@ -1295,8 +1273,8 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu } /* ES5.1: 7 */ - actual_delete_count = (ecma_length_t) (JERRY_MIN (JERRY_MAX (delete_num, 0), - (ecma_number_t) (len - actual_start))); + actual_delete_count = + (ecma_length_t) (JERRY_MIN (JERRY_MAX (delete_num, 0), (ecma_number_t) (len - actual_start))); } } @@ -1344,10 +1322,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE; #endif /* JERRY_ESNEXT */ - ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, - k, - from_present, - prop_flags); + ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, k, from_present, prop_flags); ecma_free_value (from_present); #if JERRY_ESNEXT @@ -1364,8 +1339,8 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu #if JERRY_ESNEXT /* ES11: 12. */ - ecma_value_t set_length = ecma_builtin_array_prototype_helper_set_length (new_array_p, - ((ecma_number_t) actual_delete_count)); + ecma_value_t set_length = + ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) actual_delete_count)); if (ECMA_IS_VALUE_ERROR (set_length)) { @@ -1465,10 +1440,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu uint32_t idx = 0; for (uint32_t arg_index = 2; arg_index < args_number; arg_index++, idx++) { - ecma_value_t put_value = ecma_op_object_put_by_index (obj_p, - actual_start + idx, - args[arg_index], - true); + ecma_value_t put_value = ecma_op_object_put_by_index (obj_p, actual_start + idx, args[arg_index], true); if (ECMA_IS_VALUE_ERROR (put_value)) { @@ -1506,13 +1478,11 @@ ecma_builtin_array_prototype_object_unshift (const ecma_value_t args[], /**< arg ecma_object_t *obj_p, /**< object */ ecma_length_t len) /**< object's length */ { - if (ecma_op_object_is_fast_array (obj_p)) { ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p; - if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE - && len != 0) + if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0) { if (args_number > UINT32_MAX - len) { @@ -1730,8 +1700,7 @@ ecma_builtin_array_prototype_object_index_of (const ecma_value_t args[], /**< ar } /* 9.b.i, 9.b.ii */ - if (ecma_is_value_found (get_value) - && ecma_op_strict_equality_compare (args[0], get_value)) + if (ecma_is_value_found (get_value) && ecma_op_strict_equality_compare (args[0], get_value)) { ecma_free_value (get_value); return ecma_make_length_value (from_idx); @@ -1822,7 +1791,7 @@ ecma_builtin_array_prototype_object_last_index_of (const ecma_value_t args[], /* } } - /* 8. */ + /* 8. */ while (from_idx < len) { /* 8.a */ @@ -1834,8 +1803,7 @@ ecma_builtin_array_prototype_object_last_index_of (const ecma_value_t args[], /* } /* 8.b.i, 8.b.ii */ - if (ecma_is_value_found (get_value) - && ecma_op_strict_equality_compare (search_element, get_value)) + if (ecma_is_value_found (get_value) && ecma_op_strict_equality_compare (search_element, get_value)) { ecma_free_value (get_value); return ecma_make_length_value (from_idx); @@ -2023,10 +1991,7 @@ ecma_builtin_array_prototype_object_map (ecma_value_t arg1, /**< callbackfn */ #else /* !JERRY_ESNEXT */ const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE; #endif /* JERRY_ESNEXT */ - put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, - index, - mapped_value, - prop_flags); + put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, index, mapped_value, prop_flags); ecma_free_value (mapped_value); ecma_free_value (current_value); @@ -2124,10 +2089,7 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t arg1, /**< callbackfn * if (ecma_op_to_boolean (call_value)) { ecma_value_t put_comp; - put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, - new_array_index, - get_value, - prop_flags); + put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, new_array_index, get_value, prop_flags); #if JERRY_ESNEXT if (ECMA_IS_VALUE_ERROR (put_comp)) { @@ -2206,8 +2168,7 @@ ecma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's argu k_present = true; /* 8.b.ii-iii */ - ecma_value_t current_value = ecma_op_object_find_by_index (obj_p, start_from_left ? index - : last_index - index); + ecma_value_t current_value = ecma_op_object_find_by_index (obj_p, start_from_left ? index : last_index - index); if (ECMA_IS_VALUE_ERROR (current_value)) { @@ -2253,12 +2214,9 @@ ecma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's argu { /* 9.c.i, 9.c.ii */ current_index = ecma_make_length_value (corrected_index); - ecma_value_t call_args[] = {accumulator, current_value, current_index, ecma_make_object_value (obj_p)}; + ecma_value_t call_args[] = { accumulator, current_value, current_index, ecma_make_object_value (obj_p) }; - ecma_value_t call_value = ecma_op_function_call (func_object_p, - ECMA_VALUE_UNDEFINED, - call_args, - 4); + ecma_value_t call_value = ecma_op_function_call (func_object_p, ECMA_VALUE_UNDEFINED, call_args, 4); ecma_free_value (current_index); ecma_free_value (accumulator); ecma_free_value (current_value); @@ -2298,9 +2256,7 @@ ecma_builtin_array_prototype_fill (ecma_value_t value, /**< value */ ecma_length_t k, final; /* 5. 6. 7. */ - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (start_val, - len, - &k))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (start_val, len, &k))) { return ECMA_VALUE_ERROR; } @@ -2313,9 +2269,7 @@ ecma_builtin_array_prototype_fill (ecma_value_t value, /**< value */ else { /* 8 part 2, 9, 10 */ - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (end_val, - len, - &final))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (end_val, len, &final))) { return ECMA_VALUE_ERROR; } @@ -2728,7 +2682,7 @@ ecma_builtin_array_flatten_into_array (ecma_value_t target, /**< target will con { /* i-ii. */ ecma_value_t source_val = ecma_make_length_value (source_index); - ecma_value_t args[] = {element, source_val, ecma_make_object_value (source)}; + ecma_value_t args[] = { element, source_val, ecma_make_object_value (source) }; ecma_value_t temp_element = ecma_op_function_call (ecma_get_object_from_value (mapped_value), thisArg, args, 3); ecma_free_value (element); @@ -2787,10 +2741,8 @@ ecma_builtin_array_flatten_into_array (ecma_value_t target, /**< target will con /* vi. */ const uint32_t flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW; - ecma_value_t element_temp = ecma_builtin_helper_def_prop_by_index (ecma_get_object_from_value (target), - target_index, - element, - flags); + ecma_value_t element_temp = + ecma_builtin_helper_def_prop_by_index (ecma_get_object_from_value (target), target_index, element, flags); ecma_free_value (element); @@ -2885,13 +2837,8 @@ ecma_builtin_array_prototype_object_flat_map (ecma_value_t callback, /**< callba } /* 5. */ - ecma_value_t flatten_val = ecma_builtin_array_flatten_into_array (ecma_make_object_value (new_array_p), - obj_p, - len, - 0, - 1, - callback, - this_arg); + ecma_value_t flatten_val = + ecma_builtin_array_flatten_into_array (ecma_make_object_value (new_array_p), obj_p, len, 0, 1, callback, this_arg); if (ECMA_IS_VALUE_ERROR (flatten_val)) { ecma_deref_object (new_array_p); @@ -2937,16 +2884,11 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< #endif /* !JERRY_ESNEXT */ if (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_SORT) { - ret_value = ecma_builtin_array_prototype_object_sort (this_arg, - arguments_list_p[0], - obj_p); - + ret_value = ecma_builtin_array_prototype_object_sort (this_arg, arguments_list_p[0], obj_p); } else if (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_CONCAT) { - ret_value = ecma_builtin_array_prototype_object_concat (arguments_list_p, - arguments_number, - obj_p); + ret_value = ecma_builtin_array_prototype_object_concat (arguments_list_p, arguments_number, obj_p); } ecma_deref_object (obj_p); @@ -3004,10 +2946,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< } case ECMA_ARRAY_PROTOTYPE_PUSH: { - ret_value = ecma_builtin_array_prototype_object_push (arguments_list_p, - arguments_number, - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_push (arguments_list_p, arguments_number, obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_REVERSE: @@ -3022,49 +2961,32 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< } case ECMA_ARRAY_PROTOTYPE_SLICE: { - ret_value = ecma_builtin_array_prototype_object_slice (arguments_list_p[0], - arguments_list_p[1], - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_slice (arguments_list_p[0], arguments_list_p[1], obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_SPLICE: { - ret_value = ecma_builtin_array_prototype_object_splice (arguments_list_p, - arguments_number, - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_splice (arguments_list_p, arguments_number, obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_UNSHIFT: { - ret_value = ecma_builtin_array_prototype_object_unshift (arguments_list_p, - arguments_number, - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_unshift (arguments_list_p, arguments_number, obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_AT: { - ret_value = ecma_builtin_array_prototype_object_at (arguments_list_p[0], - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_at (arguments_list_p[0], obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_INDEX_OF: { - ret_value = ecma_builtin_array_prototype_object_index_of (arguments_list_p, - arguments_number, - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_index_of (arguments_list_p, arguments_number, obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_LAST_INDEX_OF: { - ret_value = ecma_builtin_array_prototype_object_last_index_of (arguments_list_p, - arguments_number, - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_last_index_of (arguments_list_p, arguments_number, obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_EVERY: @@ -3080,10 +3002,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< } case ECMA_ARRAY_PROTOTYPE_MAP: { - ret_value = ecma_builtin_array_prototype_object_map (arguments_list_p[0], - arguments_list_p[1], - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_map (arguments_list_p[0], arguments_list_p[1], obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_REDUCE: @@ -3099,10 +3018,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< #if JERRY_ESNEXT case ECMA_ARRAY_PROTOTYPE_COPY_WITHIN: { - ret_value = ecma_builtin_array_prototype_object_copy_within (arguments_list_p, - arguments_number, - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_copy_within (arguments_list_p, arguments_number, obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_FIND: @@ -3126,26 +3042,18 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< } case ECMA_ARRAY_PROTOTYPE_INCLUDES: { - ret_value = ecma_builtin_array_prototype_includes (arguments_list_p, - arguments_number, - obj_p, - length); + ret_value = ecma_builtin_array_prototype_includes (arguments_list_p, arguments_number, obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_FLAT: { - ret_value = ecma_builtin_array_prototype_object_flat (arguments_list_p, - arguments_number, - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_flat (arguments_list_p, arguments_number, obj_p, length); break; } case ECMA_ARRAY_PROTOTYPE_FLATMAP: { - ret_value = ecma_builtin_array_prototype_object_flat_map (arguments_list_p[0], - arguments_list_p[1], - obj_p, - length); + ret_value = + ecma_builtin_array_prototype_object_flat_map (arguments_list_p[0], arguments_list_p[1], obj_p, length); break; } #endif /* JERRY_ESNEXT */ @@ -3153,10 +3061,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< { JERRY_ASSERT (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_FILTER); - ret_value = ecma_builtin_array_prototype_object_filter (arguments_list_p[0], - arguments_list_p[1], - obj_p, - length); + ret_value = ecma_builtin_array_prototype_object_filter (arguments_list_p[0], arguments_list_p[1], obj_p, length); break; } } diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.inc.h index 387c3a48..4ca296af 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.inc.h @@ -25,9 +25,7 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.4.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #if JERRY_ESNEXT /* ECMA-262 v6, 22.1.3.31 */ @@ -40,9 +38,7 @@ OBJECT_VALUE (LIT_GLOBAL_SYMBOL_UNSCOPABLES, * (property name, object pointer getter) */ /* ECMA-262 v5, 15.4.4 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FLAG_WRITABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_WRITABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ @@ -82,11 +78,12 @@ ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_ARRAY_PROTOTYPE_KEYS, 0, 0) ROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_ARRAY_PROTOTYPE_INCLUDES, NON_FIXED, 1) ROUTINE (LIT_MAGIC_STRING_FLAT, ECMA_ARRAY_PROTOTYPE_FLAT, 1, 0) ROUTINE (LIT_MAGIC_STRING_FLATMAP, ECMA_ARRAY_PROTOTYPE_FLATMAP, 2, 1) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL, +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES, + LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES, LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES, +INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, + LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array.c index 399c88d0..469ad114 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array.c @@ -14,8 +14,9 @@ */ #include "ecma-alloc.h" -#include "ecma-builtins.h" +#include "ecma-array-object.h" #include "ecma-builtin-helpers.h" +#include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" @@ -24,7 +25,7 @@ #include "ecma-helpers.h" #include "ecma-iterator-object.h" #include "ecma-objects.h" -#include "ecma-array-object.h" + #include "jcontext.h" #include "jrt.h" @@ -53,7 +54,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-array.inc.h" -#define BUILTIN_UNDERSCORED_ID array +#define BUILTIN_UNDERSCORED_ID array #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -185,10 +186,8 @@ ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */ { /* 6.g.iv.1 */ ecma_value_t len_value = ecma_make_uint32_value (k); - ecma_value_t set_status = ecma_op_object_put (array_obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), - len_value, - true); + ecma_value_t set_status = + ecma_op_object_put (array_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len_value, true); ecma_free_value (len_value); /* 6.g.iv.2 */ @@ -255,7 +254,7 @@ ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */ k++; } -iterator_cleanup: + iterator_cleanup: ecma_free_value (iterator); ecma_free_value (next_method); ecma_deref_object (array_obj_p); @@ -376,10 +375,8 @@ iterator_cleanup: /* 17. */ len_value = ecma_make_length_value (k); - ecma_value_t set_status = ecma_op_object_put (array_obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), - len_value, - true); + ecma_value_t set_status = + ecma_op_object_put (array_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len_value, true); ecma_free_value (len_value); /* 18. */ @@ -420,10 +417,8 @@ ecma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */ ecma_value_t len = ecma_make_uint32_value (arguments_list_len); - ecma_value_t ret_val = ecma_op_function_construct (ecma_get_object_from_value (this_arg), - ecma_get_object_from_value (this_arg), - &len, - 1); + ecma_value_t ret_val = + ecma_op_function_construct (ecma_get_object_from_value (this_arg), ecma_get_object_from_value (this_arg), &len, 1); if (ECMA_IS_VALUE_ERROR (ret_val)) { @@ -437,10 +432,8 @@ ecma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */ while (k < arguments_list_len) { - ecma_value_t define_status = ecma_builtin_helper_def_prop_by_index (obj_p, - k, - arguments_list_p[k], - prop_status_flags); + ecma_value_t define_status = + ecma_builtin_helper_def_prop_by_index (obj_p, k, arguments_list_p[k], prop_status_flags); if (ECMA_IS_VALUE_ERROR (define_status)) { @@ -452,10 +445,7 @@ ecma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */ k++; } - ret_val = ecma_op_object_put (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), - len, - true); + ret_val = ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len, true); ecma_free_value (len); @@ -482,8 +472,7 @@ ecma_builtin_array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - if (arguments_list_len != 1 - || !ecma_is_value_number (arguments_list_p[0])) + if (arguments_list_len != 1 || !ecma_is_value_number (arguments_list_p[0])) { return ecma_op_new_array_object_from_buffer (arguments_list_p, arguments_list_len); } @@ -514,8 +503,8 @@ ecma_builtin_array_dispatch_construct (const ecma_value_t *arguments_list_p, /** #if !JERRY_ESNEXT return ecma_builtin_array_dispatch_call (arguments_list_p, arguments_list_len); #else /* JERRY_ESNEXT */ - ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), - ECMA_BUILTIN_ID_ARRAY_PROTOTYPE); + ecma_object_t *proto_p = + ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_ARRAY_PROTOTYPE); if (proto_p == NULL) { diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-array.inc.h index 5a031fab..19f8b731 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array.inc.h @@ -25,21 +25,15 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.4.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, ECMA_PROPERTY_FIXED) /* Number properties: * (property name, object pointer getter) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_ARRAY_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ARRAY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ /* Routine properties: @@ -50,9 +44,7 @@ ROUTINE (LIT_MAGIC_STRING_FROM, ECMA_ARRAY_ROUTINE_FROM, NON_FIXED, 1) ROUTINE (LIT_MAGIC_STRING_OF, ECMA_ARRAY_ROUTINE_OF, NON_FIXED, 0) /* ECMA-262 v6, 22.1.2.5 */ -ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, - ECMA_ARRAY_ROUTINE_SPECIES_GET, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ECMA_ARRAY_ROUTINE_SPECIES_GET, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #endif /* !(JERRY_BUILTIN_ARRAY) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c index 1ce2a1a6..d1aee322 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c @@ -13,6 +13,7 @@ * limitations under the License. */ +#include "ecma-arraybuffer-object.h" #include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" @@ -22,9 +23,9 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-objects.h" -#include "ecma-arraybuffer-object.h" -#include "jrt.h" + #include "jrt-libc-includes.h" +#include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -32,7 +33,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-arraybuffer-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID arraybuffer_prototype +#define BUILTIN_UNDERSCORED_ID arraybuffer_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h index 6d77ed25..80463446 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h @@ -24,9 +24,7 @@ /* Object properties: * (property name, object pointer getter) */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_ARRAYBUFFER, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* Readonly accessor properties */ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL, @@ -34,9 +32,7 @@ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 24.1.4.4 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_ARRAY_BUFFER_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c index 0cc315f5..1ad9d9bf 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c @@ -13,14 +13,15 @@ * limitations under the License. */ +#include "ecma-arraybuffer-object.h" #include "ecma-builtins.h" +#include "ecma-dataview-object.h" #include "ecma-exceptions.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-arraybuffer-object.h" -#include "ecma-dataview-object.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -29,7 +30,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-arraybuffer.inc.h" -#define BUILTIN_UNDERSCORED_ID arraybuffer +#define BUILTIN_UNDERSCORED_ID arraybuffer #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h index 0c05b869..6fe1a936 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h @@ -24,20 +24,14 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE, ECMA_PROPERTY_FIXED) -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_ARRAY_BUFFER_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ @@ -46,9 +40,7 @@ STRING_VALUE (LIT_MAGIC_STRING_NAME, ROUTINE (LIT_MAGIC_STRING_IS_VIEW_UL, ecma_builtin_arraybuffer_object_is_view, 1, 1) /* ES2015 24.1.3.3 */ -ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, - ecma_builtin_arraybuffer_species_get, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_arraybuffer_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c index 1c25e172..0f2c5552 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c @@ -13,6 +13,8 @@ * limitations under the License. */ +#include "jerryscript-types.h" + #include "ecma-builtin-handlers.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" @@ -23,8 +25,8 @@ #include "ecma-iterator-object.h" #include "ecma-objects.h" #include "ecma-promise-object.h" + #include "jcontext.h" -#include "jerryscript-types.h" #include "jrt.h" #include "lit-magic-strings.h" #include "lit-strings.h" @@ -37,8 +39,8 @@ #include "ecma-builtins-internal.h" /** - * This object has a custom dispatch function. - */ + * This object has a custom dispatch function. + */ #define BUILTIN_CUSTOM_DISPATCH /** @@ -53,7 +55,7 @@ enum } ecma_async_from_sync_iterator_operation_type_t; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-from-sync-iterator-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID async_from_sync_iterator_prototype +#define BUILTIN_UNDERSCORED_ID async_from_sync_iterator_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -146,9 +148,8 @@ ecma_builtin_async_from_sync_iterator_prototype_next (ecma_async_from_sync_itera ecma_value_t value) /**< routine's 'value' argument */ { /* 5. */ - ecma_value_t next_result = ecma_op_iterator_next (iter_p->header.u.cls.u3.sync_iterator, - iter_p->sync_next_method, - value); + ecma_value_t next_result = + ecma_op_iterator_next (iter_p->header.u.cls.u3.sync_iterator, iter_p->sync_next_method, value); /* 6. */ if (ECMA_IS_VALUE_ERROR (ecma_op_if_abrupt_reject_promise (&next_result, capability_p))) @@ -224,10 +225,8 @@ ecma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterato } /* 7.b. */ - ecma_value_t resolve = ecma_op_function_call (ecma_get_object_from_value (func_obj), - ECMA_VALUE_UNDEFINED, - &call_arg, - arg_size); + ecma_value_t resolve = + ecma_op_function_call (ecma_get_object_from_value (func_obj), ECMA_VALUE_UNDEFINED, &call_arg, arg_size); JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (resolve)); ecma_free_value (resolve); @@ -273,10 +272,8 @@ ecma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterato ecma_value_t type_error = ecma_make_object_value (type_error_obj_p); /* 10.a. */ - ecma_value_t reject = ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), - ECMA_VALUE_UNDEFINED, - &type_error, - 1); + ecma_value_t reject = + ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), ECMA_VALUE_UNDEFINED, &type_error, 1); JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (reject)); ecma_deref_object (type_error_obj_p); ecma_free_value (reject); @@ -292,11 +289,11 @@ ecma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterato } /* ecma_builtin_async_from_sync_iterator_prototype_do */ /** - * Dispatcher of the %AsyncFromSyncIteratorPrototype% built-in's routines - * - * @return ecma value - * Returned value must be freed with ecma_free_value. - */ + * Dispatcher of the %AsyncFromSyncIteratorPrototype% built-in's routines + * + * @return ecma value + * Returned value must be freed with ecma_free_value. + */ ecma_value_t ecma_builtin_async_from_sync_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide * routine diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c index 68f2a012..150bb953 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-function-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID async_function_prototype +#define BUILTIN_UNDERSCORED_ID async_function_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h index 5ff638c7..32e3cfae 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h @@ -22,14 +22,10 @@ #if JERRY_ESNEXT /* ECMA-262 v11, 25.7.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_ASYNC_FUNCTION, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v11, 25.7.3.2 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c index bb26e4e3..115af43c 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c @@ -22,7 +22,7 @@ #include "ecma-function-object.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-function.inc.h" -#define BUILTIN_UNDERSCORED_ID async_function +#define BUILTIN_UNDERSCORED_ID async_function #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -47,9 +47,7 @@ ecma_builtin_async_function_dispatch_call (const ecma_value_t *arguments_list_p, { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_op_create_dynamic_function (arguments_list_p, - arguments_list_len, - ECMA_PARSE_ASYNC_FUNCTION); + return ecma_op_create_dynamic_function (arguments_list_p, arguments_list_len, ECMA_PARSE_ASYNC_FUNCTION); } /* ecma_builtin_async_function_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.inc.h index e304ff17..fb96a002 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.inc.h @@ -22,24 +22,16 @@ #if JERRY_ESNEXT /* ECMA-262 v11, 25.7.2 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v11, 25.7.2.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v10, 25.7.2.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE, ECMA_PROPERTY_FIXED) /* ECMA-262 v11, 25.7.3.2 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c index 26091097..ad2fcd67 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c @@ -22,7 +22,7 @@ #include "ecma-function-object.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-generator-function.inc.h" -#define BUILTIN_UNDERSCORED_ID async_generator_function +#define BUILTIN_UNDERSCORED_ID async_generator_function #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h index acafd42b..40914c49 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h @@ -22,19 +22,13 @@ #if JERRY_ESNEXT /* ECMA-262 v10, 25.3.2 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v10, 25.3.2.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 25.3.2.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_ASYNC_GENERATOR, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_GENERATOR, ECMA_PROPERTY_FIXED) #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c index 72a49491..0d710f26 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c @@ -21,6 +21,7 @@ #include "ecma-helpers.h" #include "ecma-iterator-object.h" #include "ecma-promise-object.h" + #include "jcontext.h" #include "opcodes.h" #include "vm-defines.h" @@ -31,8 +32,8 @@ #include "ecma-builtins-internal.h" /** - * This object has a custom dispatch function. - */ + * This object has a custom dispatch function. + */ #define BUILTIN_CUSTOM_DISPATCH /** @@ -47,7 +48,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-generator-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID async_generator_prototype +#define BUILTIN_UNDERSCORED_ID async_generator_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -64,26 +65,26 @@ enum * Convert routine type to operation type.. */ #define ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION(type) \ - ((ecma_async_generator_operation_type_t) ((type) - ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT)) + ((ecma_async_generator_operation_type_t) ((type) -ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT)) JERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT) - == ECMA_ASYNC_GENERATOR_DO_NEXT, + == ECMA_ASYNC_GENERATOR_DO_NEXT, convert_ecma_async_generator_routine_next_to_ecma_async_generator_do_next_failed); JERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_THROW) - == ECMA_ASYNC_GENERATOR_DO_THROW, + == ECMA_ASYNC_GENERATOR_DO_THROW, convert_ecma_async_generator_routine_throw_to_ecma_async_generator_do_throw_failed); JERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_RETURN) - == ECMA_ASYNC_GENERATOR_DO_RETURN, + == ECMA_ASYNC_GENERATOR_DO_RETURN, convert_ecma_async_generator_routine_return_to_ecma_async_generator_do_return_failed); /** - * Dispatcher of the Generator built-in's routines - * - * @return ecma value - * Returned value must be freed with ecma_free_value. - */ + * Dispatcher of the Generator built-in's routines + * + * @return ecma value + * Returned value must be freed with ecma_free_value. + */ ecma_value_t ecma_builtin_async_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine * identifier */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h index f96a2e26..481c097d 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h @@ -25,14 +25,10 @@ * (property name, object pointer getter) */ /* ECMA-262 v6, 25.3.1.5 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 25.2.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_ASYNC_GENERATOR, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_GENERATOR, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c index 51e095d5..2f5651b1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-generator.inc.h" -#define BUILTIN_UNDERSCORED_ID async_generator +#define BUILTIN_UNDERSCORED_ID async_generator #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.inc.h index 0b6162d5..076e42cc 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.inc.h @@ -22,14 +22,10 @@ #if JERRY_ESNEXT /* ECMA-262 v6, 25.3.2.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 25.3.2.3.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 25.3.2.3.3 */ STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c index aaefa492..ec65c765 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c @@ -37,7 +37,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-iterator-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID async_iterator_prototype +#define BUILTIN_UNDERSCORED_ID async_iterator_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.c b/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.c index a73850b1..c7d1847c 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.c @@ -17,6 +17,7 @@ #include "ecma-builtins.h" #include "ecma-globals.h" #include "ecma-helpers.h" + #include "jrt.h" #if JERRY_BUILTIN_ATOMICS @@ -51,7 +52,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-atomics.inc.h" -#define BUILTIN_UNDERSCORED_ID atomics +#define BUILTIN_UNDERSCORED_ID atomics #include "ecma-builtin-internal-routines-template.inc.h" @@ -76,7 +77,7 @@ enum static ecma_value_t ecma_builtin_atomics_compare_exchange (ecma_value_t typedarray, /**< typedArray argument */ ecma_value_t index, /**< index argument */ - ecma_value_t expected_value, /**< expectedValue argument */ + ecma_value_t expected_value, /**< expectedValue argument */ ecma_value_t replacement_value) /**< replacementValue argument*/ { JERRY_UNUSED (typedarray); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.inc.h index 7eab2372..a11b4518 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.inc.h @@ -22,9 +22,7 @@ #if JERRY_BUILTIN_ATOMICS /* ECMA-262 v11, 24.4.14 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_ATOMICS_U, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ATOMICS_U, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c index 7eee8cc6..3c32e724 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c @@ -38,7 +38,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-bigint-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID bigint_prototype +#define BUILTIN_UNDERSCORED_ID bigint_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h index 91f637fb..1dc916b0 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h @@ -25,14 +25,10 @@ * (property name, object pointer getter) */ /* ECMA-262 v11, 20.2.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_BIGINT, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_BIGINT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v11, 20.2.3.5 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_BIGINT_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_BIGINT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c index 08f0dacb..1c7e9f0c 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c @@ -23,7 +23,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-bigint.inc.h" -#define BUILTIN_UNDERSCORED_ID bigint +#define BUILTIN_UNDERSCORED_ID bigint #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.inc.h index a19f9acd..d8b216ab 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.inc.h @@ -25,22 +25,16 @@ * (property name, number value, writable, enumerable, configurable) */ /* ECMA-262 v11, 20.2.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v11, 20.2.1 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_BIGINT_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_BIGINT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v11, 20.2.2.3 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_BIGINT_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_BIGINT_PROTOTYPE, ECMA_PROPERTY_FIXED) #endif /* JERRY_BUILTIN_BIGINT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c index cefa45cd..cd175dd4 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c @@ -22,6 +22,7 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" + #include "jrt.h" #if JERRY_BUILTIN_BOOLEAN @@ -45,7 +46,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-boolean-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID boolean_prototype +#define BUILTIN_UNDERSCORED_ID boolean_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h index d9dba92b..82ef75f9 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h @@ -25,14 +25,12 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.6.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_BOOLEAN, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_BOOLEAN, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_TO_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF, 0, 0) +ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF, 0, 0) #endif /* JERRY_BUILTIN_BOOLEAN */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c index 3883317a..603d6104 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c @@ -22,6 +22,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-objects.h" + #include "jrt.h" #if JERRY_BUILTIN_BOOLEAN @@ -30,7 +31,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-boolean.inc.h" -#define BUILTIN_UNDERSCORED_ID boolean +#define BUILTIN_UNDERSCORED_ID boolean #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.inc.h index b52478aa..51e0c298 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.inc.h @@ -25,21 +25,15 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.6.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, ECMA_PROPERTY_FIXED) /* Number properties: * (property name, object pointer getter) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_BOOLEAN_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_BOOLEAN_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_BOOLEAN */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c index b0edf012..edebf7b7 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c @@ -14,8 +14,8 @@ */ #include "ecma-arraybuffer-object.h" -#include "ecma-exceptions.h" #include "ecma-dataview-object.h" +#include "ecma-exceptions.h" #include "ecma-gc.h" #if JERRY_BUILTIN_DATAVIEW @@ -74,7 +74,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-dataview-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID dataview_prototype +#define BUILTIN_UNDERSCORED_ID dataview_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -179,7 +179,8 @@ ecma_builtin_dataview_prototype_dispatch_routine (uint8_t builtin_routine_id, /* return ecma_op_dataview_get_set_view_value (this_arg, arguments_list_p[0], arguments_list_p[1], - ECMA_VALUE_EMPTY, id); + ECMA_VALUE_EMPTY, + id); } case ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT32: #if JERRY_NUMBER_TYPE_FLOAT64 diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h index 2f2e245f..82ef26b1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h @@ -25,14 +25,10 @@ * (property name, object pointer getter) */ /* ECMA-262 v6, 24.2.3 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_DATAVIEW, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_DATAVIEW, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 23.2.4.21 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_DATAVIEW_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ @@ -64,9 +60,7 @@ ROUTINE (LIT_MAGIC_STRING_SET_BIGUINT64, ECMA_DATAVIEW_PROTOTYPE_SET_BIGUINT64, #endif /* JERRY_BUILTIN_BIGINT */ /* ECMA-262 v6, 24.2.4.1 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BUFFER, - ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BUFFER, ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 24.2.4.2 */ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL, diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c index 94d73784..6e86c6dc 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c @@ -14,8 +14,8 @@ */ #include "ecma-builtins.h" -#include "ecma-exceptions.h" #include "ecma-dataview-object.h" +#include "ecma-exceptions.h" #if JERRY_BUILTIN_DATAVIEW @@ -23,7 +23,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-dataview.inc.h" -#define BUILTIN_UNDERSCORED_ID dataview +#define BUILTIN_UNDERSCORED_ID dataview #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.inc.h index 009cca18..9b1027cc 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.inc.h @@ -25,22 +25,16 @@ * (property name, number value, writable, enumerable, configurable) */ /* ECMA-262 v6, 23.1.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 23.1 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_DATAVIEW_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v6, 23.1.2.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE, ECMA_PROPERTY_FIXED) #endif /* JERRY_BUILTIN_DATAVIEW */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c index b02de1bf..2a3120bc 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c @@ -22,8 +22,8 @@ #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" +#include "ecma-objects.h" #if JERRY_BUILTIN_DATE @@ -39,7 +39,7 @@ * Checks whether the function uses UTC time zone. */ #define BUILTIN_DATE_FUNCTION_IS_UTC(builtin_routine_id) \ - (((builtin_routine_id) - ECMA_DATE_PROTOTYPE_GET_FULL_YEAR) & 0x1) + (((builtin_routine_id) -ECMA_DATE_PROTOTYPE_GET_FULL_YEAR) & 0x1) /** * List of built-in routine identifiers. @@ -108,7 +108,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-date-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID date_prototype +#define BUILTIN_UNDERSCORED_ID date_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -311,7 +311,7 @@ ecma_builtin_date_prototype_dispatch_get (uint16_t builtin_routine_id, /**< buil * Returns true, if the built-in id sets a year. */ #define ECMA_DATE_PROTOTYPE_IS_SET_YEAR_ROUTINE(builtin_routine_id) \ - ((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \ + ((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \ || (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR \ || (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_YEAR) @@ -321,7 +321,7 @@ ecma_builtin_date_prototype_dispatch_get (uint16_t builtin_routine_id, /**< buil * Returns true, if the built-in id sets a year. */ #define ECMA_DATE_PROTOTYPE_IS_SET_YEAR_ROUTINE(builtin_routine_id) \ - ((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \ + ((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \ || (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR) #endif /* JERRY_BUILTIN_ANNEXB */ @@ -677,7 +677,6 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b if (builtin_routine_id <= ECMA_DATE_PROTOTYPE_SET_UTC_MILLISECONDS) { - if (builtin_routine_id <= ECMA_DATE_PROTOTYPE_GET_UTC_TIMEZONE_OFFSET) { if (!BUILTIN_DATE_FUNCTION_IS_UTC (builtin_routine_id)) @@ -706,10 +705,7 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b return ecma_builtin_date_prototype_dispatch_get (builtin_routine_id, date_value); } - return ecma_builtin_date_prototype_dispatch_set (builtin_routine_id, - this_obj_p, - arguments_list, - arguments_number); + return ecma_builtin_date_prototype_dispatch_set (builtin_routine_id, this_obj_p, arguments_list, arguments_number); } if (builtin_routine_id == ECMA_DATE_PROTOTYPE_TO_ISO_STRING) diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.inc.h index 1c80040a..ff4f9a20 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.inc.h @@ -21,9 +21,7 @@ #if JERRY_BUILTIN_DATE -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_DATE, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_DATE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_DATE_PROTOTYPE_TO_STRING, 0, 0) ROUTINE (LIT_MAGIC_STRING_TO_DATE_STRING_UL, ECMA_DATE_PROTOTYPE_TO_DATE_STRING, 0, 0) @@ -69,10 +67,12 @@ ROUTINE (LIT_MAGIC_STRING_TO_ISO_STRING_UL, ECMA_DATE_PROTOTYPE_TO_ISO_STRING, 0 ROUTINE (LIT_MAGIC_STRING_TO_JSON_UL, ECMA_DATE_PROTOTYPE_TO_JSON, 1, 1) #if JERRY_ESNEXT ROUTINE_CONFIGURABLE_ONLY (LIT_GLOBAL_SYMBOL_TO_PRIMITIVE, ECMA_DATE_PROTOTYPE_TO_PRIMITIVE, 1, 1) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_UTC_STRING_UL, LIT_MAGIC_STRING_TO_UTC_STRING_UL, +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_UTC_STRING_UL, + LIT_MAGIC_STRING_TO_UTC_STRING_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #if JERRY_BUILTIN_ANNEXB -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_GMT_STRING_UL, LIT_MAGIC_STRING_TO_UTC_STRING_UL, +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_GMT_STRING_UL, + LIT_MAGIC_STRING_TO_UTC_STRING_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_ANNEXB */ #else /* !JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date.c b/jerry-core/ecma/builtin-objects/ecma-builtin-date.c index a16b6c1b..cad9534c 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-date.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date.c @@ -15,15 +15,16 @@ #include <math.h> -#include "jcontext.h" -#include "ecma-function-object.h" #include "ecma-alloc.h" #include "ecma-builtin-helpers.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" + +#include "jcontext.h" #include "lit-char-helpers.h" #if JERRY_BUILTIN_DATE @@ -48,7 +49,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-date.inc.h" -#define BUILTIN_UNDERSCORED_ID date +#define BUILTIN_UNDERSCORED_ID date #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -148,8 +149,7 @@ ecma_date_check_two_chars (const lit_utf8_byte_t *str_p, /**< pointer to the ces ecma_char_t expected_char1, /**< first expected character */ ecma_char_t expected_char2) /**< second expected character */ { - return (str_p < str_end_p - && (*str_p == expected_char1 || *str_p == expected_char2)); + return (str_p < str_end_p && (*str_p == expected_char1 || *str_p == expected_char2)); } /* ecma_date_check_two_chars */ /** @@ -236,21 +236,20 @@ ecma_date_parse_month_name (const lit_utf8_byte_t **str_p, /**< pointer to the c } /* ecma_date_parse_month_name */ /** - * Calculate MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)) for Date constructor and UTC - * - * See also: - * ECMA-262 v11, 20.4.3.4 - * - * @return false - if the operation fails - * true - otherwise - */ + * Calculate MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)) for Date constructor and UTC + * + * See also: + * ECMA-262 v11, 20.4.3.4 + * + * @return false - if the operation fails + * true - otherwise + */ static bool ecma_date_construct_helper (const ecma_value_t *args, /**< arguments passed to the Date constructor */ uint32_t args_len, /**< number of arguments */ ecma_number_t *tv_p) /**< [out] time value */ { - ecma_number_t date_nums[7] = - { + ecma_number_t date_nums[7] = { ECMA_NUMBER_ZERO, /* year */ ECMA_NUMBER_ZERO, /* month */ ECMA_NUMBER_ONE, /* date */ @@ -287,13 +286,8 @@ ecma_date_construct_helper (const ecma_value_t *args, /**< arguments passed to t } /* 10. */ - *tv_p = ecma_date_make_date (ecma_date_make_day (date_nums[0], - date_nums[1], - date_nums[2]), - ecma_date_make_time (date_nums[3], - date_nums[4], - date_nums[5], - date_nums[6])); + *tv_p = ecma_date_make_date (ecma_date_make_day (date_nums[0], date_nums[1], date_nums[2]), + ecma_date_make_time (date_nums[3], date_nums[4], date_nums[5], date_nums[6])); return true; } /* ecma_date_construct_helper */ @@ -324,10 +318,8 @@ ecma_builtin_date_parse_basic (const lit_utf8_byte_t *date_str_curr_p, /**< date year_limit = 999999; } - ecma_number_t year = ecma_date_parse_date_chars (&date_str_curr_p, - date_str_end_p, - year_digits, - ECMA_DATE_LIMIT (0, year_limit)); + ecma_number_t year = + ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, year_digits, ECMA_DATE_LIMIT (0, year_limit)); if (is_year_sign_negative) { year = -year; @@ -466,8 +458,7 @@ ecma_builtin_date_parse_basic (const lit_utf8_byte_t *date_str_curr_p, /**< date * @return the parsed date as ecma_number_t or NaN otherwise */ static ecma_number_t -ecma_builtin_date_parse_toString_formats (const lit_utf8_byte_t *date_str_curr_p, - const lit_utf8_byte_t *date_str_end_p) +ecma_builtin_date_parse_toString_formats (const lit_utf8_byte_t *date_str_curr_p, const lit_utf8_byte_t *date_str_end_p) { const ecma_number_t nan = ecma_number_make_nan (); @@ -582,8 +573,7 @@ ecma_builtin_date_parse_toString_formats (const lit_utf8_byte_t *date_str_curr_p } const char gmt_p[] = " GMT"; - if (date_str_end_p - date_str_curr_p < 4 - || memcmp (date_str_curr_p, gmt_p, 4) != 0) + if (date_str_end_p - date_str_curr_p < 4 || memcmp (date_str_curr_p, gmt_p, 4) != 0) { return nan; } @@ -725,8 +715,8 @@ ecma_builtin_date_create (ecma_number_t tv) #if JERRY_ESNEXT JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL); - ecma_object_t *prototype_obj_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), - ECMA_BUILTIN_ID_DATE_PROTOTYPE); + ecma_object_t *prototype_obj_p = + ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_DATE_PROTOTYPE); if (JERRY_UNLIKELY (prototype_obj_p == NULL)) { @@ -787,7 +777,6 @@ ecma_value_t ecma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - /* 20.4.2.3 */ if (arguments_list_len == 0) { @@ -804,7 +793,6 @@ ecma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**< if (ecma_is_value_object (argument) && ecma_object_class_is (ecma_get_object_from_value (argument), ECMA_OBJECT_CLASS_DATE)) { - #if JERRY_ESNEXT tv = ((ecma_date_object_t *) ecma_get_object_from_value (argument))->date_value; #else /* !JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h index 7e675c97..f390e0dd 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h @@ -22,22 +22,16 @@ #if JERRY_BUILTIN_DATE /* ECMA-262 v5, 15.9.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_DATE_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_DATE_PROTOTYPE, ECMA_PROPERTY_FIXED) -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 7, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 7, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) ROUTINE (LIT_MAGIC_STRING_PARSE, ECMA_DATE_ROUTINE_PARSE, 1, 1) ROUTINE (LIT_MAGIC_STRING_UTC_U, ECMA_DATE_ROUTINE_UTC, NON_FIXED, 7) ROUTINE (LIT_MAGIC_STRING_NOW, ECMA_DATE_ROUTINE_NOW, 0, 0) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_DATE_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_DATE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_DATE */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c index 5f4f5650..861d8226 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c @@ -20,18 +20,19 @@ #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "lit-char-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" + #include "jrt.h" +#include "lit-char-helpers.h" #include "lit-magic-strings.h" #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" /** - * This object has a custom dispatch function. - */ + * This object has a custom dispatch function. + */ #define BUILTIN_CUSTOM_DISPATCH /** @@ -44,7 +45,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-error-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID error_prototype +#define BUILTIN_UNDERSCORED_ID error_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -105,18 +106,16 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this ecma_object_t *obj_p = ecma_get_object_from_value (this_arg); - ecma_string_t *name_string_p = ecma_builtin_error_prototype_object_to_string_helper (obj_p, - LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_ERROR_UL); + ecma_string_t *name_string_p = + ecma_builtin_error_prototype_object_to_string_helper (obj_p, LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL); if (JERRY_UNLIKELY (name_string_p == NULL)) { return ECMA_VALUE_ERROR; } - ecma_string_t *msg_string_p = ecma_builtin_error_prototype_object_to_string_helper (obj_p, - LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY); + ecma_string_t *msg_string_p = + ecma_builtin_error_prototype_object_to_string_helper (obj_p, LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY); if (JERRY_UNLIKELY (msg_string_p == NULL)) { @@ -136,7 +135,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (name_string_p); - ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *)": ", 2); + ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) ": ", 2); ecma_stringbuilder_append (&builder, msg_string_p); ecma_deref_ecma_string (name_string_p); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.inc.h index 5e02b20c..751094ca 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.inc.h @@ -23,19 +23,13 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.4.2 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.4.3 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-error.c b/jerry-core/ecma/builtin-objects/ecma-builtin-error.c index 17693f2e..1f8dedda 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-error.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-error.c @@ -14,23 +14,24 @@ */ #include "ecma-alloc.h" +#include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtin-helpers.h" #include "ecma-objects.h" -#include "ecma-function-object.h" -#include "jrt.h" + #include "jcontext.h" +#include "jrt.h" #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-error.inc.h" -#define BUILTIN_UNDERSCORED_ID error +#define BUILTIN_UNDERSCORED_ID error #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -67,8 +68,8 @@ ecma_builtin_error_dispatch_construct (const ecma_value_t *arguments_list_p, /** #if !JERRY_ESNEXT return ecma_builtin_error_dispatch_call (arguments_list_p, arguments_list_len); #else /* JERRY_ESNEXT */ - ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), - ECMA_BUILTIN_ID_ERROR_PROTOTYPE); + ecma_object_t *proto_p = + ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_ERROR_PROTOTYPE); if (proto_p == NULL) { diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-error.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-error.inc.h index c3df1a7c..7098dd95 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-error.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-error.inc.h @@ -22,22 +22,16 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.7.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_ERROR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c index a755b166..37588033 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c @@ -22,6 +22,7 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" + #include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -30,7 +31,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-evalerror-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID eval_error_prototype +#define BUILTIN_UNDERSCORED_ID eval_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h index f131641f..1f13dd2f 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h @@ -25,19 +25,13 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_EVAL_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_EVAL_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_EVAL_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c index 29e71ecb..3804420d 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c @@ -14,17 +14,18 @@ */ #include "ecma-alloc.h" +#include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtin-helpers.h" #include "ecma-objects.h" -#include "ecma-function-object.h" -#include "jrt.h" + #include "jcontext.h" +#include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -32,7 +33,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-evalerror.inc.h" -#define BUILTIN_UNDERSCORED_ID eval_error +#define BUILTIN_UNDERSCORED_ID eval_error #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -69,8 +70,8 @@ ecma_builtin_eval_error_dispatch_construct (const ecma_value_t *arguments_list_p #if !JERRY_ESNEXT return ecma_builtin_eval_error_dispatch_call (arguments_list_p, arguments_list_len); #else /* JERRY_ESNEXT */ - ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), - ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE); + ecma_object_t *proto_p = + ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE); if (proto_p == NULL) { diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.inc.h index 64887c8d..9efa35f6 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.inc.h @@ -24,22 +24,16 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_EVAL_ERROR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c index d1d71ea2..44e30347 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c @@ -13,20 +13,22 @@ * limitations under the License. */ +#include "ecma-builtin-function-prototype.h" + #include "ecma-alloc.h" #include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" #include "ecma-extended-info.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-function-object.h" #include "ecma-objects.h" #include "ecma-proxy-object.h" + #include "jrt.h" -#include "ecma-builtin-function-prototype.h" #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -52,7 +54,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-function-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID function_prototype +#define BUILTIN_UNDERSCORED_ID function_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -209,7 +211,7 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th /* 2. */ if (ecma_is_value_null (arg2) || ecma_is_value_undefined (arg2)) { - return ecma_op_function_call (func_obj_p, arg1, NULL, 0); + return ecma_op_function_call (func_obj_p, arg1, NULL, 0); } /* 3. */ @@ -256,10 +258,7 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th if (ecma_is_value_empty (ret_value)) { JERRY_ASSERT (index == length); - ret_value = ecma_op_function_call (func_obj_p, - arg1, - arguments_list_p, - (uint32_t) length); + ret_value = ecma_op_function_call (func_obj_p, arg1, arguments_list_p, (uint32_t) length); } for (uint32_t remove_index = 0; remove_index < index; remove_index++) @@ -282,17 +281,14 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th * Returned value must be freed with ecma_free_value. */ static ecma_value_t -ecma_builtin_function_prototype_object_call (ecma_object_t *func_obj_p , /**< this argument object */ +ecma_builtin_function_prototype_object_call (ecma_object_t *func_obj_p, /**< this argument object */ const ecma_value_t *arguments_list_p, /**< list of arguments */ uint32_t arguments_number) /**< number of arguments */ { if (arguments_number == 0) { /* Even a 'this' argument is missing. */ - return ecma_op_function_call (func_obj_p, - ECMA_VALUE_UNDEFINED, - NULL, - 0); + return ecma_op_function_call (func_obj_p, ECMA_VALUE_UNDEFINED, NULL, 0); } return ecma_op_function_call (func_obj_p, @@ -311,7 +307,7 @@ ecma_builtin_function_prototype_object_call (ecma_object_t *func_obj_p , /**< th * Returned value must be freed with ecma_free_value. */ static ecma_value_t -ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**< this argument object */ +ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p, /**< this argument object */ const ecma_value_t *arguments_list_p, /**< list of arguments */ uint32_t arguments_number) /**< number of arguments */ { @@ -353,18 +349,13 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /** ecma_object_t *function_p; ecma_bound_function_t *bound_func_p; - if (arguments_number == 0 - || (arguments_number == 1 && !ecma_is_value_integer_number (arguments_list_p[0]))) + if (arguments_number == 0 || (arguments_number == 1 && !ecma_is_value_integer_number (arguments_list_p[0]))) { - function_p = ecma_create_object (prototype_obj_p, - sizeof (ecma_bound_function_t), - ECMA_OBJECT_TYPE_BOUND_FUNCTION); + function_p = ecma_create_object (prototype_obj_p, sizeof (ecma_bound_function_t), ECMA_OBJECT_TYPE_BOUND_FUNCTION); /* 8. */ bound_func_p = (ecma_bound_function_t *) function_p; - ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function, - this_arg_obj_p, - 0); + ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function, this_arg_obj_p, 0); bound_func_p->header.u.bound_function.args_len_or_this = ECMA_VALUE_UNDEFINED; @@ -379,15 +370,11 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /** size_t obj_size = sizeof (ecma_bound_function_t) + (arguments_number * sizeof (ecma_value_t)); - function_p = ecma_create_object (prototype_obj_p, - obj_size, - ECMA_OBJECT_TYPE_BOUND_FUNCTION); + function_p = ecma_create_object (prototype_obj_p, obj_size, ECMA_OBJECT_TYPE_BOUND_FUNCTION); /* 8. */ bound_func_p = (ecma_bound_function_t *) function_p; - ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function, - this_arg_obj_p, - 0); + ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function, this_arg_obj_p, 0); /* NOTE: This solution provides temporary false data about the object's size but prevents GC from freeing it until it's not fully initialized. */ @@ -413,9 +400,7 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /** ecma_string_t *len_string = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH); ecma_property_descriptor_t prop_desc; - ecma_value_t status = ecma_op_object_get_own_property_descriptor (this_arg_obj_p, - len_string, - &prop_desc); + ecma_value_t status = ecma_op_object_get_own_property_descriptor (this_arg_obj_p, len_string, &prop_desc); #if JERRY_BUILTIN_PROXY if (ECMA_IS_VALUE_ERROR (status)) @@ -428,8 +413,7 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /** if (ecma_is_value_true (status)) { ecma_free_property_descriptor (&prop_desc); - ecma_value_t len_value = ecma_op_object_get (this_arg_obj_p, - len_string); + ecma_value_t len_value = ecma_op_object_get (this_arg_obj_p, len_string); if (ECMA_IS_VALUE_ERROR (len_value)) { @@ -552,9 +536,7 @@ ecma_builtin_function_prototype_dispatch_routine (uint8_t builtin_routine_id, /* } case ECMA_FUNCTION_PROTOTYPE_APPLY: { - return ecma_builtin_function_prototype_object_apply (func_obj_p, - arguments_list_p[0], - arguments_list_p[1]); + return ecma_builtin_function_prototype_object_apply (func_obj_p, arguments_list_p[0], arguments_list_p[1]); } case ECMA_FUNCTION_PROTOTYPE_CALL: { diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.h b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.h index 97ba3137..363681f5 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.h @@ -16,8 +16,9 @@ #ifndef ECMA_BUILTIN_FUNCTION_PROTOTYPE_H #define ECMA_BUILTIN_FUNCTION_PROTOTYPE_H -ecma_value_t ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, - ecma_value_t arg1, - ecma_value_t arg2); +#include "ecma-globals.h" + +ecma_value_t +ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, ecma_value_t arg1, ecma_value_t arg2); #endif /* !ECMA_BUILTIN_FUNCTION_PROTOTYPE_H */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h index 1c61dfab..46261d2d 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h @@ -23,21 +23,15 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.3.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_FUNCTION, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_FUNCTION, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* Number properties: * (property name, object pointer getter) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ /* Routine properties: diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function.c b/jerry-core/ecma/builtin-objects/ecma-builtin-function.c index 562fab2f..7c8e1dfd 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-function.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function.c @@ -15,11 +15,12 @@ #include "ecma-alloc.h" #include "ecma-conversion.h" -#include "ecma-exceptions.h" #include "ecma-eval.h" -#include "ecma-gc.h" +#include "ecma-exceptions.h" #include "ecma-function-object.h" +#include "ecma-gc.h" #include "ecma-lex-env.h" + #include "js-parser.h" #include "lit-magic-strings.h" @@ -27,7 +28,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-function.inc.h" -#define BUILTIN_UNDERSCORED_ID function +#define BUILTIN_UNDERSCORED_ID function #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-function.inc.h index 68f9edbd..388755de 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-function.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function.inc.h @@ -23,21 +23,15 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.3.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, ECMA_PROPERTY_FIXED) /* Number properties: * (property name, object pointer getter) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_FUNCTION_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c index 05ee6cc8..14907dd1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c @@ -22,7 +22,7 @@ #include "ecma-function-object.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-generator-function.inc.h" -#define BUILTIN_UNDERSCORED_ID generator_function +#define BUILTIN_UNDERSCORED_ID generator_function #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -53,7 +53,7 @@ ecma_builtin_generator_function_dispatch_call (const ecma_value_t *arguments_lis /** * Handle calling [[Construct]] of built-in GeneratorFunction object * -* @return constructed generator function object - if success + * @return constructed generator function object - if success * raised error otherwise */ ecma_value_t diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.inc.h index 842f70a9..a6d60bdc 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.inc.h @@ -22,19 +22,13 @@ #if JERRY_ESNEXT /* ECMA-262 v6, 25.2.2 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 25.2.2.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 25.2.2.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_GENERATOR, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_GENERATOR, ECMA_PROPERTY_FIXED) #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c index 6ce574ea..815e9393 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-iterator-object.h" + #include "jcontext.h" #include "opcodes.h" #include "vm-defines.h" @@ -29,8 +30,8 @@ #include "ecma-builtins-internal.h" /** - * This object has a custom dispatch function. - */ + * This object has a custom dispatch function. + */ #define BUILTIN_CUSTOM_DISPATCH /** @@ -45,7 +46,7 @@ enum } ecma_generator_operation_type_t; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-generator-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID generator_prototype +#define BUILTIN_UNDERSCORED_ID generator_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -62,18 +63,17 @@ enum * Convert routine type to operation type.. */ #define ECMA_GENERATOR_ROUTINE_TO_OPERATION(type) \ - ((ecma_iterator_command_type_t) ((type) - ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT)) + ((ecma_iterator_command_type_t) ((type) -ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT)) -JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT) - == ECMA_ITERATOR_NEXT, +JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT) == ECMA_ITERATOR_NEXT, convert_ecma_generator_routine_next_to_ecma_iterator_next_failed); JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW) - == ECMA_ITERATOR_THROW, + == ECMA_ITERATOR_THROW, convert_ecma_generator_routine_throw_to_ecma_iterator_throw_failed); JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN) - == ECMA_ITERATOR_RETURN, + == ECMA_ITERATOR_RETURN, convert_ecma_generator_routine_return_to_ecma_iterator_return_failed); /** @@ -161,9 +161,8 @@ ecma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_ob if (byte_code_p[-1] == CBC_EXT_YIELD_ITERATOR) { - ecma_value_t iterator = ecma_op_get_iterator (value, - ECMA_VALUE_SYNC_ITERATOR, - generator_object_p->frame_ctx.stack_top_p); + ecma_value_t iterator = + ecma_op_get_iterator (value, ECMA_VALUE_SYNC_ITERATOR, generator_object_p->frame_ctx.stack_top_p); ecma_free_value (value); if (ECMA_IS_VALUE_ERROR (iterator)) @@ -195,11 +194,11 @@ ecma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_ob } /* ecma_builtin_generator_prototype_object_do */ /** - * Dispatcher of the Generator built-in's routines - * - * @return ecma value - * Returned value must be freed with ecma_free_value. - */ + * Dispatcher of the Generator built-in's routines + * + * @return ecma value + * Returned value must be freed with ecma_free_value. + */ ecma_value_t ecma_builtin_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine * identifier */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h index e774f0fb..4028b4e8 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h @@ -25,14 +25,10 @@ * (property name, object pointer getter) */ /* ECMA-262 v6, 25.3.1.5 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_GENERATOR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_GENERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 25.2.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_GENERATOR, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_GENERATOR, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator.c b/jerry-core/ecma/builtin-objects/ecma-builtin-generator.c index 7cb11537..29045609 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-generator.inc.h" -#define BUILTIN_UNDERSCORED_ID generator +#define BUILTIN_UNDERSCORED_ID generator #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-generator.inc.h index 235593ba..bf3fc2f5 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator.inc.h @@ -22,19 +22,13 @@ #if JERRY_ESNEXT /* ECMA-262 v6, 25.3.2.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_GENERATOR_FUNCTION, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_GENERATOR_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 25.3.2.3.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 25.3.2.3.3 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-global.c b/jerry-core/ecma/builtin-objects/ecma-builtin-global.c index 34570ecb..f0230384 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-global.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-global.c @@ -21,14 +21,15 @@ #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" + +#include "jcontext.h" +#include "jrt-bit-fields.h" +#include "jrt-libc-includes.h" #include "jrt.h" #include "lit-char-helpers.h" #include "lit-magic-strings.h" #include "lit-strings.h" #include "vm.h" -#include "jcontext.h" -#include "jrt-libc-includes.h" -#include "jrt-bit-fields.h" #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -59,7 +60,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-global.inc.h" -#define BUILTIN_UNDERSCORED_ID global +#define BUILTIN_UNDERSCORED_ID global #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -137,8 +138,7 @@ ecma_builtin_global_object_is_nan (ecma_number_t arg_num) /**< routine's first a static ecma_value_t ecma_builtin_global_object_is_finite (ecma_number_t arg_num) /**< routine's first argument */ { - bool is_finite = !(ecma_number_is_nan (arg_num) - || ecma_number_is_infinity (arg_num)); + bool is_finite = !(ecma_number_is_nan (arg_num) || ecma_number_is_infinity (arg_num)); return ecma_make_boolean_value (is_finite); } /* ecma_builtin_global_object_is_finite */ @@ -161,22 +161,16 @@ ecma_builtin_global_object_character_is_in (uint32_t character, /**< character * * One bit for each character between 0 - 127. * Bit is set if the character is in the unescaped URI set. */ -static const uint8_t unescaped_uri_set[16] = -{ - 0x0, 0x0, 0x0, 0x0, 0xda, 0xff, 0xff, 0xaf, - 0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47 -}; +static const uint8_t unescaped_uri_set[16] = { 0x0, 0x0, 0x0, 0x0, 0xda, 0xff, 0xff, 0xaf, + 0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47 }; /** * Unescaped URI component characters bitset: * One bit for each character between 0 - 127. * Bit is set if the character is in the unescaped component URI set. */ -static const uint8_t unescaped_uri_component_set[16] = -{ - 0x0, 0x0, 0x0, 0x0, 0x82, 0x67, 0xff, 0x3, - 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47 -}; +static const uint8_t unescaped_uri_component_set[16] = { 0x0, 0x0, 0x0, 0x0, 0x82, 0x67, 0xff, 0x3, + 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47 }; /** * Format is a percent sign followed by two hex digits. @@ -283,8 +277,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /* } } - if (!is_valid - || !lit_is_valid_utf8_string (octets, bytes_count, true)) + if (!is_valid || !lit_is_valid_utf8_string (octets, bytes_count, true)) { ecma_stringbuilder_destroy (&builder); return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 string")); @@ -293,8 +286,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /* lit_code_point_t cp; lit_read_code_point_from_utf8 (octets, bytes_count, &cp); - if (lit_is_code_point_utf16_high_surrogate (cp) - || lit_is_code_point_utf16_low_surrogate (cp)) + if (lit_is_code_point_utf16_high_surrogate (cp) || lit_is_code_point_utf16_low_surrogate (cp)) { ecma_stringbuilder_destroy (&builder); return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 codepoint")); @@ -431,11 +423,8 @@ ecma_builtin_global_object_encode_uri_helper (lit_utf8_byte_t *input_start_p, /* * Bit is set if the character does not need to be converted to %xx form. * These characters are: a-z A-Z 0-9 @ * _ + - . / */ -static const uint8_t ecma_escape_set[16] = -{ - 0x0, 0x0, 0x0, 0x0, 0x0, 0xec, 0xff, 0x3, - 0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x7 -}; +static const uint8_t ecma_escape_set[16] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0xec, 0xff, 0x3, + 0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x7 }; /** * The Global object's 'escape' routine @@ -502,7 +491,7 @@ ecma_builtin_global_object_escape (lit_utf8_byte_t *input_start_p, /**< routine' * @return number of characters processed during the escape resolve */ static uint8_t -ecma_builtin_global_object_unescape_resolve_escape (const lit_utf8_byte_t *buffer_p, /**< character buffer */ +ecma_builtin_global_object_unescape_resolve_escape (const lit_utf8_byte_t *buffer_p, /**< character buffer */ bool unicode_sequence, /**< true if unescaping unicode sequence */ ecma_char_t *out_result_p) /**< [out] resolved character */ { @@ -643,15 +632,12 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in if (builtin_routine_id == ECMA_GLOBAL_PARSE_INT) { - ret_value = ecma_number_parse_int (string_buff, - string_buff_size, - arguments_list_p[1]); + ret_value = ecma_number_parse_int (string_buff, string_buff_size, arguments_list_p[1]); } else { JERRY_ASSERT (builtin_routine_id == ECMA_GLOBAL_PARSE_FLOAT); - ret_value = ecma_number_parse_float (string_buff, - string_buff_size); + ret_value = ecma_number_parse_float (string_buff, string_buff_size); } ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size); @@ -661,9 +647,7 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in lit_utf8_size_t input_size = ecma_string_get_size (str_p); - JMEM_DEFINE_LOCAL_ARRAY (input_start_p, - input_size + 1, - lit_utf8_byte_t); + JMEM_DEFINE_LOCAL_ARRAY (input_start_p, input_size + 1, lit_utf8_byte_t); ecma_string_to_utf8_bytes (str_p, input_start_p, input_size); @@ -686,8 +670,8 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in case ECMA_GLOBAL_DECODE_URI: case ECMA_GLOBAL_DECODE_URI_COMPONENT: { - const uint8_t *uri_set = (builtin_routine_id == ECMA_GLOBAL_DECODE_URI ? unescaped_uri_set - : unescaped_uri_component_set); + const uint8_t *uri_set = + (builtin_routine_id == ECMA_GLOBAL_DECODE_URI ? unescaped_uri_set : unescaped_uri_component_set); ret_value = ecma_builtin_global_object_decode_uri_helper (input_start_p, input_size, uri_set); break; @@ -697,8 +681,8 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in JERRY_ASSERT (builtin_routine_id == ECMA_GLOBAL_ENCODE_URI || builtin_routine_id == ECMA_GLOBAL_ENCODE_URI_COMPONENT); - const uint8_t *uri_set = (builtin_routine_id == ECMA_GLOBAL_ENCODE_URI ? unescaped_uri_set - : unescaped_uri_component_set); + const uint8_t *uri_set = + (builtin_routine_id == ECMA_GLOBAL_ENCODE_URI ? unescaped_uri_set : unescaped_uri_component_set); ret_value = ecma_builtin_global_object_encode_uri_helper (input_start_p, input_size, uri_set); break; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h index 88007be2..6048dfd4 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h @@ -23,147 +23,101 @@ * (property name, simple value, writable, enumerable, configurable) */ /* ECMA-262 v5, 15.1.1.3 */ -SIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED, - ECMA_VALUE_UNDEFINED, - ECMA_PROPERTY_FIXED) +SIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED, ECMA_VALUE_UNDEFINED, ECMA_PROPERTY_FIXED) /* Number properties: * (property name, number value, writable, enumerable, configurable) */ /* ECMA-262 v5, 15.1.1.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_NAN, - ECMA_BUILTIN_NUMBER_NAN, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_NAN, ECMA_BUILTIN_NUMBER_NAN, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.1.1.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL, - ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL, ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, ECMA_PROPERTY_FIXED) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.1.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_OBJECT_UL, - ECMA_BUILTIN_ID_OBJECT, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_OBJECT_UL, ECMA_BUILTIN_ID_OBJECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.1.4.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_FUNCTION_UL, - ECMA_BUILTIN_ID_FUNCTION, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_FUNCTION_UL, ECMA_BUILTIN_ID_FUNCTION, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.1.4.3 */ #if JERRY_BUILTIN_ARRAY -OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL, - ECMA_BUILTIN_ID_ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL, ECMA_BUILTIN_ID_ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_ARRAY */ #if JERRY_BUILTIN_STRING /* ECMA-262 v5, 15.1.4.4 */ -OBJECT_VALUE (LIT_MAGIC_STRING_STRING_UL, - ECMA_BUILTIN_ID_STRING, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_STRING_UL, ECMA_BUILTIN_ID_STRING, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_STRING */ #if JERRY_BUILTIN_BOOLEAN /* ECMA-262 v5, 15.1.4.5 */ -OBJECT_VALUE (LIT_MAGIC_STRING_BOOLEAN_UL, - ECMA_BUILTIN_ID_BOOLEAN, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_BOOLEAN_UL, ECMA_BUILTIN_ID_BOOLEAN, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_BOOLEAN */ #if JERRY_BUILTIN_NUMBER /* ECMA-262 v5, 15.1.4.6 */ -OBJECT_VALUE (LIT_MAGIC_STRING_NUMBER_UL, - ECMA_BUILTIN_ID_NUMBER, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_NUMBER_UL, ECMA_BUILTIN_ID_NUMBER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_NUMBER */ #if JERRY_BUILTIN_DATE /* ECMA-262 v5, 15.1.4.7 */ -OBJECT_VALUE (LIT_MAGIC_STRING_DATE_UL, - ECMA_BUILTIN_ID_DATE, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_DATE_UL, ECMA_BUILTIN_ID_DATE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_DATE */ #if JERRY_BUILTIN_REGEXP /* ECMA-262 v5, 15.1.4.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_REGEXP_UL, - ECMA_BUILTIN_ID_REGEXP, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_REGEXP_UL, ECMA_BUILTIN_ID_REGEXP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_REGEXP */ /* ECMA-262 v5, 15.1.4.9 */ -OBJECT_VALUE (LIT_MAGIC_STRING_ERROR_UL, - ECMA_BUILTIN_ID_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_ERROR_UL, ECMA_BUILTIN_ID_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #if JERRY_BUILTIN_ERRORS /* ECMA-262 v5, 15.1.4.10 */ -OBJECT_VALUE (LIT_MAGIC_STRING_EVAL_ERROR_UL, - ECMA_BUILTIN_ID_EVAL_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_BUILTIN_ID_EVAL_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.1.4.11 */ -OBJECT_VALUE (LIT_MAGIC_STRING_RANGE_ERROR_UL, - ECMA_BUILTIN_ID_RANGE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_RANGE_ERROR_UL, ECMA_BUILTIN_ID_RANGE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.1.4.12 */ -OBJECT_VALUE (LIT_MAGIC_STRING_REFERENCE_ERROR_UL, - ECMA_BUILTIN_ID_REFERENCE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_REFERENCE_ERROR_UL, ECMA_BUILTIN_ID_REFERENCE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.1.4.13 */ -OBJECT_VALUE (LIT_MAGIC_STRING_SYNTAX_ERROR_UL, - ECMA_BUILTIN_ID_SYNTAX_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_SYNTAX_ERROR_UL, ECMA_BUILTIN_ID_SYNTAX_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.1.4.14 */ -OBJECT_VALUE (LIT_MAGIC_STRING_TYPE_ERROR_UL, - ECMA_BUILTIN_ID_TYPE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_TYPE_ERROR_UL, ECMA_BUILTIN_ID_TYPE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.1.4.15 */ -OBJECT_VALUE (LIT_MAGIC_STRING_URI_ERROR_UL, - ECMA_BUILTIN_ID_URI_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_URI_ERROR_UL, ECMA_BUILTIN_ID_URI_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_ERRORS */ #if JERRY_BUILTIN_MATH /* ECMA-262 v5, 15.1.5.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_MATH_UL, - ECMA_BUILTIN_ID_MATH, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_MATH_UL, ECMA_BUILTIN_ID_MATH, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_MATH */ #if JERRY_BUILTIN_REFLECT /* ECMA-262 v6, 26.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_REFLECT_UL, - ECMA_BUILTIN_ID_REFLECT, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_REFLECT_UL, ECMA_BUILTIN_ID_REFLECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_REFLECT */ #if JERRY_BUILTIN_JSON /* ECMA-262 v5, 15.1.5.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U, - ECMA_BUILTIN_ID_JSON, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U, ECMA_BUILTIN_ID_JSON, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_JSON */ #if JERRY_BUILTIN_ATOMICS /* ECMA-262 v5, 15.1.5.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_ATOMICS_U, - ECMA_BUILTIN_ID_ATOMICS, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_ATOMICS_U, ECMA_BUILTIN_ID_ATOMICS, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_ATOMICS */ #if JERRY_BUILTIN_TYPEDARRAY -OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_BUFFER_UL, - ECMA_BUILTIN_ID_ARRAYBUFFER, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_BUILTIN_ID_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #if JERRY_BUILTIN_SHAREDARRAYBUFFER OBJECT_VALUE (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, @@ -171,48 +125,28 @@ OBJECT_VALUE (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */ -OBJECT_VALUE (LIT_MAGIC_STRING_INT8_ARRAY_UL, - ECMA_BUILTIN_ID_INT8ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_INT8_ARRAY_UL, ECMA_BUILTIN_ID_INT8ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_ARRAY_UL, - ECMA_BUILTIN_ID_UINT8ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_ARRAY_UL, ECMA_BUILTIN_ID_UINT8ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -OBJECT_VALUE (LIT_MAGIC_STRING_INT16_ARRAY_UL, - ECMA_BUILTIN_ID_INT16ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_INT16_ARRAY_UL, ECMA_BUILTIN_ID_INT16ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -OBJECT_VALUE (LIT_MAGIC_STRING_UINT16_ARRAY_UL, - ECMA_BUILTIN_ID_UINT16ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_UINT16_ARRAY_UL, ECMA_BUILTIN_ID_UINT16ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -OBJECT_VALUE (LIT_MAGIC_STRING_INT32_ARRAY_UL, - ECMA_BUILTIN_ID_INT32ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_INT32_ARRAY_UL, ECMA_BUILTIN_ID_INT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -OBJECT_VALUE (LIT_MAGIC_STRING_UINT32_ARRAY_UL, - ECMA_BUILTIN_ID_UINT32ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_UINT32_ARRAY_UL, ECMA_BUILTIN_ID_UINT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, - ECMA_BUILTIN_ID_FLOAT32ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, ECMA_BUILTIN_ID_FLOAT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #if JERRY_NUMBER_TYPE_FLOAT64 -OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, - ECMA_BUILTIN_ID_FLOAT64ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, ECMA_BUILTIN_ID_FLOAT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_NUMBER_TYPE_FLOAT64 */ #if JERRY_BUILTIN_BIGINT -OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, - ECMA_BUILTIN_ID_BIGINT64ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, ECMA_BUILTIN_ID_BIGINT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -OBJECT_VALUE (LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, - ECMA_BUILTIN_ID_BIGUINT64ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, ECMA_BUILTIN_ID_BIGUINT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_BIGINT */ OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL, @@ -223,73 +157,49 @@ OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL, #if JERRY_BUILTIN_CONTAINER /* ECMA-262 v6, 23.1.1.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_WEAKSET_UL, - ECMA_BUILTIN_ID_WEAKSET, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_WEAKSET_UL, ECMA_BUILTIN_ID_WEAKSET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 23.1.1.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_MAP_UL, - ECMA_BUILTIN_ID_MAP, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_MAP_UL, ECMA_BUILTIN_ID_MAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 23.1.1.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_SET_UL, - ECMA_BUILTIN_ID_SET, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_SET_UL, ECMA_BUILTIN_ID_SET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 23.1.1.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_WEAKMAP_UL, - ECMA_BUILTIN_ID_WEAKMAP, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_WEAKMAP_UL, ECMA_BUILTIN_ID_WEAKMAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_CONTAINER */ #if JERRY_BUILTIN_WEAKREF -OBJECT_VALUE (LIT_MAGIC_STRING_WEAKREF_UL, - ECMA_BUILTIN_ID_WEAKREF, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_WEAKREF_UL, ECMA_BUILTIN_ID_WEAKREF, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_WEAKREF */ #if JERRY_ESNEXT -OBJECT_VALUE (LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, - ECMA_BUILTIN_ID_AGGREGATE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_BUILTIN_ID_AGGREGATE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -OBJECT_VALUE (LIT_MAGIC_STRING_PROMISE_UL, - ECMA_BUILTIN_ID_PROMISE, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_PROMISE_UL, ECMA_BUILTIN_ID_PROMISE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 19.4.1.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_SYMBOL_UL, - ECMA_BUILTIN_ID_SYMBOL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_SYMBOL_UL, ECMA_BUILTIN_ID_SYMBOL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_GLOBAL_THIS /* ECMA-262 v11, 18.1.1 */ -SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL_THIS_UL, - ECMA_VALUE_GLOBAL_THIS, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL_THIS_UL, ECMA_VALUE_GLOBAL_THIS, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_GLOBAL_THIS */ #if JERRY_BUILTIN_DATAVIEW /* ECMA-262 v6, 23.1.1.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_DATAVIEW_UL, - ECMA_BUILTIN_ID_DATAVIEW, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_BUILTIN_ID_DATAVIEW, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_DATAVIEW */ #if JERRY_BUILTIN_PROXY /* ECMA-262 v6, 26.2.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROXY_UL, - ECMA_BUILTIN_ID_PROXY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_PROXY_UL, ECMA_BUILTIN_ID_PROXY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_PROXY */ #if JERRY_BUILTIN_BIGINT /* ECMA-262 v11, 20.2.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT_UL, - ECMA_BUILTIN_ID_BIGINT, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT_UL, ECMA_BUILTIN_ID_BIGINT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_BIGINT */ /* Routine properties: diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.c b/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.c index 984e9823..d727f026 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.c @@ -18,18 +18,16 @@ #if JERRY_ESNEXT #include "ecma-builtin-handlers.h" -#include "ecma-promise-object.h" #include "ecma-iterator-object.h" +#include "ecma-promise-object.h" -static const ecma_builtin_handler_t ecma_native_handlers[] = -{ +static const ecma_builtin_handler_t ecma_native_handlers[] = { #define ECMA_NATIVE_HANDLER(id, handler, length) handler, #include "ecma-builtin-handlers.inc.h" #undef ECMA_NATIVE_HANDLER }; -static const uint8_t ecma_native_handler_lengths[] = -{ +static const uint8_t ecma_native_handler_lengths[] = { #define ECMA_NATIVE_HANDLER(id, handler, length) length, #include "ecma-builtin-handlers.inc.h" #undef ECMA_NATIVE_HANDLER diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.h b/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.h index de582adc..21e96311 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.h @@ -20,8 +20,8 @@ #if JERRY_ESNEXT -#include "ecma-helpers.h" #include "ecma-builtins.h" +#include "ecma-helpers.h" #include "ecma-promise-object.h" #include "ecma-proxy-object.h" @@ -46,10 +46,8 @@ typedef enum */ #define ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT 2 -ecma_builtin_handler_t -ecma_builtin_handler_get (ecma_native_handler_id_t id); -uint8_t -ecma_builtin_handler_get_length (ecma_native_handler_id_t id); +ecma_builtin_handler_t ecma_builtin_handler_get (ecma_native_handler_id_t id); +uint8_t ecma_builtin_handler_get_length (ecma_native_handler_id_t id); #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c index 36a96923..f9e697ff 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c @@ -21,6 +21,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-objects.h" + #include "lit-char-helpers.h" #if JERRY_BUILTIN_DATE @@ -35,16 +36,12 @@ /** * Day names */ -const char day_names_p[7][3] = -{ - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" -}; +const char day_names_p[7][3] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; /** * Month names */ -const char month_names_p[12][3] = -{ +const char month_names_p[12][3] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -79,15 +76,10 @@ ecma_date_day_from_year (int32_t year) /**< year value */ { if (JERRY_LIKELY (year >= 1970)) { - return (int32_t) (365 * (year - 1970) - + ((year - 1969) / 4) - - ((year - 1901) / 100) - + ((year - 1601) / 400)); + return (int32_t) (365 * (year - 1970) + ((year - 1969) / 4) - ((year - 1901) / 100) + ((year - 1601) / 400)); } - return (int32_t) (365 * (year - 1970) - + floor ((year - 1969) / 4.0) - - floor ((year - 1901) / 100.0) + return (int32_t) (365 * (year - 1970) + floor ((year - 1969) / 4.0) - floor ((year - 1901) / 100.0) + floor ((year - 1601) / 400.0)); } /* ecma_date_day_from_year */ @@ -102,8 +94,7 @@ ecma_date_day_from_year (int32_t year) /**< year value */ static int ecma_date_days_in_year (int32_t year) /**< year */ { - if (year % 4 != 0 - || (year % 100 == 0 && (year % 400 != 0))) + if (year % 4 != 0 || (year % 100 == 0 && (year % 400 != 0))) { return ECMA_DATE_DAYS_IN_YEAR; } @@ -129,16 +120,34 @@ ecma_date_in_leap_year (int32_t year) /**< time value */ /** * First days of months in normal and leap years */ -static const uint16_t first_day_in_month[2][12] = -{ - { - 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, /* normal year */ - } - , - { - 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 /* leap year */ - } -}; +static const uint16_t first_day_in_month[2][12] = { { + 0, + 31, + 59, + 90, + 120, + 151, + 181, + 212, + 243, + 273, + 304, + 334, /* normal year */ + }, + { + 0, + 31, + 60, + 91, + 121, + 152, + 182, + 213, + 244, + 274, + 305, + 335 /* leap year */ + } }; /** * Abstract operation: YearFromTime @@ -383,9 +392,7 @@ ecma_date_make_time (ecma_number_t hour, /**< hour value */ ecma_number_t sec, /**< second value */ ecma_number_t ms) /**< millisecond value */ { - if (!ecma_number_is_finite (hour) - || !ecma_number_is_finite (min) - || !ecma_number_is_finite (sec) + if (!ecma_number_is_finite (hour) || !ecma_number_is_finite (min) || !ecma_number_is_finite (sec) || !ecma_number_is_finite (ms)) { return ecma_number_make_nan (); @@ -396,10 +403,7 @@ ecma_date_make_time (ecma_number_t hour, /**< hour value */ ecma_number_t s = ecma_number_trunc (sec); ecma_number_t milli = ecma_number_trunc (ms); - return (ecma_number_t) ((h * ECMA_DATE_MS_PER_HOUR - + m * ECMA_DATE_MS_PER_MINUTE - + s * ECMA_DATE_MS_PER_SECOND - + milli)); + return h * ECMA_DATE_MS_PER_HOUR + m * ECMA_DATE_MS_PER_MINUTE + s * ECMA_DATE_MS_PER_SECOND + milli; } /* ecma_date_make_time */ /** @@ -416,9 +420,7 @@ ecma_date_make_day (ecma_number_t year, /**< year value */ ecma_number_t date) /**< date value */ { /* 1. */ - if (!ecma_number_is_finite (year) - || !ecma_number_is_finite (month) - || !ecma_number_is_finite (date) + if (!ecma_number_is_finite (year) || !ecma_number_is_finite (month) || !ecma_number_is_finite (date) || fabs (year) > INT32_MAX) { return ecma_number_make_nan (); @@ -441,9 +443,7 @@ ecma_date_make_day (ecma_number_t year, /**< year value */ } /* 7. */ - ecma_number_t days = (ecma_date_day_from_year (ym) - + first_day_in_month[ecma_date_in_leap_year (ym)][mn] - + (dt - 1)); + ecma_number_t days = (ecma_date_day_from_year (ym) + first_day_in_month[ecma_date_in_leap_year (ym)][mn] + (dt - 1)); return days * ECMA_DATE_MS_PER_DAY; } /* ecma_date_make_day */ @@ -459,8 +459,7 @@ ecma_number_t ecma_date_make_date (ecma_number_t day, /**< day value */ ecma_number_t time) /**< time value */ { - if (!ecma_number_is_finite (day) - || !ecma_number_is_finite (time)) + if (!ecma_number_is_finite (day) || !ecma_number_is_finite (time)) { return ecma_number_make_nan (); } @@ -479,8 +478,7 @@ ecma_date_make_date (ecma_number_t day, /**< day value */ ecma_number_t ecma_date_time_clip (ecma_number_t time) /**< time value */ { - if (!ecma_number_is_finite (time) - || fabs (time) > ECMA_DATE_MAX_VALUE) + if (!ecma_number_is_finite (time) || fabs (time) > ECMA_DATE_MAX_VALUE) { return ecma_number_make_nan (); } @@ -674,14 +672,13 @@ ecma_date_to_string_format (ecma_number_t datetime_number, /**< datetime */ buffer_p--; *buffer_p = (lit_utf8_byte_t) ((number % 10) + (int32_t) LIT_CHAR_0); number /= 10; - } - while (--number_length); + } while (--number_length); } JERRY_ASSERT (dest_p <= date_buffer + date_buffer_length); - return ecma_make_string_value (ecma_new_ecma_string_from_ascii (date_buffer, - (lit_utf8_size_t) (dest_p - date_buffer))); + return ecma_make_string_value ( + ecma_new_ecma_string_from_ascii (date_buffer, (lit_utf8_size_t) (dest_p - date_buffer))); } /* ecma_date_to_string_format */ /** diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c index 74715b20..67f91c1f 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c @@ -14,14 +14,15 @@ */ #include "ecma-alloc.h" +#include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtin-helpers.h" #include "ecma-objects.h" + #include "jrt.h" /** \addtogroup ecma ECMA @@ -43,8 +44,7 @@ ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type, /**< native e { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - if (arguments_list_len != 0 - && !ecma_is_value_undefined (arguments_list_p[0])) + if (arguments_list_len != 0 && !ecma_is_value_undefined (arguments_list_p[0])) { ecma_string_t *message_string_p = ecma_op_to_string (arguments_list_p[0]); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c index 2f1fa927..7b926c7a 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c @@ -14,8 +14,9 @@ */ #include "ecma-alloc.h" -#include "ecma-helpers.h" #include "ecma-builtin-helpers.h" +#include "ecma-helpers.h" + #include "lit-char-helpers.h" #if JERRY_BUILTIN_JSON diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c index d00f202c..3edab6f2 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c @@ -19,14 +19,15 @@ #include "ecma-array-object.h" #include "ecma-builtins.h" #include "ecma-conversion.h" -#include "ecma-function-object.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-helpers.h" -#include "jmem.h" #include "ecma-objects.h" -#include "lit-magic-strings.h" + +#include "jmem.h" #include "lit-char-helpers.h" +#include "lit-magic-strings.h" /** \addtogroup ecma ECMA * @{ @@ -61,8 +62,7 @@ ecma_builtin_helper_object_to_string_tag_helper (ecma_value_t tag_value) /**< st lit_utf8_byte_t *buffer_ptr = str_buffer; - const lit_magic_string_id_t magic_string_ids[] = - { + const lit_magic_string_id_t magic_string_ids[] = { LIT_MAGIC_STRING_LEFT_SQUARE_CHAR, LIT_MAGIC_STRING_OBJECT, LIT_MAGIC_STRING_SPACE_CHAR, @@ -71,20 +71,23 @@ ecma_builtin_helper_object_to_string_tag_helper (ecma_value_t tag_value) /**< st /* Copy to buffer the "[object " string */ for (uint32_t i = 0; i < sizeof (magic_string_ids) / sizeof (lit_magic_string_id_t); ++i) { - buffer_ptr = lit_copy_magic_string_to_buffer (magic_string_ids[i], buffer_ptr, + buffer_ptr = lit_copy_magic_string_to_buffer (magic_string_ids[i], + buffer_ptr, (lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr)); JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size); } /* Copy to buffer the #@@toStringTag# string */ - buffer_ptr += ecma_string_copy_to_cesu8_buffer (tag_str_p, buffer_ptr, + buffer_ptr += ecma_string_copy_to_cesu8_buffer (tag_str_p, + buffer_ptr, (lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr)); JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size); /* Copy to buffer the "]" string */ - buffer_ptr = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_RIGHT_SQUARE_CHAR, buffer_ptr, + buffer_ptr = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_RIGHT_SQUARE_CHAR, + buffer_ptr, (lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr)); JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size); @@ -167,14 +170,10 @@ ecma_builtin_helper_object_to_string (const ecma_value_t this_arg) /**< this arg ecma_deref_object (obj_p); return ecma_builtin_helper_object_to_string_tag_helper (tag); } - else if (builtin_tag != LIT_MAGIC_STRING_ARGUMENTS_UL - && builtin_tag != LIT_MAGIC_STRING_FUNCTION_UL - && builtin_tag != LIT_MAGIC_STRING_ERROR_UL - && builtin_tag != LIT_MAGIC_STRING_BOOLEAN_UL - && builtin_tag != LIT_MAGIC_STRING_NUMBER_UL - && builtin_tag != LIT_MAGIC_STRING_STRING_UL - && builtin_tag != LIT_MAGIC_STRING_DATE_UL - && builtin_tag != LIT_MAGIC_STRING_REGEXP_UL + else if (builtin_tag != LIT_MAGIC_STRING_ARGUMENTS_UL && builtin_tag != LIT_MAGIC_STRING_FUNCTION_UL + && builtin_tag != LIT_MAGIC_STRING_ERROR_UL && builtin_tag != LIT_MAGIC_STRING_BOOLEAN_UL + && builtin_tag != LIT_MAGIC_STRING_NUMBER_UL && builtin_tag != LIT_MAGIC_STRING_STRING_UL + && builtin_tag != LIT_MAGIC_STRING_DATE_UL && builtin_tag != LIT_MAGIC_STRING_REGEXP_UL && builtin_tag != LIT_MAGIC_STRING_ARRAY_UL) { builtin_tag = LIT_MAGIC_STRING_OBJECT_UL; @@ -393,10 +392,8 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *array_obj_p, /**< array * /* 5.b.iii.3.b */ /* This will always be a simple value since 'is_throw' is false, so no need to free. */ - ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p, - *length_p + array_index, - get_value, - prop_flags); + ecma_value_t put_comp = + ecma_builtin_helper_def_prop_by_index (array_obj_p, *length_p + array_index, get_value, prop_flags); ecma_free_value (get_value); #if JERRY_ESNEXT if (ECMA_IS_VALUE_ERROR (put_comp)) @@ -414,10 +411,7 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *array_obj_p, /**< array * /* 5.c.i */ /* This will always be a simple value since 'is_throw' is false, so no need to free. */ - ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p, - (*length_p)++, - value, - prop_flags); + ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p, (*length_p)++, value, prop_flags); #if JERRY_ESNEXT if (ECMA_IS_VALUE_ERROR (put_comp)) @@ -686,10 +680,8 @@ ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_st { break; } - uint32_t index = ecma_builtin_helper_string_find_index (original_str_p, - search_str_p, - (uint32_t) start_ends_with); - ret_value = ecma_make_boolean_value (index == (uint32_t) start_ends_with); + uint32_t index = ecma_builtin_helper_string_find_index (original_str_p, search_str_p, (uint32_t) start_ends_with); + ret_value = ecma_make_boolean_value (index == (uint32_t) start_ends_with); break; } #endif /* JERRY_ESNEXT */ @@ -772,7 +764,7 @@ ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, /**< index while (!((size_t) (original_end_p - str_current_p) < search_str_size)) { - if (memcmp (str_current_p , search_str_utf8_p, search_str_size) == 0) + if (memcmp (str_current_p, search_str_utf8_p, search_str_size) == 0) { match_found = start_pos; break; @@ -804,10 +796,7 @@ ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, /**< object */ { if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM)) { - return ecma_builtin_helper_def_prop (obj_p, - ECMA_CREATE_DIRECT_UINT32_STRING (index), - value, - opts); + return ecma_builtin_helper_def_prop (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), value, opts); } ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index); @@ -842,7 +831,7 @@ ecma_builtin_helper_calculate_index (ecma_value_t index, /**< relative index arg ecma_number_t relative_index; ecma_value_t conversion_result = ecma_op_to_integer (index, &relative_index); - /* 4. */ + /* 4. */ if (ECMA_IS_VALUE_ERROR (conversion_result)) { return ECMA_VALUE_ERROR; @@ -893,9 +882,7 @@ ecma_builtin_helper_def_prop (ecma_object_t *obj_p, /**< object */ prop_desc.value = value; - return ecma_op_object_define_own_property (obj_p, - name_p, - &prop_desc); + return ecma_op_object_define_own_property (obj_p, name_p, &prop_desc); } /* ecma_builtin_helper_def_prop */ /** @@ -909,16 +896,12 @@ ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p) /**< replace con { JERRY_ASSERT (ctx_p->string_p != NULL); JERRY_ASSERT (ctx_p->matched_p == NULL - || (ctx_p->matched_p >= ctx_p->string_p - && ctx_p->matched_p <= ctx_p->string_p + ctx_p->string_size)); + || (ctx_p->matched_p >= ctx_p->string_p && ctx_p->matched_p <= ctx_p->string_p + ctx_p->string_size)); lit_utf8_size_t replace_size; uint8_t replace_flags = ECMA_STRING_FLAG_IS_ASCII; - const lit_utf8_byte_t *replace_buf_p = ecma_string_get_chars (ctx_p->replace_str_p, - &replace_size, - NULL, - NULL, - &replace_flags); + const lit_utf8_byte_t *replace_buf_p = + ecma_string_get_chars (ctx_p->replace_str_p, &replace_size, NULL, NULL, &replace_flags); const lit_utf8_byte_t *const replace_end_p = replace_buf_p + replace_size; const lit_utf8_byte_t *curr_p = replace_buf_p; @@ -1016,7 +999,7 @@ ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p) /**< replace con uint8_t idx = (uint8_t) (c - LIT_CHAR_0); if (curr_p < replace_end_p && lit_char_is_decimal_digit (*(curr_p))) { - uint8_t two_digit_index = (uint8_t) (idx * 10 + (uint8_t) (*(curr_p) - LIT_CHAR_0)); + uint8_t two_digit_index = (uint8_t) (idx * 10 + (uint8_t) (*(curr_p) -LIT_CHAR_0)); if (two_digit_index < capture_count) { idx = two_digit_index; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h index 08440fb4..1cf50c15 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h @@ -16,8 +16,8 @@ #ifndef ECMA_BUILTIN_HELPERS_H #define ECMA_BUILTIN_HELPERS_H -#include "ecma-globals.h" #include "ecma-exceptions.h" +#include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-regexp-object.h" @@ -41,45 +41,38 @@ typedef enum ECMA_STRING_ENDS_WITH /**< String.includes: ECMA-262 v6, 21.1.3.6 */ } ecma_string_index_of_mode_t; -ecma_value_t -ecma_builtin_helper_object_to_string (const ecma_value_t this_arg); -ecma_string_t * -ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, ecma_length_t index); -ecma_value_t -ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, ecma_length_t *length_p, ecma_value_t value); -ecma_value_t -ecma_builtin_helper_uint32_index_normalize (ecma_value_t arg, uint32_t length, uint32_t *number_p); +ecma_value_t ecma_builtin_helper_object_to_string (const ecma_value_t this_arg); +ecma_string_t *ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, ecma_length_t index); +ecma_value_t ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, ecma_length_t *length_p, ecma_value_t value); +ecma_value_t ecma_builtin_helper_uint32_index_normalize (ecma_value_t arg, uint32_t length, uint32_t *number_p); ecma_value_t ecma_builtin_helper_array_index_normalize (ecma_value_t arg, ecma_length_t length, ecma_length_t *number_p); -ecma_value_t -ecma_builtin_helper_string_index_normalize (ecma_number_t index, uint32_t length, bool nan_to_zero); -ecma_value_t -ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_str_p, ecma_value_t arg1, - ecma_value_t arg2, ecma_string_index_of_mode_t mode); +ecma_value_t ecma_builtin_helper_string_index_normalize (ecma_number_t index, uint32_t length, bool nan_to_zero); +ecma_value_t ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_str_p, + ecma_value_t arg1, + ecma_value_t arg2, + ecma_string_index_of_mode_t mode); uint32_t -ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, ecma_string_t *search_str_p, - uint32_t start_pos); +ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, ecma_string_t *search_str_p, uint32_t start_pos); ecma_value_t ecma_builtin_helper_def_prop (ecma_object_t *obj_p, ecma_string_t *name_p, ecma_value_t value, uint32_t opts); ecma_value_t -ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, ecma_length_t index, ecma_value_t value, - uint32_t opts); -ecma_value_t -ecma_builtin_helper_calculate_index (ecma_value_t index, ecma_length_t length, ecma_length_t *out_index); +ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, ecma_length_t index, ecma_value_t value, uint32_t opts); +ecma_value_t ecma_builtin_helper_calculate_index (ecma_value_t index, ecma_length_t length, ecma_length_t *out_index); /** * Context for replace substitutions */ typedef struct { - ecma_stringbuilder_t builder; /**< result string builder */ - const lit_utf8_byte_t *string_p; /**< source string */ - lit_utf8_size_t string_size; /**< source string size */ - const lit_utf8_byte_t *matched_p; /**< matched string */ - lit_utf8_size_t matched_size; /**< matcehd string size */ - lit_utf8_size_t match_byte_pos; /**< byte position of the match in the source string */ - uint16_t flags; /**< replace flags */ + ecma_stringbuilder_t builder; /**< result string builder */ + const lit_utf8_byte_t *string_p; /**< source string */ + lit_utf8_size_t string_size; /**< source string size */ + const lit_utf8_byte_t *matched_p; /**< matched string */ + lit_utf8_size_t matched_size; /**< matcehd string size */ + lit_utf8_size_t match_byte_pos; /**< byte position of the match in the source string */ + uint16_t flags; /**< replace flags */ /** * Capture results @@ -89,19 +82,17 @@ typedef struct #if JERRY_BUILTIN_REGEXP const ecma_regexp_capture_t *captures_p; /**< array of regexp capturing groups */ #endif /* JERRY_BUILTIN_REGEXP */ - const ecma_collection_t *collection_p; /**< collection of captured substrings */ + const ecma_collection_t *collection_p; /**< collection of captured substrings */ } u; - uint32_t capture_count; /**< number of captures in the capturing group array */ - ecma_string_t *replace_str_p; /**< replacement string */ + uint32_t capture_count; /**< number of captures in the capturing group array */ + ecma_string_t *replace_str_p; /**< replacement string */ } ecma_replace_context_t; -void -ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p); +void ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p); #if JERRY_ESNEXT -bool -ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p); +bool ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p); #endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_DATE @@ -114,35 +105,35 @@ ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p); */ /** Hours in a day. */ -#define ECMA_DATE_HOURS_PER_DAY (24) +#define ECMA_DATE_HOURS_PER_DAY (24) /** Minutes in an hour. */ -#define ECMA_DATE_MINUTES_PER_HOUR (60) +#define ECMA_DATE_MINUTES_PER_HOUR (60) /** Seconds in a minute. */ -#define ECMA_DATE_SECONDS_PER_MINUTE (60) +#define ECMA_DATE_SECONDS_PER_MINUTE (60) /** Milliseconds in a second. */ -#define ECMA_DATE_MS_PER_SECOND (1000) +#define ECMA_DATE_MS_PER_SECOND (1000) /** ECMA_DATE_MS_PER_MINUTE == 60000 */ -#define ECMA_DATE_MS_PER_MINUTE (ECMA_DATE_MS_PER_SECOND * ECMA_DATE_SECONDS_PER_MINUTE) +#define ECMA_DATE_MS_PER_MINUTE (ECMA_DATE_MS_PER_SECOND * ECMA_DATE_SECONDS_PER_MINUTE) /** ECMA_DATE_MS_PER_HOUR == 3600000 */ -#define ECMA_DATE_MS_PER_HOUR (ECMA_DATE_MS_PER_MINUTE * ECMA_DATE_MINUTES_PER_HOUR) +#define ECMA_DATE_MS_PER_HOUR (ECMA_DATE_MS_PER_MINUTE * ECMA_DATE_MINUTES_PER_HOUR) /** ECMA_DATE_MS_PER_DAY == 86400000 */ -#define ECMA_DATE_MS_PER_DAY ((ECMA_DATE_MS_PER_HOUR * ECMA_DATE_HOURS_PER_DAY)) +#define ECMA_DATE_MS_PER_DAY ((ECMA_DATE_MS_PER_HOUR * ECMA_DATE_HOURS_PER_DAY)) -#define ECMA_DATE_DAYS_IN_YEAR (365) +#define ECMA_DATE_DAYS_IN_YEAR (365) -#define ECMA_DATE_DAYS_IN_LEAP_YEAR (366) +#define ECMA_DATE_DAYS_IN_LEAP_YEAR (366) /** * This gives a range of 8,640,000,000,000,000 milliseconds * to either side of 01 January, 1970 UTC. */ -#define ECMA_DATE_MAX_VALUE 8.64e15 +#define ECMA_DATE_MAX_VALUE 8.64e15 /** * Timezone type. @@ -219,21 +210,20 @@ typedef struct ecma_stringbuilder_t result_builder; } ecma_json_stringify_context_t; -ecma_value_t ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p, - lit_utf8_size_t string_size); +ecma_value_t ecma_builtin_json_parse_buffer (const lit_utf8_byte_t *str_start_p, lit_utf8_size_t string_size); ecma_value_t ecma_builtin_json_stringify_no_opts (const ecma_value_t value); bool ecma_json_has_object_in_stack (ecma_json_occurrence_stack_item_t *stack_p, ecma_object_t *object_p); -ecma_value_t -ecma_builtin_helper_json_create_non_formatted_json (lit_utf8_byte_t left_bracket, lit_utf8_byte_t right_bracket, - ecma_collection_t *partial_p); +ecma_value_t ecma_builtin_helper_json_create_non_formatted_json (lit_utf8_byte_t left_bracket, + lit_utf8_byte_t right_bracket, + ecma_collection_t *partial_p); #endif /* JERRY_BUILTIN_JSON */ /* ecma-builtin-helper-error.c */ -ecma_value_t -ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type, const ecma_value_t *arguments_list_p, - uint32_t arguments_list_len); +ecma_value_t ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type, + const ecma_value_t *arguments_list_p, + uint32_t arguments_list_len); /* ecma-builtin-helpers-sort.c */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h index 28bea6fc..be175c23 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h @@ -14,41 +14,38 @@ */ #ifndef BUILTIN_UNDERSCORED_ID -# error "Please, define BUILTIN_UNDERSCORED_ID" +#error "Please, define BUILTIN_UNDERSCORED_ID" #endif /* !BUILTIN_UNDERSCORED_ID */ #ifndef BUILTIN_INC_HEADER_NAME -# error "Please, define BUILTIN_INC_HEADER_NAME" +#error "Please, define BUILTIN_INC_HEADER_NAME" #endif /* !BUILTIN_INC_HEADER_NAME */ #include "ecma-objects.h" -#define PASTE__(x, y) x ## y -#define PASTE_(x, y) PASTE__ (x, y) -#define PASTE(x, y) PASTE_ (x, y) +#define PASTE__(x, y) x##y +#define PASTE_(x, y) PASTE__ (x, y) +#define PASTE(x, y) PASTE_ (x, y) -#define PROPERTY_DESCRIPTOR_LIST_NAME \ - PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _property_descriptor_list) -#define DISPATCH_ROUTINE_ROUTINE_NAME \ - PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _dispatch_routine) +#define PROPERTY_DESCRIPTOR_LIST_NAME PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _property_descriptor_list) +#define DISPATCH_ROUTINE_ROUTINE_NAME PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _dispatch_routine) #ifndef BUILTIN_CUSTOM_DISPATCH -#define ROUTINE_ARG(n) , ecma_value_t arg ## n -#define ROUTINE_ARG_LIST_0 ecma_value_t this_arg -#define ROUTINE_ARG_LIST_1 ROUTINE_ARG_LIST_0 ROUTINE_ARG(1) -#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1 ROUTINE_ARG(2) -#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2 ROUTINE_ARG(3) -#define ROUTINE_ARG_LIST_NON_FIXED ROUTINE_ARG_LIST_0, \ - const ecma_value_t *arguments_list_p, uint32_t arguments_list_len +#define ROUTINE_ARG(n) , ecma_value_t arg##n +#define ROUTINE_ARG_LIST_0 ecma_value_t this_arg +#define ROUTINE_ARG_LIST_1 ROUTINE_ARG_LIST_0 ROUTINE_ARG (1) +#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1 ROUTINE_ARG (2) +#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2 ROUTINE_ARG (3) +#define ROUTINE_ARG_LIST_NON_FIXED ROUTINE_ARG_LIST_0, const ecma_value_t *arguments_list_p, uint32_t arguments_list_len #define ROUTINE(name, c_function_name, args_number, length_prop_value) \ - static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number); + static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number); #define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \ - static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number); + static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number); #define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \ - static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number); + static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number); #define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \ - static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0); \ + static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0); \ static ecma_value_t c_setter_func_name (ROUTINE_ARG_LIST_1); #define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \ static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0); @@ -66,17 +63,14 @@ enum { PASTE (ECMA_ROUTINE_START_, BUILTIN_UNDERSCORED_ID) = 0, -#define ROUTINE(name, c_function_name, args_number, length_prop_value) \ - ECMA_ROUTINE_ ## name ## c_function_name, +#define ROUTINE(name, c_function_name, args_number, length_prop_value) ECMA_ROUTINE_##name##c_function_name, #define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \ - ECMA_ROUTINE_ ## name ## c_function_name, + ECMA_ROUTINE_##name##c_function_name, #define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \ - ECMA_ROUTINE_ ## name ## c_function_name, + ECMA_ROUTINE_##name##c_function_name, #define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \ - ECMA_ACCESSOR_ ## name ## c_getter_func_name, \ - ECMA_ACCESSOR_ ## name ## c_setter_func_name, -#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \ - ECMA_ACCESSOR_ ## name ## c_getter_func_name, + ECMA_ACCESSOR_##name##c_getter_func_name, ECMA_ACCESSOR_##name##c_setter_func_name, +#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) ECMA_ACCESSOR_##name##c_getter_func_name, #include BUILTIN_INC_HEADER_NAME }; @@ -85,140 +79,80 @@ enum /** * Built-in property list of the built-in object. */ -const ecma_builtin_property_descriptor_t PROPERTY_DESCRIPTOR_LIST_NAME[] = -{ +const ecma_builtin_property_descriptor_t PROPERTY_DESCRIPTOR_LIST_NAME[] = { #ifndef BUILTIN_CUSTOM_DISPATCH #define ROUTINE(name, c_function_name, args_number, length_prop_value) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ROUTINE, \ - ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \ - ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ROUTINE, \ + ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \ + ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) }, #define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ROUTINE, \ - ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \ - ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ROUTINE, \ + ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \ + ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) }, #define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ROUTINE, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ROUTINE, \ + (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ + ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) }, #define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - ECMA_ACCESSOR_ ## name ## c_getter_func_name \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \ + (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ + ECMA_ACCESSOR_##name##c_getter_func_name }, #define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - ECMA_ACCESSOR_READ_WRITE (ECMA_ACCESSOR_ ## name ## c_getter_func_name, \ - ECMA_ACCESSOR_ ## name ## c_setter_func_name) \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \ + (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ + ECMA_ACCESSOR_READ_WRITE (ECMA_ACCESSOR_##name##c_getter_func_name, ECMA_ACCESSOR_##name##c_setter_func_name) }, #else /* BUILTIN_CUSTOM_DISPATCH */ #define ROUTINE(name, c_function_name, args_number, length_prop_value) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ROUTINE, \ - ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \ - ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ROUTINE, \ + ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \ + ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) }, #define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ROUTINE, \ - ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \ - ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ROUTINE, \ + ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \ + ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) }, #define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ROUTINE, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ROUTINE, \ + (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ + ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) }, #define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - c_getter_func_name \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \ + (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ + c_getter_func_name }, #define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - ECMA_ACCESSOR_READ_WRITE (c_getter_func_name, c_setter_func_name) \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \ + (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ + ECMA_ACCESSOR_READ_WRITE (c_getter_func_name, c_setter_func_name) }, #endif /* !BUILTIN_CUSTOM_DISPATCH */ #define OBJECT_VALUE(name, obj_builtin_id, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_OBJECT, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - obj_builtin_id \ - }, + { name, ECMA_BUILTIN_PROPERTY_OBJECT, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, obj_builtin_id }, #define SIMPLE_VALUE(name, simple_value, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_SIMPLE, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - simple_value \ - }, + { name, ECMA_BUILTIN_PROPERTY_SIMPLE, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, simple_value }, #define NUMBER_VALUE(name, number_value, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_NUMBER, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - number_value \ - }, + { name, ECMA_BUILTIN_PROPERTY_NUMBER, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, number_value }, #define STRING_VALUE(name, magic_string_id, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_STRING, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - magic_string_id \ - }, + { name, ECMA_BUILTIN_PROPERTY_STRING, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, magic_string_id }, #if JERRY_ESNEXT -#define SYMBOL_VALUE(name, symbol) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_SYMBOL, \ - ECMA_PROPERTY_BUILT_IN_FIXED, \ - symbol \ - }, +#define SYMBOL_VALUE(name, symbol) { name, ECMA_BUILTIN_PROPERTY_SYMBOL, ECMA_PROPERTY_BUILT_IN_FIXED, symbol }, #define INTRINSIC_PROPERTY(name, magic_string_id, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_INTRINSIC_PROPERTY, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - magic_string_id \ - }, + { name, ECMA_BUILTIN_PROPERTY_INTRINSIC_PROPERTY, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, magic_string_id }, #define ACCESSOR_BUILTIN_FUNCTION(name, getter_builtin_id, setter_builtin_id, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ACCESSOR_BUILTIN_FUNCTION, \ - (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ - ECMA_ACCESSOR_READ_WRITE (getter_builtin_id, setter_builtin_id) \ - }, + { name, \ + ECMA_BUILTIN_PROPERTY_ACCESSOR_BUILTIN_FUNCTION, \ + (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \ + ECMA_ACCESSOR_READ_WRITE (getter_builtin_id, setter_builtin_id) }, #endif /* JERRY_ESNEXT */ #include BUILTIN_INC_HEADER_NAME - { - LIT_MAGIC_STRING__COUNT, - ECMA_BUILTIN_PROPERTY_END, - 0, - 0 - } + { LIT_MAGIC_STRING__COUNT, ECMA_BUILTIN_PROPERTY_END, 0, 0 } }; #ifndef BUILTIN_CUSTOM_DISPATCH @@ -248,39 +182,39 @@ DISPATCH_ROUTINE_ROUTINE_NAME (uint8_t builtin_routine_id, /**< built-in wide ro { #define ROUTINE_ARG(n) (arguments_list[n - 1]) #define ROUTINE_ARG_LIST_0 -#define ROUTINE_ARG_LIST_1 , ROUTINE_ARG(1) -#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1, ROUTINE_ARG(2) -#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2, ROUTINE_ARG(3) +#define ROUTINE_ARG_LIST_1 , ROUTINE_ARG (1) +#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1, ROUTINE_ARG (2) +#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2, ROUTINE_ARG (3) #define ROUTINE_ARG_LIST_NON_FIXED , arguments_list, arguments_number -#define ROUTINE(name, c_function_name, args_number, length_prop_value) \ - case ECMA_ROUTINE_ ## name ## c_function_name: \ - { \ - return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \ - } +#define ROUTINE(name, c_function_name, args_number, length_prop_value) \ + case ECMA_ROUTINE_##name##c_function_name: \ + { \ + return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number); \ + } #define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \ - case ECMA_ROUTINE_ ## name ## c_function_name: \ - { \ - return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \ - } + case ECMA_ROUTINE_##name##c_function_name: \ + { \ + return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number); \ + } #define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \ - case ECMA_ROUTINE_ ## name ## c_function_name: \ - { \ - return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \ - } + case ECMA_ROUTINE_##name##c_function_name: \ + { \ + return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number); \ + } #define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \ - case ECMA_ACCESSOR_ ## name ## c_getter_func_name: \ - { \ - return c_getter_func_name(this_arg_value); \ - } \ - case ECMA_ACCESSOR_ ## name ## c_setter_func_name: \ - { \ - return c_setter_func_name(this_arg_value ROUTINE_ARG_LIST_1); \ - } + case ECMA_ACCESSOR_##name##c_getter_func_name: \ + { \ + return c_getter_func_name (this_arg_value); \ + } \ + case ECMA_ACCESSOR_##name##c_setter_func_name: \ + { \ + return c_setter_func_name (this_arg_value ROUTINE_ARG_LIST_1); \ + } #define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \ - case ECMA_ACCESSOR_ ## name ## c_getter_func_name: \ - { \ - return c_getter_func_name(this_arg_value); \ - } + case ECMA_ACCESSOR_##name##c_getter_func_name: \ + { \ + return c_getter_func_name (this_arg_value); \ + } #include BUILTIN_INC_HEADER_NAME #undef ROUTINE_ARG #undef ROUTINE_ARG_LIST_0 diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c b/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c index 1dc65d63..fc11a6be 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c @@ -13,15 +13,16 @@ * limitations under the License. */ -#include "ecma-builtins.h" -#include "ecma-builtin-helpers.h" -#include "ecma-container-object.h" #include "ecma-array-object.h" #include "ecma-arraybuffer-object.h" -#include "ecma-typedarray-object.h" -#include "ecma-string-object.h" +#include "ecma-builtin-helpers.h" +#include "ecma-builtins.h" +#include "ecma-container-object.h" #include "ecma-gc.h" #include "ecma-helpers.h" +#include "ecma-string-object.h" +#include "ecma-typedarray-object.h" + #include "lit-char-helpers.h" #if JERRY_ESNEXT @@ -53,7 +54,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-intrinsic.inc.h" -#define BUILTIN_UNDERSCORED_ID intrinsic +#define BUILTIN_UNDERSCORED_ID intrinsic #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -214,8 +215,8 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built- ecma_number_t *date_value_p = &((ecma_date_object_t *) ecma_get_object_from_value (this_arg))->date_value; #else /* !JERRY_ESNEXT */ ecma_extended_object_t *arg_ext_object_p = (ecma_extended_object_t *) ecma_get_object_from_value (argument); - ecma_number_t *date_value_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, - arg_ext_object_p->u.class_prop.u.date); + ecma_number_t *date_value_p = + ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, arg_ext_object_p->u.class_prop.u.date); #endif /* JERRY_ESNEXT */ if (ecma_number_is_nan (*date_value_p)) @@ -263,12 +264,10 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built- ecma_value_t result = ecma_make_string_value (ret_str_p); ecma_deref_ecma_string (to_str_p); return result; - } default: { - JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT - || builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT); + JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT || builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT); ecma_string_t *str_p = ecma_op_to_string (arguments_list_p[0]); @@ -282,15 +281,12 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built- if (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT) { - result = ecma_number_parse_int (string_buff, - string_buff_size, - arguments_list_p[1]); + result = ecma_number_parse_int (string_buff, string_buff_size, arguments_list_p[1]); } else { JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT); - result = ecma_number_parse_float (string_buff, - string_buff_size); + result = ecma_number_parse_float (string_buff, string_buff_size); } ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c index 19ead319..1bcc9166 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c @@ -37,7 +37,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-iterator-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID iterator_prototype +#define BUILTIN_UNDERSCORED_ID iterator_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-json.c b/jerry-core/ecma/builtin-objects/ecma-builtin-json.c index ba71461a..ef2a7dbd 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-json.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-json.c @@ -15,6 +15,7 @@ #include "ecma-alloc.h" #include "ecma-array-object.h" +#include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" @@ -22,11 +23,11 @@ #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtin-helpers.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" -#include "jrt.h" +#include "ecma-objects.h" + #include "jrt-libc-includes.h" +#include "jrt.h" #include "lit-char-helpers.h" #include "lit-globals.h" @@ -51,7 +52,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-json.inc.h" -#define BUILTIN_UNDERSCORED_ID json +#define BUILTIN_UNDERSCORED_ID json #include "ecma-builtin-internal-routines-template.inc.h" /** @@ -134,9 +135,7 @@ ecma_builtin_json_parse_string (ecma_json_token_t *token_p) /**< token argument if (*current_p == LIT_CHAR_BACKSLASH) { - ecma_stringbuilder_append_raw (&result_builder, - unappended_p, - (lit_utf8_size_t) (current_p - unappended_p)); + ecma_stringbuilder_append_raw (&result_builder, unappended_p, (lit_utf8_size_t) (current_p - unappended_p)); current_p++; @@ -212,9 +211,7 @@ ecma_builtin_json_parse_string (ecma_json_token_t *token_p) /**< token argument current_p++; } - ecma_stringbuilder_append_raw (&result_builder, - unappended_p, - (lit_utf8_size_t) (current_p - unappended_p)); + ecma_stringbuilder_append_raw (&result_builder, unappended_p, (lit_utf8_size_t) (current_p - unappended_p)); token_p->u.string_p = ecma_stringbuilder_finalize (&result_builder); token_p->current_p = current_p + 1; token_p->type = TOKEN_STRING; @@ -260,8 +257,7 @@ ecma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument do { current_p++; - } - while (current_p < end_p && lit_char_is_decimal_digit (*current_p)); + } while (current_p < end_p && lit_char_is_decimal_digit (*current_p)); } if (current_p < end_p && *current_p == LIT_CHAR_DOT) @@ -276,8 +272,7 @@ ecma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument do { current_p++; - } - while (current_p < end_p && lit_char_is_decimal_digit (*current_p)); + } while (current_p < end_p && lit_char_is_decimal_digit (*current_p)); } if (current_p < end_p && (*current_p == LIT_CHAR_LOWERCASE_E || *current_p == LIT_CHAR_UPPERCASE_E)) @@ -297,8 +292,7 @@ ecma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument do { current_p++; - } - while (current_p < end_p && lit_char_is_decimal_digit (*current_p)); + } while (current_p < end_p && lit_char_is_decimal_digit (*current_p)); } token_p->type = TOKEN_NUMBER; @@ -322,9 +316,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum token_p->type = TOKEN_INVALID; while (current_p < end_p - && (*current_p == LIT_CHAR_SP - || *current_p == LIT_CHAR_CR - || *current_p == LIT_CHAR_LF + && (*current_p == LIT_CHAR_SP || *current_p == LIT_CHAR_CR || *current_p == LIT_CHAR_LF || *current_p == LIT_CHAR_TAB)) { current_p++; @@ -388,9 +380,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_NULL); if (current_p + size <= end_p) { - if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_NULL), - current_p, - size)) + if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_NULL), current_p, size)) { token_p->type = TOKEN_NULL; token_p->current_p = current_p + size; @@ -404,9 +394,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_TRUE); if (current_p + size <= end_p) { - if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_TRUE), - current_p, - size)) + if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_TRUE), current_p, size)) { token_p->type = TOKEN_TRUE; token_p->current_p = current_p + size; @@ -420,9 +408,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_FALSE); if (current_p + size <= end_p) { - if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_FALSE), - current_p, - size)) + if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_FALSE), current_p, size)) { token_p->type = TOKEN_FALSE; token_p->current_p = current_p + size; @@ -454,10 +440,8 @@ ecma_builtin_json_define_value_property (ecma_object_t *obj_p, /**< this object ecma_string_t *property_name_p, /**< property name */ ecma_value_t value) /**< value */ { - ecma_value_t completion_value = ecma_builtin_helper_def_prop (obj_p, - property_name_p, - value, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); + ecma_value_t completion_value = + ecma_builtin_helper_def_prop (obj_p, property_name_p, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); JERRY_ASSERT (ecma_is_value_boolean (completion_value)); } /* ecma_builtin_json_define_value_property */ @@ -612,10 +596,9 @@ ecma_builtin_json_parse_value (ecma_json_token_t *token_p) /**< token argument * } } /* ecma_builtin_json_parse_value */ -static ecma_value_t -ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p, - ecma_object_t *object_p, - ecma_string_t *prop_name); +static ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p, + ecma_object_t *object_p, + ecma_string_t *prop_name); /** * Abstract operation InternalizeJSONProperty @@ -698,8 +681,8 @@ ecma_builtin_json_internalize_property (ecma_object_t *reviver_p, /**< reviver f /* 3.d */ else { - ecma_collection_t *props_p = ecma_op_object_get_enumerable_property_names (object_p, - ECMA_ENUMERABLE_PROPERTY_KEYS); + ecma_collection_t *props_p = + ecma_op_object_get_enumerable_property_names (object_p, ECMA_ENUMERABLE_PROPERTY_KEYS); #if JERRY_ESNEXT if (JERRY_UNLIKELY (props_p == NULL)) { @@ -737,10 +720,7 @@ ecma_builtin_json_internalize_property (ecma_object_t *reviver_p, /**< reviver f arguments_list[1] = value; /* 4. */ - ecma_value_t ret_value = ecma_op_function_call (reviver_p, - ecma_make_object_value (holder_p), - arguments_list, - 2); + ecma_value_t ret_value = ecma_op_function_call (reviver_p, ecma_make_object_value (holder_p), arguments_list, 2); ecma_free_value (value); return ret_value; } /* ecma_builtin_json_internalize_property */ @@ -755,10 +735,10 @@ ecma_builtin_json_internalize_property (ecma_object_t *reviver_p, /**< reviver f * @return ECMA_VALUE_TRUE - if no error occurred. * error if one of the operation failed. */ -static -ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p, /**< reviver function */ - ecma_object_t *object_p, /**< holder object */ - ecma_string_t *prop_name) /**< property name */ +static ecma_value_t +ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p, /**< reviver function */ + ecma_object_t *object_p, /**< holder object */ + ecma_string_t *prop_name) /**< property name */ { /* ES11: 2.b.iii.1 / 2.c.ii.1 */ ecma_value_t new_element = ecma_builtin_json_internalize_property (reviver_p, object_p, prop_name); @@ -786,10 +766,8 @@ ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *revi else { /* ES11: 2.b.iii.3.a / 2.c.ii.3.a */ - ecma_value_t def_value = ecma_builtin_helper_def_prop (object_p, - prop_name, - new_element, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); + ecma_value_t def_value = + ecma_builtin_helper_def_prop (object_p, prop_name, new_element, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); ecma_free_value (new_element); #if JERRY_ESNEXT @@ -812,7 +790,7 @@ ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *revi * Returned value must be freed with ecma_free_value. */ ecma_value_t -ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p, /**< String to parse */ +ecma_builtin_json_parse_buffer (const lit_utf8_byte_t *str_start_p, /**< String to parse */ lit_utf8_size_t string_size) /**< size of the string */ { ecma_json_token_t token; @@ -834,7 +812,7 @@ ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p, /**< String } return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid JSON format")); -} /*ecma_builtin_json_parse_buffer*/ +} /* ecma_builtin_json_parse_buffer */ /** * The JSON object's 'parse' routine @@ -939,9 +917,9 @@ ecma_builtin_json_quote (ecma_stringbuilder_t *builder_p, /**< builder for the r else if (c < LIT_CHAR_SP || should_escape) { /** - * In ES10 we should escape high or low surrogate characters, - * so we shouldn't append the unescaped character to the stringbuilder - */ + * In ES10 we should escape high or low surrogate characters, + * so we shouldn't append the unescaped character to the stringbuilder + */ uint8_t offset = should_escape ? LIT_UTF8_MAX_BYTES_IN_CODE_UNIT : 1; ecma_stringbuilder_append_raw (builder_p, @@ -986,18 +964,15 @@ ecma_builtin_json_quote (ecma_stringbuilder_t *builder_p, /**< builder for the r } } - ecma_stringbuilder_append_raw (builder_p, - regular_str_start_p, - (lit_utf8_size_t) (str_end_p - regular_str_start_p)); + ecma_stringbuilder_append_raw (builder_p, regular_str_start_p, (lit_utf8_size_t) (str_end_p - regular_str_start_p)); ecma_stringbuilder_append_byte (builder_p, LIT_CHAR_DOUBLE_QUOTE); ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size); } /* ecma_builtin_json_quote */ -static ecma_value_t -ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p, - ecma_object_t *holder_p, - ecma_string_t *key_p); +static ecma_value_t ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p, + ecma_object_t *holder_p, + ecma_string_t *key_p); /** * Abstract operation 'SerializeJSONObject' defined in 24.3.2.3 @@ -1272,9 +1247,8 @@ ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p, } ecma_object_t *value_obj_p = ecma_get_object_from_value (to_object_value); - ecma_value_t to_json = ecma_op_object_get_with_receiver (value_obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_TO_JSON_UL), - value); + ecma_value_t to_json = + ecma_op_object_get_with_receiver (value_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_TO_JSON_UL), value); ecma_deref_object (value_obj_p); @@ -1487,16 +1461,15 @@ ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p, * Returned value must be freed with ecma_free_value. * */ -static ecma_value_t ecma_builtin_json_str_helper (ecma_json_stringify_context_t *context_p, /**< context argument */ - const ecma_value_t arg1) /**< object argument */ +static ecma_value_t +ecma_builtin_json_str_helper (ecma_json_stringify_context_t *context_p, /**< context argument */ + const ecma_value_t arg1) /**< object argument */ { ecma_value_t ret_value = ECMA_VALUE_EMPTY; ecma_object_t *obj_wrapper_p = ecma_op_create_object_object_noarg (); ecma_string_t *empty_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY); - ecma_value_t put_comp_val = ecma_builtin_helper_def_prop (obj_wrapper_p, - empty_str_p, - arg1, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); + ecma_value_t put_comp_val = + ecma_builtin_helper_def_prop (obj_wrapper_p, empty_str_p, arg1, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); JERRY_ASSERT (ecma_is_value_true (put_comp_val)); @@ -1556,9 +1529,9 @@ ecma_builtin_json_stringify_no_opts (const ecma_value_t value) /**< value to str * Returned value must be freed with ecma_free_value. */ static ecma_value_t -ecma_builtin_json_stringify (ecma_value_t arg1, /**< value */ - ecma_value_t arg2, /**< replacer */ - ecma_value_t arg3) /**< space */ +ecma_builtin_json_stringify (ecma_value_t arg1, /**< value */ + ecma_value_t arg2, /**< replacer */ + ecma_value_t arg3) /**< space */ { ecma_json_stringify_context_t context; context.replacer_function_p = NULL; @@ -1750,8 +1723,8 @@ ecma_builtin_json_stringify (ecma_value_t arg1, /**< value */ JMEM_DEFINE_LOCAL_ARRAY (space_buff, num_of_spaces, char); memset (space_buff, LIT_CHAR_SP, (size_t) num_of_spaces); - context.gap_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff, - (lit_utf8_size_t) num_of_spaces); + context.gap_str_p = + ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff, (lit_utf8_size_t) num_of_spaces); JMEM_FINALIZE_LOCAL_ARRAY (space_buff); } diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h index e83345f8..21776999 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h @@ -23,9 +23,7 @@ #if JERRY_ESNEXT /* ECMA-262 v6, 24.3.3 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_JSON_U, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_JSON_U, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ /* Routine properties: diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c index 15f61a77..9471a450 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c @@ -37,7 +37,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-map-iterator-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID map_iterator_prototype +#define BUILTIN_UNDERSCORED_ID map_iterator_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h index 67348f54..fe2b8187 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h @@ -21,9 +21,7 @@ #if JERRY_BUILTIN_CONTAINER -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_MAP_ITERATOR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MAP_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c index 45d9329d..d7a10cc9 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c @@ -25,7 +25,7 @@ */ #define BUILTIN_CUSTOM_DISPATCH #define BUILTIN_INC_HEADER_NAME "ecma-builtin-map-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID map_prototype +#define BUILTIN_UNDERSCORED_ID map_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.inc.h index 6d99f667..65d91d69 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.inc.h @@ -25,14 +25,10 @@ * (property name, object pointer getter) */ /* ECMA-262 v6, 23.1.3.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_MAP, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_MAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 23.1.3.13 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_MAP_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ @@ -44,15 +40,15 @@ ROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1) ROUTINE (LIT_MAGIC_STRING_SET, ECMA_CONTAINER_ROUTINE_SET, 2, 2) ROUTINE (LIT_MAGIC_STRING_VALUES, ECMA_CONTAINER_ROUTINE_VALUES, 0, 0) ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_CONTAINER_ROUTINE_KEYS, 0, 0) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_ENTRIES, LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES, +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_ENTRIES, + LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES, +INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, + LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 23.1.3.10 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, - ECMA_CONTAINER_ROUTINE_SIZE_GETTER, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, ECMA_CONTAINER_ROUTINE_SIZE_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_BUILTIN_CONTAINER */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map.c b/jerry-core/ecma/builtin-objects/ecma-builtin-map.c index 215e2cc4..f79cccd5 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-map.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map.c @@ -14,8 +14,8 @@ */ #include "ecma-builtins.h" -#include "ecma-exceptions.h" #include "ecma-container-object.h" +#include "ecma-exceptions.h" #if JERRY_BUILTIN_CONTAINER @@ -23,7 +23,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-map.inc.h" -#define BUILTIN_UNDERSCORED_ID map +#define BUILTIN_UNDERSCORED_ID map #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-map.inc.h index 5cf091d4..e1ff9c00 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-map.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map.inc.h @@ -25,27 +25,19 @@ * (property name, number value, writable, enumerable, configurable) */ /* ECMA-262 v6, 23.1.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 23.1 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_MAP_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_MAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v6, 23.1.2.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_MAP_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_MAP_PROTOTYPE, ECMA_PROPERTY_FIXED) /* ECMA-262 v6, 23.1.2.2 */ -ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, - ecma_builtin_map_species_get, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_map_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_BUILTIN_CONTAINER */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-math.c b/jerry-core/ecma/builtin-objects/ecma-builtin-math.c index be8656c9..a9e737ec 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-math.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-math.c @@ -23,14 +23,15 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-number-arithmetic.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" -#include "jrt.h" +#include "ecma-objects.h" + #include "jrt-libc-includes.h" +#include "jrt.h" -#if defined (_WIN32) +#if defined(_WIN32) #include <intrin.h> -#endif +#endif /* defined(_WIN32) */ #if JERRY_BUILTIN_MATH @@ -79,11 +80,13 @@ enum ECMA_MATH_OBJECT_TANH, /* ECMA-262 v6, 20.2.2.34 */ ECMA_MATH_OBJECT_TRUNC, /* ECMA-262 v6, 20.2.2.35 */ #endif /* JERRY_ESNEXT */ - ECMA_MATH_OBJECT_ATAN2, /* ECMA-262 v5, 15.8.2.5 */ /* first routine with 2 arguments */ + ECMA_MATH_OBJECT_ATAN2, +/* ECMA-262 v5, 15.8.2.5 */ /* first routine with 2 arguments */ #if JERRY_ESNEXT ECMA_MATH_OBJECT_IMUL, /* ECMA-262 v6, 20.2.2.19 */ #endif /* JERRY_ESNEXT */ - ECMA_MATH_OBJECT_POW, /* ECMA-262 v5, 15.8.2.13 */ /* last routine with 1 or 2 arguments*/ + ECMA_MATH_OBJECT_POW, + /* ECMA-262 v5, 15.8.2.13 */ /* last routine with 1 or 2 arguments*/ ECMA_MATH_OBJECT_MAX, /* ECMA-262 v5, 15.8.2.11 */ ECMA_MATH_OBJECT_MIN, /* ECMA-262 v5, 15.8.2.12 */ #if JERRY_ESNEXT @@ -93,7 +96,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-math.inc.h" -#define BUILTIN_UNDERSCORED_ID math +#define BUILTIN_UNDERSCORED_ID math #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -151,8 +154,7 @@ ecma_builtin_math_object_max_min (bool is_max, /**< 'max' or 'min' operation */ continue; } - if (ecma_number_is_zero (arg_num) - && ecma_number_is_zero (result_num)) + if (ecma_number_is_zero (arg_num) && ecma_number_is_zero (result_num)) { bool is_negative = ecma_number_is_negative (arg_num); @@ -358,8 +360,7 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi } } - if (builtin_routine_id >= ECMA_MATH_OBJECT_ATAN2 - && arguments_number >= 2) + if (builtin_routine_id >= ECMA_MATH_OBJECT_ATAN2 && arguments_number >= 2) { if (ecma_is_value_number (arguments_list[1])) { @@ -437,15 +438,11 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi #endif /* JERRY_ESNEXT */ case ECMA_MATH_OBJECT_ROUND: { - if (ecma_number_is_nan (x) - || ecma_number_is_zero (x) - || ecma_number_is_infinity (x) - || fmod (x, 1.0) == 0) + if (ecma_number_is_nan (x) || ecma_number_is_zero (x) || ecma_number_is_infinity (x) || fmod (x, 1.0) == 0) { /* Do nothing. */ } - else if (ecma_number_is_negative (x) - && x >= -ECMA_NUMBER_HALF) + else if (ecma_number_is_negative (x) && x >= -ECMA_NUMBER_HALF) { x = -ECMA_NUMBER_ZERO; } @@ -551,12 +548,12 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi case ECMA_MATH_OBJECT_CLZ32: { uint32_t n = ecma_number_to_uint32 (x); -#if defined (__GNUC__) || defined (__clang__) +#if defined(__GNUC__) || defined(__clang__) x = n ? __builtin_clz (n) : 32; -#elif defined (_WIN32) +#elif defined(_WIN32) unsigned long ret; x = _BitScanReverse (&ret, n) ? 31 - ret : 32; -#else +#else /* !(defined(__GNUC__) || defined(__clang__) || defined(_WIN32)) */ x = 32; for (int i = 31; i >= 0; i--) { @@ -566,7 +563,7 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi break; } } -#endif +#endif /* defined (__GNUC__) || defined (__clang__) */ break; } case ECMA_MATH_OBJECT_FROUND: diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-math.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-math.inc.h index 4c663356..16d24d5e 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-math.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-math.inc.h @@ -25,50 +25,32 @@ * (property name, number value, writable, enumerable, configurable) */ /* ECMA-262 v5, 15.8.1.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_E_U, - ECMA_BUILTIN_NUMBER_E, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_E_U, ECMA_BUILTIN_NUMBER_E, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.8.1.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LN10_U, - ECMA_BUILTIN_NUMBER_LN10, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_LN10_U, ECMA_BUILTIN_NUMBER_LN10, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.8.1.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LN2_U, - ECMA_BUILTIN_NUMBER_LN2, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_LN2_U, ECMA_BUILTIN_NUMBER_LN2, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.8.1.4 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U, - ECMA_BUILTIN_NUMBER_LOG2E, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U, ECMA_BUILTIN_NUMBER_LOG2E, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.8.1.5 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U, - ECMA_BUILTIN_NUMBER_LOG10E, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U, ECMA_BUILTIN_NUMBER_LOG10E, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.8.1.6 */ -NUMBER_VALUE (LIT_MAGIC_STRING_PI_U, - ECMA_BUILTIN_NUMBER_PI, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_PI_U, ECMA_BUILTIN_NUMBER_PI, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.8.1.7 */ -NUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U, - ECMA_BUILTIN_NUMBER_SQRT_1_2, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U, ECMA_BUILTIN_NUMBER_SQRT_1_2, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.8.1.8 */ -NUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U, - ECMA_BUILTIN_NUMBER_SQRT2, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U, ECMA_BUILTIN_NUMBER_SQRT2, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT /* ECMA-262 v6, 20.2.1.9 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_MATH_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MATH_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ /* Routine properties: diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c index c27aecb3..6b2bdd52 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c @@ -24,8 +24,9 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" -#include "jrt.h" + #include "jrt-libc-includes.h" +#include "jrt.h" #include "lit-char-helpers.h" #if JERRY_BUILTIN_NUMBER @@ -53,7 +54,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-number-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID number_prototype +#define BUILTIN_UNDERSCORED_ID number_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -146,13 +147,9 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, / const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - static const lit_utf8_byte_t digit_chars[36] = - { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', - 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', - 'u', 'v', 'w', 'x', 'y', 'z' - }; + static const lit_utf8_byte_t digit_chars[36] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', + 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; uint32_t radix = 10; if (arguments_list_len > 0 && !ecma_is_value_undefined (arguments_list_p[0])) @@ -172,10 +169,8 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, / } } - if (ecma_number_is_nan (this_arg_number) - || ecma_number_is_infinity (this_arg_number) - || ecma_number_is_zero (this_arg_number) - || radix == 10) + if (ecma_number_is_nan (this_arg_number) || ecma_number_is_infinity (this_arg_number) + || ecma_number_is_zero (this_arg_number) || radix == 10) { ecma_string_t *ret_str_p = ecma_new_ecma_string_from_number (this_arg_number); return ecma_make_string_value (ret_str_p); @@ -319,7 +314,7 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, / * Calculate where we have to put the radix point relative to the beginning of * the new digits. If the exponent is non-negative this will be right after the number. */ - int point = exponent >= 0 ? magnitude + 1: buff_index - magnitude; + int point = exponent >= 0 ? magnitude + 1 : buff_index - magnitude; if (point < 0) { @@ -464,10 +459,10 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this_arg) /**< this */ typedef enum { - NUMBER_ROUTINE_TO_FIXED, /**< Number.prototype.toFixed: ECMA-262 v11, 20.1.3.3 */ + NUMBER_ROUTINE_TO_FIXED, /**< Number.prototype.toFixed: ECMA-262 v11, 20.1.3.3 */ NUMBER_ROUTINE_TO_EXPONENTIAL, /**< Number.prototype.toExponential: ECMA-262 v11, 20.1.3.2 */ - NUMBER_ROUTINE_TO_PRECISION, /**< Number.prototype.toPrecision: ECMA-262 v11, 20.1.3.5 */ - NUMBER_ROUTINE__COUNT, /**< count of the modes */ + NUMBER_ROUTINE_TO_PRECISION, /**< Number.prototype.toPrecision: ECMA-262 v11, 20.1.3.5 */ + NUMBER_ROUTINE__COUNT, /**< count of the modes */ } number_routine_mode_t; /** @@ -478,8 +473,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num, ecma_value_t arg, /**< routine's argument */ number_routine_mode_t mode) /**< number routine mode */ { - if (ecma_is_value_undefined (arg) - && mode == NUMBER_ROUTINE_TO_PRECISION) + if (ecma_is_value_undefined (arg) && mode == NUMBER_ROUTINE_TO_PRECISION) { return ecma_builtin_number_prototype_object_to_string (this_num, NULL, 0); } @@ -493,8 +487,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num, } /* Argument boundary check for toFixed method */ - if (mode == NUMBER_ROUTINE_TO_FIXED - && (arg_num <= -1 || arg_num >= 101)) + if (mode == NUMBER_ROUTINE_TO_FIXED && (arg_num <= -1 || arg_num >= 101)) { return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100")); } @@ -561,14 +554,12 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num, } /* Argument boundary check for toExponential and toPrecision methods */ - if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL - && (arg_num <= -1 || arg_num >= 101)) + if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL && (arg_num <= -1 || arg_num >= 101)) { ecma_stringbuilder_destroy (&builder); return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100")); } - else if (mode == NUMBER_ROUTINE_TO_PRECISION - && (arg_num < 1 || arg_num > 100)) + else if (mode == NUMBER_ROUTINE_TO_PRECISION && (arg_num < 1 || arg_num > 100)) { ecma_stringbuilder_destroy (&builder); return ecma_raise_range_error (ECMA_ERR_MSG ("Precision digits must be between 1 and 100")); @@ -582,8 +573,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num, arg_int = (int32_t) num_of_digits - 1; } - if (mode == NUMBER_ROUTINE_TO_FIXED - && exponent > 21) + if (mode == NUMBER_ROUTINE_TO_FIXED && exponent > 21) { ecma_stringbuilder_destroy (&builder); @@ -606,16 +596,11 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num, digits_to_keep += 1; } - num_of_digits = ecma_builtin_number_prototype_helper_round (digits, - num_of_digits, - digits_to_keep, - &exponent, - false); + num_of_digits = ecma_builtin_number_prototype_helper_round (digits, num_of_digits, digits_to_keep, &exponent, false); /* toExponent routine and toPrecision cases where the exponent > precision or exponent < -5 */ if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL - || (mode == NUMBER_ROUTINE_TO_PRECISION - && (exponent < -5 || exponent > arg_int))) + || (mode == NUMBER_ROUTINE_TO_PRECISION && (exponent < -5 || exponent > arg_int))) { /* Append first digit */ ecma_stringbuilder_append_byte (&builder, *digits); @@ -664,13 +649,11 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num, if (mode == NUMBER_ROUTINE_TO_FIXED) { - result_digits = ((exponent > 0) ? (lit_utf8_size_t) (exponent + arg_int) - : (lit_utf8_size_t) (arg_int + 1)); + result_digits = ((exponent > 0) ? (lit_utf8_size_t) (exponent + arg_int) : (lit_utf8_size_t) (arg_int + 1)); } else { - result_digits = ((exponent <= 0) ? (lit_utf8_size_t) (1 - exponent + arg_int) - : (lit_utf8_size_t) arg_int); + result_digits = ((exponent <= 0) ? (lit_utf8_size_t) (1 - exponent + arg_int) : (lit_utf8_size_t) arg_int); } /* Number of digits we copied from digits array */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h index 530616eb..e5ac7dd1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h @@ -25,9 +25,7 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.7.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_NUMBER, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_NUMBER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-number.c b/jerry-core/ecma/builtin-objects/ecma-builtin-number.c index c36fbd94..6626368c 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-number.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-number.c @@ -25,6 +25,7 @@ #include "ecma-helpers.h" #include "ecma-number-object.h" #include "ecma-objects.h" + #include "jrt.h" #if JERRY_BUILTIN_NUMBER @@ -52,7 +53,7 @@ enum #endif /* JERRY_ESNEXT */ #define BUILTIN_INC_HEADER_NAME "ecma-builtin-number.inc.h" -#define BUILTIN_UNDERSCORED_ID number +#define BUILTIN_UNDERSCORED_ID number #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-number.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-number.inc.h index 9f84069b..c586aa07 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-number.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-number.inc.h @@ -24,64 +24,42 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* ECMA-262 v5, 15.7.3.4 */ -NUMBER_VALUE (LIT_MAGIC_STRING_NAN, - ECMA_BUILTIN_NUMBER_NAN, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_NAN, ECMA_BUILTIN_NUMBER_NAN, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.7.3.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_MAX_VALUE_U, - ECMA_BUILTIN_NUMBER_MAX, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_MAX_VALUE_U, ECMA_BUILTIN_NUMBER_MAX, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.7.3.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_MIN_VALUE_U, - ECMA_BUILTIN_NUMBER_MIN, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_MIN_VALUE_U, ECMA_BUILTIN_NUMBER_MIN, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.7.3.5 */ -NUMBER_VALUE (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, - ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.7.3.6 */ -NUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, - ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT /* ECMA-262 v6, 20.1.2.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_EPSILON_U, - ECMA_BUILTIN_NUMBER_EPSILON, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_EPSILON_U, ECMA_BUILTIN_NUMBER_EPSILON, ECMA_PROPERTY_FIXED) /* ECMA-262 v6, 20.1.2.6 */ -NUMBER_VALUE (LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U, - ECMA_BUILTIN_NUMBER_MAX_SAFE_INTEGER, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U, ECMA_BUILTIN_NUMBER_MAX_SAFE_INTEGER, ECMA_PROPERTY_FIXED) /* ECMA-262 v6, 20.1.2.8 */ -NUMBER_VALUE (LIT_MAGIC_STRING_MIN_SAFE_INTEGER_U, - ECMA_BUILTIN_NUMBER_MIN_SAFE_INTEGER, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_MIN_SAFE_INTEGER_U, ECMA_BUILTIN_NUMBER_MIN_SAFE_INTEGER, ECMA_PROPERTY_FIXED) -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_NUMBER_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_NUMBER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.7.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, ECMA_PROPERTY_FIXED) #endif /* JERRY_BUILTIN_NUMBER */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c index 95e06156..7bdf27da 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c @@ -15,8 +15,8 @@ #include "ecma-alloc.h" #include "ecma-builtin-helpers.h" -#include "ecma-builtins.h" #include "ecma-builtin-object.h" +#include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" @@ -26,6 +26,7 @@ #include "ecma-objects.h" #include "ecma-proxy-object.h" #include "ecma-string-object.h" + #include "jrt.h" #define ECMA_BUILTINS_INTERNAL @@ -60,7 +61,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-object-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID object_prototype +#define BUILTIN_UNDERSCORED_ID object_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -247,11 +248,8 @@ ecma_builtin_object_prototype_define_getter_setter (ecma_value_t this_arg, /**< /* 3. */ ecma_property_descriptor_t desc = ecma_make_empty_property_descriptor (); - desc.flags |= (JERRY_PROP_IS_ENUMERABLE - | JERRY_PROP_IS_CONFIGURABLE - | JERRY_PROP_IS_ENUMERABLE_DEFINED - | JERRY_PROP_IS_CONFIGURABLE_DEFINED - | JERRY_PROP_SHOULD_THROW); + desc.flags |= (JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE_DEFINED + | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_SHOULD_THROW); if (define_getter) { diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h index a9c9d33b..47d2b8b4 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h @@ -23,9 +23,7 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.2.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_OBJECT, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_OBJECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ACCESSOR_READ_WRITE (LIT_MAGIC_STRING__PROTO__, ECMA_OBJECT_PROTOTYPE_GET_PROTO, diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object.c b/jerry-core/ecma/builtin-objects/ecma-builtin-object.c index 7d8a08a9..6f7da099 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-object.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object.c @@ -13,6 +13,8 @@ * limitations under the License. */ +#include "ecma-builtin-object.h" + #include "ecma-alloc.h" #include "ecma-array-object.h" #include "ecma-builtin-helpers.h" @@ -22,14 +24,15 @@ #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" +#include "ecma-objects-general.h" #include "ecma-objects.h" #include "ecma-proxy-object.h" -#include "ecma-objects-general.h" + #include "jrt.h" -#include "ecma-builtin-object.h" #if JERRY_ESNEXT -#include "ecma-iterator-object.h" #include "ecma-function-object.h" +#include "ecma-iterator-object.h" + #include "jcontext.h" #endif /* JERRY_ESNEXT */ @@ -82,7 +85,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-object.inc.h" -#define BUILTIN_UNDERSCORED_ID object +#define BUILTIN_UNDERSCORED_ID object #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -104,8 +107,7 @@ ecma_value_t ecma_builtin_object_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - if (arguments_list_len == 0 - || ecma_is_value_undefined (arguments_list_p[0]) + if (arguments_list_len == 0 || ecma_is_value_undefined (arguments_list_p[0]) || ecma_is_value_null (arguments_list_p[0])) { return ecma_make_object_value (ecma_op_create_object_object_noarg ()); @@ -126,16 +128,14 @@ ecma_builtin_object_dispatch_construct (const ecma_value_t *arguments_list_p, /* #if JERRY_ESNEXT if (JERRY_CONTEXT (current_new_target_p) != ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT)) { - ecma_object_t *prototype_obj_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE); + ecma_object_t *prototype_obj_p = + ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_OBJECT_PROTOTYPE); if (JERRY_UNLIKELY (prototype_obj_p == NULL)) { return ECMA_VALUE_ERROR; } - ecma_object_t *object_p = ecma_create_object (prototype_obj_p, - 0, - ECMA_OBJECT_TYPE_GENERAL); + ecma_object_t *object_p = ecma_create_object (prototype_obj_p, 0, ECMA_OBJECT_TYPE_GENERAL); ecma_deref_object (prototype_obj_p); return ecma_make_object_value (object_p); @@ -374,9 +374,7 @@ ecma_builtin_object_set_integrity_level (ecma_object_t *obj_p, /**< object */ prop_desc.flags |= JERRY_PROP_SHOULD_THROW; /* 8.a.i */ - ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, - property_name_p, - &prop_desc); + ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, property_name_p, &prop_desc); ecma_free_property_descriptor (&prop_desc); @@ -425,9 +423,7 @@ ecma_builtin_object_set_integrity_level (ecma_object_t *obj_p, /**< object */ prop_desc.flags |= JERRY_PROP_SHOULD_THROW; /* 9.3 */ - ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, - property_name_p, - &prop_desc); + ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, property_name_p, &prop_desc); ecma_free_property_descriptor (&prop_desc); @@ -440,7 +436,6 @@ ecma_builtin_object_set_integrity_level (ecma_object_t *obj_p, /**< object */ ecma_free_value (define_own_prop_ret); } - } ecma_collection_free (props_p); @@ -636,8 +631,7 @@ ecma_builtin_object_test_integrity_level (ecma_object_t *obj_p, /**< routine's a /* 2.b for isFrozen */ /* 2.b for isSealed, 2.c for isFrozen */ - if ((mode == ECMA_OBJECT_ROUTINE_IS_FROZEN && is_writable_data) - || is_configurable) + if ((mode == ECMA_OBJECT_ROUTINE_IS_FROZEN && is_writable_data) || is_configurable) { ret_value = ECMA_VALUE_FALSE; break; @@ -855,9 +849,7 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (buffer_p[i]); ecma_property_descriptor_t prop_desc; - ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (props_p, - prop_name_p, - &prop_desc); + ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (props_p, prop_name_p, &prop_desc); #if JERRY_ESNEXT if (ECMA_IS_VALUE_ERROR (get_desc)) @@ -878,8 +870,8 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine goto cleanup; } - ecma_value_t conv_result = ecma_op_to_property_descriptor (desc_obj, - &property_descriptors[property_descriptor_number]); + ecma_value_t conv_result = + ecma_op_to_property_descriptor (desc_obj, &property_descriptors[property_descriptor_number]); property_descriptors[property_descriptor_number].flags |= JERRY_PROP_SHOULD_THROW; @@ -906,9 +898,8 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine { ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (enum_prop_names->buffer_p[i]); - ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, - prop_name_p, - &property_descriptors[i]); + ecma_value_t define_own_prop_ret = + ecma_op_object_define_own_property (obj_p, prop_name_p, &property_descriptors[i]); if (ECMA_IS_VALUE_ERROR (define_own_prop_ret)) { goto cleanup; @@ -922,9 +913,7 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine cleanup: /* Clean up. */ - for (uint32_t index = 0; - index < property_descriptor_number; - index++) + for (uint32_t index = 0; index < property_descriptor_number; index++) { ecma_free_property_descriptor (&property_descriptors[index]); } @@ -1011,9 +1000,7 @@ ecma_builtin_object_object_define_property (ecma_object_t *obj_p, /**< routine's prop_desc.flags |= JERRY_PROP_SHOULD_THROW; - ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, - name_str_p, - &prop_desc); + ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, name_str_p, &prop_desc); ecma_free_property_descriptor (&prop_desc); ecma_free_value (conv_result); @@ -1272,10 +1259,8 @@ ecma_builtin_object_from_entries (ecma_value_t iterator) /**< object's iterator if (property_p == NULL) { ecma_property_value_t *prop; - prop = ecma_create_named_data_property (obj_p, - property_key, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, - NULL); + prop = + ecma_create_named_data_property (obj_p, property_key, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL); prop->value = ecma_copy_value_if_not_object (value); } else @@ -1331,8 +1316,7 @@ ecma_op_object_get_own_property_keys (ecma_value_t this_arg, /**< this argument if (type == ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_SYMBOLS) { - filter = (JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS - | JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES); + filter = (JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS | JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES); } ecma_collection_t *props_p = ecma_op_object_own_property_keys (obj_p, filter); @@ -1488,8 +1472,8 @@ ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in JERRY_ASSERT (builtin_routine_id - ECMA_OBJECT_ROUTINE_KEYS < ECMA_ENUMERABLE_PROPERTY__COUNT); const int option = builtin_routine_id - ECMA_OBJECT_ROUTINE_KEYS; - result = ecma_builtin_object_object_keys_values_helper (obj_p, - (ecma_enumerable_property_names_options_t) option); + result = + ecma_builtin_object_object_keys_values_helper (obj_p, (ecma_enumerable_property_names_options_t) option); break; } case ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTOR: diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object.h b/jerry-core/ecma/builtin-objects/ecma-builtin-object.h index 489e9831..f31b2617 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-object.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object.h @@ -15,22 +15,20 @@ #ifndef ECMA_BUILTIN_OBJECT_H #define ECMA_BUILTIN_OBJECT_H +#include "ecma-globals.h" + ecma_value_t ecma_builtin_object_object_get_prototype_of (ecma_object_t *obj_p); -ecma_value_t ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1, - ecma_value_t arg2); +ecma_value_t ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1, ecma_value_t arg2); -ecma_value_t ecma_builtin_object_object_set_proto (ecma_value_t arg1, - ecma_value_t arg2); +ecma_value_t ecma_builtin_object_object_set_proto (ecma_value_t arg1, ecma_value_t arg2); ecma_value_t ecma_builtin_object_object_prevent_extensions (ecma_object_t *obj_p); ecma_value_t ecma_builtin_object_object_is_extensible (ecma_object_t *obj_p); -ecma_value_t ecma_builtin_object_object_get_own_property_descriptor (ecma_object_t *obj_p, - ecma_string_t *name_str_p); -ecma_value_t ecma_builtin_object_object_define_property (ecma_object_t *obj_p, - ecma_string_t *name_str_p, - ecma_value_t arg3); +ecma_value_t ecma_builtin_object_object_get_own_property_descriptor (ecma_object_t *obj_p, ecma_string_t *name_str_p); +ecma_value_t +ecma_builtin_object_object_define_property (ecma_object_t *obj_p, ecma_string_t *name_str_p, ecma_value_t arg3); #endif /* !ECMA_BUILTIN_OBJECT_H */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h index 546e57b9..7f79d4e5 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h @@ -22,22 +22,16 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.2.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_OBJECT_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_OBJECT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ /* Routine properties: diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c index 7021b9bb..252512d6 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c @@ -38,7 +38,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-promise-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID promise_prototype +#define BUILTIN_UNDERSCORED_ID promise_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -74,7 +74,7 @@ ecma_builtin_promise_prototype_dispatch_routine (uint8_t builtin_routine_id, /** } case ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH: { - ecma_value_t args[] = {ECMA_VALUE_UNDEFINED, arguments_list_p[0]}; + ecma_value_t args[] = { ECMA_VALUE_UNDEFINED, arguments_list_p[0] }; return ecma_op_invoke_by_magic_id (this_arg, LIT_MAGIC_STRING_THEN, args, 2); } case ECMA_PROMISE_PROTOTYPE_ROUTINE_FINALLY: diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h index 2ffcc1b1..2f741624 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h @@ -20,14 +20,10 @@ /* Object properties: * (property name, object pointer getter) */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_PROMISE, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_PROMISE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 25.4.5.4 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_PROMISE_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_PROMISE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) ROUTINE (LIT_MAGIC_STRING_THEN, ECMA_PROMISE_PROTOTYPE_ROUTINE_THEN, 2, 2) ROUTINE (LIT_MAGIC_STRING_CATCH, ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH, 1, 1) diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c b/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c index 55afaa34..4de450bf 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c @@ -15,8 +15,8 @@ #include "ecma-alloc.h" #include "ecma-array-object.h" -#include "ecma-builtin-helpers.h" #include "ecma-builtin-handlers.h" +#include "ecma-builtin-helpers.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" #include "ecma-gc.h" @@ -24,6 +24,7 @@ #include "ecma-iterator-object.h" #include "ecma-number-object.h" #include "ecma-promise-object.h" + #include "jcontext.h" #if JERRY_ESNEXT @@ -52,7 +53,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-promise.inc.h" -#define BUILTIN_UNDERSCORED_ID promise +#define BUILTIN_UNDERSCORED_ID promise #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -87,8 +88,7 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p; - ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor), - LIT_MAGIC_STRING_RESOLVE); + ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor), LIT_MAGIC_STRING_RESOLVE); if (ECMA_IS_VALUE_ERROR (resolve)) { @@ -143,7 +143,7 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for } /* i. */ - ecma_value_t args[2] = {capability_p->resolve, capability_p->reject}; + ecma_value_t args[2] = { capability_p->resolve, capability_p->reject }; ecma_value_t result = ecma_op_invoke_by_magic_id (next_promise, LIT_MAGIC_STRING_THEN, args, 2); ecma_free_value (next_promise); @@ -175,7 +175,7 @@ exit: static inline ecma_value_t ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */ ecma_value_t next_method, /**< next method */ - ecma_object_t *capability_obj_p, /**< PromiseCapability record */ + ecma_object_t *capability_obj_p, /**< PromiseCapability record */ ecma_value_t ctor, /**< the caller of Promise.all */ uint8_t builtin_routine_id, /**< built-in wide routine identifier */ bool *done_p) /**< [out] iteratorRecord[[done]] */ @@ -186,8 +186,7 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */ ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p; - ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor), - LIT_MAGIC_STRING_RESOLVE); + ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor), LIT_MAGIC_STRING_RESOLVE); if (ECMA_IS_VALUE_ERROR (resolve)) { @@ -293,8 +292,8 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */ if (builtin_routine_id != ECMA_PROMISE_ROUTINE_ANY) { /* k. */ - executor_func_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, - sizeof (ecma_promise_all_executor_t)); + executor_func_p = + ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, sizeof (ecma_promise_all_executor_t)); ecma_promise_all_executor_t *executor_p = (ecma_promise_all_executor_t *) executor_func_p; @@ -339,8 +338,8 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */ executor_type = ECMA_PROMISE_ANY_REJECT << ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT; } - ecma_object_t *reject_func_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, - sizeof (ecma_promise_all_executor_t)); + ecma_object_t *reject_func_p = + ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, sizeof (ecma_promise_all_executor_t)); ecma_promise_all_executor_t *reject_p = (ecma_promise_all_executor_t *) reject_func_p; reject_p->index = idx; @@ -421,12 +420,8 @@ ecma_builtin_promise_helper (ecma_value_t this_arg, /**< 'this' argument */ } else { - ret = ecma_builtin_promise_perform (iterator, - next_method, - capability_obj_p, - this_arg, - builtin_routine_id, - &is_done); + ret = + ecma_builtin_promise_perform (iterator, next_method, capability_obj_p, this_arg, builtin_routine_id, &is_done); } if (ECMA_IS_VALUE_ERROR (ret)) diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-promise.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-promise.inc.h index 03c6439c..52a63aa4 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-promise.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-promise.inc.h @@ -24,20 +24,14 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_PROMISE_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_PROMISE_PROTOTYPE, ECMA_PROPERTY_FIXED) -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_PROMISE_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_PROMISE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ @@ -49,9 +43,7 @@ ROUTINE (LIT_MAGIC_STRING_ALLSETTLED, ECMA_PROMISE_ROUTINE_ALLSETTLED, 1, 1) ROUTINE (LIT_MAGIC_STRING_ANY, ECMA_PROMISE_ROUTINE_ANY, 1, 1) /* ES2015 25.4.4.6 */ -ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, - ECMA_PROMISE_ROUTINE_SPECIES_GET, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ECMA_PROMISE_ROUTINE_SPECIES_GET, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c b/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c index 5844a872..1fe6ac23 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-proxy-object.h" + #include "jrt.h" #if JERRY_BUILTIN_PROXY @@ -41,7 +42,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-proxy.inc.h" -#define BUILTIN_UNDERSCORED_ID proxy +#define BUILTIN_UNDERSCORED_ID proxy #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.inc.h index 82fedd00..32670616 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.inc.h @@ -24,13 +24,9 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 2, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_CONFIGURABLE) -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_PROXY_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_PROXY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c index 21565971..f72ac2c2 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c @@ -22,6 +22,7 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" + #include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -30,7 +31,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-rangeerror-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID range_error_prototype +#define BUILTIN_UNDERSCORED_ID range_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h index ce8406b1..1307e4a0 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h @@ -25,19 +25,13 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_RANGE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_RANGE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_RANGE_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_RANGE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c index cadbfc34..83ae4feb 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c @@ -14,17 +14,18 @@ */ #include "ecma-alloc.h" +#include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtin-helpers.h" #include "ecma-objects.h" -#include "ecma-function-object.h" -#include "jrt.h" + #include "jcontext.h" +#include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -32,7 +33,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-rangeerror.inc.h" -#define BUILTIN_UNDERSCORED_ID range_error +#define BUILTIN_UNDERSCORED_ID range_error #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.inc.h index 008acd08..042c13a3 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.inc.h @@ -24,22 +24,16 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_RANGE_ERROR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_RANGE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c index f1d4c593..5212d6bf 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c @@ -22,6 +22,7 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" + #include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -30,7 +31,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-referenceerror-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID reference_error_prototype +#define BUILTIN_UNDERSCORED_ID reference_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h index d03e8a65..caa9e0e3 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h @@ -25,19 +25,13 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_REFERENCE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_REFERENCE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_REFERENCE_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_REFERENCE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c index a3b6fbaa..5c983555 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c @@ -14,17 +14,18 @@ */ #include "ecma-alloc.h" +#include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtin-helpers.h" #include "ecma-objects.h" -#include "ecma-function-object.h" -#include "jrt.h" + #include "jcontext.h" +#include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -32,7 +33,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-referenceerror.inc.h" -#define BUILTIN_UNDERSCORED_ID reference_error +#define BUILTIN_UNDERSCORED_ID reference_error #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.inc.h index 4cb17bae..fa268dbc 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.inc.h @@ -24,22 +24,16 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_REFERENCE_ERROR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_REFERENCE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c b/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c index 3f921f04..32c32dc7 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c @@ -14,15 +14,16 @@ */ #include "ecma-array-object.h" -#include "ecma-builtins.h" #include "ecma-builtin-function-prototype.h" -#include "ecma-iterator-object.h" #include "ecma-builtin-helpers.h" #include "ecma-builtin-object.h" +#include "ecma-builtins.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" #include "ecma-gc.h" +#include "ecma-iterator-object.h" #include "ecma-proxy-object.h" + #include "jcontext.h" #if JERRY_BUILTIN_REFLECT @@ -57,7 +58,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-reflect.inc.h" -#define BUILTIN_UNDERSCORED_ID reflect +#define BUILTIN_UNDERSCORED_ID reflect #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -213,10 +214,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in return ECMA_VALUE_ERROR; } - ecma_value_t ret_value = ecma_op_function_construct (target_p, - new_target_p, - coll_p->buffer_p, - coll_p->item_count); + ecma_value_t ret_value = ecma_op_function_construct (target_p, new_target_p, coll_p->buffer_p, coll_p->item_count); ecma_collection_free (coll_p); return ret_value; @@ -285,9 +283,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in return conv_result; } - ecma_value_t result = ecma_op_object_define_own_property (obj_p, - name_str_p, - &prop_desc); + ecma_value_t result = ecma_op_object_define_own_property (obj_p, name_str_p, &prop_desc); ecma_deref_ecma_string (name_str_p); ecma_free_property_descriptor (&prop_desc); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c index 41ad961d..12b3b08e 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c @@ -15,20 +15,22 @@ #include "ecma-alloc.h" #include "ecma-array-object.h" -#include "ecma-builtins.h" #include "ecma-builtin-helpers.h" +#include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" -#include "ecma-globals.h" #include "ecma-gc.h" +#include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-regexp-object.h" + #include "lit-char-helpers.h" #if JERRY_BUILTIN_REGEXP #include "ecma-regexp-object.h" + #include "re-compiler.h" #define ECMA_BUILTINS_INTERNAL @@ -37,7 +39,7 @@ /** * This object has a custom dispatch function. */ - #define BUILTIN_CUSTOM_DISPATCH +#define BUILTIN_CUSTOM_DISPATCH /** * List of built-in routine identifiers. @@ -73,7 +75,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-regexp-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID regexp_prototype +#define BUILTIN_UNDERSCORED_ID regexp_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -100,14 +102,8 @@ ecma_builtin_regexp_prototype_flags_helper (ecma_extended_object_t *re_obj_p, /* uint16_t flags = bc_p->header.status_flags; - static const uint8_t re_flags[] = - { - RE_FLAG_GLOBAL, - RE_FLAG_IGNORE_CASE, - RE_FLAG_MULTILINE, - RE_FLAG_STICKY, - RE_FLAG_UNICODE, - RE_FLAG_DOTALL, + static const uint8_t re_flags[] = { + RE_FLAG_GLOBAL, RE_FLAG_IGNORE_CASE, RE_FLAG_MULTILINE, RE_FLAG_STICKY, RE_FLAG_UNICODE, RE_FLAG_DOTALL, }; uint16_t offset = (uint16_t) (builtin_routine_id - ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL); @@ -128,25 +124,12 @@ ecma_builtin_regexp_prototype_flags_helper (ecma_extended_object_t *re_obj_p, /* static ecma_value_t ecma_builtin_regexp_prototype_get_flags (ecma_object_t *object_p) /**< this object */ { - static const lit_magic_string_id_t flag_lit_ids[] = - { - LIT_MAGIC_STRING_GLOBAL, - LIT_MAGIC_STRING_IGNORECASE_UL, - LIT_MAGIC_STRING_MULTILINE, - LIT_MAGIC_STRING_DOTALL, - LIT_MAGIC_STRING_UNICODE, - LIT_MAGIC_STRING_STICKY - }; + static const lit_magic_string_id_t flag_lit_ids[] = { LIT_MAGIC_STRING_GLOBAL, LIT_MAGIC_STRING_IGNORECASE_UL, + LIT_MAGIC_STRING_MULTILINE, LIT_MAGIC_STRING_DOTALL, + LIT_MAGIC_STRING_UNICODE, LIT_MAGIC_STRING_STICKY }; - static const lit_utf8_byte_t flag_chars[] = - { - LIT_CHAR_LOWERCASE_G, - LIT_CHAR_LOWERCASE_I, - LIT_CHAR_LOWERCASE_M, - LIT_CHAR_LOWERCASE_S, - LIT_CHAR_LOWERCASE_U, - LIT_CHAR_LOWERCASE_Y - }; + static const lit_utf8_byte_t flag_chars[] = { LIT_CHAR_LOWERCASE_G, LIT_CHAR_LOWERCASE_I, LIT_CHAR_LOWERCASE_M, + LIT_CHAR_LOWERCASE_S, LIT_CHAR_LOWERCASE_U, LIT_CHAR_LOWERCASE_Y }; ecma_stringbuilder_t builder = ecma_stringbuilder_create (); for (uint32_t i = 0; i < sizeof (flag_lit_ids) / sizeof (lit_magic_string_id_t); i++) @@ -466,8 +449,7 @@ ecma_builtin_regexp_prototype_to_string (ecma_object_t *object_p) /**< this obje #else /* !JERRY_ESNEXT */ ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) object_p; - re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, - re_obj_p->u.cls.u3.value); + re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, re_obj_p->u.cls.u3.value); ecma_string_t *source_p = ecma_get_string_from_value (bc_p->source); uint16_t flags = bc_p->header.status_flags; @@ -565,7 +547,7 @@ ecma_builtin_regexp_prototype_match_all (ecma_object_t *regexp_obj_p, /**< this /* 6. */ ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor); ecma_value_t flags_value = ecma_make_string_value (flags); - ecma_value_t match_args[] = { ecma_make_object_value (regexp_obj_p), flags_value}; + ecma_value_t match_args[] = { ecma_make_object_value (regexp_obj_p), flags_value }; ecma_value_t matcher = ecma_op_function_construct (constructor_obj_p, constructor_obj_p, match_args, 2); ecma_deref_object (constructor_obj_p); @@ -604,10 +586,8 @@ ecma_builtin_regexp_prototype_match_all (ecma_object_t *regexp_obj_p, /**< this /* 8. */ ecma_object_t *matcher_obj_p = ecma_get_object_from_value (matcher); ecma_value_t last_index_value = ecma_make_length_value (last_index); - ecma_value_t set = ecma_op_object_put (matcher_obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), - last_index_value, - true); + ecma_value_t set = + ecma_op_object_put (matcher_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index_value, true); ecma_free_value (last_index_value); @@ -633,9 +613,7 @@ ecma_builtin_regexp_prototype_match_all (ecma_object_t *regexp_obj_p, /**< this /* 13. */ ecma_object_t *result_obj; ecma_object_t *proto_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_STRING_ITERATOR_PROTOTYPE); - result_obj = ecma_create_object (proto_p, - sizeof (ecma_regexp_string_iterator_t), - ECMA_OBJECT_TYPE_CLASS); + result_obj = ecma_create_object (proto_p, sizeof (ecma_regexp_string_iterator_t), ECMA_OBJECT_TYPE_CLASS); ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) result_obj; ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h index 320b4bf0..9b60457e 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h @@ -22,30 +22,20 @@ #if JERRY_BUILTIN_REGEXP /* ECMA-262 v5, 15.10.6.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_REGEXP, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_REGEXP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #if JERRY_ESNEXT -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_FLAGS, - ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_FLAGS, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_FLAGS, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_FLAGS, ECMA_PROPERTY_FLAG_CONFIGURABLE) -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SOURCE, - ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_SOURCE, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SOURCE, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_SOURCE, ECMA_PROPERTY_FLAG_CONFIGURABLE) -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_GLOBAL, - ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_GLOBAL, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL, ECMA_PROPERTY_FLAG_CONFIGURABLE) ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_IGNORECASE_UL, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_IGNORE_CASE, ECMA_PROPERTY_FLAG_CONFIGURABLE) -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_DOTALL, - ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_DOT_ALL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_DOTALL, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_DOT_ALL, ECMA_PROPERTY_FLAG_CONFIGURABLE) ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_MULTILINE, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_MULTILINE, @@ -55,9 +45,7 @@ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_UNICODE, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_UNICODE, ECMA_PROPERTY_FLAG_CONFIGURABLE) -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_STICKY, - ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_STICKY, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_STICKY, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_STICKY, ECMA_PROPERTY_FLAG_CONFIGURABLE) ROUTINE (LIT_GLOBAL_SYMBOL_REPLACE, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_REPLACE, 2, 2) ROUTINE (LIT_GLOBAL_SYMBOL_SEARCH, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_SEARCH, 1, 1) @@ -66,29 +54,19 @@ ROUTINE (LIT_GLOBAL_SYMBOL_MATCH, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_MATCH, 1, ROUTINE (LIT_GLOBAL_SYMBOL_MATCH_ALL, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_MATCH_ALL, 1, 1) #else /* !JERRY_ESNEXT */ /* ECMA-262 v5, 15.10.7.1 */ -STRING_VALUE (LIT_MAGIC_STRING_SOURCE, - LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP, - ECMA_PROPERTY_FIXED) +STRING_VALUE (LIT_MAGIC_STRING_SOURCE, LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.10.7.2 */ -SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL, - ECMA_VALUE_FALSE, - ECMA_PROPERTY_FIXED) +SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL, ECMA_VALUE_FALSE, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.10.7.3 */ -SIMPLE_VALUE (LIT_MAGIC_STRING_IGNORECASE_UL, - ECMA_VALUE_FALSE, - ECMA_PROPERTY_FIXED) +SIMPLE_VALUE (LIT_MAGIC_STRING_IGNORECASE_UL, ECMA_VALUE_FALSE, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.10.7.4 */ -SIMPLE_VALUE (LIT_MAGIC_STRING_MULTILINE, - ECMA_VALUE_FALSE, - ECMA_PROPERTY_FIXED) +SIMPLE_VALUE (LIT_MAGIC_STRING_MULTILINE, ECMA_VALUE_FALSE, ECMA_PROPERTY_FIXED) /* ECMA-262 v5, 15.10.7.5 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LASTINDEX_UL, - 0, - ECMA_PROPERTY_FLAG_WRITABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LASTINDEX_UL, 0, ECMA_PROPERTY_FLAG_WRITABLE) #endif /* JERRY_ESNEXT */ #if JERRY_BUILTIN_ANNEXB diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c index 9d3ab15f..d2d0d56e 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c @@ -26,7 +26,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-regexp-string-iterator-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID regexp_string_iterator_prototype +#define BUILTIN_UNDERSCORED_ID regexp_string_iterator_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -144,9 +144,8 @@ ecma_builtin_regexp_string_iterator_prototype_object_next (ecma_value_t this_val } uint8_t flags = regexp_string_iterator_obj->header.u.cls.u1.regexp_string_iterator_flags; - ecma_length_t next_index = ecma_op_advance_string_index (matcher_str_p, - this_index, - (flags & RE_FLAG_UNICODE) != 0); + ecma_length_t next_index = + ecma_op_advance_string_index (matcher_str_p, this_index, (flags & RE_FLAG_UNICODE) != 0); ecma_value_t next_index_value = ecma_make_length_value (next_index); ecma_value_t set = ecma_op_object_put (regexp_obj_p, diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c index e2274301..e9990429 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c @@ -19,17 +19,18 @@ #include "ecma-exceptions.h" #include "ecma-gc.h" #include "ecma-helpers.h" -#include "jcontext.h" #include "ecma-objects.h" #include "ecma-regexp-object.h" +#include "jcontext.h" + #if JERRY_BUILTIN_REGEXP #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-regexp.inc.h" -#define BUILTIN_UNDERSCORED_ID regexp +#define BUILTIN_UNDERSCORED_ID regexp #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -199,8 +200,7 @@ ecma_value_t ecma_builtin_regexp_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_builtin_regexp_dispatch_helper (arguments_list_p, - arguments_list_len); + return ecma_builtin_regexp_dispatch_helper (arguments_list_p, arguments_list_len); } /* ecma_builtin_regexp_dispatch_call */ /** @@ -213,8 +213,7 @@ ecma_value_t ecma_builtin_regexp_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_builtin_regexp_dispatch_helper (arguments_list_p, - arguments_list_len); + return ecma_builtin_regexp_dispatch_helper (arguments_list_p, arguments_list_len); } /* ecma_builtin_regexp_dispatch_construct */ #if JERRY_ESNEXT diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.inc.h index f64cea94..882e42ca 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.inc.h @@ -21,24 +21,16 @@ #if JERRY_BUILTIN_REGEXP -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 2, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* ECMA-262 v5, 15.10.5.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_REGEXP_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_REGEXP_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_REGEXP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 21.2.4.2 */ -ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, - ecma_builtin_regexp_species_get, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_regexp_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_REGEXP */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c index 38bf75b2..e435626b 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c @@ -37,7 +37,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-set-iterator-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID set_iterator_prototype +#define BUILTIN_UNDERSCORED_ID set_iterator_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h index 471f5ccf..4704236a 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h @@ -21,9 +21,7 @@ #if JERRY_BUILTIN_CONTAINER -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_SET_ITERATOR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SET_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c index 3f596bda..8ff2687c 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c @@ -25,7 +25,7 @@ */ #define BUILTIN_CUSTOM_DISPATCH #define BUILTIN_INC_HEADER_NAME "ecma-builtin-set-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID set_prototype +#define BUILTIN_UNDERSCORED_ID set_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.inc.h index 1c819a13..8c6f874b 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.inc.h @@ -25,14 +25,10 @@ * (property name, object pointer getter) */ /* ECMA-262 v6, 23.2.3.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_SET, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 23.1.3.13 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_SET_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ @@ -42,16 +38,17 @@ ROUTINE (LIT_MAGIC_STRING_DELETE, ECMA_CONTAINER_ROUTINE_DELETE, 1, 1) ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_CONTAINER_ROUTINE_FOREACH, 2, 1) ROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1) ROUTINE (LIT_MAGIC_STRING_ENTRIES, ECMA_CONTAINER_ROUTINE_ENTRIES, 0, 0) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES, LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES, +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES, + LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES, +INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, + LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_KEYS, LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES, +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_KEYS, + LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, - ECMA_CONTAINER_ROUTINE_SIZE_GETTER, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, ECMA_CONTAINER_ROUTINE_SIZE_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_BUILTIN_CONTAINER */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set.c b/jerry-core/ecma/builtin-objects/ecma-builtin-set.c index 5bc8fcc0..8210cc94 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-set.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set.c @@ -14,8 +14,8 @@ */ #include "ecma-builtins.h" -#include "ecma-exceptions.h" #include "ecma-container-object.h" +#include "ecma-exceptions.h" #if JERRY_BUILTIN_CONTAINER @@ -23,7 +23,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-set.inc.h" -#define BUILTIN_UNDERSCORED_ID set +#define BUILTIN_UNDERSCORED_ID set #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-set.inc.h index 0d2a7d71..559b4ccb 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-set.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set.inc.h @@ -25,27 +25,19 @@ * (property name, number value, writable, enumerable, configurable) */ /* ECMA-262 v6, 23.2.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 23.1 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_SET_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v6, 23.2.2.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_SET_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SET_PROTOTYPE, ECMA_PROPERTY_FIXED) /* ECMA-262 v6, 23.2.2.2 */ -ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, - ecma_builtin_set_species_get, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_set_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_BUILTIN_CONTAINER */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c index aea79461..dc6fc22f 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c @@ -13,6 +13,7 @@ * limitations under the License. */ +#include "ecma-arraybuffer-object.h" #include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" @@ -23,9 +24,9 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-shared-arraybuffer-object.h" -#include "ecma-arraybuffer-object.h" -#include "jrt.h" + #include "jrt-libc-includes.h" +#include "jrt.h" #if JERRY_BUILTIN_SHAREDARRAYBUFFER @@ -33,7 +34,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-shared-arraybuffer-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID shared_arraybuffer_prototype +#define BUILTIN_UNDERSCORED_ID shared_arraybuffer_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h index 4008dee7..c7b0b9eb 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h @@ -24,9 +24,7 @@ /* Object properties: * (property name, object pointer getter) */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* Readonly accessor properties */ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL, @@ -34,9 +32,7 @@ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v11, 24.2.4.4 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c index e5b7ba00..473287ec 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c @@ -14,13 +14,14 @@ */ #include "ecma-builtins.h" +#include "ecma-dataview-object.h" #include "ecma-exceptions.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-shared-arraybuffer-object.h" -#include "ecma-dataview-object.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_SHAREDARRAYBUFFER @@ -29,7 +30,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-shared-arraybuffer.inc.h" -#define BUILTIN_UNDERSCORED_ID shared_arraybuffer +#define BUILTIN_UNDERSCORED_ID shared_arraybuffer #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h index 35eafcf2..8a7c73a7 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h @@ -24,20 +24,14 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE, ECMA_PROPERTY_FIXED) -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c index 639fecae..a939a888 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c @@ -37,7 +37,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-string-iterator-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID string_iterator_prototype +#define BUILTIN_UNDERSCORED_ID string_iterator_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -157,10 +157,8 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**< ext_obj_p->u.cls.u2.iterator_index = ECMA_ITERATOR_INDEX_LIMIT; ecma_string_t *prop_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX); - ecma_value_t put_result = ecma_op_object_put (obj_p, - prop_name_p, - ecma_make_length_value (position + result_size), - true); + ecma_value_t put_result = + ecma_op_object_put (obj_p, prop_name_p, ecma_make_length_value (position + result_size), true); JERRY_ASSERT (ecma_is_value_true (put_result)); } diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h index 1597c5b2..e5d043d1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h @@ -21,9 +21,7 @@ #if JERRY_ESNEXT -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_STRING_ITERATOR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_STRING_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c index c1c09d65..dafde43e 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c @@ -16,8 +16,8 @@ #include "ecma-alloc.h" #include "ecma-array-object.h" #include "ecma-builtin-helpers.h" -#include "ecma-builtins.h" #include "ecma-builtin-regexp.inc.h" +#include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" @@ -27,9 +27,10 @@ #include "ecma-iterator-object.h" #include "ecma-objects.h" #include "ecma-string-object.h" + #include "jcontext.h" -#include "jrt.h" #include "jrt-libc-includes.h" +#include "jrt.h" #include "lit-char-helpers.h" #include "lit-strings.h" @@ -96,7 +97,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-string-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID string_prototype +#define BUILTIN_UNDERSCORED_ID string_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -179,8 +180,7 @@ ecma_builtin_string_prototype_char_at_helper (ecma_value_t this_arg, /**< this a if (index_num < 0 || index_num >= len || (ecma_number_is_nan (index_num) && len == 0)) { ecma_deref_ecma_string (original_string_p); - return (charcode_mode ? ecma_make_nan_value () - : ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY)); + return (charcode_mode ? ecma_make_nan_value () : ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY)); } /* 6 */ @@ -338,7 +338,6 @@ ecma_builtin_string_prototype_object_match (ecma_value_t this_argument, /**< thi /* 7. */ if (ECMA_IS_VALUE_ERROR (new_regexp)) { - ecma_deref_object (regexp_obj_p); ecma_deref_ecma_string (this_str_p); return new_regexp; @@ -629,20 +628,13 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /* } uint8_t input_flags = ECMA_STRING_FLAG_IS_ASCII; - replace_ctx.string_p = ecma_string_get_chars (input_str_p, - &(replace_ctx.string_size), - NULL, - NULL, - &input_flags); + replace_ctx.string_p = ecma_string_get_chars (input_str_p, &(replace_ctx.string_size), NULL, NULL, &input_flags); lit_utf8_size_t search_size; lit_utf8_size_t search_length; uint8_t search_flags = ECMA_STRING_FLAG_IS_ASCII; - const lit_utf8_byte_t *search_buf_p = ecma_string_get_chars (search_str_p, - &search_size, - &search_length, - NULL, - &search_flags); + const lit_utf8_byte_t *search_buf_p = + ecma_string_get_chars (search_str_p, &search_size, &search_length, NULL, &search_flags); ecma_string_t *result_string_p = NULL; @@ -669,17 +661,11 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /* { ecma_object_t *function_p = ecma_get_object_from_value (replace_value); - ecma_value_t args[] = - { - ecma_make_string_value (search_str_p), - ecma_make_uint32_value (pos), - ecma_make_string_value (input_str_p) - }; + ecma_value_t args[] = { ecma_make_string_value (search_str_p), + ecma_make_uint32_value (pos), + ecma_make_string_value (input_str_p) }; - result = ecma_op_function_call (function_p, - ECMA_VALUE_UNDEFINED, - args, - 3); + result = ecma_op_function_call (function_p, ECMA_VALUE_UNDEFINED, args, 3); if (ECMA_IS_VALUE_ERROR (result)) { @@ -708,8 +694,7 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /* ecma_builtin_replace_substitute (&replace_ctx); } - if (!replace_all - || last_match_end_p == input_end_p) + if (!replace_all || last_match_end_p == input_end_p) { break; } @@ -727,10 +712,9 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /* } ecma_stringbuilder_append_raw (&replace_ctx.builder, - last_match_end_p, - (lit_utf8_size_t) (input_end_p - last_match_end_p)); + last_match_end_p, + (lit_utf8_size_t) (input_end_p - last_match_end_p)); result_string_p = ecma_stringbuilder_finalize (&replace_ctx.builder); - } if (result_string_p == NULL) @@ -827,9 +811,8 @@ ecma_builtin_string_prototype_object_search (ecma_value_t this_value, /**< this return ECMA_VALUE_ERROR; } - ecma_value_t new_regexp = ecma_op_create_regexp_from_pattern (new_regexp_obj_p, - ecma_make_string_value (pattern_p), - ECMA_VALUE_UNDEFINED); + ecma_value_t new_regexp = + ecma_op_create_regexp_from_pattern (new_regexp_obj_p, ecma_make_string_value (pattern_p), ECMA_VALUE_UNDEFINED); ecma_deref_ecma_string (pattern_p); @@ -875,9 +858,7 @@ ecma_builtin_string_prototype_object_slice (ecma_string_t *get_string_val, /**< /* 4. 6. */ lit_utf8_size_t start = 0, end = len; - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (arg1, - len, - &start))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (arg1, len, &start))) { return ECMA_VALUE_ERROR; } @@ -889,9 +870,7 @@ ecma_builtin_string_prototype_object_slice (ecma_string_t *get_string_val, /**< } else { - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (arg2, - len, - &end))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (arg2, len, &end))) { return ECMA_VALUE_ERROR; } @@ -1046,32 +1025,23 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_value, /**< this a lit_utf8_size_t string_size; 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, - NULL, - NULL, - &string_flags); + const lit_utf8_byte_t *string_buffer_p = ecma_string_get_chars (string_p, &string_size, NULL, NULL, &string_flags); lit_utf8_size_t separator_size; uint8_t separator_flags = ECMA_STRING_FLAG_IS_ASCII; - const lit_utf8_byte_t *separator_buffer_p = ecma_string_get_chars (separator_p, - &separator_size, - NULL, - NULL, - &separator_flags); + const lit_utf8_byte_t *separator_buffer_p = + ecma_string_get_chars (separator_p, &separator_size, NULL, NULL, &separator_flags); const lit_utf8_byte_t *const string_end_p = string_buffer_p + string_size; - const lit_utf8_byte_t *const compare_end_p = JERRY_MIN (string_end_p - separator_size + 1, - string_end_p); + const lit_utf8_byte_t *const compare_end_p = JERRY_MIN (string_end_p - separator_size + 1, string_end_p); const lit_utf8_byte_t *current_p = string_buffer_p; const lit_utf8_byte_t *last_str_begin_p = string_buffer_p; while (current_p < compare_end_p) { - if (!memcmp (current_p, separator_buffer_p, separator_size) - && (last_str_begin_p != current_p + separator_size)) + if (!memcmp (current_p, separator_buffer_p, separator_size) && (last_str_begin_p != current_p + separator_size)) { - ecma_string_t *substr_p = ecma_new_ecma_string_from_utf8 (last_str_begin_p, - (lit_utf8_size_t) (current_p - last_str_begin_p)); + ecma_string_t *substr_p = + ecma_new_ecma_string_from_utf8 (last_str_begin_p, (lit_utf8_size_t) (current_p - last_str_begin_p)); ecma_value_t put_result = ecma_builtin_helper_def_prop_by_index (array_p, array_length++, ecma_make_string_value (substr_p), @@ -1092,8 +1062,8 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_value, /**< this a lit_utf8_incr (¤t_p); } - ecma_string_t *end_substr_p = ecma_new_ecma_string_from_utf8 (last_str_begin_p, - (lit_utf8_size_t) (string_end_p - last_str_begin_p)); + ecma_string_t *end_substr_p = + ecma_new_ecma_string_from_utf8 (last_str_begin_p, (lit_utf8_size_t) (string_end_p - last_str_begin_p)); ecma_value_t put_result = ecma_builtin_helper_def_prop_by_index (array_p, array_length, ecma_make_string_value (end_substr_p), @@ -1211,8 +1181,7 @@ ecma_builtin_string_prototype_object_conversion_helper (ecma_string_t *input_str lit_code_point_t cp = lit_cesu8_read_next (&input_curr_p); #if JERRY_ESNEXT - if (lit_is_code_point_utf16_high_surrogate (cp) - && input_curr_p < input_str_end_p) + if (lit_is_code_point_utf16_high_surrogate (cp) && input_curr_p < input_str_end_p) { const ecma_char_t next_ch = lit_cesu8_peek_next (input_curr_p); if (lit_is_code_point_utf16_low_surrogate (next_ch)) @@ -1312,8 +1281,7 @@ ecma_builtin_string_prototype_object_repeat (ecma_string_t *original_string_p, / for (int32_t n = 0; n < repeat_count; n++) { - buffer_ptr += ecma_string_copy_to_cesu8_buffer (original_string_p, buffer_ptr, - (lit_utf8_size_t) (size)); + buffer_ptr += ecma_string_copy_to_cesu8_buffer (original_string_p, buffer_ptr, (lit_utf8_size_t) (size)); } ret_string_p = ecma_new_ecma_string_from_utf8 (str_buffer, (lit_utf8_size_t) (buffer_ptr - str_buffer)); @@ -1353,17 +1321,14 @@ ecma_builtin_string_prototype_object_code_point_at (ecma_string_t *this_string_p ecma_char_t first = ecma_string_get_char_at_pos (this_string_p, index); - if (first < LIT_UTF16_HIGH_SURROGATE_MIN - || first > LIT_UTF16_HIGH_SURROGATE_MAX - || index + 1 == length) + if (first < LIT_UTF16_HIGH_SURROGATE_MIN || first > LIT_UTF16_HIGH_SURROGATE_MAX || index + 1 == length) { return ecma_make_uint32_value (first); } ecma_char_t second = ecma_string_get_char_at_pos (this_string_p, index + 1); - if (second < LIT_UTF16_LOW_SURROGATE_MARKER - || second > LIT_UTF16_LOW_SURROGATE_MAX) + if (second < LIT_UTF16_LOW_SURROGATE_MARKER || second > LIT_UTF16_LOW_SURROGATE_MAX) { return ecma_make_uint32_value (first); } diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.inc.h index 5e78ffed..ba3278f1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.inc.h @@ -25,17 +25,13 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.5.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_STRING, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_STRING, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* Number properties: * (property name, number value) */ /* ECMA-262 v5, 15.5.4 (String.prototype is itself a String object whose value is an empty String), 15.5.5.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FIXED) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ @@ -77,19 +73,15 @@ ROUTINE (LIT_MAGIC_STRING_STARTS_WITH, ECMA_STRING_PROTOTYPE_STARTS_WITH, 2, 1) ROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_STRING_PROTOTYPE_INCLUDES, 2, 1) ROUTINE (LIT_MAGIC_STRING_ENDS_WITH, ECMA_STRING_PROTOTYPE_ENDS_WITH, 2, 1) ROUTINE (LIT_MAGIC_STRING_CODE_POINT_AT, ECMA_STRING_PROTOTYPE_CODE_POINT_AT, 1, 1) -ROUTINE (LIT_MAGIC_STRING_PAD_START, ECMA_STRING_PROTOTYPE_PAD_START, 2, 1) -ROUTINE (LIT_MAGIC_STRING_PAD_END, ECMA_STRING_PROTOTYPE_PAD_END, 2, 1) +ROUTINE (LIT_MAGIC_STRING_PAD_START, ECMA_STRING_PROTOTYPE_PAD_START, 2, 1) +ROUTINE (LIT_MAGIC_STRING_PAD_END, ECMA_STRING_PROTOTYPE_PAD_END, 2, 1) ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ECMA_STRING_PROTOTYPE_ITERATOR, 0, 0) ROUTINE (LIT_MAGIC_STRING_MATCH_ALL, ECMA_STRING_PROTOTYPE_MATCH_ALL, 1, 1) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_START, LIT_MAGIC_STRING_TRIM_START, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_LEFT, LIT_MAGIC_STRING_TRIM_START, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_END, LIT_MAGIC_STRING_TRIM_END, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_RIGHT, LIT_MAGIC_STRING_TRIM_END, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_START, LIT_MAGIC_STRING_TRIM_START, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_LEFT, LIT_MAGIC_STRING_TRIM_START, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_END, LIT_MAGIC_STRING_TRIM_END, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_RIGHT, LIT_MAGIC_STRING_TRIM_END, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_STRING */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string.c index db4ca8a6..206889ba 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string.c @@ -13,7 +13,6 @@ * limitations under the License. */ -#include "lit-strings.h" #include "ecma-alloc.h" #include "ecma-builtins.h" #include "ecma-conversion.h" @@ -23,6 +22,8 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" + +#include "lit-strings.h" #if JERRY_ESNEXT #include "ecma-symbol-object.h" #endif /* JERRY_ESNEXT */ @@ -50,7 +51,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-string.inc.h" -#define BUILTIN_UNDERSCORED_ID string +#define BUILTIN_UNDERSCORED_ID string #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -85,15 +86,11 @@ ecma_builtin_string_object_from_char_code (const ecma_value_t args[], /**< argum ecma_string_t *ret_string_p = NULL; bool isError = false; - JMEM_DEFINE_LOCAL_ARRAY (utf8_buf_p, - utf8_buf_size, - lit_utf8_byte_t); + JMEM_DEFINE_LOCAL_ARRAY (utf8_buf_p, utf8_buf_size, lit_utf8_byte_t); lit_utf8_size_t utf8_buf_used = 0; - for (uint32_t arg_index = 0; - arg_index < args_number; - arg_index++) + for (uint32_t arg_index = 0; arg_index < args_number; arg_index++) { ecma_number_t arg_num; @@ -411,7 +408,7 @@ ecma_builtin_string_dispatch_routine (uint8_t builtin_routine_id, /**< built-in switch (builtin_routine_id) { - case ECMA_BUILTIN_STRING_OBJECT_FROM_CHAR_CODE: + case ECMA_BUILTIN_STRING_OBJECT_FROM_CHAR_CODE: { return ecma_builtin_string_object_from_char_code (arguments_list_p, arguments_number); } diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-string.inc.h index 0d08ace2..8bc41343 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string.inc.h @@ -24,22 +24,16 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.7.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_STRING_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_STRING_PROTOTYPE, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_STRING_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_STRING_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ /* Routine properties: diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c index 9bd30dce..c508148b 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c @@ -13,16 +13,17 @@ * limitations under the License. */ - #include "ecma-alloc.h" - #include "ecma-builtins.h" - #include "ecma-conversion.h" - #include "ecma-exceptions.h" - #include "ecma-gc.h" - #include "ecma-globals.h" - #include "ecma-helpers.h" - #include "ecma-objects.h" - #include "ecma-symbol-object.h" - #include "jrt.h" +#include "ecma-alloc.h" +#include "ecma-builtins.h" +#include "ecma-conversion.h" +#include "ecma-exceptions.h" +#include "ecma-gc.h" +#include "ecma-globals.h" +#include "ecma-helpers.h" +#include "ecma-objects.h" +#include "ecma-symbol-object.h" + +#include "jrt.h" #if JERRY_ESNEXT @@ -47,7 +48,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-symbol-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID symbol_prototype +#define BUILTIN_UNDERSCORED_ID symbol_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h index 15ff82a0..585b86b6 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h @@ -24,26 +24,17 @@ /* Object properties: * (property name, object pointer getter) */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_SYMBOL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SYMBOL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_SYMBOL_PROTOTYPE_TO_STRING, 0, 0) ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_SYMBOL_PROTOTYPE_VALUE_OF, 0, 0) -ROUTINE_CONFIGURABLE_ONLY (LIT_GLOBAL_SYMBOL_TO_PRIMITIVE, - ECMA_SYMBOL_PROTOTYPE_TO_PRIMITIVE, - 0, - 1) +ROUTINE_CONFIGURABLE_ONLY (LIT_GLOBAL_SYMBOL_TO_PRIMITIVE, ECMA_SYMBOL_PROTOTYPE_TO_PRIMITIVE, 0, 1) /* ECMA-262 v6, 19.4.3.4 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_SYMBOL_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SYMBOL_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262, v11, 19.4.3.2 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_DESCRIPTION, - ECMA_SYMBOL_PROTOTYPE_DESCRIPTION, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_DESCRIPTION, ECMA_SYMBOL_PROTOTYPE_DESCRIPTION, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c index 5cec6a05..646a4daa 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c @@ -13,18 +13,19 @@ * limitations under the License. */ - #include "ecma-alloc.h" - #include "ecma-builtins.h" - #include "ecma-conversion.h" - #include "ecma-exceptions.h" - #include "ecma-gc.h" - #include "ecma-globals.h" - #include "ecma-helpers.h" - #include "ecma-objects.h" - #include "ecma-symbol-object.h" - #include "ecma-literal-storage.h" - #include "jcontext.h" - #include "jrt.h" +#include "ecma-alloc.h" +#include "ecma-builtins.h" +#include "ecma-conversion.h" +#include "ecma-exceptions.h" +#include "ecma-gc.h" +#include "ecma-globals.h" +#include "ecma-helpers.h" +#include "ecma-literal-storage.h" +#include "ecma-objects.h" +#include "ecma-symbol-object.h" + +#include "jcontext.h" +#include "jrt.h" #if JERRY_ESNEXT @@ -32,7 +33,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-symbol.inc.h" -#define BUILTIN_UNDERSCORED_ID symbol +#define BUILTIN_UNDERSCORED_ID symbol #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -106,15 +107,13 @@ ecma_builtin_symbol_for_helper (ecma_value_t value_to_find) /**< symbol or ecma- while (symbol_list_cp != JMEM_CP_NULL) { - ecma_lit_storage_item_t *symbol_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, - symbol_list_cp); + ecma_lit_storage_item_t *symbol_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, symbol_list_cp); for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++) { if (symbol_list_p->values[i] != JMEM_CP_NULL) { - ecma_string_t *value_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, - symbol_list_p->values[i]); + ecma_string_t *value_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, symbol_list_p->values[i]); if (is_for) { diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.inc.h index a2037c82..1d34b3a4 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.inc.h @@ -25,73 +25,54 @@ * (property name, number value, writable, enumerable, configurable) */ /* ECMA-262 v6, 19.4.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE) -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_SYMBOL_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SYMBOL_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v6, 19.4.2.7 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE, ECMA_PROPERTY_FIXED) /* ECMA-262 v10, 19.4.2.1 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_ASYNC_ITERATOR, - LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR) +SYMBOL_VALUE (LIT_MAGIC_STRING_ASYNC_ITERATOR, LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR) /* ECMA-262 v6, 19.4.2.2 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_HAS_INSTANCE, - LIT_GLOBAL_SYMBOL_HAS_INSTANCE) +SYMBOL_VALUE (LIT_MAGIC_STRING_HAS_INSTANCE, LIT_GLOBAL_SYMBOL_HAS_INSTANCE) /* ECMA-262 v6, 19.4.2.3 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE, - LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE) +SYMBOL_VALUE (LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE, LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE) /* ECMA-262 v6, 19.4.2.4 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_ITERATOR, - LIT_GLOBAL_SYMBOL_ITERATOR) +SYMBOL_VALUE (LIT_MAGIC_STRING_ITERATOR, LIT_GLOBAL_SYMBOL_ITERATOR) /* ECMA-262 v6, 19.4.2.6 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_MATCH, - LIT_GLOBAL_SYMBOL_MATCH) +SYMBOL_VALUE (LIT_MAGIC_STRING_MATCH, LIT_GLOBAL_SYMBOL_MATCH) /* ECMA-262 v6, 19.4.2.8 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_REPLACE, - LIT_GLOBAL_SYMBOL_REPLACE) +SYMBOL_VALUE (LIT_MAGIC_STRING_REPLACE, LIT_GLOBAL_SYMBOL_REPLACE) /* ECMA-262 v6, 19.4.2.9 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_SEARCH, - LIT_GLOBAL_SYMBOL_SEARCH) +SYMBOL_VALUE (LIT_MAGIC_STRING_SEARCH, LIT_GLOBAL_SYMBOL_SEARCH) /* ECMA-262 v6, 19.4.2.10 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_SPECIES, - LIT_GLOBAL_SYMBOL_SPECIES) +SYMBOL_VALUE (LIT_MAGIC_STRING_SPECIES, LIT_GLOBAL_SYMBOL_SPECIES) /* ECMA-262 v6, 19.4.2.11 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_SPLIT, - LIT_GLOBAL_SYMBOL_SPLIT) +SYMBOL_VALUE (LIT_MAGIC_STRING_SPLIT, LIT_GLOBAL_SYMBOL_SPLIT) /* ECMA-262 v6, 19.4.2.12 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_TO_PRIMITIVE, - LIT_GLOBAL_SYMBOL_TO_PRIMITIVE) +SYMBOL_VALUE (LIT_MAGIC_STRING_TO_PRIMITIVE, LIT_GLOBAL_SYMBOL_TO_PRIMITIVE) /* ECMA-262 v6, 19.4.2.13 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_TO_STRING_TAG, - LIT_GLOBAL_SYMBOL_TO_STRING_TAG) +SYMBOL_VALUE (LIT_MAGIC_STRING_TO_STRING_TAG, LIT_GLOBAL_SYMBOL_TO_STRING_TAG) /* ECMA-262 v6, 19.4.2.14 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_UNSCOPABLES, - LIT_GLOBAL_SYMBOL_UNSCOPABLES) +SYMBOL_VALUE (LIT_MAGIC_STRING_UNSCOPABLES, LIT_GLOBAL_SYMBOL_UNSCOPABLES) /* ECMA-262 v11, 19.4.2.8 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_MATCH_ALL, - LIT_GLOBAL_SYMBOL_MATCH_ALL) +SYMBOL_VALUE (LIT_MAGIC_STRING_MATCH_ALL, LIT_GLOBAL_SYMBOL_MATCH_ALL) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c index 915c586f..2e5e7b8c 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c @@ -22,6 +22,7 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" + #include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -30,7 +31,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-syntaxerror-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID syntax_error_prototype +#define BUILTIN_UNDERSCORED_ID syntax_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h index abaf5a4f..670efc1d 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h @@ -25,19 +25,13 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_SYNTAX_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SYNTAX_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_SYNTAX_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SYNTAX_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c index 29d2ce6c..6227ef60 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c @@ -14,17 +14,18 @@ */ #include "ecma-alloc.h" +#include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtin-helpers.h" #include "ecma-objects.h" -#include "ecma-function-object.h" -#include "jrt.h" + #include "jcontext.h" +#include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -32,7 +33,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-syntaxerror.inc.h" -#define BUILTIN_UNDERSCORED_ID syntax_error +#define BUILTIN_UNDERSCORED_ID syntax_error #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h index 88e12d51..18df8255 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h @@ -24,22 +24,16 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_SYNTAX_ERROR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SYNTAX_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c b/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c index 98a68f03..3e2f9df3 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c @@ -21,13 +21,14 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-objects.h" + #include "jrt.h" #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-type-error-thrower.inc.h" -#define BUILTIN_UNDERSCORED_ID type_error_thrower +#define BUILTIN_UNDERSCORED_ID type_error_thrower #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h index 4833a075..e44c8aba 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h @@ -24,12 +24,8 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FIXED) -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_FIXED) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_FIXED) #include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c index 45ad8210..9e9971a1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c @@ -22,6 +22,7 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" + #include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -30,7 +31,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-typeerror-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID type_error_prototype +#define BUILTIN_UNDERSCORED_ID type_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h index b34fb39e..4d0b4f28 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h @@ -25,19 +25,13 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_TYPE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_TYPE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_TYPE_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_TYPE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c index 608f241f..a16fce50 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c @@ -14,17 +14,18 @@ */ #include "ecma-alloc.h" +#include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtin-helpers.h" #include "ecma-objects.h" -#include "ecma-function-object.h" -#include "jrt.h" + #include "jcontext.h" +#include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -32,7 +33,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-typeerror.inc.h" -#define BUILTIN_UNDERSCORED_ID type_error +#define BUILTIN_UNDERSCORED_ID type_error #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -69,8 +70,8 @@ ecma_builtin_type_error_dispatch_construct (const ecma_value_t *arguments_list_p #if !JERRY_ESNEXT return ecma_builtin_type_error_dispatch_call (arguments_list_p, arguments_list_len); #else /* JERRY_ESNEXT */ - ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), - ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE); + ecma_object_t *proto_p = + ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE); if (proto_p == NULL) { diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.inc.h index bcd735b1..a4508f91 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.inc.h @@ -24,22 +24,16 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_TYPE_ERROR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_TYPE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c index 068ec26a..26acbaba 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c @@ -22,6 +22,7 @@ #include "ecma-helpers.h" #include "ecma-objects.h" #include "ecma-string-object.h" + #include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -30,7 +31,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-urierror-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID uri_error_prototype +#define BUILTIN_UNDERSCORED_ID uri_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h index caa932cd..2b6fd89c 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h @@ -25,19 +25,13 @@ * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_URI_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_URI_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_URI_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_URI_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c index fed1838e..52d7a2b6 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c @@ -14,17 +14,18 @@ */ #include "ecma-alloc.h" +#include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-conversion.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtin-helpers.h" #include "ecma-objects.h" -#include "ecma-function-object.h" -#include "jrt.h" + #include "jcontext.h" +#include "jrt.h" #if JERRY_BUILTIN_ERRORS @@ -32,7 +33,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-urierror.inc.h" -#define BUILTIN_UNDERSCORED_ID uri_error +#define BUILTIN_UNDERSCORED_ID uri_error #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -69,8 +70,8 @@ ecma_builtin_uri_error_dispatch_construct (const ecma_value_t *arguments_list_p, #if !JERRY_ESNEXT return ecma_builtin_uri_error_dispatch_call (arguments_list_p, arguments_list_len); #else /* JERRY_ESNEXT */ - ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), - ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE); + ecma_object_t *proto_p = + ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE); if (proto_p == NULL) { diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.inc.h index 08259451..fd98a1d7 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.inc.h @@ -24,22 +24,16 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED) #if JERRY_ESNEXT -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_URI_ERROR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_URI_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_ESNEXT */ #endif /* JERRY_BUILTIN_ERRORS */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c index d522e9da..2a8d6768 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c @@ -25,7 +25,7 @@ */ #define BUILTIN_CUSTOM_DISPATCH #define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakmap-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID weakmap_prototype +#define BUILTIN_UNDERSCORED_ID weakmap_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h index d2c1acc6..75d61770 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h @@ -25,14 +25,10 @@ * (property name, object pointer getter) */ /* ECMA-262 v6, 23.3.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_WEAKMAP, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_WEAKMAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 23.3.3.6 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_WEAKMAP_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_WEAKMAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c index 7496e335..76dcfedf 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c @@ -14,8 +14,8 @@ */ #include "ecma-builtins.h" -#include "ecma-exceptions.h" #include "ecma-container-object.h" +#include "ecma-exceptions.h" #if JERRY_BUILTIN_CONTAINER @@ -23,7 +23,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakmap.inc.h" -#define BUILTIN_UNDERSCORED_ID weakmap +#define BUILTIN_UNDERSCORED_ID weakmap #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.inc.h index 141b1824..8bf9843f 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.inc.h @@ -25,22 +25,16 @@ * (property name, number value, writable, enumerable, configurable) */ /* ECMA-262 v6, 23.3.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 23.1 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_WEAKMAP_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_WEAKMAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v6, 23.3.2.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE, ECMA_PROPERTY_FIXED) #endif /* JERRY_BUILTIN_CONTAINER */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.c index b5a93fea..be72d066 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.c @@ -39,7 +39,7 @@ enum * This object has a custom dispatch function. */ #define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakref-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID weakref_prototype +#define BUILTIN_UNDERSCORED_ID weakref_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -52,12 +52,12 @@ enum * @{ */ - /** - * Deref checks weakRef target - * - * @return weakRef target - * error - otherwise - */ +/** + * Deref checks weakRef target + * + * @return weakRef target + * error - otherwise + */ static ecma_value_t ecma_builtin_weakref_prototype_object_deref (ecma_value_t this_arg) /**< this argument */ { diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h index cf05cf43..533d3956 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h @@ -24,13 +24,9 @@ /* Object properties: * (property name, object pointer getter) */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_WEAKREF, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_WEAKREF, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_WEAKREF_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_WEAKREF_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.c index 381888f4..286c76e8 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.c @@ -15,17 +15,18 @@ #include "ecma-builtins.h" #include "ecma-exceptions.h" -#include "jcontext.h" #include "ecma-function-object.h" #include "ecma-gc.h" +#include "jcontext.h" + #if JERRY_BUILTIN_WEAKREF #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakref.inc.h" -#define BUILTIN_UNDERSCORED_ID weakref +#define BUILTIN_UNDERSCORED_ID weakref #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -68,17 +69,15 @@ ecma_builtin_weakref_dispatch_construct (const ecma_value_t *arguments_list_p, / JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL); - ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), - ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE); + ecma_object_t *proto_p = + ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE); if (JERRY_UNLIKELY (proto_p == NULL)) { return ECMA_VALUE_ERROR; } - ecma_object_t *object_p = ecma_create_object (proto_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_deref_object (proto_p); ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p; ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_WEAKREF; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.inc.h index 6a2109ba..d4e6e5b5 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.inc.h @@ -24,20 +24,14 @@ /* Number properties: * (property name, number value, writable, enumerable, configurable) */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE) -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_WEAKREF_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_WEAKREF_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE, ECMA_PROPERTY_FIXED) #endif /* JERRY_BUILTIN_WEAKREF */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c index c1232d42..370c5047 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c @@ -25,7 +25,7 @@ */ #define BUILTIN_CUSTOM_DISPATCH #define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakset-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID weakset_prototype +#define BUILTIN_UNDERSCORED_ID weakset_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h index 6c203333..6221f895 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h @@ -25,14 +25,10 @@ * (property name, object pointer getter) */ /* ECMA-262 v6, 23.4.3.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_WEAKSET, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_WEAKSET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ECMA-262 v6, 23.4.3.5 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_WEAKSET_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_WEAKSET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c index d96790dd..1bd04ec4 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c @@ -14,8 +14,8 @@ */ #include "ecma-builtins.h" -#include "ecma-exceptions.h" #include "ecma-container-object.h" +#include "ecma-exceptions.h" #if JERRY_BUILTIN_CONTAINER @@ -23,7 +23,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakset.inc.h" -#define BUILTIN_UNDERSCORED_ID weakset +#define BUILTIN_UNDERSCORED_ID weakset #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.inc.h index d9331786..8aa16c84 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.inc.h @@ -25,22 +25,16 @@ * (property name, number value, writable, enumerable, configurable) */ /* ECMA-262 v6, 23.4.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ECMA-262 v6, 23.4 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_WEAKSET_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_WEAKSET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* Object properties: * (property name, object pointer getter) */ /* ECMA-262 v6, 23.4.2.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE, ECMA_PROPERTY_FIXED) #endif /* JERRY_BUILTIN_CONTAINER */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h b/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h index a158c0f0..c8030b6b 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h @@ -17,7 +17,7 @@ #define ECMA_BUILTINS_INTERNAL_H #ifndef ECMA_BUILTINS_INTERNAL -# error "!ECMA_BUILTINS_INTERNAL" +#error "!ECMA_BUILTINS_INTERNAL" #endif /* !ECMA_BUILTINS_INTERNAL */ #include "ecma-builtins.h" @@ -80,36 +80,20 @@ typedef struct uint16_t value; /**< value of the property */ } ecma_builtin_property_descriptor_t; -#define BUILTIN_ROUTINE(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ -extern const ecma_builtin_property_descriptor_t \ -ecma_builtin_ ## lowercase_name ## _property_descriptor_list[]; \ -ecma_value_t \ -ecma_builtin_ ## lowercase_name ## _dispatch_call (const ecma_value_t *, \ - uint32_t); \ -ecma_value_t \ -ecma_builtin_ ## lowercase_name ## _dispatch_construct (const ecma_value_t *, \ - uint32_t); \ -ecma_value_t \ -ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint8_t builtin_routine_id, \ - ecma_value_t this_arg_value, \ - const ecma_value_t [], \ - uint32_t); -#define BUILTIN(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ -extern const ecma_builtin_property_descriptor_t \ -ecma_builtin_ ## lowercase_name ## _property_descriptor_list[]; \ -ecma_value_t \ -ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint8_t builtin_routine_id, \ - ecma_value_t this_arg_value, \ - const ecma_value_t [], \ - uint32_t); +#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ + extern const ecma_builtin_property_descriptor_t ecma_builtin_##lowercase_name##_property_descriptor_list[]; \ + ecma_value_t ecma_builtin_##lowercase_name##_dispatch_call (const ecma_value_t *, uint32_t); \ + ecma_value_t ecma_builtin_##lowercase_name##_dispatch_construct (const ecma_value_t *, uint32_t); \ + ecma_value_t ecma_builtin_##lowercase_name##_dispatch_routine (uint8_t builtin_routine_id, \ + ecma_value_t this_arg_value, \ + const ecma_value_t[], \ + uint32_t); +#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ + extern const ecma_builtin_property_descriptor_t ecma_builtin_##lowercase_name##_property_descriptor_list[]; \ + ecma_value_t ecma_builtin_##lowercase_name##_dispatch_routine (uint8_t builtin_routine_id, \ + ecma_value_t this_arg_value, \ + const ecma_value_t[], \ + uint32_t); #include "ecma-builtins.inc.h" #undef BUILTIN_ROUTINE diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins.c b/jerry-core/ecma/builtin-objects/ecma-builtins.c index d95c111f..b2473bef 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtins.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtins.c @@ -13,14 +13,16 @@ * limitations under the License. */ -#include "ecma-alloc.h" #include "ecma-builtins.h" + +#include "ecma-alloc.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-function-object.h" #include "ecma-objects.h" + #include "jcontext.h" #include "jrt-bit-fields.h" @@ -58,8 +60,7 @@ typedef ecma_value_t (*ecma_builtin_dispatch_routine_t) (uint8_t builtin_routine /** * Definition of built-in dispatch call function pointer. */ -typedef ecma_value_t (*ecma_builtin_dispatch_call_t) (const ecma_value_t arguments_list[], - uint32_t arguments_number); +typedef ecma_value_t (*ecma_builtin_dispatch_call_t) (const ecma_value_t arguments_list[], uint32_t arguments_number); /** * Definition of a builtin descriptor which contains the builtin object's: * - prototype objects's id (13-bits) @@ -85,36 +86,26 @@ typedef uint16_t ecma_builtin_descriptor_t; /** * Create a builtin descriptor value */ -#define ECMA_MAKE_BUILTIN_DESCRIPTOR(type, proto_id) \ - (((proto_id) << ECMA_BUILTIN_PROTOTYPE_ID_SHIFT) | (type)) +#define ECMA_MAKE_BUILTIN_DESCRIPTOR(type, proto_id) (((proto_id) << ECMA_BUILTIN_PROTOTYPE_ID_SHIFT) | (type)) /** * List of the built-in descriptors. */ -static const ecma_builtin_descriptor_t ecma_builtin_descriptors[] = -{ +static const ecma_builtin_descriptor_t ecma_builtin_descriptors[] = { /** @cond doxygen_suppress */ #define BUILTIN(a, b, c, d, e) -#define BUILTIN_ROUTINE(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ +#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ ECMA_MAKE_BUILTIN_DESCRIPTOR (object_type, object_prototype_builtin_id), #include "ecma-builtins.inc.h" #undef BUILTIN #undef BUILTIN_ROUTINE #define BUILTIN_ROUTINE(a, b, c, d, e) -#define BUILTIN(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ +#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ ECMA_MAKE_BUILTIN_DESCRIPTOR (object_type, object_prototype_builtin_id), #include "ecma-builtins.inc.h" #undef BUILTIN #undef BUILTIN_ROUTINE -/** @endcond */ + /** @endcond */ }; #ifndef JERRY_NDEBUG @@ -123,26 +114,18 @@ enum { ECMA_BUILTIN_EXTENSIBLE_CHECK = #define BUILTIN(a, b, c, d, e) -#define BUILTIN_ROUTINE(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ +#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ (is_extensible != 0 || builtin_id == ECMA_BUILTIN_ID_TYPE_ERROR_THROWER) && #include "ecma-builtins.inc.h" #undef BUILTIN #undef BUILTIN_ROUTINE #define BUILTIN_ROUTINE(a, b, c, d, e) -#define BUILTIN(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ +#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ (is_extensible != 0 || builtin_id == ECMA_BUILTIN_ID_TYPE_ERROR_THROWER) && #include "ecma-builtins.inc.h" #undef BUILTIN #undef BUILTIN_ROUTINE - true + true }; /** @endcond */ @@ -156,97 +139,69 @@ JERRY_STATIC_ASSERT (ECMA_BUILTIN_EXTENSIBLE_CHECK == true, /** * List of the built-in routines. */ -static const ecma_builtin_dispatch_routine_t ecma_builtin_routines[] = -{ +static const ecma_builtin_dispatch_routine_t ecma_builtin_routines[] = { /** @cond doxygen_suppress */ #define BUILTIN(a, b, c, d, e) -#define BUILTIN_ROUTINE(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ - ecma_builtin_ ## lowercase_name ## _dispatch_routine, +#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ + ecma_builtin_##lowercase_name##_dispatch_routine, #include "ecma-builtins.inc.h" #undef BUILTIN #undef BUILTIN_ROUTINE #define BUILTIN_ROUTINE(a, b, c, d, e) -#define BUILTIN(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ - ecma_builtin_ ## lowercase_name ## _dispatch_routine, +#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ + ecma_builtin_##lowercase_name##_dispatch_routine, #include "ecma-builtins.inc.h" #undef BUILTIN #undef BUILTIN_ROUTINE -/** @endcond */ + /** @endcond */ }; /** * List of the built-in call functions. */ -static const ecma_builtin_dispatch_call_t ecma_builtin_call_functions[] = -{ +static const ecma_builtin_dispatch_call_t ecma_builtin_call_functions[] = { /** @cond doxygen_suppress */ #define BUILTIN(a, b, c, d, e) -#define BUILTIN_ROUTINE(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ - ecma_builtin_ ## lowercase_name ## _dispatch_call, +#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ + ecma_builtin_##lowercase_name##_dispatch_call, #include "ecma-builtins.inc.h" #undef BUILTIN_ROUTINE #undef BUILTIN -/** @endcond */ + /** @endcond */ }; /** * List of the built-in construct functions. */ -static const ecma_builtin_dispatch_call_t ecma_builtin_construct_functions[] = -{ +static const ecma_builtin_dispatch_call_t ecma_builtin_construct_functions[] = { /** @cond doxygen_suppress */ #define BUILTIN(a, b, c, d, e) -#define BUILTIN_ROUTINE(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ - ecma_builtin_ ## lowercase_name ## _dispatch_construct, +#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ + ecma_builtin_##lowercase_name##_dispatch_construct, #include "ecma-builtins.inc.h" #undef BUILTIN_ROUTINE #undef BUILTIN -/** @endcond */ + /** @endcond */ }; /** * Property descriptor lists for all built-ins. */ -static const ecma_builtin_property_list_reference_t ecma_builtin_property_list_references[] = -{ +static const ecma_builtin_property_list_reference_t ecma_builtin_property_list_references[] = { /** @cond doxygen_suppress */ #define BUILTIN(a, b, c, d, e) -#define BUILTIN_ROUTINE(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ - ecma_builtin_ ## lowercase_name ## _property_descriptor_list, +#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ + ecma_builtin_##lowercase_name##_property_descriptor_list, #include "ecma-builtins.inc.h" #undef BUILTIN #undef BUILTIN_ROUTINE #define BUILTIN_ROUTINE(a, b, c, d, e) -#define BUILTIN(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ - ecma_builtin_ ## lowercase_name ## _property_descriptor_list, +#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \ + ecma_builtin_##lowercase_name##_property_descriptor_list, #include "ecma-builtins.inc.h" #undef BUILTIN_ROUTINE #undef BUILTIN -/** @endcond */ + /** @endcond */ }; /** @@ -291,7 +246,7 @@ ecma_builtin_is_global (ecma_object_t *object_p) /**< pointer to an object */ * * @return pointer to the global object */ -extern inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE ecma_builtin_get_global (void) { JERRY_ASSERT (JERRY_CONTEXT (global_object_p) != NULL); @@ -330,10 +285,8 @@ ecma_builtin_get_realm (ecma_object_t *builtin_object_p) /**< built-in object */ ecma_object_type_t object_type = ecma_get_object_type (builtin_object_p); ecma_value_t realm_value; - JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL - || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS - || object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY - || object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION); + JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS + || object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY || object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION); if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (object_type)) { @@ -384,15 +337,13 @@ ecma_instantiate_builtin (ecma_global_object_t *global_object_p, /**< global obj ecma_object_type_t obj_type = (ecma_object_type_t) (builtin_desc & ECMA_BUILTIN_OBJECT_TYPE_MASK); - JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL - || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS - || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY - || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION); + JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS + || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION); bool is_extended_built_in = ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (obj_type); - size_t ext_object_size = (is_extended_built_in ? sizeof (ecma_extended_built_in_object_t) - : sizeof (ecma_extended_object_t)); + size_t ext_object_size = + (is_extended_built_in ? sizeof (ecma_extended_built_in_object_t) : sizeof (ecma_extended_object_t)); size_t property_count = ecma_builtin_get_property_count (obj_builtin_id); @@ -527,8 +478,8 @@ ecma_instantiate_builtin (ecma_global_object_t *global_object_p, /**< global obj ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_REGEXP; - re_compiled_code_t *bc_p = re_compile_bytecode (ecma_get_magic_string (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP), - RE_FLAG_EMPTY); + re_compiled_code_t *bc_p = + re_compile_bytecode (ecma_get_magic_string (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP), RE_FLAG_EMPTY); JERRY_ASSERT (bc_p != NULL); @@ -678,7 +629,7 @@ ecma_builtin_get_from_realm (ecma_global_object_t *global_object_p, /**< global * * @return pointer to the object's instance */ -static inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE +static inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE ecma_builtin_get_from_builtin (ecma_object_t *builtin_object_p, /**< built-in object */ ecma_builtin_id_t builtin_id) /**< id of built-in to check on */ { @@ -706,14 +657,11 @@ ecma_builtin_make_function_object_for_routine (ecma_object_t *builtin_object_p, uint32_t routine_index, /**< property descriptor index of routine */ uint8_t flags) /**< see also: ecma_builtin_routine_flags */ { - ecma_object_t *prototype_obj_p = ecma_builtin_get_from_builtin (builtin_object_p, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE); + ecma_object_t *prototype_obj_p = ecma_builtin_get_from_builtin (builtin_object_p, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE); size_t ext_object_size = sizeof (ecma_extended_object_t); - ecma_object_t *func_obj_p = ecma_create_object (prototype_obj_p, - ext_object_size, - ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION); + ecma_object_t *func_obj_p = ecma_create_object (prototype_obj_p, ext_object_size, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION); JERRY_ASSERT (routine_id > 0); JERRY_ASSERT (routine_index <= UINT8_MAX); @@ -799,10 +747,8 @@ ecma_builtin_native_handler_try_to_instantiate_property (ecma_object_t *object_p { if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED) == 0) { - ecma_property_value_t *value_p = ecma_create_named_data_property (object_p, - property_name_p, - ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, - &prop_p); + ecma_property_value_t *value_p = + ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &prop_p); value_p->value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY); } @@ -811,10 +757,8 @@ ecma_builtin_native_handler_try_to_instantiate_property (ecma_object_t *object_p { if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED) == 0) { - ecma_property_value_t *value_p = ecma_create_named_data_property (object_p, - property_name_p, - ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, - &prop_p); + ecma_property_value_t *value_p = + ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &prop_p); const uint8_t length = ecma_builtin_handler_get_length (ext_obj_p->u.built_in.routine_id); value_p->value = ecma_make_integer_value (length); @@ -869,17 +813,13 @@ ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, /**< /* We mark that the property was lazily instantiated, * as it is configurable and so can be deleted (ECMA-262 v6, 19.2.4.1) */ - ecma_property_value_t *len_prop_value_p = ecma_create_named_data_property (object_p, - property_name_p, - ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, - &len_prop_p); + ecma_property_value_t *len_prop_value_p = + ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &len_prop_p); #else /* !JERRY_ESNEXT */ /* We don't need to mark that the property was already lazy instantiated, * as it is non-configurable and so can't be deleted (ECMA-262 v5, 13.2.5) */ - ecma_property_value_t *len_prop_value_p = ecma_create_named_data_property (object_p, - property_name_p, - ECMA_PROPERTY_BUILT_IN_FIXED, - &len_prop_p); + ecma_property_value_t *len_prop_value_p = + ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_FIXED, &len_prop_p); #endif /* JERRY_ESNEXT */ uint8_t length = 0; @@ -920,10 +860,8 @@ ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, /**< /* We mark that the property was lazily instantiated */ ecma_property_t *name_prop_p; - ecma_property_value_t *name_prop_value_p = ecma_create_named_data_property (object_p, - property_name_p, - ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, - &name_prop_p); + ecma_property_value_t *name_prop_value_p = + ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &name_prop_p); uint8_t routine_index = ext_func_p->u.built_in.u.routine_index; const ecma_builtin_property_descriptor_t *property_list_p; @@ -999,8 +937,7 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object * lit_magic_string_id_t magic_string_id = ecma_get_string_magic (property_name_p); #if JERRY_ESNEXT - if (JERRY_UNLIKELY (ecma_prop_name_is_symbol (property_name_p)) - && property_name_p->u.hash & ECMA_GLOBAL_SYMBOL_FLAG) + if (JERRY_UNLIKELY (ecma_prop_name_is_symbol (property_name_p)) && property_name_p->u.hash & ECMA_GLOBAL_SYMBOL_FLAG) { magic_string_id = (property_name_p->u.hash >> ECMA_GLOBAL_SYMBOL_SHIFT); } @@ -1014,11 +951,9 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object * ecma_built_in_props_t *built_in_props_p; ecma_object_type_t object_type = ecma_get_object_type (object_p); - JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL - || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS + JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS || object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY - || (object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION - && !ecma_builtin_function_is_routine (object_p))); + || (object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION && !ecma_builtin_function_is_routine (object_p))); if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (object_type)) { @@ -1095,8 +1030,7 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object * } else if (curr_property_p->value < ECMA_BUILTIN_NUMBER_NAN) { - static const ecma_number_t builtin_number_list[] = - { + static const ecma_number_t builtin_number_list[] = { ECMA_NUMBER_MAX_VALUE, ECMA_NUMBER_MIN_VALUE, #if JERRY_ESNEXT @@ -1236,10 +1170,8 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object * } else { - ecma_property_value_t *prop_value_p = ecma_create_named_data_property (object_p, - property_name_p, - curr_property_p->attributes, - &prop_p); + ecma_property_value_t *prop_value_p = + ecma_create_named_data_property (object_p, property_name_p, curr_property_p->attributes, &prop_p); prop_value_p->value = value; /* Reference count of objects must be decreased. */ @@ -1332,11 +1264,9 @@ ecma_builtin_delete_built_in_property (ecma_object_t *object_p, /**< object */ ecma_built_in_props_t *built_in_props_p; ecma_object_type_t object_type = ecma_get_object_type (object_p); - JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL - || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS + JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS || object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY - || (object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION - && !ecma_builtin_function_is_routine (object_p))); + || (object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION && !ecma_builtin_function_is_routine (object_p))); if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (object_type)) { @@ -1385,7 +1315,7 @@ ecma_builtin_delete_built_in_property (ecma_object_t *object_p, /**< object */ static void ecma_builtin_native_handler_list_lazy_property_names (ecma_object_t *object_p, /**< function object */ ecma_collection_t *prop_names_p, /**< prop name collection */ - ecma_property_counter_t *prop_counter_p) /**< prop counter */ + ecma_property_counter_t *prop_counter_p) /**< prop counter */ { JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION); ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p; @@ -1413,7 +1343,7 @@ ecma_builtin_native_handler_list_lazy_property_names (ecma_object_t *object_p, / */ void ecma_builtin_routine_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in object */ - ecma_collection_t *prop_names_p, /**< prop name collection */ + ecma_collection_t *prop_names_p, /**< prop name collection */ ecma_property_counter_t *prop_counter_p, /**< property counters */ jerry_property_filter_t filter) /**< name filters */ { @@ -1556,8 +1486,7 @@ ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in uint32_t bit_for_index = (uint32_t) 1u << index; - if (curr_property_p->magic_string_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT - && !(bitset & bit_for_index)) + if (curr_property_p->magic_string_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT && !(bitset & bit_for_index)) { ecma_string_t *name_p = ecma_op_get_global_symbol (curr_property_p->magic_string_id); ecma_collection_push_back (prop_names_p, ecma_make_symbol_value (name_p)); @@ -1610,10 +1539,10 @@ ecma_builtin_dispatch_routine (ecma_extended_object_t *func_obj_p, /**< builtin arguments_list_p = padded_arguments_list_p; } - return ecma_builtin_routines[func_obj_p->u.built_in.id] (func_obj_p->u.built_in.routine_id, - this_arg_value, - arguments_list_p, - arguments_list_len); + return ecma_builtin_routines[func_obj_p->u.built_in.id](func_obj_p->u.built_in.routine_id, + this_arg_value, + arguments_list_p, + arguments_list_len); } /* ecma_builtin_dispatch_routine */ /** @@ -1641,15 +1570,12 @@ ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */ } #endif /* !JERRY_ESNEXT */ - return ecma_builtin_dispatch_routine (ext_obj_p, - this_arg_value, - arguments_list_p, - arguments_list_len); + return ecma_builtin_dispatch_routine (ext_obj_p, this_arg_value, arguments_list_p, arguments_list_len); } ecma_builtin_id_t builtin_object_id = ext_obj_p->u.built_in.id; JERRY_ASSERT (builtin_object_id < sizeof (ecma_builtin_call_functions) / sizeof (ecma_builtin_dispatch_call_t)); - return ecma_builtin_call_functions[builtin_object_id] (arguments_list_p, arguments_list_len); + return ecma_builtin_call_functions[builtin_object_id](arguments_list_p, arguments_list_len); } /* ecma_builtin_dispatch_call */ /** @@ -1673,7 +1599,7 @@ ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */ ecma_builtin_id_t builtin_object_id = ext_obj_p->u.built_in.id; JERRY_ASSERT (builtin_object_id < sizeof (ecma_builtin_construct_functions) / sizeof (ecma_builtin_dispatch_call_t)); - return ecma_builtin_construct_functions[builtin_object_id] (arguments_list_p, arguments_list_len); + return ecma_builtin_construct_functions[builtin_object_id](arguments_list_p, arguments_list_len); } /* ecma_builtin_dispatch_construct */ /** diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins.h b/jerry-core/ecma/builtin-objects/ecma-builtins.h index 22578fa1..96040de7 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtins.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtins.h @@ -25,26 +25,16 @@ typedef enum { /** @cond doxygen_suppress */ #define BUILTIN(a, b, c, d, e) -#define BUILTIN_ROUTINE(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ - builtin_id, +#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) builtin_id, #include "ecma-builtins.inc.h" #undef BUILTIN #undef BUILTIN_ROUTINE #define BUILTIN_ROUTINE(a, b, c, d, e) -#define BUILTIN(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ - builtin_id, +#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) builtin_id, #include "ecma-builtins.inc.h" #undef BUILTIN #undef BUILTIN_ROUTINE -/** @endcond */ + /** @endcond */ ECMA_BUILTIN_ID__COUNT /**< number of built-in objects */ } ecma_builtin_id_t; @@ -59,8 +49,7 @@ typedef enum /** * Number of global symbols */ -#define ECMA_BUILTIN_GLOBAL_SYMBOL_COUNT \ - (LIT_GLOBAL_SYMBOL__LAST - LIT_GLOBAL_SYMBOL__FIRST + 1) +#define ECMA_BUILTIN_GLOBAL_SYMBOL_COUNT (LIT_GLOBAL_SYMBOL__LAST - LIT_GLOBAL_SYMBOL__FIRST + 1) #endif /* JERRY_ESNEXT */ @@ -72,7 +61,7 @@ typedef enum /** * Get routine length */ -#define ECMA_GET_ROUTINE_LENGTH(value) ((uint8_t) ((value) & 0xf)) +#define ECMA_GET_ROUTINE_LENGTH(value) ((uint8_t) ((value) &0xf)) /** * Get routine ID @@ -87,7 +76,7 @@ typedef enum /** * Get accessor setter ID */ -#define ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID(value) ((uint8_t) ((value) & 0xff)) +#define ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID(value) ((uint8_t) ((value) &0xff)) /** * Get accessor getter ID @@ -121,42 +110,35 @@ typedef struct ecma_global_object_t *ecma_builtin_create_global_object (void); -ecma_value_t -ecma_builtin_dispatch_call (ecma_object_t *obj_p, ecma_value_t this_arg_value, - const ecma_value_t *arguments_list_p, uint32_t arguments_list_len); -ecma_value_t -ecma_builtin_dispatch_construct (ecma_object_t *obj_p, const ecma_value_t *arguments_list_p, - uint32_t arguments_list_len); -ecma_property_t * -ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p); -ecma_property_t * -ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p); +ecma_value_t ecma_builtin_dispatch_call (ecma_object_t *obj_p, + ecma_value_t this_arg_value, + const ecma_value_t *arguments_list_p, + uint32_t arguments_list_len); +ecma_value_t ecma_builtin_dispatch_construct (ecma_object_t *obj_p, + const ecma_value_t *arguments_list_p, + uint32_t arguments_list_len); +ecma_property_t *ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, + ecma_string_t *property_name_p); +ecma_property_t *ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p); #if JERRY_ESNEXT -void -ecma_builtin_routine_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p); +void ecma_builtin_routine_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p); #endif /* JERRY_ESNEXT */ -void -ecma_builtin_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p); -void -ecma_builtin_routine_list_lazy_property_names (ecma_object_t *object_p, ecma_collection_t *prop_names_p, - ecma_property_counter_t *prop_counter_p, - jerry_property_filter_t filter); -void -ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, ecma_collection_t *prop_names_p, - ecma_property_counter_t *prop_counter_p, - jerry_property_filter_t filter); -bool -ecma_builtin_is_global (ecma_object_t *object_p); -ecma_object_t * -ecma_builtin_get (ecma_builtin_id_t builtin_id); -ecma_object_t * -ecma_builtin_get_global (void); -bool -ecma_builtin_function_is_routine (ecma_object_t *func_obj_p); +void ecma_builtin_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p); +void ecma_builtin_routine_list_lazy_property_names (ecma_object_t *object_p, + ecma_collection_t *prop_names_p, + ecma_property_counter_t *prop_counter_p, + jerry_property_filter_t filter); +void ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, + ecma_collection_t *prop_names_p, + ecma_property_counter_t *prop_counter_p, + jerry_property_filter_t filter); +bool ecma_builtin_is_global (ecma_object_t *object_p); +ecma_object_t *ecma_builtin_get (ecma_builtin_id_t builtin_id); +ecma_object_t *ecma_builtin_get_global (void); +bool ecma_builtin_function_is_routine (ecma_object_t *func_obj_p); #if JERRY_BUILTIN_REALMS -ecma_object_t * -ecma_builtin_get_from_realm (ecma_global_object_t *global_object_p, ecma_builtin_id_t builtin_id); +ecma_object_t *ecma_builtin_get_from_realm (ecma_global_object_t *global_object_p, ecma_builtin_id_t builtin_id); #endif /* JERRY_BUILTIN_REALMS */ #endif /* !ECMA_BUILTINS_H */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h index d03868d1..48cae1ca 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h +++ b/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h @@ -47,50 +47,50 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAY, #endif /* JERRY_BUILTIN_ARRAY */ #if JERRY_ESNEXT -# if JERRY_BUILTIN_DATE +#if JERRY_BUILTIN_DATE /* The Date.prototype object (20.3.4) */ BUILTIN (ECMA_BUILTIN_ID_DATE_PROTOTYPE, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, date_prototype) -# endif /* JERRY_BUILTIN_DATE */ +#endif /* JERRY_BUILTIN_DATE */ -# if JERRY_BUILTIN_REGEXP +#if JERRY_BUILTIN_REGEXP /* The RegExp.prototype object (21.2.5) */ BUILTIN (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, regexp_prototype) -# endif /* JERRY_BUILTIN_REGEXP */ +#endif /* JERRY_BUILTIN_REGEXP */ #else /* !JERRY_ESNEXT */ -# if JERRY_BUILTIN_DATE +#if JERRY_BUILTIN_DATE /* The Date.prototype object (15.9.4) */ BUILTIN (ECMA_BUILTIN_ID_DATE_PROTOTYPE, ECMA_OBJECT_TYPE_BUILT_IN_CLASS, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, date_prototype) -# endif /* JERRY_BUILTIN_DATE */ +#endif /* JERRY_BUILTIN_DATE */ -# if JERRY_BUILTIN_REGEXP +#if JERRY_BUILTIN_REGEXP /* The RegExp.prototype object (15.10.6) */ BUILTIN (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE, ECMA_OBJECT_TYPE_BUILT_IN_CLASS, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, regexp_prototype) -# endif /* JERRY_BUILTIN_REGEXP */ +#endif /* JERRY_BUILTIN_REGEXP */ #endif /* !JERRY_ESNEXT */ #if JERRY_BUILTIN_STRING /* The String.prototype object (15.5.4) */ BUILTIN (ECMA_BUILTIN_ID_STRING_PROTOTYPE, - ECMA_OBJECT_TYPE_BUILT_IN_CLASS, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - string_prototype) + ECMA_OBJECT_TYPE_BUILT_IN_CLASS, + ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, + true, + string_prototype) /* The String object (15.5.1) */ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_STRING, @@ -148,39 +148,23 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION, #if JERRY_BUILTIN_MATH /* The Math object (15.8) */ -BUILTIN (ECMA_BUILTIN_ID_MATH, - ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - math) +BUILTIN (ECMA_BUILTIN_ID_MATH, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, math) #endif /* JERRY_BUILTIN_MATH */ #if JERRY_BUILTIN_REFLECT /* The Reflect object (26.1) */ -BUILTIN (ECMA_BUILTIN_ID_REFLECT, - ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - reflect) +BUILTIN (ECMA_BUILTIN_ID_REFLECT, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, reflect) #endif /* JERRY_BUILTIN_REFLECT */ #if JERRY_BUILTIN_JSON /* The JSON object (15.12) */ -BUILTIN (ECMA_BUILTIN_ID_JSON, - ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - json) +BUILTIN (ECMA_BUILTIN_ID_JSON, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, json) #endif /* JERRY_BUILTIN_JSON */ #if JERRY_BUILTIN_ATOMICS /* The Atomics object (24.4) */ -BUILTIN (ECMA_BUILTIN_ID_ATOMICS, - ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - atomics) +BUILTIN (ECMA_BUILTIN_ID_ATOMICS, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, atomics) #endif /* JERRY_BUILTIN_ATOMICS */ #if JERRY_BUILTIN_DATE @@ -545,11 +529,7 @@ BUILTIN (ECMA_BUILTIN_ID_MAP_PROTOTYPE, map_prototype) /* The Map routine (ECMA-262 v6, 23.1.1.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP, - ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - map) +BUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, map) /* The Set prototype object (23.1.3) */ BUILTIN (ECMA_BUILTIN_ID_SET_PROTOTYPE, @@ -559,11 +539,7 @@ BUILTIN (ECMA_BUILTIN_ID_SET_PROTOTYPE, set_prototype) /* The Set routine (ECMA-262 v6, 23.1.1.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SET, - ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - set) +BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SET, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, set) /* The WeakMap prototype object (23.1.3) */ BUILTIN (ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE, diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c index 373b0580..3b33e033 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c @@ -22,7 +22,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-bigint64array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID bigint64array_prototype +#define BUILTIN_UNDERSCORED_ID bigint64array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.inc.h index e6822117..5e1087bf 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.inc.h @@ -21,7 +21,7 @@ #if JERRY_BUILTIN_BIGINT #define TYPEDARRAY_BYTES_PER_ELEMENT 8 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGINT64ARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGINT64ARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_BUILTIN_BIGINT */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c index da4f3c8d..1f8b29f6 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -28,9 +29,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-bigint64array.inc.h" -#define BUILTIN_UNDERSCORED_ID bigint64array +#define BUILTIN_UNDERSCORED_ID bigint64array #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -50,7 +50,7 @@ */ ecma_value_t ecma_builtin_bigint64array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */ - uint32_t arguments_list_len) /**< number of arguments */ + uint32_t arguments_list_len) /**< number of arguments */ { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); @@ -64,17 +64,16 @@ ecma_builtin_bigint64array_dispatch_call (const ecma_value_t *arguments_list_p, */ ecma_value_t ecma_builtin_bigint64array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ - uint32_t arguments_list_len) /**< number of arguments */ + uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_BIGINT64_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_BIGINT64_ARRAY); } /* ecma_builtin_bigint64array_dispatch_construct */ /** - * @} - * @} - * @} - */ + * @} + * @} + * @} + */ #endif /* JERRY_BUILTIN_BIGINT */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.inc.h index b68f3581..176fc26b 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.inc.h @@ -20,8 +20,8 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 8 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_BIGINT64_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGINT64ARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_BIGINT64_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGINT64ARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c index 3cc4006d..9844fbd5 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c @@ -22,7 +22,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-biguint64array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID biguint64array_prototype +#define BUILTIN_UNDERSCORED_ID biguint64array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.inc.h index 6c0da05b..03626442 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.inc.h @@ -21,7 +21,7 @@ #if JERRY_BUILTIN_BIGINT #define TYPEDARRAY_BYTES_PER_ELEMENT 8 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGUINT64ARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGUINT64ARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_BUILTIN_BIGINT */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c index 6037d081..214fa716 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -28,9 +29,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-biguint64array.inc.h" -#define BUILTIN_UNDERSCORED_ID biguint64array +#define BUILTIN_UNDERSCORED_ID biguint64array #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -50,7 +50,7 @@ */ ecma_value_t ecma_builtin_biguint64array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */ - uint32_t arguments_list_len) /**< number of arguments */ + uint32_t arguments_list_len) /**< number of arguments */ { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); @@ -64,17 +64,16 @@ ecma_builtin_biguint64array_dispatch_call (const ecma_value_t *arguments_list_p, */ ecma_value_t ecma_builtin_biguint64array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ - uint32_t arguments_list_len) /**< number of arguments */ + uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_BIGUINT64_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_BIGUINT64_ARRAY); } /* ecma_builtin_biguint64array_dispatch_construct */ /** - * @} - * @} - * @} - */ + * @} + * @} + * @} + */ #endif /* JERRY_BUILTIN_BIGINT */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.inc.h index f9ba3338..ea38782a 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.inc.h @@ -21,8 +21,8 @@ #if JERRY_BUILTIN_BIGINT #define TYPEDARRAY_BYTES_PER_ELEMENT 8 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGUINT64ARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGUINT64ARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_BUILTIN_BIGINT */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c index 3179f97c..1e6a6041 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-float32array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID float32array_prototype +#define BUILTIN_UNDERSCORED_ID float32array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.inc.h index 6bba9b67..56bfeeae 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.inc.h @@ -20,7 +20,7 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT32ARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT32ARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c index 1998e189..b69cc4c0 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -27,9 +28,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-float32array.inc.h" -#define BUILTIN_UNDERSCORED_ID float32array +#define BUILTIN_UNDERSCORED_ID float32array #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -65,14 +65,13 @@ ecma_value_t ecma_builtin_float32array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_FLOAT32_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_FLOAT32_ARRAY); } /* ecma_builtin_float32array_dispatch_construct */ /** - * @} - * @} - * @} - */ + * @} + * @} + * @} + */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.inc.h index 0cc3d738..832b5119 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.inc.h @@ -20,8 +20,8 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_FLOAT32_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT32ARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_FLOAT32_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT32ARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c index 4f6f8a2d..205d23a7 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c @@ -22,7 +22,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-float64array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID float64array_prototype +#define BUILTIN_UNDERSCORED_ID float64array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.inc.h index 68fce0d4..815be714 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.inc.h @@ -21,7 +21,7 @@ #if JERRY_NUMBER_TYPE_FLOAT64 #define TYPEDARRAY_BYTES_PER_ELEMENT 8 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT64ARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT64ARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_NUMBER_TYPE_FLOAT64 */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c index ed857e0a..997fb5a7 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -28,9 +29,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-float64array.inc.h" -#define BUILTIN_UNDERSCORED_ID float64array +#define BUILTIN_UNDERSCORED_ID float64array #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -66,15 +66,14 @@ ecma_value_t ecma_builtin_float64array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_FLOAT64_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_FLOAT64_ARRAY); } /* ecma_builtin_float64array_dispatch_construct */ /** - * @} - * @} - * @} - */ + * @} + * @} + * @} + */ #endif /* JERRY_NUMBER_TYPE_FLOAT64 */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.inc.h index e7b053dd..ea8bd422 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.inc.h @@ -21,8 +21,8 @@ #if JERRY_NUMBER_TYPE_FLOAT64 #define TYPEDARRAY_BYTES_PER_ELEMENT 8 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_FLOAT64_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_FLOAT64_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_NUMBER_TYPE_FLOAT64 */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c index 0d4e1675..1b9c435b 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-int16array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID int16array_prototype +#define BUILTIN_UNDERSCORED_ID int16array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.inc.h index d9a0ef94..7815d9a5 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.inc.h @@ -20,7 +20,7 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 2 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT16ARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT16ARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c index 99fd2a8c..6945114a 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -27,9 +28,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-int16array.inc.h" -#define BUILTIN_UNDERSCORED_ID int16array +#define BUILTIN_UNDERSCORED_ID int16array #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -65,14 +65,13 @@ ecma_value_t ecma_builtin_int16array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_INT16_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_INT16_ARRAY); } /* ecma_builtin_int16array_dispatch_construct */ /** - * @} - * @} - * @} - */ + * @} + * @} + * @} + */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.inc.h index 3427207b..f744ed77 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.inc.h @@ -20,8 +20,8 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 2 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT16_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT16ARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT16_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT16ARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c index 0253bc0a..36fc8470 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-int32array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID int32array_prototype +#define BUILTIN_UNDERSCORED_ID int32array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.inc.h index ea2f3326..9a31a062 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.inc.h @@ -20,7 +20,7 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT32ARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT32ARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c index 06170fbe..d3d899c1 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -27,9 +28,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-int32array.inc.h" -#define BUILTIN_UNDERSCORED_ID int32array +#define BUILTIN_UNDERSCORED_ID int32array #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -65,14 +65,13 @@ ecma_value_t ecma_builtin_int32array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_INT32_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_INT32_ARRAY); } /* ecma_builtin_int32array_dispatch_construct */ /** - * @} - * @} - * @} - */ + * @} + * @} + * @} + */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.inc.h index bdc667fb..ac786a0b 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.inc.h @@ -20,8 +20,8 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT32_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT32ARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT32_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT32ARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c index a7b0b156..8221f309 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-int8array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID int8array_prototype +#define BUILTIN_UNDERSCORED_ID int8array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.inc.h index 4cb7e582..99d072b1 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.inc.h @@ -20,7 +20,7 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT8ARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT8ARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c index 03522f0b..87ea168c 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -27,9 +28,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-int8array.inc.h" -#define BUILTIN_UNDERSCORED_ID int8array +#define BUILTIN_UNDERSCORED_ID int8array #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -65,8 +65,7 @@ ecma_value_t ecma_builtin_int8array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_INT8_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_INT8_ARRAY); } /* ecma_builtin_int8array_dispatch_construct */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.inc.h index 2e3146fb..25c84de2 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.inc.h @@ -20,8 +20,8 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT8_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT8_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c index 565a48a1..23681ddb 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c @@ -18,10 +18,11 @@ #if JERRY_BUILTIN_TYPEDARRAY #include "ecma-builtins.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-objects.h" #include "ecma-typedarray-object.h" -#include "ecma-function-object.h" + #include "jcontext.h" #define ECMA_BUILTINS_INTERNAL diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.h index 54972bd9..d4064374 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.h @@ -26,10 +26,9 @@ * @{ */ -ecma_value_t -ecma_typedarray_helper_dispatch_construct (const ecma_value_t *arguments_list_p, - uint32_t arguments_list_len, - ecma_typedarray_type_t typedarray_id); +ecma_value_t ecma_typedarray_helper_dispatch_construct (const ecma_value_t *arguments_list_p, + uint32_t arguments_list_len, + ecma_typedarray_type_t typedarray_id); /** * @} diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype-template.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype-template.inc.h index 8715d0d9..beb63352 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype-template.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype-template.inc.h @@ -16,24 +16,20 @@ #if JERRY_BUILTIN_TYPEDARRAY #ifndef TYPEDARRAY_BYTES_PER_ELEMENT -# error "Please define TYPEDARRAY_BYTES_PER_ELEMENT" +#error "Please define TYPEDARRAY_BYTES_PER_ELEMENT" #endif /* !TYPEDARRAY_BYTES_PER_ELEMENT */ #ifndef TYPEDARRAY_BUILTIN_ID -# error "Please define TYPEDARRAY_BUILTIN_ID" +#error "Please define TYPEDARRAY_BUILTIN_ID" #endif /* !TYPEDARRAY_BUILTIN_ID */ #include "ecma-builtin-helpers-macro-defines.inc.h" /* ES2015 22.2.3.4 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - TYPEDARRAY_BUILTIN_ID, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, TYPEDARRAY_BUILTIN_ID, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* ES2015 22.2.6.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, - TYPEDARRAY_BYTES_PER_ELEMENT, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, TYPEDARRAY_BYTES_PER_ELEMENT, ECMA_PROPERTY_FIXED) #include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c index 0be71d15..b93c429c 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c @@ -31,6 +31,7 @@ #include "ecma-number-object.h" #include "ecma-objects.h" #include "ecma-typedarray-object.h" + #include "jcontext.h" #include "jmem.h" #include "jrt-libc-includes.h" @@ -89,7 +90,7 @@ enum }; #define BUILTIN_INC_HEADER_NAME "ecma-builtin-typedarray-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID typedarray_prototype +#define BUILTIN_UNDERSCORED_ID typedarray_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA @@ -168,8 +169,7 @@ ecma_builtin_typedarray_prototype_exec_routine (ecma_value_t this_arg, /**< this return ECMA_VALUE_FALSE; } } - else if (mode == TYPEDARRAY_ROUTINE_SOME - && to_bool_result) + else if (mode == TYPEDARRAY_ROUTINE_SOME && to_bool_result) { return ECMA_VALUE_TRUE; } @@ -354,10 +354,7 @@ ecma_builtin_typedarray_prototype_reduce_with_direction (ecma_value_t this_arg, JERRY_ASSERT (ecma_is_value_number (get_value) || ecma_is_value_bigint (get_value)); - ecma_value_t call_value = ecma_op_function_call (func_object_p, - ECMA_VALUE_UNDEFINED, - call_args, - 4); + ecma_value_t call_value = ecma_op_function_call (func_object_p, ECMA_VALUE_UNDEFINED, call_args, 4); ecma_fast_free_value (accumulator); ecma_fast_free_value (get_value); @@ -492,8 +489,7 @@ ecma_builtin_typedarray_prototype_filter (ecma_value_t this_arg, /**< this objec for (uint32_t idx = 0; idx < collected_p->item_count; idx++) { - ecma_value_t set_element = target_typedarray_setter_cb (target_buffer_p, - collected_p->buffer_p[idx]); + ecma_value_t set_element = target_typedarray_setter_cb (target_buffer_p, collected_p->buffer_p[idx]); if (ECMA_IS_VALUE_ERROR (set_element)) { @@ -802,8 +798,7 @@ ecma_op_typedarray_get_to_string_at_index (ecma_object_t *obj_p, /**< this objec return NULL; } - if (ecma_is_value_undefined (index_value) - || ecma_is_value_null (index_value)) + if (ecma_is_value_undefined (index_value) || ecma_is_value_null (index_value)) { ecma_free_value (index_value); return ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY); @@ -922,9 +917,7 @@ ecma_builtin_typedarray_prototype_subarray (ecma_value_t this_arg, /**< this obj uint32_t begin_index_uint32 = 0, end_index_uint32 = 0; /* 7. relativeBegin */ - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (begin, - info_p->length, - &begin_index_uint32))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (begin, info_p->length, &begin_index_uint32))) { return ECMA_VALUE_ERROR; } @@ -936,9 +929,7 @@ ecma_builtin_typedarray_prototype_subarray (ecma_value_t this_arg, /**< this obj else { /* 10. relativeEnd */ - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (end, - info_p->length, - &end_index_uint32))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (end, info_p->length, &end_index_uint32))) { return ECMA_VALUE_ERROR; } @@ -955,12 +946,9 @@ ecma_builtin_typedarray_prototype_subarray (ecma_value_t this_arg, /**< this obj /* 17. beginByteOffset */ uint32_t begin_byte_offset = info_p->offset + (begin_index_uint32 << info_p->shift); - ecma_value_t arguments_p[3] = - { - ecma_make_object_value (info_p->array_buffer_p), - ecma_make_uint32_value (begin_byte_offset), - ecma_make_uint32_value (subarray_length) - }; + ecma_value_t arguments_p[3] = { ecma_make_object_value (info_p->array_buffer_p), + ecma_make_uint32_value (begin_byte_offset), + ecma_make_uint32_value (subarray_length) }; ret_value = ecma_typedarray_species_create (this_arg, arguments_p, 3); @@ -1013,9 +1001,7 @@ ecma_builtin_typedarray_prototype_fill (ecma_value_t this_arg, /**< this object uint32_t begin_index_uint32 = 0, end_index_uint32 = 0; - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (begin, - info_p->length, - &begin_index_uint32))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (begin, info_p->length, &begin_index_uint32))) { ecma_free_value (value_to_set); return ECMA_VALUE_ERROR; @@ -1027,9 +1013,7 @@ ecma_builtin_typedarray_prototype_fill (ecma_value_t this_arg, /**< this object } else { - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (end, - info_p->length, - &end_index_uint32))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (end, info_p->length, &end_index_uint32))) { ecma_free_value (value_to_set); return ECMA_VALUE_ERROR; @@ -1138,10 +1122,7 @@ ecma_builtin_typedarray_prototype_sort_compare_helper (ecma_value_t lhs, /**< le ecma_value_t compare_args[] = { lhs, rhs }; - ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p, - ECMA_VALUE_UNDEFINED, - compare_args, - 2); + ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p, ECMA_VALUE_UNDEFINED, compare_args, 2); if (ECMA_IS_VALUE_ERROR (call_value) || ecma_is_value_number (call_value)) { @@ -1391,10 +1372,8 @@ ecma_builtin_typedarray_prototype_index_of (ecma_typedarray_info_t *info_p, /**< uint32_t from_index; - /* 5. */ - if (args_number == 0 - || (!ecma_is_value_number (args[0]) && !is_bigint) - || info_p->length == 0) + /* 5. */ + if (args_number == 0 || (!ecma_is_value_number (args[0]) && !is_bigint) || info_p->length == 0) { return ecma_make_integer_value (-1); } @@ -1404,9 +1383,7 @@ ecma_builtin_typedarray_prototype_index_of (ecma_typedarray_info_t *info_p, /**< } else { - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], - info_p->length, - &from_index))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &from_index))) { return ECMA_VALUE_ERROR; } @@ -1455,8 +1432,8 @@ ecma_builtin_typedarray_prototype_index_of (ecma_typedarray_info_t *info_p, /**< */ static ecma_value_t ecma_builtin_typedarray_prototype_last_index_of (ecma_typedarray_info_t *info_p, /**< object info */ - const ecma_value_t args[], /**< arguments list */ - uint32_t args_number) /**< number of arguments */ + const ecma_value_t args[], /**< arguments list */ + uint32_t args_number) /**< number of arguments */ { #if JERRY_BUILTIN_BIGINT bool is_bigint = ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info_p->id); @@ -1467,9 +1444,7 @@ ecma_builtin_typedarray_prototype_last_index_of (ecma_typedarray_info_t *info_p, uint32_t from_index; /* 5. */ - if (args_number == 0 - || (!ecma_is_value_number (args[0]) && !is_bigint) - || info_p->length == 0) + if (args_number == 0 || (!ecma_is_value_number (args[0]) && !is_bigint) || info_p->length == 0) { return ecma_make_integer_value (-1); } @@ -1480,9 +1455,7 @@ ecma_builtin_typedarray_prototype_last_index_of (ecma_typedarray_info_t *info_p, } else { - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], - info_p->length, - &from_index))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &from_index))) { return ECMA_VALUE_ERROR; } @@ -1547,27 +1520,21 @@ ecma_builtin_typedarray_prototype_copy_within (ecma_value_t this_arg, /**< this if (args_number > 0) { - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[0], - info_p->length, - &relative_target))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[0], info_p->length, &relative_target))) { return ECMA_VALUE_ERROR; } if (args_number > 1) { - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], - info_p->length, - &relative_start))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &relative_start))) { return ECMA_VALUE_ERROR; } if (args_number > 2 && args[2] != ECMA_VALUE_UNDEFINED) { - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[2], - info_p->length, - &relative_end))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[2], info_p->length, &relative_end))) { return ECMA_VALUE_ERROR; } @@ -1618,18 +1585,13 @@ ecma_builtin_typedarray_prototype_slice (ecma_value_t this_arg, /**< this argume if (args_number > 0) { - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[0], - info_p->length, - &relative_start))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[0], info_p->length, &relative_start))) { return ECMA_VALUE_ERROR; } - if (args_number > 1 - && args[1] != ECMA_VALUE_UNDEFINED - && ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], - info_p->length, - &relative_end))) + if (args_number > 1 && args[1] != ECMA_VALUE_UNDEFINED + && ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &relative_end))) { return ECMA_VALUE_ERROR; } @@ -1709,7 +1671,7 @@ ecma_builtin_typedarray_prototype_slice (ecma_value_t this_arg, /**< this argume * * @return ecma value * Returned value must be freed with ecma_free_value. -*/ + */ static ecma_value_t ecma_builtin_typedarray_prototype_to_locale_string_helper (ecma_typedarray_info_t *info_p, /**< object info */ uint32_t index) /** array index */ @@ -1801,9 +1763,7 @@ ecma_builtin_typedarray_prototype_includes (ecma_typedarray_info_t *info_p, /**< bool is_bigint = false; #endif /* JERRRY_BUILTIN_BIGINT */ - if (args_number == 0 - || (!ecma_is_value_number (args[0]) && !is_bigint) - || info_p->length == 0) + if (args_number == 0 || (!ecma_is_value_number (args[0]) && !is_bigint) || info_p->length == 0) { return ECMA_VALUE_FALSE; } @@ -1918,7 +1878,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id, case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE: case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT: { - bool is_reduce = builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT; + bool is_reduce = builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT; return ecma_builtin_typedarray_prototype_reduce_with_direction (this_arg, &info, arguments_list_p, @@ -1957,7 +1917,6 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id, } return ecma_builtin_typedarray_prototype_sort (this_arg, &info, arguments_list_p[0]); - } case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND: case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND_INDEX: @@ -1996,8 +1955,8 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id, case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS: case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_ENTRIES: { - ecma_iterator_kind_t iter_id = (builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS) - ? ECMA_ITERATOR_KEYS : ECMA_ITERATOR_ENTRIES; + ecma_iterator_kind_t iter_id = + (builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS) ? ECMA_ITERATOR_KEYS : ECMA_ITERATOR_ENTRIES; return ecma_typedarray_iterators_helper (this_arg, iter_id); } diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h index a5bf4cfd..9cace683 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h @@ -22,9 +22,7 @@ #if JERRY_BUILTIN_TYPEDARRAY /* ES2015 22.2.3.4 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_TYPEDARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_TYPEDARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) /* Readonly accessor properties */ /* ES2015 22.2.3.1 */ @@ -63,7 +61,7 @@ ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FOR_EAC ROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INCLUDES, NON_FIXED, 1) ROUTINE (LIT_MAGIC_STRING_AT, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_AT, 1, 1) ROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INDEX_OF, NON_FIXED, 1) -ROUTINE (LIT_MAGIC_STRING_JOIN, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_JOIN, 1, 1) +ROUTINE (LIT_MAGIC_STRING_JOIN, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_JOIN, 1, 1) ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS, 0, 0) ROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_LAST_INDEX_OF, NON_FIXED, 1) ROUTINE (LIT_MAGIC_STRING_MAP, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_MAP, 2, 1) @@ -76,11 +74,12 @@ ROUTINE (LIT_MAGIC_STRING_SOME, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SOME, 2, 1) ROUTINE (LIT_MAGIC_STRING_SORT, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SORT, 1, 1) ROUTINE (LIT_MAGIC_STRING_SUBARRAY, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SUBARRAY, 2, 2) ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_LOCALE_STRING, 0, 0) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL, +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) +INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES, + LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES, LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES, +INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, + LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES, ECMA_PROPERTY_CONFIGURABLE_WRITABLE) #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-template.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-template.inc.h index 23c4ce6f..7c9313fc 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-template.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-template.inc.h @@ -16,38 +16,30 @@ #if JERRY_BUILTIN_TYPEDARRAY #ifndef TYPEDARRAY_BYTES_PER_ELEMENT -# error "Please define TYPEDARRAY_BYTES_PER_ELEMENT" +#error "Please define TYPEDARRAY_BYTES_PER_ELEMENT" #endif /* !TYPEDARRAY_BYTES_PER_ELEMENT */ #ifndef TYPEDARRAY_MAGIC_STRING_ID -# error "Please define TYPEDARRAY_MAGIC_STRING_ID" +#error "Please define TYPEDARRAY_MAGIC_STRING_ID" #endif /* !TYPEDARRAY_MAGIC_STRING_ID */ #ifndef TYPEDARRAY_BUILTIN_ID -# error "Please define TYPEDARRAY_BUILTIN_ID" +#error "Please define TYPEDARRAY_BUILTIN_ID" #endif /* !TYPEDARRAY_BUILTIN_ID */ #include "ecma-builtin-helpers-macro-defines.inc.h" /* ES2015 22.2.5 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 3, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 3, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ES2015 22.2.5.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, - TYPEDARRAY_BYTES_PER_ELEMENT, - ECMA_PROPERTY_FIXED) +NUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, TYPEDARRAY_BYTES_PER_ELEMENT, ECMA_PROPERTY_FIXED) /* ES2015 22.2.5 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - TYPEDARRAY_MAGIC_STRING_ID, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, TYPEDARRAY_MAGIC_STRING_ID, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ES2015 22.2.5.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - TYPEDARRAY_BUILTIN_ID, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, TYPEDARRAY_BUILTIN_ID, ECMA_PROPERTY_FIXED) #include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c index 2631f4db..898492fa 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c @@ -13,14 +13,14 @@ * limitations under the License. */ -#include "ecma-typedarray-object.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" -#include "ecma-function-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -29,9 +29,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-typedarray.inc.h" -#define BUILTIN_UNDERSCORED_ID typedarray +#define BUILTIN_UNDERSCORED_ID typedarray #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -91,10 +90,7 @@ ecma_builtin_typedarray_from (ecma_value_t this_arg, /**< 'this' argument */ } } - return ecma_op_typedarray_from (this_arg, - source, - map_fn, - this_in_fn); + return ecma_op_typedarray_from (this_arg, source, map_fn, this_in_fn); } /* ecma_builtin_typedarray_from */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.inc.h index d362f817..bc8ab47d 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.inc.h @@ -23,19 +23,13 @@ /* ES2015 22.2.2 */ /* ES11 22.2.1.1 - value of length changed to 0 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ES2015 22.2.2 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_TYPED_ARRAY_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_TYPED_ARRAY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE) /* ES2015 22.2.2.3 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - ECMA_PROPERTY_FIXED) +OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, ECMA_PROPERTY_FIXED) /* Routine properties: * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ @@ -47,9 +41,7 @@ ROUTINE (LIT_MAGIC_STRING_FROM, ecma_builtin_typedarray_from, NON_FIXED, 1) ROUTINE (LIT_MAGIC_STRING_OF, ecma_builtin_typedarray_of, NON_FIXED, 0) /* ES2015 22.2.2.4 */ -ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, - ecma_builtin_typedarray_species_get, - ECMA_PROPERTY_FLAG_CONFIGURABLE) +ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_typedarray_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE) #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c index 5e980625..691da4ba 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint16array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID uint16array_prototype +#define BUILTIN_UNDERSCORED_ID uint16array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.inc.h index 6d0fef96..ec055f66 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.inc.h @@ -20,7 +20,7 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 2 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT16ARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT16ARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c index 5b3d33ad..db0367dd 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -27,9 +28,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint16array.inc.h" -#define BUILTIN_UNDERSCORED_ID uint16array +#define BUILTIN_UNDERSCORED_ID uint16array #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -65,14 +65,13 @@ ecma_value_t ecma_builtin_uint16array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_UINT16_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT16_ARRAY); } /* ecma_builtin_uint16array_dispatch_construct */ /** - * @} - * @} - * @} - */ + * @} + * @} + * @} + */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.inc.h index 8a21218f..2c0af1f0 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.inc.h @@ -20,8 +20,8 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 2 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT16_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT16ARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT16_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT16ARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c index ff721dcd..4b5e3842 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint32array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID uint32array_prototype +#define BUILTIN_UNDERSCORED_ID uint32array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.inc.h index b4142cb1..a04098a3 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.inc.h @@ -20,7 +20,7 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT32ARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT32ARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c index 17b6d390..51abd555 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -27,9 +28,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint32array.inc.h" -#define BUILTIN_UNDERSCORED_ID uint32array +#define BUILTIN_UNDERSCORED_ID uint32array #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -67,14 +67,13 @@ ecma_builtin_uint32array_dispatch_construct (const ecma_value_t *arguments_list_ { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_UINT32_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT32_ARRAY); } /* ecma_builtin_uint32array_dispatch_construct */ /** - * @} - * @} - * @} - */ + * @} + * @} + * @} + */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.inc.h index c3812083..fd0389a4 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.inc.h @@ -20,8 +20,8 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT32_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT32_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c index 67347067..8a8edb4a 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint8array-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID uint8array_prototype +#define BUILTIN_UNDERSCORED_ID uint8array_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.inc.h index c047d6c9..07f94b0b 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.inc.h @@ -20,7 +20,7 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8ARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8ARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c index c451327c..d646611c 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -27,9 +28,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint8array.inc.h" -#define BUILTIN_UNDERSCORED_ID uint8array +#define BUILTIN_UNDERSCORED_ID uint8array #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -65,14 +65,13 @@ ecma_value_t ecma_builtin_uint8array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< number of arguments */ { - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_UINT8_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT8_ARRAY); } /* ecma_builtin_uint8array_dispatch_construct */ /** - * @} - * @} - * @} - */ + * @} + * @} + * @} + */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.inc.h index b108370d..d0259e9b 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.inc.h @@ -20,8 +20,8 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT8_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8ARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT8_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8ARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c index b7526a92..534014b1 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c @@ -21,7 +21,7 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint8clampedarray-prototype.inc.h" -#define BUILTIN_UNDERSCORED_ID uint8clampedarray_prototype +#define BUILTIN_UNDERSCORED_ID uint8clampedarray_prototype #include "ecma-builtin-internal-routines-template.inc.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.inc.h index 3d8f96d1..8564828a 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.inc.h @@ -20,7 +20,7 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY #include "ecma-builtin-typedarray-prototype-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c index 0d6fe212..f3678f47 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c @@ -19,6 +19,7 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-typedarray-object.h" + #include "jrt.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -27,9 +28,8 @@ #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint8clampedarray.inc.h" -#define BUILTIN_UNDERSCORED_ID uint8clampedarray +#define BUILTIN_UNDERSCORED_ID uint8clampedarray #include "ecma-builtin-internal-routines-template.inc.h" - #include "ecma-builtin-typedarray-helpers.h" /** \addtogroup ecma ECMA @@ -67,14 +67,13 @@ ecma_builtin_uint8clampedarray_dispatch_construct (const ecma_value_t *arguments { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, - ECMA_UINT8_CLAMPED_ARRAY); + return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT8_CLAMPED_ARRAY); } /* ecma_builtin_uint8clampedarray_dispatch_construct */ /** - * @} - * @} - * @} - */ + * @} + * @} + * @} + */ #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.inc.h index 16d21454..d3f0eb1f 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.inc.h +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.inc.h @@ -20,8 +20,8 @@ #if JERRY_BUILTIN_TYPEDARRAY #define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE +#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL +#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE #include "ecma-builtin-typedarray-template.inc.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ diff --git a/jerry-core/ecma/operations/ecma-arguments-object.c b/jerry-core/ecma/operations/ecma-arguments-object.c index 35339be7..4d289409 100644 --- a/jerry-core/ecma/operations/ecma-arguments-object.c +++ b/jerry-core/ecma/operations/ecma-arguments-object.c @@ -13,6 +13,8 @@ * limitations under the License. */ +#include "ecma-arguments-object.h" + #include "ecma-alloc.h" #include "ecma-builtin-helpers.h" #include "ecma-builtins.h" @@ -21,9 +23,9 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-lex-env.h" -#include "ecma-objects.h" -#include "ecma-arguments-object.h" #include "ecma-objects-general.h" +#include "ecma-objects.h" + #include "jrt.h" /** \addtogroup ecma ECMA @@ -130,10 +132,8 @@ ecma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, /**< shar ecma_property_value_t *prop_value_p; ecma_string_t *prop_name_p = ecma_new_ecma_string_from_uint32 (i); - prop_value_p = ecma_create_named_data_property (obj_p, - prop_name_p, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, - NULL); + prop_value_p = + ecma_create_named_data_property (obj_p, prop_name_p, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL); ecma_deref_ecma_string (prop_name_p); @@ -163,9 +163,7 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, /**< the * descriptor */ { /* 3. */ - ecma_value_t ret_value = ecma_op_general_object_define_own_property (object_p, - property_name_p, - property_desc_p); + ecma_value_t ret_value = ecma_op_general_object_define_own_property (object_p, property_name_p, property_desc_p); if (ECMA_IS_VALUE_ERROR (ret_value) || !(((ecma_extended_object_t *) object_p)->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED)) @@ -200,16 +198,12 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, /**< the ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index); ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env); - ecma_value_t completion = ecma_op_set_mutable_binding (lex_env_p, - name_p, - property_desc_p->value, - true); + ecma_value_t completion = ecma_op_set_mutable_binding (lex_env_p, name_p, property_desc_p->value, true); JERRY_ASSERT (ecma_is_value_empty (completion)); } - if ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED) - && !(property_desc_p->flags & JERRY_PROP_IS_WRITABLE)) + if ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED) && !(property_desc_p->flags & JERRY_PROP_IS_WRITABLE)) { ecma_free_value_if_not_object (argv_p[index]); argv_p[index] = ECMA_VALUE_ARGUMENT_NO_TRACK; @@ -246,8 +240,7 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object if (index != ECMA_STRING_NOT_ARRAY_INDEX) { - if (index >= arguments_number - || ecma_is_value_empty (argv_p[index])) + if (index >= arguments_number || ecma_is_value_empty (argv_p[index])) { return NULL; } @@ -389,8 +382,7 @@ ecma_op_arguments_delete_built_in_property (ecma_object_t *object_p, /**< the ob argv_p = (ecma_value_t *) (((ecma_mapped_arguments_t *) object_p) + 1); } - JERRY_ASSERT (argv_p[index] == ECMA_VALUE_UNDEFINED - || argv_p[index] == ECMA_VALUE_ARGUMENT_NO_TRACK); + JERRY_ASSERT (argv_p[index] == ECMA_VALUE_UNDEFINED || argv_p[index] == ECMA_VALUE_ARGUMENT_NO_TRACK); argv_p[index] = ECMA_VALUE_EMPTY; } /* ecma_op_arguments_delete_built_in_property */ @@ -455,8 +447,7 @@ ecma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p, /**< ar } #if JERRY_ESNEXT - if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS) - && !(flags & ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED)) + 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)); diff --git a/jerry-core/ecma/operations/ecma-arguments-object.h b/jerry-core/ecma/operations/ecma-arguments-object.h index 08477582..755b755c 100644 --- a/jerry-core/ecma/operations/ecma-arguments-object.h +++ b/jerry-core/ecma/operations/ecma-arguments-object.h @@ -18,28 +18,25 @@ #include "ecma-globals.h" #include "ecma-helpers.h" + #include "vm-defines.h" -ecma_value_t -ecma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, ecma_object_t *lex_env_p); +ecma_value_t ecma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, ecma_object_t *lex_env_p); -ecma_value_t -ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p, - const ecma_property_descriptor_t *property_desc_p); +ecma_value_t ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, + ecma_string_t *property_name_p, + const ecma_property_descriptor_t *property_desc_p); -ecma_property_t * -ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object_p, - ecma_string_t *property_name_p); +ecma_property_t *ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object_p, + ecma_string_t *property_name_p); -void -ecma_op_arguments_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p); +void ecma_op_arguments_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p); -void -ecma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p, ecma_collection_t *prop_names_p, - ecma_property_counter_t *prop_counter_p, - jerry_property_filter_t filter); +void ecma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p, + ecma_collection_t *prop_names_p, + ecma_property_counter_t *prop_counter_p, + jerry_property_filter_t filter); -ecma_string_t * -ecma_op_arguments_object_get_formal_parameter (ecma_mapped_arguments_t *mapped_arguments_p, - uint32_t index); +ecma_string_t *ecma_op_arguments_object_get_formal_parameter (ecma_mapped_arguments_t *mapped_arguments_p, + uint32_t index); #endif /* !ECMA_ARGUMENTS_OBJECT_H */ diff --git a/jerry-core/ecma/operations/ecma-array-object.c b/jerry-core/ecma/operations/ecma-array-object.c index e52125c8..7ea3e6c6 100644 --- a/jerry-core/ecma/operations/ecma-array-object.c +++ b/jerry-core/ecma/operations/ecma-array-object.c @@ -13,20 +13,21 @@ * limitations under the License. */ -#include "ecma-alloc.h" #include "ecma-array-object.h" -#include "ecma-iterator-object.h" + +#include "ecma-alloc.h" #include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" -#include "ecma-property-hashmap.h" #include "ecma-helpers.h" +#include "ecma-iterator-object.h" #include "ecma-number-arithmetic.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" -#include "ecma-function-object.h" +#include "ecma-objects.h" +#include "ecma-property-hashmap.h" /** \addtogroup ecma ECMA * @{ @@ -54,8 +55,7 @@ /** * Property name type flag for array indices. */ -#define ECMA_FAST_ARRAY_UINT_DIRECT_STRING_PROP_TYPE \ - (ECMA_DIRECT_STRING_UINT << ECMA_PROPERTY_NAME_TYPE_SHIFT) +#define ECMA_FAST_ARRAY_UINT_DIRECT_STRING_PROP_TYPE (ECMA_DIRECT_STRING_UINT << ECMA_PROPERTY_NAME_TYPE_SHIFT) /** * Allocate a new array object with the given length @@ -71,9 +71,8 @@ ecma_op_alloc_array_object (uint32_t length) /**< length of the new array */ ecma_object_t *array_prototype_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE); #endif /* JERRY_BUILTIN_ARRAY */ - ecma_object_t *object_p = ecma_create_object (array_prototype_object_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_ARRAY); + ecma_object_t *object_p = + ecma_create_object (array_prototype_object_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_ARRAY); /* * [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_ARRAY type. @@ -97,8 +96,8 @@ ecma_op_alloc_array_object (uint32_t length) /**< length of the new array */ extern inline bool JERRY_ATTR_ALWAYS_INLINE ecma_op_object_is_fast_array (ecma_object_t *object_p) /**< ecma-object */ { - return (ecma_get_object_base_type (object_p) == ECMA_OBJECT_BASE_TYPE_ARRAY && - ecma_op_array_is_fast_array ((ecma_extended_object_t *) object_p)); + return (ecma_get_object_base_type (object_p) == ECMA_OBJECT_BASE_TYPE_ARRAY + && ecma_op_array_is_fast_array ((ecma_extended_object_t *) object_p)); } /* ecma_op_object_is_fast_array */ /** @@ -229,10 +228,8 @@ ecma_op_new_array_object_from_buffer (const ecma_value_t *args_p, /**< array ele ecma_string_t *prop_name_p = ecma_new_ecma_string_from_uint32 (i); ecma_property_value_t *prop_value_p; - prop_value_p = ecma_create_named_data_property (object_p, - prop_name_p, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, - NULL); + prop_value_p = + ecma_create_named_data_property (object_p, prop_name_p, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL); ecma_deref_ecma_string (prop_name_p); prop_value_p->value = ecma_copy_value_if_not_object (args_p[i]); } @@ -343,9 +340,9 @@ ecma_fast_array_convert_to_normal (ecma_object_t *object_p) /**< fast access mod JERRY_ASSERT (index <= ECMA_DIRECT_STRING_MAX_IMM); property_pair_p->names_cp[prop_index] = (jmem_cpointer_t) index; - property_pair_p->header.types[prop_index] = (ecma_property_t) (ECMA_PROPERTY_FLAG_DATA - | ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE - | ECMA_FAST_ARRAY_UINT_DIRECT_STRING_PROP_TYPE); + property_pair_p->header.types[prop_index] = + (ecma_property_t) (ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE + | ECMA_FAST_ARRAY_UINT_DIRECT_STRING_PROP_TYPE); property_pair_p->values[prop_index].value = values_p[index]; @@ -766,10 +763,7 @@ ecma_op_array_species_create (ecma_object_t *original_array_p, /**< The object f ecma_value_t len_val = ecma_make_length_value (length); ecma_object_t *ctor_object_p = ecma_get_object_from_value (constructor); - ecma_value_t ret_val = ecma_op_function_construct (ctor_object_p, - ctor_object_p, - &len_val, - 1); + ecma_value_t ret_val = ecma_op_function_construct (ctor_object_p, ctor_object_p, &len_val, 1); ecma_deref_object (ctor_object_p); ecma_free_value (len_val); @@ -863,8 +857,7 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */ if (current_prop_p->types[i] != ECMA_PROPERTY_TYPE_DELETED && !ecma_is_property_configurable (current_prop_p->types[i])) { - uint32_t index = ecma_string_get_property_index (current_prop_p->types[i], - prop_pair_p->names_cp[i]); + uint32_t index = ecma_string_get_property_index (current_prop_p->types[i], prop_pair_p->names_cp[i]); if (index < old_length && index >= new_length) { @@ -914,8 +907,7 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */ if (current_prop_p->types[i] != ECMA_PROPERTY_TYPE_DELETED && ecma_is_property_configurable (current_prop_p->types[i])) { - uint32_t index = ecma_string_get_property_index (current_prop_p->types[i], - prop_pair_p->names_cp[i]); + uint32_t index = ecma_string_get_property_index (current_prop_p->types[i], prop_pair_p->names_cp[i]); if (index < old_length && index >= new_length) { @@ -924,9 +916,8 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */ #if JERRY_PROPERTY_HASHMAP if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP) { - hashmap_status = ecma_property_hashmap_delete (object_p, - prop_pair_p->names_cp[i], - current_prop_p->types + i); + hashmap_status = + ecma_property_hashmap_delete (object_p, prop_pair_p->names_cp[i], current_prop_p->types + i); } #endif /* JERRY_PROPERTY_HASHMAP */ @@ -1010,10 +1001,8 @@ ecma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object } /* Only the writable and data properties can be modified. */ - if (flags & (JERRY_PROP_IS_CONFIGURABLE - | JERRY_PROP_IS_ENUMERABLE - | JERRY_PROP_IS_GET_DEFINED - | JERRY_PROP_IS_SET_DEFINED)) + if (flags + & (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)) { return ecma_raise_property_redefinition (ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), flags); } @@ -1061,8 +1050,7 @@ ecma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object ext_object_p->u.array.length = current_len_uint32; - if ((flags & JERRY_PROP_IS_WRITABLE_DEFINED) - && !(flags & JERRY_PROP_IS_WRITABLE)) + if ((flags & JERRY_PROP_IS_WRITABLE_DEFINED) && !(flags & JERRY_PROP_IS_WRITABLE)) { if (ecma_op_array_is_fast_array (ext_object_p)) { @@ -1085,13 +1073,10 @@ ecma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object * If the property desciptor fields contains all the flags below * attempt to stay fast access array during [[DefineOwnProperty]] operation. */ -#define ECMA_FAST_ARRAY_DATA_PROP_FLAGS (JERRY_PROP_IS_VALUE_DEFINED \ - | JERRY_PROP_IS_ENUMERABLE_DEFINED \ - | JERRY_PROP_IS_ENUMERABLE \ - | JERRY_PROP_IS_CONFIGURABLE_DEFINED \ - | JERRY_PROP_IS_CONFIGURABLE \ - | JERRY_PROP_IS_WRITABLE_DEFINED \ - | JERRY_PROP_IS_WRITABLE) +#define ECMA_FAST_ARRAY_DATA_PROP_FLAGS \ + (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE \ + | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_WRITABLE_DEFINED \ + | JERRY_PROP_IS_WRITABLE) /** * [[DefineOwnProperty]] ecma array object's operation @@ -1166,8 +1151,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *object_p, /**< the arra bool update_length = (index >= ext_object_p->u.array.length); - if (update_length - && !ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count)) + if (update_length && !ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count)) { return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags); } @@ -1177,9 +1161,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *object_p, /**< the arra prop_desc = *property_desc_p; prop_desc.flags &= (uint16_t) ~JERRY_PROP_SHOULD_THROW; - ecma_value_t completition = ecma_op_general_object_define_own_property (object_p, - property_name_p, - &prop_desc); + ecma_value_t completition = ecma_op_general_object_define_own_property (object_p, property_name_p, &prop_desc); JERRY_ASSERT (ecma_is_value_boolean (completition)); if (ecma_is_value_false (completition)) diff --git a/jerry-core/ecma/operations/ecma-array-object.h b/jerry-core/ecma/operations/ecma-array-object.h index a56d3bc5..c98fca0a 100644 --- a/jerry-core/ecma/operations/ecma-array-object.h +++ b/jerry-core/ecma/operations/ecma-array-object.h @@ -62,66 +62,47 @@ */ #define ECMA_FAST_ARRAY_MAX_HOLE_COUNT (1 << 24) -ecma_object_t * -ecma_op_new_array_object (uint32_t length); +ecma_object_t *ecma_op_new_array_object (uint32_t length); -ecma_object_t * -ecma_op_new_array_object_from_length (ecma_length_t length); +ecma_object_t *ecma_op_new_array_object_from_length (ecma_length_t length); -ecma_value_t -ecma_op_new_array_object_from_buffer (const ecma_value_t *args_p, uint32_t length); +ecma_value_t ecma_op_new_array_object_from_buffer (const ecma_value_t *args_p, uint32_t length); -ecma_value_t -ecma_op_new_array_object_from_collection (ecma_collection_t *collection_p, bool unref_objects); +ecma_value_t ecma_op_new_array_object_from_collection (ecma_collection_t *collection_p, bool unref_objects); -bool -ecma_op_object_is_fast_array (ecma_object_t *object_p); +bool ecma_op_object_is_fast_array (ecma_object_t *object_p); -bool -ecma_op_array_is_fast_array (ecma_extended_object_t *array_p); +bool ecma_op_array_is_fast_array (ecma_extended_object_t *array_p); -uint32_t -ecma_fast_array_get_hole_count (ecma_object_t *obj_p); +uint32_t ecma_fast_array_get_hole_count (ecma_object_t *obj_p); -ecma_value_t * -ecma_fast_array_extend (ecma_object_t *object_p, uint32_t new_lengt); +ecma_value_t *ecma_fast_array_extend (ecma_object_t *object_p, uint32_t new_lengt); -bool -ecma_fast_array_set_property (ecma_object_t *object_p, uint32_t index, ecma_value_t value); +bool ecma_fast_array_set_property (ecma_object_t *object_p, uint32_t index, ecma_value_t value); -bool -ecma_array_object_delete_property (ecma_object_t *object_p, ecma_string_t *property_name_p); +bool ecma_array_object_delete_property (ecma_object_t *object_p, ecma_string_t *property_name_p); -uint32_t -ecma_delete_fast_array_properties (ecma_object_t *object_p, uint32_t new_length); +uint32_t ecma_delete_fast_array_properties (ecma_object_t *object_p, uint32_t new_length); -ecma_collection_t * -ecma_fast_array_object_own_property_keys (ecma_object_t *object_p, jerry_property_filter_t filter); +ecma_collection_t *ecma_fast_array_object_own_property_keys (ecma_object_t *object_p, jerry_property_filter_t filter); -void -ecma_fast_array_convert_to_normal (ecma_object_t *object_p); +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_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); +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); +ecma_value_t ecma_op_array_object_set_length (ecma_object_t *object_p, ecma_value_t new_value, uint16_t flags); -ecma_value_t -ecma_op_array_object_define_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p, - const ecma_property_descriptor_t *property_desc_p); +ecma_value_t ecma_op_array_object_define_own_property (ecma_object_t *object_p, + ecma_string_t *property_name_p, + const ecma_property_descriptor_t *property_desc_p); uint32_t ecma_array_get_length (ecma_object_t *array_p); -ecma_value_t -ecma_array_object_to_string (ecma_value_t this_arg); +ecma_value_t ecma_array_object_to_string (ecma_value_t this_arg); /** * @} diff --git a/jerry-core/ecma/operations/ecma-arraybuffer-object.c b/jerry-core/ecma/operations/ecma-arraybuffer-object.c index eebf31f3..3457066c 100644 --- a/jerry-core/ecma/operations/ecma-arraybuffer-object.c +++ b/jerry-core/ecma/operations/ecma-arraybuffer-object.c @@ -14,8 +14,9 @@ */ #include "ecma-arraybuffer-object.h" -#include "ecma-builtins.h" + #include "ecma-builtin-helpers.h" +#include "ecma-builtins.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" #include "ecma-gc.h" @@ -24,6 +25,7 @@ #include "ecma-objects.h" #include "ecma-shared-arraybuffer-object.h" #include "ecma-typedarray-object.h" + #include "jcontext.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -47,8 +49,7 @@ ecma_arraybuffer_create_object (uint8_t type, /**< type of the arraybuffer */ ecma_builtin_id_t prototype_id; #if JERRY_BUILTIN_SHAREDARRAYBUFFER - JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER - || type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER); + JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER || type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER); prototype_id = (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER ? ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE : ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE); @@ -83,8 +84,7 @@ ecma_arraybuffer_create_object_with_buffer (uint8_t type, /**< type of the array ecma_builtin_id_t prototype_id; #if JERRY_BUILTIN_SHAREDARRAYBUFFER - JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER - || type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER); + JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER || type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER); prototype_id = (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER ? ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE : ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE); @@ -94,9 +94,8 @@ ecma_arraybuffer_create_object_with_buffer (uint8_t type, /**< type of the array prototype_id = ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE; #endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */ - ecma_object_t *object_p = ecma_create_object (ecma_builtin_get (prototype_id), - sizeof (ecma_arraybuffer_pointer_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = + ecma_create_object (ecma_builtin_get (prototype_id), sizeof (ecma_arraybuffer_pointer_t), ECMA_OBJECT_TYPE_CLASS); ecma_arraybuffer_pointer_t *arraybuffer_pointer_p = (ecma_arraybuffer_pointer_t *) object_p; arraybuffer_pointer_p->extended_object.u.cls.type = type; @@ -266,7 +265,6 @@ ecma_op_create_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< li if (arguments_list_len > 0) { - if (ecma_is_value_number (arguments_list_p[0])) { length_num = ecma_get_number_from_value (arguments_list_p[0]); @@ -341,7 +339,7 @@ ecma_arraybuffer_get_length (ecma_object_t *object_p) /**< pointer to the ArrayB * * @return pointer to the data buffer */ -extern inline uint8_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE +extern inline uint8_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE ecma_arraybuffer_get_buffer (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */ { JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER) @@ -420,9 +418,7 @@ ecma_arraybuffer_detach (ecma_object_t *object_p) /**< pointer to the ArrayBuffe * Returned value must be freed with ecma_free_value. */ ecma_value_t -ecma_builtin_arraybuffer_slice (ecma_value_t this_arg, - const ecma_value_t *argument_list_p, - uint32_t arguments_number) +ecma_builtin_arraybuffer_slice (ecma_value_t this_arg, const ecma_value_t *argument_list_p, uint32_t arguments_number) { ecma_object_t *object_p = ecma_get_object_from_value (this_arg); @@ -441,9 +437,7 @@ ecma_builtin_arraybuffer_slice (ecma_value_t this_arg, if (arguments_number > 0) { /* 6-7. */ - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[0], - len, - &start))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[0], len, &start))) { return ECMA_VALUE_ERROR; } @@ -451,9 +445,7 @@ ecma_builtin_arraybuffer_slice (ecma_value_t this_arg, if (arguments_number > 1 && !ecma_is_value_undefined (argument_list_p[1])) { /* 8-9. */ - if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[1], - len, - &end))) + if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[1], len, &end))) { return ECMA_VALUE_ERROR; } @@ -540,7 +532,7 @@ ecma_builtin_arraybuffer_slice (ecma_value_t this_arg, /* 22. */ memcpy (new_buf, old_buf + start, new_len); - free_new_arraybuffer: +free_new_arraybuffer: if (ret_value != ECMA_VALUE_EMPTY) { ecma_deref_object (new_arraybuffer_p); diff --git a/jerry-core/ecma/operations/ecma-arraybuffer-object.h b/jerry-core/ecma/operations/ecma-arraybuffer-object.h index f904c1ae..df1f3b3f 100644 --- a/jerry-core/ecma/operations/ecma-arraybuffer-object.h +++ b/jerry-core/ecma/operations/ecma-arraybuffer-object.h @@ -36,42 +36,28 @@ /** * Check whether the backing store is allocated for an array buffer. */ -#define ECMA_ARRAYBUFFER_CHECK_BUFFER_ERROR(arraybuffer_p) \ +#define ECMA_ARRAYBUFFER_CHECK_BUFFER_ERROR(arraybuffer_p) \ (JERRY_UNLIKELY (!(ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_ALLOCATED)) \ && ecma_arraybuffer_allocate_buffer_throw (arraybuffer_p) == ECMA_VALUE_ERROR) -ecma_value_t -ecma_op_create_arraybuffer_object (const ecma_value_t *, uint32_t); +ecma_value_t ecma_op_create_arraybuffer_object (const ecma_value_t *, uint32_t); /** * Helper functions for arraybuffer. */ -ecma_object_t * -ecma_arraybuffer_create_object (uint8_t type, uint32_t length); -ecma_object_t * -ecma_arraybuffer_create_object_with_buffer (uint8_t type, uint32_t length); -ecma_object_t * -ecma_arraybuffer_new_object (uint32_t length); -uint8_t * -ecma_arraybuffer_allocate_buffer (ecma_object_t *arraybuffer_p); -ecma_value_t -ecma_arraybuffer_allocate_buffer_throw (ecma_object_t *arraybuffer_p); -void -ecma_arraybuffer_release_buffer (ecma_object_t *arraybuffer_p); -uint8_t * JERRY_ATTR_PURE -ecma_arraybuffer_get_buffer (ecma_object_t *obj_p); -uint32_t JERRY_ATTR_PURE -ecma_arraybuffer_get_length (ecma_object_t *obj_p); -bool JERRY_ATTR_PURE -ecma_arraybuffer_is_detached (ecma_object_t *obj_p); -bool -ecma_arraybuffer_detach (ecma_object_t *obj_p); -bool -ecma_is_arraybuffer (ecma_value_t val); +ecma_object_t *ecma_arraybuffer_create_object (uint8_t type, uint32_t length); +ecma_object_t *ecma_arraybuffer_create_object_with_buffer (uint8_t type, uint32_t length); +ecma_object_t *ecma_arraybuffer_new_object (uint32_t length); +uint8_t *ecma_arraybuffer_allocate_buffer (ecma_object_t *arraybuffer_p); +ecma_value_t ecma_arraybuffer_allocate_buffer_throw (ecma_object_t *arraybuffer_p); +void ecma_arraybuffer_release_buffer (ecma_object_t *arraybuffer_p); +uint8_t *JERRY_ATTR_PURE ecma_arraybuffer_get_buffer (ecma_object_t *obj_p); +uint32_t JERRY_ATTR_PURE ecma_arraybuffer_get_length (ecma_object_t *obj_p); +bool JERRY_ATTR_PURE ecma_arraybuffer_is_detached (ecma_object_t *obj_p); +bool ecma_arraybuffer_detach (ecma_object_t *obj_p); +bool ecma_is_arraybuffer (ecma_value_t val); ecma_value_t -ecma_builtin_arraybuffer_slice (ecma_value_t this_arg, - const ecma_value_t *argument_list_p, - uint32_t arguments_number); +ecma_builtin_arraybuffer_slice (ecma_value_t this_arg, const ecma_value_t *argument_list_p, uint32_t arguments_number); /** * @} diff --git a/jerry-core/ecma/operations/ecma-async-generator-object.c b/jerry-core/ecma/operations/ecma-async-generator-object.c index 446e9cc9..fcb249d9 100644 --- a/jerry-core/ecma/operations/ecma-async-generator-object.c +++ b/jerry-core/ecma/operations/ecma-async-generator-object.c @@ -13,8 +13,9 @@ * limitations under the License. */ -#include "ecma-alloc.h" #include "ecma-async-generator-object.h" + +#include "ecma-alloc.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" @@ -24,10 +25,11 @@ #include "ecma-iterator-object.h" #include "ecma-objects.h" #include "ecma-promise-object.h" + #include "jcontext.h" #include "opcodes.h" -#include "vm.h" #include "vm-stack.h" +#include "vm.h" #if JERRY_ESNEXT @@ -145,9 +147,7 @@ ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< a return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'throw' is not available")); } - result = ecma_async_yield_call (result, - async_generator_object_p, - ECMA_VALUE_EMPTY); + result = ecma_async_yield_call (result, async_generator_object_p, ECMA_VALUE_EMPTY); if (ECMA_IS_VALUE_ERROR (result)) { @@ -158,9 +158,7 @@ ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< a return ECMA_VALUE_UNDEFINED; } - result = ecma_async_yield_call (result, - async_generator_object_p, - value); + result = ecma_async_yield_call (result, async_generator_object_p, value); if (ECMA_IS_VALUE_ERROR (result)) { @@ -407,9 +405,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl return value; } - result = ecma_async_yield_call (result, - executable_object_p, - value); + result = ecma_async_yield_call (result, executable_object_p, value); ecma_free_value (value); if (ECMA_IS_VALUE_ERROR (result)) @@ -509,8 +505,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl uint32_t context_end = VM_GET_CONTEXT_END (stack_top_p[-1]); executable_object_p->frame_ctx.byte_code_p = executable_object_p->frame_ctx.byte_code_start_p + context_end; - VM_MINUS_EQUAL_U16 (executable_object_p->frame_ctx.context_depth, - PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION); + VM_MINUS_EQUAL_U16 (executable_object_p->frame_ctx.context_depth, PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION); stack_top_p -= PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION; executable_object_p->frame_ctx.stack_top_p = stack_top_p; diff --git a/jerry-core/ecma/operations/ecma-async-generator-object.h b/jerry-core/ecma/operations/ecma-async-generator-object.h index 7436ba70..b5a94cf4 100644 --- a/jerry-core/ecma/operations/ecma-async-generator-object.h +++ b/jerry-core/ecma/operations/ecma-async-generator-object.h @@ -17,6 +17,7 @@ #define ECMA_ASYNC_GENERATOR_OBJECT_H #include "ecma-globals.h" + #include "vm-defines.h" #if JERRY_ESNEXT @@ -47,27 +48,24 @@ typedef enum /** * Set the state of an async yield iterator. */ -#define ECMA_AWAIT_SET_STATE(async_generator_object_p, to) \ - do \ - { \ +#define ECMA_AWAIT_SET_STATE(async_generator_object_p, to) \ + do \ + { \ uint16_t extra_info = (async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags; \ - extra_info &= ((1 << ECMA_AWAIT_STATE_SHIFT) - 1); \ - extra_info |= (ECMA_AWAIT_ ## to) << ECMA_AWAIT_STATE_SHIFT; \ - (async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags = extra_info; \ - } \ - while (false) + extra_info &= ((1 << ECMA_AWAIT_STATE_SHIFT) - 1); \ + extra_info |= (ECMA_AWAIT_##to) << ECMA_AWAIT_STATE_SHIFT; \ + (async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags = extra_info; \ + } while (false) /** * Mask for clearing all ASYNC_AWAIT status bits */ -#define ECMA_AWAIT_CLEAR_MASK \ - (((1 << ECMA_AWAIT_STATE_SHIFT) - 1) - ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD) +#define ECMA_AWAIT_CLEAR_MASK (((1 << ECMA_AWAIT_STATE_SHIFT) - 1) - ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD) /** * Helper macro for ECMA_AWAIT_CHANGE_STATE. */ -#define ECMA_AWAIT_CS_HELPER(from, to) \ - (((ECMA_AWAIT_ ## from) ^ (ECMA_AWAIT_ ## to)) << ECMA_AWAIT_STATE_SHIFT) +#define ECMA_AWAIT_CS_HELPER(from, to) (((ECMA_AWAIT_##from) ^ (ECMA_AWAIT_##to)) << ECMA_AWAIT_STATE_SHIFT) /** * Change the state of an async yield iterator. @@ -76,7 +74,8 @@ typedef enum ((async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags ^= ECMA_AWAIT_CS_HELPER (from, to)) ecma_value_t ecma_async_generator_enqueue (vm_executable_object_t *async_generator_object_p, - ecma_async_generator_operation_type_t operation, ecma_value_t value); + ecma_async_generator_operation_type_t operation, + ecma_value_t value); ecma_value_t ecma_async_generator_run (vm_executable_object_t *async_generator_object_p); void ecma_async_generator_finalize (vm_executable_object_t *async_generator_object_p, ecma_value_t value); diff --git a/jerry-core/ecma/operations/ecma-atomics-object.c b/jerry-core/ecma/operations/ecma-atomics-object.c index e598b3d1..24a156c8 100644 --- a/jerry-core/ecma/operations/ecma-atomics-object.c +++ b/jerry-core/ecma/operations/ecma-atomics-object.c @@ -14,19 +14,21 @@ */ #include "ecma-atomics-object.h" + #include "ecma-arraybuffer-object.h" -#include "ecma-shared-arraybuffer-object.h" #include "ecma-bigint.h" -#include "ecma-typedarray-object.h" -#include "ecma-objects.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "jmem.h" +#include "ecma-objects.h" +#include "ecma-shared-arraybuffer-object.h" +#include "ecma-typedarray-object.h" + #include "jcontext.h" -#include "ecma-function-object.h" +#include "jmem.h" #if JERRY_BUILTIN_ATOMICS @@ -56,7 +58,7 @@ ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, /**< typedArra /* 3-4. */ ecma_object_t *typedarray_p = ecma_get_object_from_value (typedarray); - ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p); + ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p); /* 5-6. */ if (waitable) @@ -68,7 +70,7 @@ ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, /**< typedArra } else { - if (target_info.id == ECMA_UINT8_CLAMPED_ARRAY || target_info.id == ECMA_FLOAT32_ARRAY + if (target_info.id == ECMA_UINT8_CLAMPED_ARRAY || target_info.id == ECMA_FLOAT32_ARRAY || target_info.id == ECMA_FLOAT64_ARRAY) { return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not supported")); @@ -159,7 +161,7 @@ ecma_atomic_read_modify_write (ecma_value_t typedarray, /**< typedArray argument /* 3. */ ecma_object_t *typedarray_p = ecma_get_object_from_value (typedarray); - ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p); + ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p); /* 4-5. */ ecma_value_t val = ECMA_VALUE_ERROR; diff --git a/jerry-core/ecma/operations/ecma-atomics-object.h b/jerry-core/ecma/operations/ecma-atomics-object.h index 62434778..d73ae99b 100644 --- a/jerry-core/ecma/operations/ecma-atomics-object.h +++ b/jerry-core/ecma/operations/ecma-atomics-object.h @@ -41,20 +41,11 @@ typedef enum ECMA_ATOMICS_COMPARE_EXCHANGE /**< Atomics compare exchange operation */ } ecma_atomics_op_t; +ecma_value_t ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, bool waitable); +ecma_value_t ecma_validate_atomic_access (ecma_value_t typedarray, ecma_value_t request_index); ecma_value_t -ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, - bool waitable); -ecma_value_t -ecma_validate_atomic_access (ecma_value_t typedarray, - ecma_value_t request_index); -ecma_value_t -ecma_atomic_read_modify_write (ecma_value_t typedarray, - ecma_value_t index, - ecma_value_t value, - ecma_atomics_op_t op); -ecma_value_t -ecma_atomic_load (ecma_value_t typedarray, - ecma_value_t index); +ecma_atomic_read_modify_write (ecma_value_t typedarray, ecma_value_t index, ecma_value_t value, ecma_atomics_op_t op); +ecma_value_t ecma_atomic_load (ecma_value_t typedarray, ecma_value_t index); /** * @} * @} diff --git a/jerry-core/ecma/operations/ecma-big-uint.c b/jerry-core/ecma/operations/ecma-big-uint.c index fa9ca1f0..990318e9 100644 --- a/jerry-core/ecma/operations/ecma-big-uint.c +++ b/jerry-core/ecma/operations/ecma-big-uint.c @@ -14,7 +14,9 @@ */ #include "ecma-big-uint.h" + #include "ecma-helpers.h" + #include "jmem.h" #include "lit-char-helpers.h" @@ -113,8 +115,7 @@ ecma_big_uint_count_leading_zero (ecma_bigint_digit_t digit) /**< digit value */ result -= shift; } shift >>= 1; - } - while (shift > 0); + } while (shift > 0); return result - digit; } /* ecma_big_uint_count_leading_zero */ @@ -139,8 +140,7 @@ ecma_big_uint_normalize_result (ecma_extended_primitive_t *value_p, /**< BigUInt do { --last_digit_p; - } - while (last_digit_p[-1] == 0); + } while (last_digit_p[-1] == 0); JERRY_ASSERT (last_digit_p >= first_digit_p); @@ -251,8 +251,7 @@ ecma_big_uint_compare (ecma_extended_primitive_t *left_value_p, /**< left BigUIn { return 1; } - } - while (left_p > start_p); + } while (left_p > start_p); return 0; } /* ecma_big_uint_compare */ @@ -309,8 +308,7 @@ ecma_big_uint_mul_digit (ecma_extended_primitive_t *value_p, /**< BigUInt value *current_p++ = multiply_result_low; carry = new_carry; - } - while (current_p < end_p); + } while (current_p < end_p); if (carry == 0) { @@ -390,8 +388,7 @@ ecma_big_uint_to_string (ecma_extended_primitive_t *value_p, /**< BigUInt value *current_p = (ecma_bigint_digit_t) (result / radix); remainder = (ecma_bigint_digit_t) (result % radix); - } - while (current_p > end_p); + } while (current_p > end_p); } else { @@ -434,16 +431,15 @@ ecma_big_uint_to_string (ecma_extended_primitive_t *value_p, /**< BigUInt value } } - *(--string_p) = (lit_utf8_byte_t) ((remainder < 10) ? (remainder + LIT_CHAR_0) - : (remainder + (LIT_CHAR_LOWERCASE_A - 10))); + *(--string_p) = + (lit_utf8_byte_t) ((remainder < 10) ? (remainder + LIT_CHAR_0) : (remainder + (LIT_CHAR_LOWERCASE_A - 10))); JERRY_ASSERT (string_p >= (lit_utf8_byte_t *) start_p); if (start_p[-1] == 0) { start_p--; } - } - while (start_p > end_p); + } while (start_p > end_p); *char_start_p = (uint32_t) (string_p - result_p); return result_p; @@ -469,8 +465,7 @@ ecma_big_uint_increase (ecma_extended_primitive_t *value_p) /**< BigUInt value * do { digits_p++; - } - while (digits_p < digits_end_p && digits_p[0] == ~((ecma_bigint_digit_t) 0)); + } while (digits_p < digits_end_p && digits_p[0] == ~((ecma_bigint_digit_t) 0)); if (digits_p == digits_end_p) { @@ -537,8 +532,7 @@ ecma_big_uint_decrease (ecma_extended_primitive_t *value_p) /**< BigUInt value * { digits_p++; JERRY_ASSERT (digits_p < digits_end_p); - } - while (digits_p[0] == 0); + } while (digits_p[0] == 0); if (digits_p + 1 == digits_end_p) { @@ -648,8 +642,7 @@ ecma_big_uint_add (ecma_extended_primitive_t *left_value_p, /**< left BigUInt va } *current_p++ = left; - } - while (current_p < end_p); + } while (current_p < end_p); end_p = (ecma_bigint_digit_t *) (((uint8_t *) end_p) + left_size); @@ -730,8 +723,7 @@ ecma_big_uint_sub (ecma_extended_primitive_t *left_value_p, /**< left BigUInt va } *current_p++ = left - right; - } - while (current_p < end_p); + } while (current_p < end_p); end_p = (ecma_bigint_digit_t *) (((uint8_t *) end_p) + left_size); @@ -870,8 +862,7 @@ ecma_big_uint_mul (ecma_extended_primitive_t *left_value_p, /**< left BigUInt va { destination_p = (ecma_bigint_digit_t *) extra_space; } - } - while (left_p < left_end_p); + } while (left_p < left_end_p); while (carry > 0) { @@ -891,8 +882,7 @@ ecma_big_uint_mul (ecma_extended_primitive_t *left_value_p, /**< left BigUInt va } result_start_p++; - } - while (right_p < right_end_p); + } while (right_p < right_end_p); if (extra_space[0] == 0) { @@ -1038,8 +1028,7 @@ ecma_big_uint_div_shift_left (ecma_extended_primitive_t *value_p, /**< BigUInt v *destination_p++ = (value << shift_left) | carry; carry = value >> shift_right; - } - while (source_p < end_p); + } while (source_p < end_p); if (extend) { @@ -1156,8 +1145,7 @@ ecma_big_uint_div_mod (ecma_extended_primitive_t *dividend_value_p, /**< divider /* Subtraction is faster than recomputing result_div * divisor_low. */ low_digits -= divisor_low; } - } - while (false); + } while (false); /* D4. [Multiply and subtract] */ ecma_bigint_digit_t *destination_p = dividend_p; @@ -1188,8 +1176,7 @@ ecma_big_uint_div_mod (ecma_extended_primitive_t *dividend_value_p, /**< divider *destination_p++ = value - carry; carry = new_carry; - } - while (source_p < divisor_end_p); + } while (source_p < divisor_end_p); bool negative_result = *destination_p < carry; *destination_p -= carry; @@ -1228,16 +1215,14 @@ ecma_big_uint_div_mod (ecma_extended_primitive_t *dividend_value_p, /**< divider } *destination_p++ = left; - } - while (source_p < divisor_end_p); + } while (source_p < divisor_end_p); } *dividend_end_p = result_div; dividend_p--; dividend_end_p--; - } - while (dividend_p >= buffer_p); + } while (dividend_p >= buffer_p); ecma_bigint_digit_t *source_p; ecma_bigint_digit_t *source_end_p; @@ -1295,8 +1280,7 @@ ecma_big_uint_div_mod (ecma_extended_primitive_t *dividend_value_p, /**< divider *(--destination_p) = (value >> shift_right) | carry; carry = value << shift_left; - } - while (source_end_p > source_p); + } while (source_end_p > source_p); } else { @@ -1378,8 +1362,7 @@ ecma_big_uint_shift_left (ecma_extended_primitive_t *left_value_p, /**< left Big *result_p++ = (value << shift_left) | carry; carry = value >> shift_right; - } - while (left_p < left_end_p); + } while (left_p < left_end_p); if (carry > 0) { @@ -1395,7 +1378,7 @@ ecma_big_uint_shift_left (ecma_extended_primitive_t *left_value_p, /**< left Big * @return new BigUInt value, NULL on error */ ecma_extended_primitive_t * -ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */ +ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */ uint32_t right_value, /**< shift value */ bool increase_result) /**< increase result */ { @@ -1410,8 +1393,7 @@ ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left B uint32_t shift_left = (1 << ECMA_BIGINT_DIGIT_SHIFT) - shift_right; ecma_bigint_digit_t carry = 0; - if (shift_right > 0 - && (ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) >> shift_right) == 0) + if (shift_right > 0 && (ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) >> shift_right) == 0) { carry = ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) << shift_left; left_size -= (uint32_t) sizeof (ecma_bigint_digit_t); @@ -1433,8 +1415,7 @@ ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left B } if (JERRY_UNLIKELY (increase_result) - && (shift_right == 0 - || (*ECMA_BIGINT_GET_DIGITS (left_value_p, crop_size) << shift_left) == 0)) + && (shift_right == 0 || (*ECMA_BIGINT_GET_DIGITS (left_value_p, crop_size) << shift_left) == 0)) { ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0); ecma_bigint_digit_t *left_end_p = ECMA_BIGINT_GET_DIGITS (left_value_p, crop_size); @@ -1483,8 +1464,7 @@ ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left B *(--result_p) = (value >> shift_right) | carry; carry = value << shift_left; - } - while (result_p > end_p); + } while (result_p > end_p); if (JERRY_LIKELY (!increase_result)) { @@ -1606,8 +1586,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation } default: { - JERRY_ASSERT (operation_type == ECMA_BIG_UINT_BITWISE_OR - || operation_type == ECMA_BIG_UINT_BITWISE_XOR); + JERRY_ASSERT (operation_type == ECMA_BIG_UINT_BITWISE_OR || operation_type == ECMA_BIG_UINT_BITWISE_XOR); if (right_size <= left_size) { @@ -1626,8 +1605,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation uint32_t decrease_opts = (operation_and_options & ECMA_BIG_UINT_BITWISE_DECREASE_BOTH); /* When exactly one bit is set, invert both bits. */ - if (decrease_opts >= ECMA_BIG_UINT_BITWISE_DECREASE_LEFT - && decrease_opts <= ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT) + if (decrease_opts >= ECMA_BIG_UINT_BITWISE_DECREASE_LEFT && decrease_opts <= ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT) { operation_and_options ^= ECMA_BIG_UINT_BITWISE_DECREASE_BOTH; } @@ -1656,8 +1634,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation do { *result_p++ = *left_p++ & *right_p++; - } - while (result_p < result_end_p); + } while (result_p < result_end_p); if (result_p[-1] == 0) { @@ -1671,8 +1648,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation do { *result_p++ = *left_p++ | *right_p++; - } - while (result_p < result_end_p); + } while (result_p < result_end_p); if (left_size > right_size) { @@ -1686,8 +1662,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation do { *result_p++ = *left_p++ ^ *right_p++; - } - while (result_p < result_end_p); + } while (result_p < result_end_p); if (left_size > right_size) { @@ -1754,8 +1729,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation break; } } - } - while (result_p < result_end_p); + } while (result_p < result_end_p); if (operation_type != ECMA_BIG_UINT_BITWISE_AND) { diff --git a/jerry-core/ecma/operations/ecma-big-uint.h b/jerry-core/ecma/operations/ecma-big-uint.h index 913387a0..7eec2dd5 100644 --- a/jerry-core/ecma/operations/ecma-big-uint.h +++ b/jerry-core/ecma/operations/ecma-big-uint.h @@ -44,20 +44,17 @@ typedef uint64_t ecma_bigint_two_digits_t; /** * Return with the digits of a BigInt value. */ -#define ECMA_BIGINT_GET_LAST_DIGIT(value_p, size) \ - *ECMA_BIGINT_GET_DIGITS (value_p, size - sizeof (ecma_bigint_digit_t)) +#define ECMA_BIGINT_GET_LAST_DIGIT(value_p, size) *ECMA_BIGINT_GET_DIGITS (value_p, size - sizeof (ecma_bigint_digit_t)) /** * Returns true if size is an odd number. */ -#define ECMA_BIGINT_SIZE_IS_ODD(size) \ - (((size) & sizeof (ecma_bigint_digit_t)) != 0) +#define ECMA_BIGINT_SIZE_IS_ODD(size) (((size) & sizeof (ecma_bigint_digit_t)) != 0) /** * Returns a two digit value where the high digit is set to the passed digit. */ -#define ECMA_BIGINT_HIGH_DIGIT(digit) \ - (((ecma_bigint_two_digits_t) digit) << (8 * sizeof (ecma_bigint_digit_t))) +#define ECMA_BIGINT_HIGH_DIGIT(digit) (((ecma_bigint_two_digits_t) digit) << (8 * sizeof (ecma_bigint_digit_t))) /** * Tells whether a number (usually a digit or uint32_t value) is an odd number. @@ -78,8 +75,7 @@ typedef enum /** * Returns with the type of the operation. */ -#define ECMA_BIGINT_BITWISE_GET_OPERATION_TYPE(operation_and_options) \ - ((operation_and_options) & 0xf) +#define ECMA_BIGINT_BITWISE_GET_OPERATION_TYPE(operation_and_options) ((operation_and_options) &0xf) /** * Options for bitwise operations. @@ -94,8 +90,7 @@ typedef enum /** * Subtract 1 from both left and right values. */ -#define ECMA_BIG_UINT_BITWISE_DECREASE_BOTH \ - (ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT) +#define ECMA_BIG_UINT_BITWISE_DECREASE_BOTH (ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT) ecma_extended_primitive_t *ecma_bigint_create (uint32_t size); ecma_extended_primitive_t *ecma_big_uint_extend (ecma_extended_primitive_t *value_p, ecma_bigint_digit_t digit); @@ -104,11 +99,13 @@ ecma_bigint_digit_t ecma_big_uint_count_leading_zero (ecma_bigint_digit_t digit) int ecma_big_uint_compare (ecma_extended_primitive_t *left_value_p, ecma_extended_primitive_t *right_value_p); -ecma_extended_primitive_t *ecma_big_uint_mul_digit (ecma_extended_primitive_t *value_p, - ecma_bigint_digit_t mul, ecma_bigint_digit_t add); +ecma_extended_primitive_t * +ecma_big_uint_mul_digit (ecma_extended_primitive_t *value_p, ecma_bigint_digit_t mul, ecma_bigint_digit_t add); -uint8_t *ecma_big_uint_to_string (ecma_extended_primitive_t *value_p, uint32_t radix, - uint32_t *char_start_p, uint32_t *char_size_p); +uint8_t *ecma_big_uint_to_string (ecma_extended_primitive_t *value_p, + uint32_t radix, + uint32_t *char_start_p, + uint32_t *char_size_p); ecma_extended_primitive_t *ecma_big_uint_increase (ecma_extended_primitive_t *value_p); ecma_extended_primitive_t *ecma_big_uint_decrease (ecma_extended_primitive_t *value_p); @@ -124,8 +121,8 @@ ecma_extended_primitive_t *ecma_big_uint_div_mod (ecma_extended_primitive_t *div bool is_mod); ecma_extended_primitive_t *ecma_big_uint_shift_left (ecma_extended_primitive_t *left_value_p, uint32_t right_value); -ecma_extended_primitive_t *ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, uint32_t right_value, - bool increase_result); +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); diff --git a/jerry-core/ecma/operations/ecma-bigint-object.c b/jerry-core/ecma/operations/ecma-bigint-object.c index cb089f06..6d03cd51 100644 --- a/jerry-core/ecma/operations/ecma-bigint-object.c +++ b/jerry-core/ecma/operations/ecma-bigint-object.c @@ -13,15 +13,16 @@ * limitations under the License. */ -#include "ecma-alloc.h" #include "ecma-bigint-object.h" + +#include "ecma-alloc.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" +#include "ecma-objects.h" #if JERRY_BUILTIN_BIGINT @@ -47,9 +48,8 @@ ecma_op_create_bigint_object (ecma_value_t arg) /**< argument passed to the toOb ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_BIGINT_PROTOTYPE); - ecma_object_t *object_p = ecma_create_object (prototype_obj_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = + ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p; ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BIGINT; diff --git a/jerry-core/ecma/operations/ecma-bigint.c b/jerry-core/ecma/operations/ecma-bigint.c index de11b815..66c25843 100644 --- a/jerry-core/ecma/operations/ecma-bigint.c +++ b/jerry-core/ecma/operations/ecma-bigint.c @@ -14,10 +14,12 @@ */ #include "ecma-bigint.h" + #include "ecma-big-uint.h" #include "ecma-exceptions.h" #include "ecma-helpers.h" #include "ecma-objects.h" + #include "lit-char-helpers.h" #if JERRY_BUILTIN_BIGINT @@ -179,8 +181,7 @@ ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, /**< string represena { break; } - } - while (++string_p < string_end_p); + } while (++string_p < string_end_p); if (JERRY_UNLIKELY (result_p == NULL)) { @@ -259,8 +260,7 @@ ecma_bigint_to_string (ecma_value_t value, /**< BigInt value */ /** * Get the size of zero digits from the result of ecma_bigint_number_to_digits */ -#define ECMA_BIGINT_NUMBER_TO_DIGITS_GET_ZERO_SIZE(value) \ - (((value) & 0xffff) * (uint32_t) sizeof (ecma_bigint_digit_t)) +#define ECMA_BIGINT_NUMBER_TO_DIGITS_GET_ZERO_SIZE(value) (((value) &0xffff) * (uint32_t) sizeof (ecma_bigint_digit_t)) /** * Get the number of digits from the result of ecma_bigint_number_to_digits @@ -723,7 +723,7 @@ ecma_bigint_create_from_digits (const uint64_t *digits_p, /**< BigInt digits */ result_p[0] = (ecma_bigint_digit_t) digit; result_p[1] = (ecma_bigint_digit_t) (digit >> (8 * sizeof (ecma_bigint_digit_t))); - result_p+= 2; + result_p += 2; } return ecma_make_extended_primitive_value (result_value_p, ECMA_TYPE_BIGINT); @@ -1052,8 +1052,7 @@ ecma_bigint_compare_to_number (ecma_value_t left_value, /**< left BigInt value * { return left > right ? left_sign : -left_sign; } - } - while (left_p > left_end_p); + } while (left_p > left_end_p); left_end_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0); @@ -1613,9 +1612,8 @@ ecma_bigint_and (ecma_value_t left_value, /**< left BigInt value */ } /* (-x) & (-y) == ~(x-1) & ~(y-1) == ~((x-1) | (y-1)) == -(((x-1) | (y-1)) + 1) */ - uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_OR - | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH - | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); + uint32_t operation_and_options = + (ECMA_BIG_UINT_BITWISE_OR | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p); } /* ecma_bigint_and */ @@ -1650,25 +1648,22 @@ ecma_bigint_or (ecma_value_t left_value, /**< left BigInt value */ } /* x | (-y) == x | ~(y-1) == ~((y-1) &~ x) == -(((y-1) &~ x) + 1) */ - uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_AND_NOT - | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT - | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); + uint32_t operation_and_options = + (ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); return ecma_bigint_bitwise_op (operation_and_options, right_p, left_p); } if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)) { /* (-x) | y == ~(x-1) | y == ~((x-1) &~ y) == -(((x-1) &~ y) + 1) */ - uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_AND_NOT - | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT - | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); + uint32_t operation_and_options = + (ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p); } /* (-x) | (-y) == ~(x-1) | ~(y-1) == ~((x-1) & (y-1)) = -(((x-1) & (y-1)) + 1) */ - uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_AND - | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH - | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); + uint32_t operation_and_options = + (ECMA_BIG_UINT_BITWISE_AND | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p); } /* ecma_bigint_or */ @@ -1703,18 +1698,16 @@ ecma_bigint_xor (ecma_value_t left_value, /**< left BigInt value */ } /* x ^ (-y) == x ^ ~(y-1) == ~(x ^ (y-1)) == -((x ^ (y-1)) + 1) */ - uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_XOR - | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT - | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); + uint32_t operation_and_options = + (ECMA_BIG_UINT_BITWISE_XOR | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p); } if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)) { /* (-x) | y == ~(x-1) ^ y == ~((x-1) ^ y) == -(((x-1) ^ y) + 1) */ - uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_XOR - | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT - | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); + uint32_t operation_and_options = + (ECMA_BIG_UINT_BITWISE_XOR | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT); return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p); } diff --git a/jerry-core/ecma/operations/ecma-bigint.h b/jerry-core/ecma/operations/ecma-bigint.h index 128c903c..33ad30d9 100644 --- a/jerry-core/ecma/operations/ecma-bigint.h +++ b/jerry-core/ecma/operations/ecma-bigint.h @@ -36,7 +36,7 @@ typedef enum * return with ECMA_VALUE_FALSE */ ECMA_BIGINT_PARSE_DISALLOW_MEMORY_ERROR = (1 << 2), /**< don't throw out-of-memory error, * return with ECMA_VALUE_NULL instead */ - ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE = (1 << 3), /** allow parse underscore characters */ + ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE = (1 << 3), /** allow parse underscore characters */ } ecma_bigint_parse_string_options_t; /** @@ -49,8 +49,7 @@ typedef enum ECMA_BIGINT_UNARY_DECREASE, /**< decrease operation */ } ecma_bigint_unary_operation_type; -ecma_value_t ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, lit_utf8_size_t size, - uint32_t options); +ecma_value_t ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, lit_utf8_size_t size, uint32_t options); ecma_value_t ecma_bigint_parse_string_value (ecma_value_t string, uint32_t options); ecma_string_t *ecma_bigint_to_string (ecma_value_t value, ecma_bigint_digit_t radix); ecma_value_t ecma_bigint_to_bigint (ecma_value_t value, bool allow_numbers); diff --git a/jerry-core/ecma/operations/ecma-boolean-object.c b/jerry-core/ecma/operations/ecma-boolean-object.c index ec6a5c71..e33299c6 100644 --- a/jerry-core/ecma/operations/ecma-boolean-object.c +++ b/jerry-core/ecma/operations/ecma-boolean-object.c @@ -13,17 +13,19 @@ * limitations under the License. */ -#include "jcontext.h" -#include "ecma-alloc.h" #include "ecma-boolean-object.h" + +#include "ecma-alloc.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" -#include "ecma-function-object.h" +#include "ecma-objects.h" + +#include "jcontext.h" /** \addtogroup ecma ECMA * @{ @@ -66,9 +68,8 @@ ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boo } } #endif /* JERRY_ESNEXT */ - ecma_object_t *object_p = ecma_create_object (prototype_obj_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = + ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p; ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BOOLEAN; diff --git a/jerry-core/ecma/operations/ecma-comparison.c b/jerry-core/ecma/operations/ecma-comparison.c index 5e1f22b9..68135fa2 100644 --- a/jerry-core/ecma/operations/ecma-comparison.c +++ b/jerry-core/ecma/operations/ecma-comparison.c @@ -13,11 +13,13 @@ * limitations under the License. */ -#include "ecma-bigint.h" #include "ecma-comparison.h" + +#include "ecma-bigint.h" #include "ecma-conversion.h" #include "ecma-globals.h" #include "ecma-objects.h" + #include "jrt.h" /** \addtogroup ecma ECMA @@ -68,14 +70,11 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ #ifndef JERRY_NDEBUG bool is_x_equal_to_y_check; - if (ecma_number_is_nan (x_num) - || ecma_number_is_nan (y_num)) + if (ecma_number_is_nan (x_num) || ecma_number_is_nan (y_num)) { is_x_equal_to_y_check = false; } - else if (x_num == y_num - || (ecma_number_is_zero (x_num) - && ecma_number_is_zero (y_num))) + else if (x_num == y_num || (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num))) { is_x_equal_to_y_check = true; } @@ -163,8 +162,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ { ecma_value_t bigint = ecma_bigint_parse_string_value (y, ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR); - if (ECMA_IS_VALUE_ERROR (bigint) - || bigint == ECMA_VALUE_FALSE) + if (ECMA_IS_VALUE_ERROR (bigint) || bigint == ECMA_VALUE_FALSE) { return bigint; } @@ -189,8 +187,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */ } #endif /* JERRY_BUILTIN_BIGINT */ - if (ecma_is_value_undefined (x) - || ecma_is_value_null (x)) + if (ecma_is_value_undefined (x) || ecma_is_value_null (x)) { /* 1. a., b. */ /* 2., 3. */ @@ -257,26 +254,17 @@ 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 (ecma_is_value_direct (x) || ecma_is_value_direct (y) #if JERRY_ESNEXT - || ecma_is_value_symbol (x) - || ecma_is_value_symbol (y) + || ecma_is_value_symbol (x) || ecma_is_value_symbol (y) #endif /* JERRY_ESNEXT */ - || ecma_is_value_object (x) - || ecma_is_value_object (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) - || ecma_is_value_boolean (x) - || ecma_is_value_integer_number (x)); - - JERRY_ASSERT (!ecma_is_value_direct (y) - || ecma_is_value_undefined (y) - || ecma_is_value_null (y) - || ecma_is_value_boolean (y) - || ecma_is_value_integer_number (y)); + JERRY_ASSERT (!ecma_is_value_direct (x) || ecma_is_value_undefined (x) || ecma_is_value_null (x) + || ecma_is_value_boolean (x) || ecma_is_value_integer_number (x)); + + JERRY_ASSERT (!ecma_is_value_direct (y) || ecma_is_value_undefined (y) || ecma_is_value_null (y) + || ecma_is_value_boolean (y) || ecma_is_value_integer_number (y)); if ((x != ecma_make_integer_value (0) || !ecma_is_value_float_number (y)) && (y != ecma_make_integer_value (0) || !ecma_is_value_float_number (x))) @@ -287,10 +275,8 @@ ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */ /* The +0 === -0 case handled below. */ } - JERRY_ASSERT (ecma_is_value_number (x) || ecma_is_value_string (x) || - ecma_is_value_bigint (x)); - JERRY_ASSERT (ecma_is_value_number (y) || ecma_is_value_string (y) || - ecma_is_value_bigint (y)); + JERRY_ASSERT (ecma_is_value_number (x) || ecma_is_value_string (x) || ecma_is_value_bigint (x)); + JERRY_ASSERT (ecma_is_value_number (y) || ecma_is_value_string (y) || ecma_is_value_bigint (y)); if (ecma_is_value_string (x)) { @@ -330,14 +316,11 @@ ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */ #ifndef JERRY_NDEBUG bool is_x_equal_to_y_check; - if (ecma_number_is_nan (x_num) - || ecma_number_is_nan (y_num)) + if (ecma_number_is_nan (x_num) || ecma_number_is_nan (y_num)) { is_x_equal_to_y_check = false; } - else if (x_num == y_num - || (ecma_number_is_zero (x_num) - && ecma_number_is_zero (y_num))) + else if (x_num == y_num || (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num))) { is_x_equal_to_y_check = true; } @@ -390,8 +373,7 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */ if (!(is_px_string && is_py_string)) { #if JERRY_BUILTIN_BIGINT - if (JERRY_LIKELY (!ecma_is_value_bigint (px)) - && JERRY_LIKELY (!ecma_is_value_bigint (py))) + if (JERRY_LIKELY (!ecma_is_value_bigint (px)) && JERRY_LIKELY (!ecma_is_value_bigint (py))) { #endif /* JERRY_BUILTIN_BIGINT */ /* 3. */ @@ -401,16 +383,14 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */ ecma_number_t nx; ecma_number_t ny; - if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (px, &nx)) - || ECMA_IS_VALUE_ERROR (ecma_op_to_number (py, &ny))) + if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (px, &nx)) || ECMA_IS_VALUE_ERROR (ecma_op_to_number (py, &ny))) { ret_value = ECMA_VALUE_ERROR; goto end; } /* b. */ - if (ecma_number_is_nan (nx) - || ecma_number_is_nan (ny)) + if (ecma_number_is_nan (nx) || ecma_number_is_nan (ny)) { /* c., d. */ ret_value = ECMA_VALUE_UNDEFINED; @@ -422,33 +402,27 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */ #ifndef JERRY_NDEBUG bool is_x_less_than_y_check; - if (nx == ny - || (ecma_number_is_zero (nx) - && ecma_number_is_zero (ny))) + if (nx == ny || (ecma_number_is_zero (nx) && ecma_number_is_zero (ny))) { /* e., f., g. */ is_x_less_than_y_check = false; } - else if (ecma_number_is_infinity (nx) - && !ecma_number_is_negative (nx)) + else if (ecma_number_is_infinity (nx) && !ecma_number_is_negative (nx)) { /* h. */ is_x_less_than_y_check = false; } - else if (ecma_number_is_infinity (ny) - && !ecma_number_is_negative (ny)) + else if (ecma_number_is_infinity (ny) && !ecma_number_is_negative (ny)) { /* i. */ is_x_less_than_y_check = true; } - else if (ecma_number_is_infinity (ny) - && ecma_number_is_negative (ny)) + else if (ecma_number_is_infinity (ny) && ecma_number_is_negative (ny)) { /* j. */ is_x_less_than_y_check = false; } - else if (ecma_number_is_infinity (nx) - && ecma_number_is_negative (nx)) + else if (ecma_number_is_infinity (nx) && ecma_number_is_negative (nx)) { /* k. */ is_x_less_than_y_check = true; @@ -456,12 +430,9 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */ else { /* l. */ - JERRY_ASSERT (!ecma_number_is_nan (nx) - && !ecma_number_is_infinity (nx)); - JERRY_ASSERT (!ecma_number_is_nan (ny) - && !ecma_number_is_infinity (ny)); - JERRY_ASSERT (!(ecma_number_is_zero (nx) - && ecma_number_is_zero (ny))); + JERRY_ASSERT (!ecma_number_is_nan (nx) && !ecma_number_is_infinity (nx)); + JERRY_ASSERT (!ecma_number_is_nan (ny) && !ecma_number_is_infinity (ny)); + JERRY_ASSERT (!(ecma_number_is_zero (nx) && ecma_number_is_zero (ny))); if (nx < ny) { diff --git a/jerry-core/ecma/operations/ecma-container-object.c b/jerry-core/ecma/operations/ecma-container-object.c index 8bbe8466..e0491041 100644 --- a/jerry-core/ecma/operations/ecma-container-object.c +++ b/jerry-core/ecma/operations/ecma-container-object.c @@ -12,19 +12,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "jcontext.h" +#include "ecma-container-object.h" + #include "ecma-alloc.h" #include "ecma-array-object.h" -#include "ecma-builtins.h" #include "ecma-builtin-helpers.h" +#include "ecma-builtins.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-helpers.h" #include "ecma-iterator-object.h" -#include "ecma-container-object.h" -#include "ecma-property-hashmap.h" #include "ecma-objects.h" +#include "ecma-property-hashmap.h" + +#include "jcontext.h" #if JERRY_BUILTIN_CONTAINER @@ -307,8 +309,7 @@ ecma_op_container_free_entries (ecma_object_t *object_p) /**< collection object JERRY_ASSERT (object_p != NULL); ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p; - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); switch (map_object_p->u.cls.u2.container_id) { @@ -353,10 +354,8 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l ecma_builtin_id_t proto_id) /**< prototype builtin id */ { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - JERRY_ASSERT (lit_id == LIT_MAGIC_STRING_MAP_UL - || lit_id == LIT_MAGIC_STRING_SET_UL - || lit_id == LIT_MAGIC_STRING_WEAKMAP_UL - || lit_id == LIT_MAGIC_STRING_WEAKSET_UL); + JERRY_ASSERT (lit_id == LIT_MAGIC_STRING_MAP_UL || lit_id == LIT_MAGIC_STRING_SET_UL + || lit_id == LIT_MAGIC_STRING_WEAKMAP_UL || lit_id == LIT_MAGIC_STRING_WEAKSET_UL); JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL); ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), proto_id); @@ -367,9 +366,7 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l } ecma_collection_t *container_p = ecma_op_create_internal_buffer (); - ecma_object_t *object_p = ecma_create_object (proto_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_deref_object (proto_p); ecma_extended_object_t *map_obj_p = (ecma_extended_object_t *) object_p; map_obj_p->u.cls.type = ECMA_OBJECT_CLASS_CONTAINER; @@ -577,8 +574,7 @@ ecma_op_container_get_object (ecma_value_t this_arg, /**< this argument */ ecma_value_t ecma_op_container_size (ecma_extended_object_t *map_object_p) /**< internal class id */ { - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); return ecma_make_uint32_value (ECMA_CONTAINER_GET_SIZE (container_p)); } /* ecma_op_container_size */ @@ -599,8 +595,7 @@ ecma_op_container_get (ecma_extended_object_t *map_object_p, /**< map object */ return ECMA_VALUE_UNDEFINED; } - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); if (ECMA_CONTAINER_GET_SIZE (container_p) == 0) { @@ -628,11 +623,9 @@ ecma_op_container_has (ecma_extended_object_t *map_object_p, /**< map object */ ecma_value_t key_arg, /**< key argument */ lit_magic_string_id_t lit_id) /**< internal class id */ { - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); - if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0 - && !ecma_is_value_object (key_arg)) + if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0 && !ecma_is_value_object (key_arg)) { return ECMA_VALUE_FALSE; } @@ -684,11 +677,9 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */ ecma_value_t value_arg, /**< value argument */ lit_magic_string_id_t lit_id) /**< internal class id */ { - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); - if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0 - && !ecma_is_value_object (key_arg)) + if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0 && !ecma_is_value_object (key_arg)) { return ecma_raise_type_error (ECMA_ERR_MSG ("Key must be an object")); } @@ -697,10 +688,7 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */ if (entry_p == NULL) { - ecma_op_internal_buffer_append (container_p, - ecma_op_container_set_noramlize_zero (key_arg), - value_arg, - lit_id); + ecma_op_internal_buffer_append (container_p, ecma_op_container_set_noramlize_zero (key_arg), value_arg, lit_id); if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0) { @@ -739,8 +727,7 @@ ecma_op_container_foreach (ecma_extended_object_t *map_object_p, /**< map object ecma_object_t *func_object_p = ecma_get_object_from_value (predicate); ecma_value_t ret_value = ECMA_VALUE_UNDEFINED; - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); uint8_t entry_size = ecma_op_container_entry_size (lit_id); @@ -781,7 +768,6 @@ ecma_op_container_foreach (ecma_extended_object_t *map_object_p, /**< map object ecma_value_t ecma_op_container_clear (ecma_extended_object_t *map_object_p) /**< this argument */ { - ecma_op_container_free_entries ((ecma_object_t *) map_object_p); return ECMA_VALUE_UNDEFINED; @@ -798,8 +784,7 @@ ecma_op_container_delete (ecma_extended_object_t *map_object_p, /**< map object ecma_value_t key_arg, /**< key argument */ lit_magic_string_id_t lit_id) /**< internal class id */ { - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id); @@ -828,8 +813,7 @@ ecma_op_container_delete_weak (ecma_extended_object_t *map_object_p, /**< map ob return ECMA_VALUE_FALSE; } - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id); @@ -860,8 +844,7 @@ ecma_op_container_find_weak_value (ecma_object_t *object_p, /**< internal contai JERRY_ASSERT (map_object_p->u.cls.type == ECMA_OBJECT_CLASS_CONTAINER && map_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKMAP_UL); - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, map_object_p->u.cls.u2.container_id); @@ -883,8 +866,7 @@ ecma_op_container_remove_weak_entry (ecma_object_t *object_p, /**< internal cont && (map_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKSET_UL || map_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKMAP_UL)); - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, map_object_p->u.cls.u2.container_id); @@ -914,10 +896,7 @@ ecma_op_container_create_iterator (ecma_value_t this_arg, /**< this argument */ ecma_object_class_type_t iterator_type, /**< iterator type */ ecma_iterator_kind_t kind) /**< iterator kind */ { - return ecma_op_create_iterator_object (this_arg, - ecma_builtin_get (proto_id), - iterator_type, - kind); + return ecma_op_create_iterator_object (this_arg, ecma_builtin_get (proto_id), iterator_type, kind); } /* ecma_op_container_create_iterator */ /** @@ -926,7 +905,7 @@ ecma_op_container_create_iterator (ecma_value_t this_arg, /**< this argument */ * @return index of the iterator. */ static uint32_t -ecma_op_iterator_get_index (ecma_object_t *iter_obj_p) /**< iterator object pointer */ +ecma_op_iterator_get_index (ecma_object_t *iter_obj_p) /**< iterator object pointer */ { uint32_t index = ((ecma_extended_object_t *) iter_obj_p)->u.cls.u2.iterator_index; @@ -1014,8 +993,7 @@ ecma_op_container_iterator_next (ecma_value_t this_val, /**< this argument */ ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) (ecma_get_object_from_value (iterated_value)); lit_magic_string_id_t lit_id = map_object_p->u.cls.u2.container_id; - ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - map_object_p->u.cls.u3.value); + ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value); uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p); uint32_t index = ecma_op_iterator_get_index (obj_p); @@ -1150,10 +1128,7 @@ ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id, /**< built ecma_iterator_kind_t kind = (ecma_iterator_kind_t) (builtin_routine_id - ECMA_CONTAINER_ROUTINE_KEYS); - return ecma_op_container_create_iterator (this_arg, - builtin_iterator_prototype, - iterator_type, - kind); + return ecma_op_container_create_iterator (this_arg, builtin_iterator_prototype, iterator_type, kind); } default: { diff --git a/jerry-core/ecma/operations/ecma-container-object.h b/jerry-core/ecma/operations/ecma-container-object.h index 9e538f71..92fc6eb2 100644 --- a/jerry-core/ecma/operations/ecma-container-object.h +++ b/jerry-core/ecma/operations/ecma-container-object.h @@ -16,8 +16,8 @@ #ifndef ECMA_CONTAINER_OBJECT_H #define ECMA_CONTAINER_OBJECT_H -#include "ecma-globals.h" #include "ecma-builtins.h" +#include "ecma-globals.h" #if JERRY_BUILTIN_CONTAINER @@ -51,21 +51,28 @@ enum uint8_t ecma_op_container_entry_size (lit_magic_string_id_t lit_id); ecma_extended_object_t *ecma_op_container_get_object (ecma_value_t this_arg, lit_magic_string_id_t lit_id); -ecma_value_t ecma_op_container_create (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len, - lit_magic_string_id_t lit_id, ecma_builtin_id_t proto_id); +ecma_value_t ecma_op_container_create (const ecma_value_t *arguments_list_p, + uint32_t arguments_list_len, + lit_magic_string_id_t lit_id, + ecma_builtin_id_t proto_id); ecma_value_t ecma_op_container_size (ecma_extended_object_t *map_object_p); -ecma_value_t ecma_op_container_get (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, - lit_magic_string_id_t lit_id); -ecma_value_t ecma_op_container_foreach (ecma_extended_object_t *map_object_p, ecma_value_t predicate, - ecma_value_t predicate_this_arg, lit_magic_string_id_t lit_id); -ecma_value_t ecma_op_container_has (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, +ecma_value_t +ecma_op_container_get (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, lit_magic_string_id_t lit_id); +ecma_value_t ecma_op_container_foreach (ecma_extended_object_t *map_object_p, + ecma_value_t predicate, + ecma_value_t predicate_this_arg, + lit_magic_string_id_t lit_id); +ecma_value_t +ecma_op_container_has (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, lit_magic_string_id_t lit_id); +ecma_value_t ecma_op_container_set (ecma_extended_object_t *map_object_p, + ecma_value_t key_arg, + ecma_value_t value_arg, lit_magic_string_id_t lit_id); -ecma_value_t ecma_op_container_set (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, - ecma_value_t value_arg, lit_magic_string_id_t lit_id); ecma_value_t ecma_op_container_clear (ecma_extended_object_t *map_object_p); -ecma_value_t ecma_op_container_delete (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, - lit_magic_string_id_t lit_id); -ecma_value_t ecma_op_container_delete_weak (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, +ecma_value_t +ecma_op_container_delete (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, lit_magic_string_id_t lit_id); +ecma_value_t ecma_op_container_delete_weak (ecma_extended_object_t *map_object_p, + ecma_value_t key_arg, lit_magic_string_id_t lit_id); ecma_value_t ecma_op_container_find_weak_value (ecma_object_t *object_p, ecma_value_t key_arg); void ecma_op_container_remove_weak_entry (ecma_object_t *object_p, ecma_value_t key_arg); @@ -75,7 +82,8 @@ ecma_value_t ecma_op_container_create_iterator (ecma_value_t this_arg, ecma_object_class_type_t iterator_type, ecma_iterator_kind_t kind); ecma_value_t ecma_op_container_iterator_next (ecma_value_t this_val, ecma_object_class_type_t iterator_type); -ecma_value_t ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id, ecma_value_t this_arg, +ecma_value_t ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id, + ecma_value_t this_arg, const ecma_value_t arguments_list_p[], lit_magic_string_id_t lit_id); diff --git a/jerry-core/ecma/operations/ecma-conversion.c b/jerry-core/ecma/operations/ecma-conversion.c index a217d30f..8cc82e08 100644 --- a/jerry-core/ecma/operations/ecma-conversion.c +++ b/jerry-core/ecma/operations/ecma-conversion.c @@ -17,23 +17,25 @@ * Implementation of ECMA-defined conversion routines */ +#include "ecma-conversion.h" + #include <math.h> #include "ecma-alloc.h" -#include "ecma-bigint.h" #include "ecma-bigint-object.h" +#include "ecma-bigint.h" #include "ecma-boolean-object.h" -#include "ecma-conversion.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-number-object.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" +#include "ecma-objects.h" #include "ecma-string-object.h" #include "ecma-symbol-object.h" + #include "jrt-libc-includes.h" /** \addtogroup ecma ECMA @@ -86,8 +88,7 @@ ecma_op_same_value (ecma_value_t x, /**< ecma value */ ecma_type_t type_of_x = ecma_get_value_type_field (x); - if (type_of_x != ecma_get_value_type_field (y) - || type_of_x == ECMA_TYPE_DIRECT) + if (type_of_x != ecma_get_value_type_field (y) || type_of_x == ECMA_TYPE_DIRECT) { return false; } @@ -105,8 +106,7 @@ ecma_op_same_value (ecma_value_t x, /**< ecma value */ return is_x_nan && is_y_nan; } - if (ecma_number_is_zero (x_num) - && ecma_number_is_zero (y_num) + if (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num) && ecma_number_is_negative (x_num) != ecma_number_is_negative (y_num)) { return false; @@ -158,9 +158,7 @@ ecma_op_same_value_zero (ecma_value_t x, /**< ecma value */ bool is_x_nan = ecma_number_is_nan (x_num); bool is_y_nan = ecma_number_is_nan (y_num); - if (strict_equality - && is_x_nan - && is_y_nan) + if (strict_equality && is_x_nan && is_y_nan) { return false; } @@ -170,8 +168,7 @@ ecma_op_same_value_zero (ecma_value_t x, /**< ecma value */ return (is_x_nan && is_y_nan); } - if (ecma_number_is_zero (x_num) - && ecma_number_is_zero (y_num) + if (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num) && ecma_number_is_negative (x_num) != ecma_number_is_negative (y_num)) { return true; @@ -227,9 +224,7 @@ ecma_op_to_boolean (ecma_value_t value) /**< ecma value */ if (ecma_is_value_simple (value)) { - JERRY_ASSERT (ecma_is_value_boolean (value) - || ecma_is_value_undefined (value) - || ecma_is_value_null (value)); + JERRY_ASSERT (ecma_is_value_boolean (value) || ecma_is_value_undefined (value) || ecma_is_value_null (value)); return ecma_is_value_true (value); } @@ -537,7 +532,7 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */ if (ecma_is_value_number (value)) { #if JERRY_BUILTIN_NUMBER - proto_id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE; + proto_id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE; #endif /* JERRY_BUILTIN_NUMBER */ class_type = ECMA_OBJECT_CLASS_NUMBER; } @@ -567,8 +562,7 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */ #endif /* JERRY_BUILTIN_BIGINT */ else { - if (ecma_is_value_undefined (value) - || ecma_is_value_null (value)) + if (ecma_is_value_undefined (value) || ecma_is_value_null (value)) { return ecma_raise_type_error (ECMA_ERR_MSG ("Argument cannot be converted to an object")); } @@ -582,9 +576,8 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */ } } - ecma_object_t *object_p = ecma_create_object (ecma_builtin_get (proto_id), - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = + ecma_create_object (ecma_builtin_get (proto_id), sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p; ext_object_p->u.cls.type = class_type; @@ -610,35 +603,28 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des ecma_value_t completion; ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor (); { - prop_desc.flags = (JERRY_PROP_IS_VALUE_DEFINED - | JERRY_PROP_IS_WRITABLE_DEFINED - | JERRY_PROP_IS_WRITABLE - | JERRY_PROP_IS_ENUMERABLE_DEFINED - | JERRY_PROP_IS_ENUMERABLE - | JERRY_PROP_IS_CONFIGURABLE_DEFINED - | JERRY_PROP_IS_CONFIGURABLE); + prop_desc.flags = (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE + | JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE + | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE); } /* 3. */ if (src_prop_desc_p->flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED)) { JERRY_ASSERT ((prop_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED)) - == (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED)); + == (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED)); /* a. */ prop_desc.value = src_prop_desc_p->value; - completion = ecma_op_object_define_own_property (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_VALUE), - &prop_desc); + completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_VALUE), &prop_desc); JERRY_ASSERT (ecma_is_value_true (completion)); /* b. */ prop_desc.value = ecma_make_boolean_value (src_prop_desc_p->flags & JERRY_PROP_IS_WRITABLE); - completion = ecma_op_object_define_own_property (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE), - &prop_desc); + completion = + 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 @@ -659,9 +645,7 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des 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); + 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. */ @@ -674,25 +658,21 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des 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); + 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); - completion = ecma_op_object_define_own_property (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE), - &prop_desc); + completion = + ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE), &prop_desc); JERRY_ASSERT (ecma_is_value_true (completion)); prop_desc.value = ecma_make_boolean_value (src_prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE); - completion = ecma_op_object_define_own_property (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE), - &prop_desc); + completion = + ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE), &prop_desc); JERRY_ASSERT (ecma_is_value_true (completion)); return obj_p; @@ -722,8 +702,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ ecma_value_t ret_value = ECMA_VALUE_ERROR; /* 3. */ - ecma_value_t enumerable_prop_value = ecma_op_object_find (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE)); + ecma_value_t enumerable_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE)); if (ECMA_IS_VALUE_ERROR (enumerable_prop_value)) { @@ -735,8 +714,8 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ if (ecma_is_value_found (enumerable_prop_value)) { - uint32_t is_enumerable = (ecma_op_to_boolean (enumerable_prop_value) ? JERRY_PROP_IS_ENUMERABLE - : JERRY_PROP_NO_OPTS); + uint32_t is_enumerable = + (ecma_op_to_boolean (enumerable_prop_value) ? JERRY_PROP_IS_ENUMERABLE : JERRY_PROP_NO_OPTS); prop_desc.flags |= (uint16_t) (JERRY_PROP_IS_ENUMERABLE_DEFINED | is_enumerable); @@ -744,8 +723,8 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ } /* 4. */ - ecma_value_t configurable_prop_value = ecma_op_object_find (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE)); + ecma_value_t configurable_prop_value = + ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE)); if (ECMA_IS_VALUE_ERROR (configurable_prop_value)) { @@ -754,8 +733,8 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ if (ecma_is_value_found (configurable_prop_value)) { - uint32_t is_configurable = (ecma_op_to_boolean (configurable_prop_value) ? JERRY_PROP_IS_CONFIGURABLE - : JERRY_PROP_NO_OPTS); + uint32_t is_configurable = + (ecma_op_to_boolean (configurable_prop_value) ? JERRY_PROP_IS_CONFIGURABLE : JERRY_PROP_NO_OPTS); prop_desc.flags |= (uint16_t) (JERRY_PROP_IS_CONFIGURABLE_DEFINED | is_configurable); @@ -763,8 +742,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ } /* 5. */ - ecma_value_t value_prop_value = ecma_op_object_find (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_VALUE)); + ecma_value_t value_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_VALUE)); if (ECMA_IS_VALUE_ERROR (value_prop_value)) { @@ -779,8 +757,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ } /* 6. */ - ecma_value_t writable_prop_value = ecma_op_object_find (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE)); + ecma_value_t writable_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE)); if (ECMA_IS_VALUE_ERROR (writable_prop_value)) { @@ -789,8 +766,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ if (ecma_is_value_found (writable_prop_value)) { - uint32_t is_writable = (ecma_op_to_boolean (writable_prop_value) ? JERRY_PROP_IS_WRITABLE - : JERRY_PROP_NO_OPTS); + uint32_t is_writable = (ecma_op_to_boolean (writable_prop_value) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS); prop_desc.flags |= (uint16_t) (JERRY_PROP_IS_WRITABLE_DEFINED | is_writable); @@ -798,8 +774,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ } /* 7. */ - ecma_value_t get_prop_value = ecma_op_object_find (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_GET)); + ecma_value_t get_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_GET)); if (ECMA_IS_VALUE_ERROR (get_prop_value)) { @@ -808,8 +783,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ if (ecma_is_value_found (get_prop_value)) { - if (!ecma_op_is_callable (get_prop_value) - && !ecma_is_value_undefined (get_prop_value)) + if (!ecma_op_is_callable (get_prop_value) && !ecma_is_value_undefined (get_prop_value)) { ecma_free_value (get_prop_value); ret_value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function)); @@ -836,8 +810,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ } /* 8. */ - ecma_value_t set_prop_value = ecma_op_object_find (obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_SET)); + ecma_value_t set_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_SET)); if (ECMA_IS_VALUE_ERROR (set_prop_value)) { @@ -846,8 +819,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ if (ecma_is_value_found (set_prop_value)) { - if (!ecma_op_is_callable (set_prop_value) - && !ecma_is_value_undefined (set_prop_value)) + if (!ecma_op_is_callable (set_prop_value) && !ecma_is_value_undefined (set_prop_value)) { ecma_free_value (set_prop_value); ret_value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function)); @@ -875,7 +847,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ /* 9. */ if ((prop_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED)) - && (prop_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))) + && (prop_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))) { ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Accessors cannot be writable")); } @@ -907,7 +879,6 @@ free_desc: bool ecma_op_is_integer (ecma_number_t num) /**< ecma number */ { - if (ecma_number_is_nan (num) || ecma_number_is_infinity (num)) { return false; @@ -917,7 +888,8 @@ ecma_op_is_integer (ecma_number_t num) /**< ecma number */ ecma_number_t fabs_value = (ecma_number_t) fabs (num); return (floor_fabs == fabs_value); -} /* ecma_op_is_integer*/ +} /* ecma_op_is_integer */ + /** * ToInteger operation. * @@ -1082,7 +1054,7 @@ ecma_op_to_index (ecma_value_t value, /**< ecma value */ * NULL otherwise */ ecma_collection_t * -ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */ +ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */ bool prop_names_only) /**< true - accept only property names false - otherwise */ { @@ -1117,8 +1089,7 @@ ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */ return NULL; } - if (prop_names_only - && !ecma_is_value_prop_name (next)) + if (prop_names_only && !ecma_is_value_prop_name (next)) { ecma_free_value (next); ecma_collection_free (list_ptr); diff --git a/jerry-core/ecma/operations/ecma-conversion.h b/jerry-core/ecma/operations/ecma-conversion.h index 31c58eae..559b8552 100644 --- a/jerry-core/ecma/operations/ecma-conversion.h +++ b/jerry-core/ecma/operations/ecma-conversion.h @@ -16,9 +16,9 @@ #ifndef ECMA_CONVERSION_H #define ECMA_CONVERSION_H +#include "ecma-builtins.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-builtins.h" /** \addtogroup ecma ECMA * @{ diff --git a/jerry-core/ecma/operations/ecma-dataview-object.c b/jerry-core/ecma/operations/ecma-dataview-object.c index 8ef71c1f..06741073 100644 --- a/jerry-core/ecma/operations/ecma-dataview-object.c +++ b/jerry-core/ecma/operations/ecma-dataview-object.c @@ -13,18 +13,20 @@ * limitations under the License. */ -#include "jcontext.h" -#include "ecma-function-object.h" +#include "ecma-dataview-object.h" + #include "ecma-arraybuffer-object.h" -#include "ecma-shared-arraybuffer-object.h" #include "ecma-bigint.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-helpers.h" -#include "ecma-dataview-object.h" -#include "ecma-typedarray-object.h" #include "ecma-objects.h" +#include "ecma-shared-arraybuffer-object.h" +#include "ecma-typedarray-object.h" + +#include "jcontext.h" #if JERRY_BUILTIN_DATAVIEW @@ -123,8 +125,8 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li } /* 9. */ - ecma_object_t *prototype_obj_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), - ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE); + ecma_object_t *prototype_obj_p = + ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE); if (JERRY_UNLIKELY (prototype_obj_p == NULL)) { return ECMA_VALUE_ERROR; @@ -139,9 +141,8 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li /* 9. */ /* It must happen after 10., because uninitialized object can't be destroyed properly. */ - ecma_object_t *object_p = ecma_create_object (prototype_obj_p, - sizeof (ecma_dataview_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = + ecma_create_object (prototype_obj_p, sizeof (ecma_dataview_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_deref_object (prototype_obj_p); @@ -223,7 +224,7 @@ ecma_dataview_swap_order (bool system_is_little_endian, /**< true - if the syste for (uint32_t i = 0; i < element_size / 2; i++) { lit_utf8_byte_t tmp = block_p[i]; - block_p[i] = block_p[element_size - i - 1]; + block_p[i] = block_p[element_size - i - 1]; block_p[element_size - i - 1] = tmp; } } diff --git a/jerry-core/ecma/operations/ecma-dataview-object.h b/jerry-core/ecma/operations/ecma-dataview-object.h index cac99a25..1d56c9be 100644 --- a/jerry-core/ecma/operations/ecma-dataview-object.h +++ b/jerry-core/ecma/operations/ecma-dataview-object.h @@ -29,8 +29,10 @@ ecma_value_t ecma_op_dataview_create (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len); ecma_dataview_object_t *ecma_op_dataview_get_object (ecma_value_t this_arg); -ecma_value_t ecma_op_dataview_get_set_view_value (ecma_value_t view, ecma_value_t request_index, - ecma_value_t little_endian, ecma_value_t value_to_set, +ecma_value_t ecma_op_dataview_get_set_view_value (ecma_value_t view, + ecma_value_t request_index, + ecma_value_t little_endian, + ecma_value_t value_to_set, ecma_typedarray_type_t id); bool ecma_is_dataview (ecma_value_t value); diff --git a/jerry-core/ecma/operations/ecma-eval.c b/jerry-core/ecma/operations/ecma-eval.c index c64ccb4b..d28a0d53 100644 --- a/jerry-core/ecma/operations/ecma-eval.c +++ b/jerry-core/ecma/operations/ecma-eval.c @@ -13,16 +13,18 @@ * limitations under the License. */ +#include "ecma-eval.h" + #include "ecma-builtins.h" #include "ecma-exceptions.h" -#include "ecma-eval.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-lex-env.h" + +#include "jcontext.h" #include "js-parser.h" #include "vm.h" -#include "jcontext.h" /** \addtogroup ecma ECMA * @{ @@ -51,8 +53,7 @@ ecma_op_eval (ecma_value_t source_code, /**< source code */ return ECMA_VALUE_UNDEFINED; } - return ecma_op_eval_chars_buffer ((void *) &source_code, - parse_opts | ECMA_PARSE_HAS_SOURCE_VALUE); + return ecma_op_eval_chars_buffer ((void *) &source_code, parse_opts | ECMA_PARSE_HAS_SOURCE_VALUE); } /* ecma_op_eval */ /** diff --git a/jerry-core/ecma/operations/ecma-eval.h b/jerry-core/ecma/operations/ecma-eval.h index fad3b02d..c06ad5d5 100644 --- a/jerry-core/ecma/operations/ecma-eval.h +++ b/jerry-core/ecma/operations/ecma-eval.h @@ -25,11 +25,9 @@ * @{ */ -ecma_value_t -ecma_op_eval (ecma_value_t source_code, uint32_t parse_opts); +ecma_value_t ecma_op_eval (ecma_value_t source_code, uint32_t parse_opts); -ecma_value_t -ecma_op_eval_chars_buffer (void *source_p, uint32_t parse_opts); +ecma_value_t ecma_op_eval_chars_buffer (void *source_p, uint32_t parse_opts); /** * @} diff --git a/jerry-core/ecma/operations/ecma-exceptions.c b/jerry-core/ecma/operations/ecma-exceptions.c index 8afb5d8e..3c24240f 100644 --- a/jerry-core/ecma/operations/ecma-exceptions.c +++ b/jerry-core/ecma/operations/ecma-exceptions.c @@ -13,17 +13,20 @@ * limitations under the License. */ +#include "ecma-exceptions.h" + #include <stdarg.h> + +#include "ecma-array-object.h" #include "ecma-builtins.h" #include "ecma-conversion.h" -#include "ecma-exceptions.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" +#include "ecma-iterator-object.h" #include "ecma-objects.h" #include "ecma-symbol-object.h" -#include "ecma-iterator-object.h" -#include "ecma-array-object.h" + #include "jcontext.h" #include "jrt.h" @@ -111,16 +114,15 @@ ecma_new_standard_error (jerry_error_t error_type, /**< native error type */ break; } } -#else +#else /* !JERRY_BUILTIN_ERRORS */ JERRY_UNUSED (error_type); ecma_builtin_id_t prototype_id = ECMA_BUILTIN_ID_ERROR_PROTOTYPE; #endif /* JERRY_BUILTIN_ERRORS */ ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id); - ecma_object_t *error_object_p = ecma_create_object (prototype_obj_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *error_object_p = + ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_extended_object_t *extended_object_p = (ecma_extended_object_t *) error_object_p; extended_object_p->u.cls.type = ECMA_OBJECT_CLASS_ERROR; @@ -143,8 +145,8 @@ ecma_new_standard_error (jerry_error_t error_type, /**< native error type */ && !(JERRY_CONTEXT (status_flags) & ECMA_STATUS_ERROR_UPDATE)) { JERRY_CONTEXT (status_flags) |= ECMA_STATUS_ERROR_UPDATE; - JERRY_CONTEXT (error_object_created_callback_p) (ecma_make_object_value (error_object_p), - JERRY_CONTEXT (error_object_created_callback_user_p)); + JERRY_CONTEXT (error_object_created_callback_p) + (ecma_make_object_value (error_object_p), JERRY_CONTEXT (error_object_created_callback_user_p)); JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_ERROR_UPDATE; } else @@ -153,10 +155,8 @@ ecma_new_standard_error (jerry_error_t error_type, /**< native error type */ /* Default decorator when line info is enabled. */ ecma_string_t *stack_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_STACK); - ecma_property_value_t *prop_value_p = ecma_create_named_data_property (error_object_p, - stack_str_p, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE, - NULL); + ecma_property_value_t *prop_value_p = + ecma_create_named_data_property (error_object_p, stack_str_p, ECMA_PROPERTY_CONFIGURABLE_WRITABLE, NULL); ecma_deref_ecma_string (stack_str_p); ecma_value_t backtrace_value = vm_get_backtrace (0); @@ -306,8 +306,7 @@ ecma_raise_standard_error (jerry_error_t error_type, /**< error type */ if (msg_p != NULL) { - ecma_string_t *error_msg_p = ecma_new_ecma_string_from_utf8 (msg_p, - lit_zt_utf8_string_size (msg_p)); + ecma_string_t *error_msg_p = ecma_new_ecma_string_from_utf8 (msg_p, lit_zt_utf8_string_size (msg_p)); error_obj_p = ecma_new_standard_error (error_type, error_msg_p); ecma_deref_ecma_string (error_msg_p); } @@ -465,7 +464,7 @@ ecma_raise_syntax_error (const char *msg_p) /**< error message */ /** * Raise a TypeError with the given message. * -* See also: ECMA-262 v5, 15.11.6.5 + * See also: ECMA-262 v5, 15.11.6.5 * * @return ecma value * Returned value must be freed with ecma_free_value @@ -479,7 +478,7 @@ ecma_raise_type_error (const char *msg_p) /**< error message */ /** * Raise a URIError with the given message. * -* See also: ECMA-262 v5, 15.11.6.6 + * See also: ECMA-262 v5, 15.11.6.6 * * @return ecma value * Returned value must be freed with ecma_free_value diff --git a/jerry-core/ecma/operations/ecma-exceptions.h b/jerry-core/ecma/operations/ecma-exceptions.h index b23281ef..f8e525e3 100644 --- a/jerry-core/ecma/operations/ecma-exceptions.h +++ b/jerry-core/ecma/operations/ecma-exceptions.h @@ -17,6 +17,7 @@ #define ECMA_EXCEPTIONS_H #include "ecma-globals.h" + #include "jrt.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/operations/ecma-function-object.c b/jerry-core/ecma/operations/ecma-function-object.c index 0850a417..8cbf3ce2 100644 --- a/jerry-core/ecma/operations/ecma-function-object.c +++ b/jerry-core/ecma/operations/ecma-function-object.c @@ -13,22 +13,24 @@ * limitations under the License. */ +#include "ecma-function-object.h" + #include "ecma-alloc.h" -#include "ecma-builtin-helpers.h" #include "ecma-builtin-handlers.h" +#include "ecma-builtin-helpers.h" #include "ecma-exceptions.h" #include "ecma-extended-info.h" -#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-helpers.h" -#include "ecma-promise-object.h" -#include "lit-char-helpers.h" #include "ecma-lex-env.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" +#include "ecma-objects.h" +#include "ecma-promise-object.h" #include "ecma-proxy-object.h" #include "ecma-symbol-object.h" + #include "jcontext.h" +#include "lit-char-helpers.h" #include "opcodes.h" /** \addtogroup ecma ECMA @@ -143,8 +145,7 @@ ecma_op_object_is_callable (ecma_object_t *obj_p) /**< ecma object */ bool ecma_op_is_callable (ecma_value_t value) /**< ecma value */ { - return (ecma_is_value_object (value) - && ecma_op_object_is_callable (ecma_get_object_from_value (value))); + return (ecma_is_value_object (value) && ecma_op_object_is_callable (ecma_get_object_from_value (value))); } /* ecma_op_is_callable */ /** @@ -170,8 +171,8 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */ { ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) obj_p; - obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, - bound_func_p->header.u.bound_function.target_function); + obj_p = + ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function); type = ecma_get_object_type (obj_p); } @@ -241,8 +242,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */ } #endif /* JERRY_BUILTIN_PROXY */ - JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION - || type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION + JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION || type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION || type == ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION); if (type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION) @@ -298,8 +298,7 @@ ecma_object_is_constructor (ecma_object_t *obj_p) /**< ecma object */ bool ecma_is_constructor (ecma_value_t value) /**< ecma value */ { - return (ecma_is_value_object (value) - && ecma_object_is_constructor (ecma_get_object_from_value (value))); + return (ecma_is_value_object (value) && ecma_object_is_constructor (ecma_get_object_from_value (value))); } /* ecma_is_constructor */ /** @@ -382,9 +381,7 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */ } #endif /* JERRY_SNAPSHOT_EXEC */ - ecma_object_t *func_p = ecma_create_object (prototype_obj_p, - function_object_size, - ECMA_OBJECT_TYPE_FUNCTION); + ecma_object_t *func_p = ecma_create_object (prototype_obj_p, function_object_size, ECMA_OBJECT_TYPE_FUNCTION); /* 2., 6., 7., 8. */ /* @@ -447,8 +444,8 @@ ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, /**< argu { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - ecma_string_t *arguments_str_p = ecma_op_create_dynamic_function_arguments_helper (arguments_list_p, - arguments_list_len); + ecma_string_t *arguments_str_p = + ecma_op_create_dynamic_function_arguments_helper (arguments_list_p, arguments_list_len); if (JERRY_UNLIKELY (arguments_str_p == NULL)) { @@ -637,9 +634,7 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc } #endif /* JERRY_SNAPSHOT_EXEC */ - ecma_object_t *func_p = ecma_create_object (prototype_obj_p, - arrow_function_object_size, - ECMA_OBJECT_TYPE_FUNCTION); + ecma_object_t *func_p = ecma_create_object (prototype_obj_p, arrow_function_object_size, ECMA_OBJECT_TYPE_FUNCTION); ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) func_p; @@ -686,9 +681,8 @@ ecma_op_create_external_function_object (ecma_native_handler_t handler_cb) /**< { ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE); - ecma_object_t *function_obj_p = ecma_create_object (prototype_obj_p, - sizeof (ecma_native_function_t), - ECMA_OBJECT_TYPE_NATIVE_FUNCTION); + ecma_object_t *function_obj_p = + ecma_create_object (prototype_obj_p, sizeof (ecma_native_function_t), ECMA_OBJECT_TYPE_NATIVE_FUNCTION); /* * [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_NATIVE_FUNCTION type. @@ -698,8 +692,7 @@ ecma_op_create_external_function_object (ecma_native_handler_t handler_cb) /**< ecma_native_function_t *native_function_p = (ecma_native_function_t *) function_obj_p; #if JERRY_BUILTIN_REALMS - ECMA_SET_INTERNAL_VALUE_POINTER (native_function_p->realm_value, - ecma_builtin_get_global ()); + ECMA_SET_INTERNAL_VALUE_POINTER (native_function_p->realm_value, ecma_builtin_get_global ()); #endif /* JERRY_BUILTIN_REALMS */ native_function_p->native_handler_cb = handler_cb; @@ -719,9 +712,7 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */ { ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE); - ecma_object_t *function_obj_p = ecma_create_object (prototype_obj_p, - object_size, - ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION); + ecma_object_t *function_obj_p = ecma_create_object (prototype_obj_p, object_size, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION); ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) function_obj_p; ext_func_obj_p->u.built_in.id = ECMA_BUILTIN_ID_HANDLER; @@ -729,8 +720,7 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */ ext_func_obj_p->u.built_in.u2.routine_flags = ECMA_NATIVE_HANDLER_FLAGS_NONE; #if JERRY_BUILTIN_REALMS - ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_obj_p->u.built_in.realm_value, - ecma_builtin_get_global ()); + ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_obj_p->u.built_in.realm_value, ecma_builtin_get_global ()); #endif /* JERRY_BUILTIN_REALMS */ return function_obj_p; @@ -743,20 +733,18 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */ * * @return compiled code */ -extern inline const ecma_compiled_code_t * JERRY_ATTR_ALWAYS_INLINE +extern inline const ecma_compiled_code_t *JERRY_ATTR_ALWAYS_INLINE ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< function pointer */ { #if JERRY_SNAPSHOT_EXEC if (JERRY_LIKELY (function_p->u.function.bytecode_cp != ECMA_NULL_POINTER)) { - return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t, - function_p->u.function.bytecode_cp); + return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t, function_p->u.function.bytecode_cp); } return ((ecma_static_function_t *) function_p)->bytecode_p; #else /* !JERRY_SNAPSHOT_EXEC */ - return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t, - function_p->u.function.bytecode_cp); + return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t, function_p->u.function.bytecode_cp); #endif /* JERRY_SNAPSHOT_EXEC */ } /* ecma_op_function_get_compiled_code */ @@ -770,7 +758,7 @@ ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< fun * * @return pointer to realm (global) object */ -extern inline ecma_global_object_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_global_object_t *JERRY_ATTR_ALWAYS_INLINE ecma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p) /**< byte code header */ { #if JERRY_SNAPSHOT_EXEC @@ -811,15 +799,13 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob if (type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION) { ecma_extended_object_t *ext_function_obj_p = (ecma_extended_object_t *) func_obj_p; - return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, - ext_function_obj_p->u.built_in.realm_value); + return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, ext_function_obj_p->u.built_in.realm_value); } if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION) { ecma_native_function_t *native_function_p = (ecma_native_function_t *) func_obj_p; - return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, - native_function_p->realm_value); + return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value); } #if JERRY_ESNEXT @@ -848,8 +834,8 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob JERRY_ASSERT (type == ECMA_OBJECT_TYPE_BOUND_FUNCTION); ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p; - func_obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, - bound_func_p->header.u.bound_function.target_function); + func_obj_p = + ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function); } } /* ecma_op_function_get_function_realm */ @@ -866,8 +852,7 @@ ecma_value_t ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object */ ecma_value_t value) /**< argument 'V' */ { - JERRY_ASSERT (func_obj_p != NULL - && !ecma_is_lexical_environment (func_obj_p)); + JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p)); if (!ecma_is_value_object (value)) { @@ -881,8 +866,8 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object * /* 1. 3. */ ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p; - func_obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, - bound_func_p->header.u.bound_function.target_function); + func_obj_p = + ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function); } JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION @@ -893,8 +878,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object * ecma_object_t *v_obj_p = ecma_get_object_from_value (value); - ecma_value_t prototype_obj_value = ecma_op_object_get_by_magic_id (func_obj_p, - LIT_MAGIC_STRING_PROTOTYPE); + ecma_value_t prototype_obj_value = ecma_op_object_get_by_magic_id (func_obj_p, LIT_MAGIC_STRING_PROTOTYPE); if (ECMA_IS_VALUE_ERROR (prototype_obj_value)) { @@ -1133,8 +1117,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */ /* Entering Function Code (ECMA-262 v5, 10.4.3) */ ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) func_obj_p; - ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, - ext_func_p->u.function.scope_cp); + ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_func_p->u.function.scope_cp); /* 8. */ const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p); @@ -1190,8 +1173,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */ break; } - if (ecma_is_value_undefined (this_binding) - || ecma_is_value_null (this_binding)) + if (ecma_is_value_undefined (this_binding) || ecma_is_value_null (this_binding)) { /* 2. */ #if JERRY_BUILTIN_REALMS @@ -1253,14 +1235,12 @@ ecma_op_function_call_native_built_in (ecma_object_t *func_obj_p, /**< Function ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p); ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p; - JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, - ext_func_obj_p->u.built_in.realm_value); + JERRY_CONTEXT (global_object_p) = + ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, ext_func_obj_p->u.built_in.realm_value); #endif /* JERRY_BUILTIN_REALMS */ - ecma_value_t ret_value = ecma_builtin_dispatch_call (func_obj_p, - this_arg_value, - arguments_list_p, - arguments_list_len); + ecma_value_t ret_value = + ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len); #if JERRY_BUILTIN_REALMS JERRY_CONTEXT (global_object_p) = saved_global_object_p; @@ -1285,8 +1265,8 @@ ecma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */ #if JERRY_BUILTIN_REALMS ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p); - JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, - native_function_p->realm_value); + JERRY_CONTEXT (global_object_p) = + ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value); #endif /* JERRY_BUILTIN_REALMS */ jerry_call_info_t call_info; @@ -1301,9 +1281,7 @@ ecma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */ #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); + ecma_value_t ret_value = native_function_p->native_handler_cb (&call_info, arguments_list_p, arguments_list_len); #if JERRY_BUILTIN_REALMS JERRY_CONTEXT (global_object_p) = saved_global_object_p; #endif /* JERRY_BUILTIN_REALMS */ @@ -1337,8 +1315,8 @@ ecma_op_bound_function_get_argument_list (ecma_object_t *func_obj_p, /**< bound ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p; - func_obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, - bound_func_p->header.u.bound_function.target_function); + func_obj_p = + ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function); ecma_value_t args_len_or_this = bound_func_p->header.u.bound_function.args_len_or_this; @@ -1438,8 +1416,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */ const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< length of arguments list */ { - JERRY_ASSERT (func_obj_p != NULL - && !ecma_is_lexical_environment (func_obj_p)); + JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p)); ECMA_CHECK_STACK_USAGE (); @@ -1702,10 +1679,7 @@ ecma_op_function_construct_constructor (ecma_object_t *func_obj_p, /**< Function } ecma_object_t *super_ctor_p = ecma_get_object_from_value (super_ctor); - ecma_value_t result = ecma_op_function_construct (super_ctor_p, - new_target_p, - arguments_list_p, - arguments_list_len); + ecma_value_t result = ecma_op_function_construct (super_ctor_p, new_target_p, arguments_list_p, arguments_list_len); ecma_deref_object (super_ctor_p); if (ecma_is_value_object (result)) @@ -1785,8 +1759,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */ const ecma_value_t *arguments_list_p, /**< arguments list */ uint32_t arguments_list_len) /**< length of arguments list */ { - JERRY_ASSERT (func_obj_p != NULL - && !ecma_is_lexical_environment (func_obj_p)); + JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p)); switch (ecma_get_object_type (func_obj_p)) { @@ -1852,8 +1825,7 @@ ecma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the fun { ecma_native_function_t *native_function_p = (ecma_native_function_t *) object_p; - global_object_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, - native_function_p->realm_value); + global_object_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value); } #endif /* JERRY_BUILTIN_REALMS */ @@ -1997,10 +1969,8 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< } ecma_property_t *value_prop_p; - ecma_property_value_t *value_p = ecma_create_named_data_property (object_p, - property_name_p, - ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, - &value_prop_p); + ecma_property_value_t *value_p = + ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &value_prop_p); value_p->value = ecma_make_uint32_value (len); return value_prop_p; } @@ -2026,10 +1996,8 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< /* Initialize 'name' property */ ecma_property_t *value_prop_p; - ecma_property_value_t *value_p = ecma_create_named_data_property (object_p, - property_name_p, - ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, - &value_prop_p); + ecma_property_value_t *value_p = + ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &value_prop_p); value_p->value = ecma_copy_value (value); return value_prop_p; } @@ -2043,8 +2011,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< const bool is_arguments = ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS); - if (is_arguments - || ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER)) + if (is_arguments || ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER)) { const ecma_compiled_code_t *bytecode_data_p; bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p); @@ -2055,10 +2022,8 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< { ecma_property_t *value_prop_p; /* The property_name_p argument contains the name. */ - ecma_property_value_t *value_p = ecma_create_named_data_property (object_p, - property_name_p, - ECMA_PROPERTY_BUILT_IN_FIXED, - &value_prop_p); + ecma_property_value_t *value_p = + ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_FIXED, &value_prop_p); value_p->value = is_arguments ? ECMA_VALUE_NULL : ECMA_VALUE_UNDEFINED; return value_prop_p; } @@ -2146,8 +2111,8 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p 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); + 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) { @@ -2167,10 +2132,8 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p } ecma_property_t *len_prop_p; - ecma_property_value_t *len_prop_value_p = ecma_create_named_data_property (object_p, - property_name_p, - length_attributes, - &len_prop_p); + ecma_property_value_t *len_prop_value_p = + ecma_create_named_data_property (object_p, property_name_p, length_attributes, &len_prop_p); len_prop_value_p->value = ecma_make_number_value (length); return len_prop_p; diff --git a/jerry-core/ecma/operations/ecma-function-object.h b/jerry-core/ecma/operations/ecma-function-object.h index 76c833a1..1531d85e 100644 --- a/jerry-core/ecma/operations/ecma-function-object.h +++ b/jerry-core/ecma/operations/ecma-function-object.h @@ -16,9 +16,10 @@ #ifndef ECMA_FUNCTION_OBJECT_H #define ECMA_FUNCTION_OBJECT_H -#include "ecma-globals.h" -#include "ecma-builtins.h" #include "ecma-builtin-handlers.h" +#include "ecma-builtins.h" +#include "ecma-globals.h" + #include "vm.h" /** \addtogroup ecma ECMA @@ -50,93 +51,84 @@ bool ecma_object_is_constructor (ecma_object_t *obj_p); char *ecma_object_check_constructor (ecma_object_t *obj_p); char *ecma_check_constructor (ecma_value_t value); -ecma_object_t * -ecma_op_create_simple_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p); +ecma_object_t *ecma_op_create_simple_function_object (ecma_object_t *scope_p, + const ecma_compiled_code_t *bytecode_data_p); -ecma_object_t * -ecma_op_create_external_function_object (ecma_native_handler_t handler_cb); +ecma_object_t *ecma_op_create_external_function_object (ecma_native_handler_t handler_cb); -const ecma_compiled_code_t * -ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p); +const ecma_compiled_code_t *ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p); #if JERRY_BUILTIN_REALMS -ecma_global_object_t * -ecma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p); +ecma_global_object_t *ecma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p); -ecma_global_object_t * -ecma_op_function_get_function_realm (ecma_object_t *func_obj_p); +ecma_global_object_t *ecma_op_function_get_function_realm (ecma_object_t *func_obj_p); #endif /* JERRY_BUILTIN_REALMS */ -ecma_value_t -ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, - uint32_t arguments_list_len, - ecma_parse_opts_t opts); +ecma_value_t ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, + uint32_t arguments_list_len, + ecma_parse_opts_t opts); #if JERRY_ESNEXT -ecma_value_t -ecma_op_function_get_super_constructor (ecma_object_t *func_obj_p); +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); +ecma_object_t *ecma_op_create_any_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p); -ecma_object_t * -ecma_op_create_arrow_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p, - ecma_value_t this_binding); +ecma_object_t *ecma_op_create_arrow_function_object (ecma_object_t *scope_p, + const ecma_compiled_code_t *bytecode_data_p, + ecma_value_t this_binding); -ecma_object_t * -ecma_op_create_native_handler (ecma_native_handler_id_t id, size_t object_size); +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_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); +ecma_value_t ecma_op_function_has_instance (ecma_object_t *func_obj_p, ecma_value_t value); -ecma_value_t -ecma_op_function_validated_call (ecma_value_t callee, ecma_value_t this_arg_value, - const ecma_value_t *arguments_list_p, uint32_t arguments_list_len); +ecma_value_t ecma_op_function_validated_call (ecma_value_t callee, + ecma_value_t this_arg_value, + const ecma_value_t *arguments_list_p, + uint32_t arguments_list_len); -ecma_value_t -ecma_op_function_call (ecma_object_t *func_obj_p, ecma_value_t this_arg_value, - const ecma_value_t *arguments_list_p, uint32_t arguments_list_len); +ecma_value_t ecma_op_function_call (ecma_object_t *func_obj_p, + ecma_value_t this_arg_value, + const ecma_value_t *arguments_list_p, + uint32_t arguments_list_len); -ecma_value_t -ecma_op_function_construct (ecma_object_t *func_obj_p, ecma_object_t *new_target_p, - const ecma_value_t *arguments_list_p, uint32_t arguments_list_len); +ecma_value_t ecma_op_function_construct (ecma_object_t *func_obj_p, + ecma_object_t *new_target_p, + const ecma_value_t *arguments_list_p, + uint32_t arguments_list_len); -ecma_property_t * -ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p); +ecma_property_t *ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, + ecma_string_t *property_name_p); -ecma_property_t * -ecma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p); +ecma_property_t *ecma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, + ecma_string_t *property_name_p); -ecma_property_t * -ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p); +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_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); +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, - ecma_property_counter_t *prop_counter_p, - jerry_property_filter_t filter); +void ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, + ecma_collection_t *prop_names_p, + ecma_property_counter_t *prop_counter_p, + jerry_property_filter_t filter); -void -ecma_op_external_function_list_lazy_property_names (ecma_object_t *object_p, ecma_collection_t *prop_names_p, - ecma_property_counter_t *prop_counter_p, - jerry_property_filter_t filter); +void ecma_op_external_function_list_lazy_property_names (ecma_object_t *object_p, + ecma_collection_t *prop_names_p, + ecma_property_counter_t *prop_counter_p, + jerry_property_filter_t filter); -void -ecma_op_bound_function_list_lazy_property_names (ecma_object_t *object_p, ecma_collection_t *prop_names_p, - ecma_property_counter_t *prop_counter_p, - jerry_property_filter_t filter); +void ecma_op_bound_function_list_lazy_property_names (ecma_object_t *object_p, + ecma_collection_t *prop_names_p, + ecma_property_counter_t *prop_counter_p, + jerry_property_filter_t filter); /** * @} diff --git a/jerry-core/ecma/operations/ecma-get-put-value.c b/jerry-core/ecma/operations/ecma-get-put-value.c index 110858e1..86dbc81b 100644 --- a/jerry-core/ecma/operations/ecma-get-put-value.c +++ b/jerry-core/ecma/operations/ecma-get-put-value.c @@ -19,13 +19,12 @@ #include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-helpers.h" #include "ecma-lex-env.h" -#include "ecma-objects.h" -#include "ecma-function-object.h" #include "ecma-objects-general.h" - +#include "ecma-objects.h" #include "ecma-reference.h" /** \addtogroup ecma ECMA @@ -48,8 +47,7 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme ecma_object_t **ref_base_lex_env_p, /**< [out] reference's base (lexical environment) */ ecma_string_t *name_p) /**< variable name */ { - JERRY_ASSERT (lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); while (true) { @@ -174,8 +172,7 @@ ecma_op_get_value_object_base (ecma_value_t base_value, /**< base value */ uint32_t index = ecma_string_get_array_index (property_name_p); - if (index != ECMA_STRING_NOT_ARRAY_INDEX - && index < ecma_string_get_length (string_p)) + if (index != ECMA_STRING_NOT_ARRAY_INDEX && index < ecma_string_get_length (string_p)) { ecma_char_t char_at_idx = ecma_string_get_char_at_pos (string_p, index); return ecma_make_string_value (ecma_new_ecma_string_from_code_unit (char_at_idx)); @@ -231,8 +228,7 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme bool is_strict, /**< flag indicating strict mode */ ecma_value_t value) /**< ECMA-value */ { - JERRY_ASSERT (lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); while (true) { @@ -257,11 +253,9 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme #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)); + JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_WRITABLE) || (*property_p & ECMA_PROPERTY_FLAG_DATA)); - if ((*property_p & ECMA_PROPERTY_FLAG_WRITABLE) - && property_value_p->value != ECMA_VALUE_UNINITIALIZED) + if ((*property_p & ECMA_PROPERTY_FLAG_WRITABLE) && property_value_p->value != ECMA_VALUE_UNINITIALIZED) { ecma_named_data_property_assign_value (lex_env_p, property_value_p, value); return ECMA_VALUE_EMPTY; @@ -296,10 +290,7 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme if (ecma_is_value_true (has_property)) { - ecma_value_t completion = ecma_op_object_put (binding_obj_p, - name_p, - value, - is_strict); + ecma_value_t completion = ecma_op_object_put (binding_obj_p, name_p, value, is_strict); if (ECMA_IS_VALUE_ERROR (completion)) { @@ -335,10 +326,7 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme #endif /* JERRY_ERROR_MESSAGES */ } - ecma_value_t completion = ecma_op_object_put (ecma_get_lex_env_binding_object (lex_env_p), - name_p, - value, - false); + ecma_value_t completion = ecma_op_object_put (ecma_get_lex_env_binding_object (lex_env_p), name_p, value, false); JERRY_ASSERT (ecma_is_value_boolean (completion)); diff --git a/jerry-core/ecma/operations/ecma-iterator-object.c b/jerry-core/ecma/operations/ecma-iterator-object.c index badb795e..a40c9e02 100644 --- a/jerry-core/ecma/operations/ecma-iterator-object.c +++ b/jerry-core/ecma/operations/ecma-iterator-object.c @@ -13,19 +13,21 @@ * limitations under the License. */ +#include "ecma-iterator-object.h" + #include "ecma-alloc.h" #include "ecma-array-object.h" -#include "ecma-iterator-object.h" #include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-number-arithmetic.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" -#include "ecma-function-object.h" +#include "ecma-objects.h" + #include "jcontext.h" /** \addtogroup ecma ECMA @@ -57,18 +59,14 @@ ecma_create_array_from_iter_element (ecma_value_t value, /**< value */ /* 3-4. */ ecma_value_t completion; - completion = ecma_builtin_helper_def_prop_by_index (new_array_p, - 0, - index_value, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); + completion = + ecma_builtin_helper_def_prop_by_index (new_array_p, 0, index_value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); /* 4.b */ JERRY_ASSERT (ecma_is_value_true (completion)); - completion = ecma_builtin_helper_def_prop_by_index (new_array_p, - 1, - value, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); + completion = + ecma_builtin_helper_def_prop_by_index (new_array_p, 1, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); JERRY_ASSERT (ecma_is_value_true (completion)); /* 5. */ @@ -95,9 +93,8 @@ ecma_create_iter_result_object (ecma_value_t value, /**< value */ JERRY_ASSERT (ecma_is_value_boolean (done)); /* 2. */ - ecma_object_t *object_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), - 0, - ECMA_OBJECT_TYPE_GENERAL); + ecma_object_t *object_p = + ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL); /* 3. */ ecma_property_value_t *prop_value_p; @@ -136,17 +133,15 @@ ecma_op_create_iterator_object (ecma_value_t iterated_value, /**< value from cre ecma_iterator_kind_t kind) /**< iterator kind*/ { /* 1. */ - JERRY_ASSERT (iterator_type == ECMA_OBJECT_CLASS_ARRAY_ITERATOR - || iterator_type == ECMA_OBJECT_CLASS_SET_ITERATOR + JERRY_ASSERT (iterator_type == ECMA_OBJECT_CLASS_ARRAY_ITERATOR || iterator_type == ECMA_OBJECT_CLASS_SET_ITERATOR || iterator_type == ECMA_OBJECT_CLASS_MAP_ITERATOR || iterator_type == ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR || iterator_type == ECMA_OBJECT_CLASS_STRING_ITERATOR); JERRY_ASSERT (kind < ECMA_ITERATOR__COUNT); /* 2. */ - ecma_object_t *object_p = ecma_create_object (prototype_obj_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = + ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p; ext_obj_p->u.cls.type = (uint8_t) iterator_type; @@ -235,9 +230,8 @@ ecma_op_get_iterator (ecma_value_t value, /**< value to get iterator from */ return sync_iterator; } - ecma_value_t async_iterator = ecma_op_create_async_from_sync_iterator (sync_iterator, - sync_next_method, - next_method_p); + ecma_value_t async_iterator = + ecma_op_create_async_from_sync_iterator (sync_iterator, sync_next_method, next_method_p); ecma_free_value (method); ecma_free_value (sync_iterator); @@ -716,8 +710,8 @@ ecma_async_from_sync_iterator_unwrap_cb (ecma_object_t *function_obj_p, /**< fun /* 2. */ ecma_value_t arg = args_count > 0 ? args_p[0] : ECMA_VALUE_UNDEFINED; - ecma_value_t done = ecma_make_boolean_value (unwrap_p->u.built_in.u2.routine_flags - >> ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT); + ecma_value_t done = + ecma_make_boolean_value (unwrap_p->u.built_in.u2.routine_flags >> ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT); return ecma_create_iter_result_object (arg, done); } /* ecma_async_from_sync_iterator_unwrap_cb */ diff --git a/jerry-core/ecma/operations/ecma-iterator-object.h b/jerry-core/ecma/operations/ecma-iterator-object.h index 157b3432..f0903508 100644 --- a/jerry-core/ecma/operations/ecma-iterator-object.h +++ b/jerry-core/ecma/operations/ecma-iterator-object.h @@ -43,48 +43,40 @@ typedef enum */ #define ECMA_ITERATOR_INDEX_LIMIT UINT16_MAX -ecma_value_t -ecma_op_create_iterator_object (ecma_value_t iterated_value, - ecma_object_t *prototype_obj_p, - ecma_object_class_type_t iterator_type, - ecma_iterator_kind_t kind); +ecma_value_t ecma_op_create_iterator_object (ecma_value_t iterated_value, + ecma_object_t *prototype_obj_p, + ecma_object_class_type_t iterator_type, + ecma_iterator_kind_t kind); -ecma_value_t -ecma_create_iter_result_object (ecma_value_t value, ecma_value_t done); +ecma_value_t ecma_create_iter_result_object (ecma_value_t value, ecma_value_t done); -ecma_value_t -ecma_create_array_from_iter_element (ecma_value_t value, ecma_value_t index_value); +ecma_value_t ecma_create_array_from_iter_element (ecma_value_t value, ecma_value_t index_value); -ecma_value_t -ecma_op_get_iterator (ecma_value_t value, ecma_value_t method, ecma_value_t *next_method_p); +ecma_value_t ecma_op_get_iterator (ecma_value_t value, ecma_value_t method, ecma_value_t *next_method_p); -ecma_value_t -ecma_op_iterator_complete (ecma_value_t iter_result); +ecma_value_t ecma_op_iterator_complete (ecma_value_t iter_result); -ecma_value_t -ecma_op_iterator_value (ecma_value_t iter_result); +ecma_value_t ecma_op_iterator_value (ecma_value_t iter_result); -ecma_value_t -ecma_op_iterator_next (ecma_value_t iterator, ecma_value_t next_method, ecma_value_t value); +ecma_value_t ecma_op_iterator_next (ecma_value_t iterator, ecma_value_t next_method, ecma_value_t value); -ecma_value_t -ecma_op_iterator_close (ecma_value_t iterator); +ecma_value_t ecma_op_iterator_close (ecma_value_t iterator); -ecma_value_t -ecma_op_iterator_step (ecma_value_t iterator, ecma_value_t next_method); +ecma_value_t ecma_op_iterator_step (ecma_value_t iterator, ecma_value_t next_method); -ecma_value_t -ecma_op_iterator_do (ecma_iterator_command_type_t command, ecma_value_t iterator, - ecma_value_t next_method, ecma_value_t value, bool *done_p); +ecma_value_t ecma_op_iterator_do (ecma_iterator_command_type_t command, + ecma_value_t iterator, + ecma_value_t next_method, + ecma_value_t value, + bool *done_p); -ecma_value_t -ecma_op_create_async_from_sync_iterator (ecma_value_t sync_iterator, ecma_value_t sync_next_method, - ecma_value_t *async_next_method_p); +ecma_value_t ecma_op_create_async_from_sync_iterator (ecma_value_t sync_iterator, + ecma_value_t sync_next_method, + ecma_value_t *async_next_method_p); -ecma_value_t -ecma_async_from_sync_iterator_unwrap_cb (ecma_object_t *function_obj_p, - const ecma_value_t args_p[], - const uint32_t args_count); +ecma_value_t ecma_async_from_sync_iterator_unwrap_cb (ecma_object_t *function_obj_p, + 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 17ad9913..990e3b7a 100644 --- a/jerry-core/ecma/operations/ecma-jobqueue.c +++ b/jerry-core/ecma/operations/ecma-jobqueue.c @@ -13,13 +13,15 @@ * limitations under the License. */ +#include "ecma-jobqueue.h" + #include "ecma-async-generator-object.h" #include "ecma-function-object.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-jobqueue.h" #include "ecma-objects.h" #include "ecma-promise-object.h" + #include "jcontext.h" #include "opcodes.h" #include "vm-stack.h" @@ -82,7 +84,8 @@ typedef struct /** * Initialize the jobqueue. */ -void ecma_job_queue_init (void) +void +ecma_job_queue_init (void) { JERRY_CONTEXT (job_queue_head_p) = NULL; JERRY_CONTEXT (job_queue_tail_p) = NULL; @@ -182,8 +185,8 @@ static ecma_value_t ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the job to be operated */ { /* 2. */ - JERRY_ASSERT (ecma_object_class_is (ecma_get_object_from_value (job_p->capability), - ECMA_OBJECT_CLASS_PROMISE_CAPABILITY)); + JERRY_ASSERT ( + ecma_object_class_is (ecma_get_object_from_value (job_p->capability), ECMA_OBJECT_CLASS_PROMISE_CAPABILITY)); ecma_promise_capabality_t *capability_p; capability_p = (ecma_promise_capabality_t *) ecma_get_object_from_value (job_p->capability); @@ -191,10 +194,11 @@ ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_REACTION_JOB)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB, - capability_p->header.u.cls.u3.promise, - ECMA_VALUE_UNDEFINED, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB, + capability_p->header.u.cls.u3.promise, + ECMA_VALUE_UNDEFINED, + JERRY_CONTEXT (promise_callback_user_p)); } #endif /* JERRY_PROMISE_CALLBACK */ @@ -213,10 +217,8 @@ ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the else { /* 6. */ - handler_result = ecma_op_function_call (ecma_get_object_from_value (handler), - ECMA_VALUE_UNDEFINED, - &(job_p->argument), - 1); + handler_result = + ecma_op_function_call (ecma_get_object_from_value (handler), ECMA_VALUE_UNDEFINED, &(job_p->argument), 1); } ecma_value_t status; @@ -249,10 +251,11 @@ ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_REACTION_JOB)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_AFTER_REACTION_JOB, - capability_p->header.u.cls.u3.promise, - ECMA_VALUE_UNDEFINED, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_AFTER_REACTION_JOB, + capability_p->header.u.cls.u3.promise, + ECMA_VALUE_UNDEFINED, + JERRY_CONTEXT (promise_callback_user_p)); } #endif /* JERRY_PROMISE_CALLBACK */ @@ -281,10 +284,8 @@ ecma_process_promise_async_reaction_job (ecma_job_promise_async_reaction_t *job_ } JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (type, - job_p->executable_object, - job_p->argument, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (type, job_p->executable_object, job_p->argument, JERRY_CONTEXT (promise_callback_user_p)); } #endif /* JERRY_PROMISE_CALLBACK */ @@ -385,10 +386,8 @@ free_job: } JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (type, - job_p->executable_object, - job_p->argument, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (type, job_p->executable_object, job_p->argument, JERRY_CONTEXT (promise_callback_user_p)); } #endif /* JERRY_PROMISE_CALLBACK */ @@ -494,8 +493,8 @@ ecma_enqueue_promise_async_reaction_job (ecma_value_t executable_object, /**< ex { ecma_job_promise_async_reaction_t *job_p; job_p = (ecma_job_promise_async_reaction_t *) jmem_heap_alloc_block (sizeof (ecma_job_promise_async_reaction_t)); - job_p->header.next_and_type = (is_rejected ? ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED - : ECMA_JOB_PROMISE_ASYNC_REACTION_FULFILLED); + job_p->header.next_and_type = + (is_rejected ? ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED : ECMA_JOB_PROMISE_ASYNC_REACTION_FULFILLED); job_p->executable_object = ecma_copy_value (executable_object); job_p->argument = ecma_copy_value (argument); diff --git a/jerry-core/ecma/operations/ecma-jobqueue.h b/jerry-core/ecma/operations/ecma-jobqueue.h index e75f05f6..72128c2e 100644 --- a/jerry-core/ecma/operations/ecma-jobqueue.h +++ b/jerry-core/ecma/operations/ecma-jobqueue.h @@ -16,6 +16,8 @@ #ifndef ECMA_JOB_QUEUE_H #define ECMA_JOB_QUEUE_H +#include "ecma-globals.h" + #if JERRY_ESNEXT /** \addtogroup ecma ECMA @@ -48,8 +50,7 @@ typedef struct void ecma_job_queue_init (void); void ecma_enqueue_promise_reaction_job (ecma_value_t capability, ecma_value_t handler, ecma_value_t argument); -void ecma_enqueue_promise_async_reaction_job (ecma_value_t executable_object, - ecma_value_t argument, bool is_rejected); +void ecma_enqueue_promise_async_reaction_job (ecma_value_t executable_object, ecma_value_t argument, bool is_rejected); void ecma_enqueue_promise_async_generator_job (ecma_value_t executable_object); void ecma_enqueue_promise_resolve_thenable_job (ecma_value_t promise, ecma_value_t thenable, ecma_value_t then); void ecma_free_all_enqueued_jobs (void); diff --git a/jerry-core/ecma/operations/ecma-lex-env.c b/jerry-core/ecma/operations/ecma-lex-env.c index 31a832d4..804822bc 100644 --- a/jerry-core/ecma/operations/ecma-lex-env.c +++ b/jerry-core/ecma/operations/ecma-lex-env.c @@ -13,15 +13,17 @@ * limitations under the License. */ +#include "ecma-lex-env.h" + #include "ecma-builtin-helpers.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-lex-env.h" #include "ecma-objects.h" #include "ecma-proxy-object.h" + #include "jcontext.h" /** \addtogroup ecma ECMA @@ -156,8 +158,7 @@ ecma_value_t ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */ ecma_string_t *name_p) /**< argument N */ { - JERRY_ASSERT (lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); ecma_lexical_environment_type_t lex_env_type = ecma_get_lex_env_type (lex_env_p); @@ -204,8 +205,7 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme ecma_string_t *name_p, /**< argument N */ bool is_deletable) /**< argument D */ { - JERRY_ASSERT (lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); JERRY_ASSERT (name_p != NULL); if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) @@ -219,10 +219,7 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme ecma_property_t *prop_p; - ecma_create_named_data_property (lex_env_p, - name_p, - prop_attributes, - &prop_p); + ecma_create_named_data_property (lex_env_p, name_p, prop_attributes, &prop_p); return prop_p; } else @@ -259,11 +256,11 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme const uint32_t flags = ECMA_PROPERTY_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW; - ecma_value_t completion = ecma_builtin_helper_def_prop (binding_obj_p, - name_p, - ECMA_VALUE_UNDEFINED, - is_deletable ? flags | ECMA_PROPERTY_FLAG_CONFIGURABLE - : flags); + ecma_value_t completion = + ecma_builtin_helper_def_prop (binding_obj_p, + name_p, + ECMA_VALUE_UNDEFINED, + is_deletable ? flags | ECMA_PROPERTY_FLAG_CONFIGURABLE : flags); if (ECMA_IS_VALUE_ERROR (completion)) { @@ -292,8 +289,7 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment ecma_value_t value, /**< argument V */ bool is_strict) /**< argument S */ { - JERRY_ASSERT (lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); JERRY_ASSERT (name_p != NULL); switch (ecma_get_lex_env_type (lex_env_p)) @@ -319,8 +315,7 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment } JERRY_ASSERT (property_p != NULL && ECMA_PROPERTY_IS_RAW_DATA (*property_p)); - JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_WRITABLE) - || (*property_p & ECMA_PROPERTY_FLAG_DATA)); + JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_WRITABLE) || (*property_p & ECMA_PROPERTY_FLAG_DATA)); if ((*property_p & ECMA_PROPERTY_FLAG_WRITABLE)) { @@ -340,10 +335,7 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p); - ecma_value_t completion = ecma_op_object_put (binding_obj_p, - name_p, - value, - is_strict); + ecma_value_t completion = ecma_op_object_put (binding_obj_p, name_p, value, is_strict); if (ECMA_IS_VALUE_ERROR (completion)) { @@ -369,8 +361,7 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */ ecma_string_t *name_p, /**< argument N */ bool is_strict) /**< argument S */ { - JERRY_ASSERT (lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); JERRY_ASSERT (name_p != NULL); if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) @@ -421,8 +412,7 @@ ecma_value_t ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */ ecma_string_t *name_p) /**< argument N */ { - JERRY_ASSERT (lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); JERRY_ASSERT (name_p != NULL); if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) @@ -473,8 +463,7 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */ ecma_value_t ecma_op_implicit_this_value (ecma_object_t *lex_env_p) /**< lexical environment */ { - JERRY_ASSERT (lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE) { @@ -501,18 +490,14 @@ ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environ ecma_string_t *name_p, /**< argument N */ ecma_value_t value) /**< argument V */ { - JERRY_ASSERT (lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE); /* * Warning: * Whether immutable bindings are deletable seems not to be defined by ECMA v5. */ - ecma_property_value_t *prop_value_p = ecma_create_named_data_property (lex_env_p, - name_p, - ECMA_PROPERTY_FIXED, - NULL); + ecma_property_value_t *prop_value_p = ecma_create_named_data_property (lex_env_p, name_p, ECMA_PROPERTY_FIXED, NULL); prop_value_p->value = ecma_copy_value_if_not_object (value); } /* ecma_op_create_immutable_binding */ @@ -528,8 +513,7 @@ ecma_op_initialize_binding (ecma_object_t *lex_env_p, /**< lexical environment * ecma_string_t *name_p, /**< argument N */ ecma_value_t value) /**< argument V */ { - JERRY_ASSERT (lex_env_p != NULL - && ecma_is_lexical_environment (lex_env_p)); + JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p)); JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE); ecma_property_t *prop_p = ecma_find_named_property (lex_env_p, name_p); diff --git a/jerry-core/ecma/operations/ecma-lex-env.h b/jerry-core/ecma/operations/ecma-lex-env.h index e77f4f1e..5b59559c 100644 --- a/jerry-core/ecma/operations/ecma-lex-env.h +++ b/jerry-core/ecma/operations/ecma-lex-env.h @@ -18,6 +18,7 @@ #include "ecma-globals.h" #include "ecma-reference.h" + #include "jrt.h" /** \addtogroup ecma ECMA @@ -49,17 +50,19 @@ void ecma_module_finalize_lex_envs (void); */ /* ECMA-262 v5, 8.7.1 and 8.7.2 */ -ecma_value_t ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, ecma_object_t **ref_base_lex_env_p, - ecma_string_t *name_p); +ecma_value_t +ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, ecma_object_t **ref_base_lex_env_p, ecma_string_t *name_p); ecma_value_t ecma_op_get_value_object_base (ecma_value_t base_value, ecma_string_t *property_name_p); -ecma_value_t ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, ecma_string_t *var_name_string_p, - bool is_strict, ecma_value_t value); +ecma_value_t ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, + ecma_string_t *var_name_string_p, + bool is_strict, + ecma_value_t value); /* ECMA-262 v5, Table 17. Abstract methods of Environment Records */ ecma_value_t ecma_op_has_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p); ecma_property_t *ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, bool is_deletable); -ecma_value_t ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value, - bool is_strict); +ecma_value_t +ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value, bool is_strict); ecma_value_t ecma_op_get_binding_value (ecma_object_t *lex_env_p, ecma_string_t *name_p, bool is_strict); ecma_value_t ecma_op_delete_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p); ecma_value_t ecma_op_implicit_this_value (ecma_object_t *lex_env_p); @@ -70,8 +73,7 @@ void ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, ecma_string_t * #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); +void ecma_op_create_environment_record (ecma_object_t *lex_env_p, ecma_value_t this_binding, ecma_object_t *func_obj_p); ecma_environment_record_t *ecma_op_get_environment_record (ecma_object_t *lex_env_p); bool ecma_op_this_binding_is_initialized (ecma_environment_record_t *environment_record_p); diff --git a/jerry-core/ecma/operations/ecma-number-arithmetic.c b/jerry-core/ecma/operations/ecma-number-arithmetic.c index 0440b5fa..2d17900a 100644 --- a/jerry-core/ecma/operations/ecma-number-arithmetic.c +++ b/jerry-core/ecma/operations/ecma-number-arithmetic.c @@ -13,9 +13,10 @@ * limitations under the License. */ +#include "ecma-number-arithmetic.h" + #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-number-arithmetic.h" /** \addtogroup ecma ECMA * @{ @@ -36,16 +37,12 @@ ecma_number_t ecma_op_number_remainder (ecma_number_t left_num, /**< left operand */ ecma_number_t right_num) /**< right operand */ { - if (ecma_number_is_nan (left_num) - || ecma_number_is_nan (right_num) - || ecma_number_is_infinity (left_num) + if (ecma_number_is_nan (left_num) || ecma_number_is_nan (right_num) || ecma_number_is_infinity (left_num) || ecma_number_is_zero (right_num)) { return ecma_number_make_nan (); } - else if (ecma_number_is_infinity (right_num) - || (ecma_number_is_zero (left_num) - && !ecma_number_is_zero (right_num))) + else if (ecma_number_is_infinity (right_num) || (ecma_number_is_zero (left_num) && !ecma_number_is_zero (right_num))) { return left_num; } diff --git a/jerry-core/ecma/operations/ecma-number-object.c b/jerry-core/ecma/operations/ecma-number-object.c index 38e21695..4160e765 100644 --- a/jerry-core/ecma/operations/ecma-number-object.c +++ b/jerry-core/ecma/operations/ecma-number-object.c @@ -13,16 +13,18 @@ * limitations under the License. */ +#include "ecma-number-object.h" + #include "ecma-alloc.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-number-object.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" -#include "ecma-function-object.h" +#include "ecma-objects.h" + #include "jcontext.h" /** \addtogroup ecma ECMA @@ -70,9 +72,8 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb } } #endif /* JERRY_ESNEXT */ - ecma_object_t *object_p = ecma_create_object (prototype_obj_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = + ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p; ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_NUMBER; diff --git a/jerry-core/ecma/operations/ecma-objects-general.c b/jerry-core/ecma/operations/ecma-objects-general.c index be9ef803..438bfd75 100644 --- a/jerry-core/ecma/operations/ecma-objects-general.c +++ b/jerry-core/ecma/operations/ecma-objects-general.c @@ -13,6 +13,8 @@ * limitations under the License. */ +#include "ecma-objects-general.h" + #include "ecma-arguments-object.h" #include "ecma-array-object.h" #include "ecma-builtins.h" @@ -22,7 +24,6 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-objects.h" -#include "ecma-objects-general.h" #include "ecma-proxy-object.h" /** \addtogroup ecma ECMA @@ -89,23 +90,19 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p, /**< property name */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT (obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p)); JERRY_ASSERT (property_name_p != NULL); /* 1. */ ecma_property_ref_t property_ref; - ecma_property_t property = ecma_op_object_get_own_property (obj_p, - property_name_p, - &property_ref, - ECMA_PROPERTY_GET_NO_OPTIONS); + ecma_property_t property = + ecma_op_object_get_own_property (obj_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_NO_OPTIONS); /* 2. */ if (!ECMA_PROPERTY_IS_FOUND (property)) { - JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND - || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP); + JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP); return ECMA_VALUE_TRUE; } @@ -124,8 +121,7 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */ ecma_object_type_t type = ecma_get_object_type (obj_p); - if (type == ECMA_OBJECT_TYPE_ARRAY - && ecma_array_object_delete_property (obj_p, property_name_p)) + if (type == ECMA_OBJECT_TYPE_ARRAY && ecma_array_object_delete_property (obj_p, property_name_p)) { return ECMA_VALUE_TRUE; } @@ -196,8 +192,7 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */ /** * Property invocation order during [[DefaultValue]] operation with string hint */ -static const lit_magic_string_id_t to_primitive_string_hint_method_names[2] = -{ +static const lit_magic_string_id_t to_primitive_string_hint_method_names[2] = { LIT_MAGIC_STRING_TO_STRING_UL, /**< toString operation */ LIT_MAGIC_STRING_VALUE_OF_UL, /**< valueOf operation */ }; @@ -205,8 +200,7 @@ static const lit_magic_string_id_t to_primitive_string_hint_method_names[2] = /** * Property invocation order during [[DefaultValue]] operation with non string hint */ -static const lit_magic_string_id_t to_primitive_non_string_hint_method_names[2] = -{ +static const lit_magic_string_id_t to_primitive_non_string_hint_method_names[2] = { LIT_MAGIC_STRING_VALUE_OF_UL, /**< valueOf operation */ LIT_MAGIC_STRING_TO_STRING_UL, /**< toString operation */ }; @@ -215,8 +209,7 @@ static const lit_magic_string_id_t to_primitive_non_string_hint_method_names[2] /** * Hints for the ecma general object's toPrimitve operation */ -static const lit_magic_string_id_t hints[3] = -{ +static const lit_magic_string_id_t hints[3] = { LIT_MAGIC_STRING_DEFAULT, /**< "default" hint */ LIT_MAGIC_STRING_NUMBER, /**< "number" hint */ LIT_MAGIC_STRING_STRING, /**< "string" hint */ @@ -237,14 +230,12 @@ ecma_value_t ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */ ecma_preferred_type_hint_t hint) /**< hint on preferred result type */ { - JERRY_ASSERT (obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); + 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); + ecma_value_t exotic_to_prim = ecma_op_get_method_by_symbol_id (obj_value, LIT_GLOBAL_SYMBOL_TO_PRIMITIVE); if (ECMA_IS_VALUE_ERROR (exotic_to_prim)) { @@ -256,15 +247,11 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */ ecma_object_t *call_func_p = ecma_get_object_from_value (exotic_to_prim); ecma_value_t argument = ecma_make_magic_string_value (hints[hint]); - ecma_value_t result = ecma_op_function_call (call_func_p, - obj_value, - &argument, - 1); + ecma_value_t result = ecma_op_function_call (call_func_p, obj_value, &argument, 1); ecma_free_value (exotic_to_prim); - if (ECMA_IS_VALUE_ERROR (result) - || !ecma_is_value_object (result)) + if (ECMA_IS_VALUE_ERROR (result) || !ecma_is_value_object (result)) { return result; } @@ -310,9 +297,9 @@ ecma_value_t ecma_op_general_object_ordinary_value (ecma_object_t *obj_p, /**< the object */ ecma_preferred_type_hint_t hint) /**< hint on preferred result type */ { - const lit_magic_string_id_t *function_name_ids_p = (hint == ECMA_PREFERRED_TYPE_STRING - ? to_primitive_string_hint_method_names - : to_primitive_non_string_hint_method_names); + const lit_magic_string_id_t *function_name_ids_p = + (hint == ECMA_PREFERRED_TYPE_STRING ? to_primitive_string_hint_method_names + : to_primitive_non_string_hint_method_names); for (uint32_t i = 0; i < 2; i++) { @@ -329,17 +316,13 @@ ecma_op_general_object_ordinary_value (ecma_object_t *obj_p, /**< the object */ { ecma_object_t *func_obj_p = ecma_get_object_from_value (function_value); - call_completion = ecma_op_function_call (func_obj_p, - ecma_make_object_value (obj_p), - NULL, - 0); + call_completion = ecma_op_function_call (func_obj_p, ecma_make_object_value (obj_p), NULL, 0); } ecma_free_value (function_value); if (ECMA_IS_VALUE_ERROR (call_completion) - || (!ecma_is_value_empty (call_completion) - && !ecma_is_value_object (call_completion))) + || (!ecma_is_value_empty (call_completion) && !ecma_is_value_object (call_completion))) { return call_completion; } @@ -383,8 +366,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob } #endif /* JERRY_BUILTIN_PROXY */ - JERRY_ASSERT (object_p != NULL - && !ecma_is_lexical_environment (object_p)); + JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p)); JERRY_ASSERT (!ecma_op_object_is_fast_array (object_p)); JERRY_ASSERT (property_name_p != NULL); @@ -394,7 +376,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob { /* A property descriptor cannot be both named data and named accessor. */ JERRY_ASSERT ((property_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)) - != (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)); + != (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)); property_desc_type = ECMA_OP_OBJECT_DEFINE_DATA; } else if (property_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)) @@ -444,10 +426,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob JERRY_ASSERT (property_desc_type == ECMA_OP_OBJECT_DEFINE_GENERIC || property_desc_type == ECMA_OP_OBJECT_DEFINE_DATA); - ecma_property_value_t *new_prop_value_p = ecma_create_named_data_property (object_p, - property_name_p, - prop_attributes, - NULL); + ecma_property_value_t *new_prop_value_p = + ecma_create_named_data_property (object_p, property_name_p, prop_attributes, NULL); JERRY_ASSERT ((property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED) || ecma_is_value_undefined (property_desc_p->value)); @@ -513,11 +493,9 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob ecma_value_t result = ECMA_VALUE_TRUE; - if (property_desc_type == ECMA_OP_OBJECT_DEFINE_ACCESSOR - || writable_check_failed + if (property_desc_type == ECMA_OP_OBJECT_DEFINE_ACCESSOR || writable_check_failed || ((property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED) - && !ecma_op_same_value (property_desc_p->value, - ext_property_ref.property_ref.virtual_value))) + && !ecma_op_same_value (property_desc_p->value, ext_property_ref.property_ref.virtual_value))) { result = ecma_raise_property_redefinition (property_name_p, property_desc_p->flags); } @@ -542,8 +520,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob if (!ecma_is_property_writable (current_prop) && ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE) || ((property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED) - && !ecma_op_same_value (property_desc_p->value, - ext_property_ref.property_ref.value_p->value)))) + && !ecma_op_same_value (property_desc_p->value, ext_property_ref.property_ref.value_p->value)))) { return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags); } @@ -560,8 +537,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob ECMA_SET_POINTER (prop_desc_getter_cp, property_desc_p->get_p); ECMA_SET_POINTER (prop_desc_setter_cp, property_desc_p->set_p); - if (((property_desc_p->flags & JERRY_PROP_IS_GET_DEFINED) - && prop_desc_getter_cp != get_set_pair_p->getter_cp) + if (((property_desc_p->flags & JERRY_PROP_IS_GET_DEFINED) && prop_desc_getter_cp != get_set_pair_p->getter_cp) || ((property_desc_p->flags & JERRY_PROP_IS_SET_DEFINED) && prop_desc_setter_cp != get_set_pair_p->setter_cp)) { @@ -603,8 +579,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob JERRY_ASSERT (!(current_prop & ECMA_PROPERTY_FLAG_DATA)); #if JERRY_CPOINTER_32_BIT ecma_getter_setter_pointers_t *getter_setter_pair_p; - getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, - value_p->getter_setter_pair_cp); + getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, value_p->getter_setter_pair_cp); jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t)); #endif /* JERRY_CPOINTER_32_BIT */ value_p->value = ECMA_VALUE_UNDEFINED; @@ -624,9 +599,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob if (property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED) { - ecma_named_data_property_assign_value (object_p, - ext_property_ref.property_ref.value_p, - property_desc_p->value); + ecma_named_data_property_assign_value (object_p, ext_property_ref.property_ref.value_p, property_desc_p->value); } if (property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED) @@ -640,16 +613,12 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob if (property_desc_p->flags & JERRY_PROP_IS_GET_DEFINED) { - ecma_set_named_accessor_property_getter (object_p, - ext_property_ref.property_ref.value_p, - property_desc_p->get_p); + ecma_set_named_accessor_property_getter (object_p, ext_property_ref.property_ref.value_p, property_desc_p->get_p); } if (property_desc_p->flags & JERRY_PROP_IS_SET_DEFINED) { - ecma_set_named_accessor_property_setter (object_p, - ext_property_ref.property_ref.value_p, - property_desc_p->set_p); + ecma_set_named_accessor_property_setter (object_p, ext_property_ref.property_ref.value_p, property_desc_p->set_p); } } @@ -700,14 +669,12 @@ ecma_op_is_compatible_property_descriptor (const ecma_property_descriptor_t *des /* 4. */ if ((current_p->flags & desc_p->flags) == desc_p->flags) { - if ((current_p->flags & JERRY_PROP_IS_VALUE_DEFINED) - && ecma_op_same_value (current_p->value, desc_p->value)) + if ((current_p->flags & JERRY_PROP_IS_VALUE_DEFINED) && ecma_op_same_value (current_p->value, desc_p->value)) { return true; } - if ((current_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED) - && current_p->get_p == desc_p->get_p + if ((current_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED) && current_p->get_p == desc_p->get_p && current_p->set_p == desc_p->set_p)) { return true; @@ -752,15 +719,13 @@ ecma_op_is_compatible_property_descriptor (const ecma_property_descriptor_t *des { if (!(current_p->flags & JERRY_PROP_IS_CONFIGURABLE)) { - if (!(current_p->flags & JERRY_PROP_IS_WRITABLE) - && (desc_p->flags & JERRY_PROP_IS_WRITABLE)) + if (!(current_p->flags & JERRY_PROP_IS_WRITABLE) && (desc_p->flags & JERRY_PROP_IS_WRITABLE)) { return false; } - if (!(current_p->flags & JERRY_PROP_IS_WRITABLE) - && (desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED) - && !ecma_op_same_value (desc_p->value, current_p->value)) + if (!(current_p->flags & JERRY_PROP_IS_WRITABLE) && (desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED) + && !ecma_op_same_value (desc_p->value, current_p->value)) { return false; } @@ -775,14 +740,12 @@ ecma_op_is_compatible_property_descriptor (const ecma_property_descriptor_t *des /* 9. */ if (!(current_p->flags & JERRY_PROP_IS_CONFIGURABLE)) { - if ((desc_p->flags & JERRY_PROP_IS_SET_DEFINED) - && desc_p->set_p != current_p->set_p) + if ((desc_p->flags & JERRY_PROP_IS_SET_DEFINED) && desc_p->set_p != current_p->set_p) { return false; } - if ((desc_p->flags & JERRY_PROP_IS_GET_DEFINED) - && desc_p->get_p != current_p->get_p) + if ((desc_p->flags & JERRY_PROP_IS_GET_DEFINED) && desc_p->get_p != current_p->get_p) { return false; } diff --git a/jerry-core/ecma/operations/ecma-objects-general.h b/jerry-core/ecma/operations/ecma-objects-general.h index 783b576b..aea9959d 100644 --- a/jerry-core/ecma/operations/ecma-objects-general.h +++ b/jerry-core/ecma/operations/ecma-objects-general.h @@ -32,7 +32,8 @@ ecma_object_t *ecma_op_create_object_object_noarg_and_set_prototype (ecma_object ecma_value_t ecma_op_general_object_delete (ecma_object_t *obj_p, ecma_string_t *property_name_p, bool is_throw); ecma_value_t ecma_op_general_object_default_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint); ecma_value_t ecma_op_general_object_ordinary_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint); -ecma_value_t ecma_op_general_object_define_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p, +ecma_value_t ecma_op_general_object_define_own_property (ecma_object_t *object_p, + ecma_string_t *property_name_p, const ecma_property_descriptor_t *property_desc_p); #if JERRY_ESNEXT diff --git a/jerry-core/ecma/operations/ecma-objects.c b/jerry-core/ecma/operations/ecma-objects.c index c096d1b1..730ddbe8 100644 --- a/jerry-core/ecma/operations/ecma-objects.c +++ b/jerry-core/ecma/operations/ecma-objects.c @@ -13,27 +13,29 @@ * limitations under the License. */ +#include "ecma-objects.h" + +#include "ecma-arguments-object.h" #include "ecma-array-object.h" -#include "ecma-builtins.h" +#include "ecma-bigint.h" #include "ecma-builtin-helpers.h" +#include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-function-object.h" -#include "ecma-lex-env.h" #include "ecma-lcache.h" -#include "ecma-string-object.h" -#include "ecma-arguments-object.h" +#include "ecma-lex-env.h" #include "ecma-objects-general.h" -#include "ecma-objects.h" #include "ecma-proxy-object.h" -#include "ecma-bigint.h" +#include "ecma-string-object.h" + #include "jcontext.h" #if JERRY_BUILTIN_TYPEDARRAY -#include "ecma-typedarray-object.h" #include "ecma-arraybuffer-object.h" +#include "ecma-typedarray-object.h" #endif /* JERRY_BUILTIN_TYPEDARRAY */ /** \addtogroup ecma ECMA @@ -54,8 +56,7 @@ * @param type object's implementation-defined type */ #ifndef JERRY_NDEBUG -#define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type) \ - JERRY_ASSERT (type < ECMA_OBJECT_TYPE__MAX); +#define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type) JERRY_ASSERT (type < ECMA_OBJECT_TYPE__MAX); #else /* JERRY_NDEBUG */ #define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type) #endif /* !JERRY_NDEBUG */ @@ -75,14 +76,12 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */ ecma_property_ref_t *property_ref_p, /**< property reference */ uint32_t options) /**< option bits */ { - JERRY_ASSERT (object_p != NULL - && !ecma_is_lexical_environment (object_p)); + JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p)); #if JERRY_BUILTIN_PROXY JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p)); #endif /* JERRY_BUILTIN_PROXY */ JERRY_ASSERT (property_name_p != NULL); - JERRY_ASSERT (options == ECMA_PROPERTY_GET_NO_OPTIONS - || property_ref_p != NULL); + JERRY_ASSERT (options == ECMA_PROPERTY_GET_NO_OPTIONS || property_ref_p != NULL); ecma_object_base_type_t base_type = ecma_get_object_base_type (object_p); @@ -407,9 +406,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */ ecma_value_t binding_value = ecma_op_get_binding_value (lex_env_p, name_p, true); - ecma_named_data_property_assign_value (object_p, - ECMA_PROPERTY_VALUE_PTR (property_p), - binding_value); + ecma_named_data_property_assign_value (object_p, ECMA_PROPERTY_VALUE_PTR (property_p), binding_value); ecma_free_value (binding_value); } } @@ -451,10 +448,8 @@ ecma_op_object_has_property (ecma_object_t *object_p, /**< the object */ #endif /* JERRY_BUILTIN_PROXY */ /* 2 - 3. */ - ecma_property_t property = ecma_op_object_get_own_property (object_p, - property_name_p, - NULL, - ECMA_PROPERTY_GET_NO_OPTIONS); + ecma_property_t property = + ecma_op_object_get_own_property (object_p, property_name_p, NULL, ECMA_PROPERTY_GET_NO_OPTIONS); if (property != ECMA_PROPERTY_TYPE_NOT_FOUND) { @@ -465,8 +460,7 @@ ecma_op_object_has_property (ecma_object_t *object_p, /**< the object */ } #endif /* JERRY_BUILTIN_TYPEDARRAY */ - JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP - || ECMA_PROPERTY_IS_FOUND (property)); + JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP || ECMA_PROPERTY_IS_FOUND (property)); return ecma_make_boolean_value (property != ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP); } @@ -497,8 +491,7 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */ ecma_object_t *object_p, /**< target object */ ecma_string_t *property_name_p) /**< property name */ { - JERRY_ASSERT (object_p != NULL - && !ecma_is_lexical_environment (object_p)); + JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p)); JERRY_ASSERT (property_name_p != NULL); JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p)); @@ -978,20 +971,11 @@ ecma_op_object_get_by_magic_id (ecma_object_t *object_p, /**< the object */ /** * Descriptor string for each global symbol */ -static const uint16_t ecma_global_symbol_descriptions[] = -{ - LIT_MAGIC_STRING_ASYNC_ITERATOR, - LIT_MAGIC_STRING_HAS_INSTANCE, - LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE, - LIT_MAGIC_STRING_ITERATOR, - LIT_MAGIC_STRING_MATCH, - LIT_MAGIC_STRING_REPLACE, - LIT_MAGIC_STRING_SEARCH, - LIT_MAGIC_STRING_SPECIES, - LIT_MAGIC_STRING_SPLIT, - LIT_MAGIC_STRING_TO_PRIMITIVE, - LIT_MAGIC_STRING_TO_STRING_TAG, - LIT_MAGIC_STRING_UNSCOPABLES, +static const uint16_t ecma_global_symbol_descriptions[] = { + LIT_MAGIC_STRING_ASYNC_ITERATOR, LIT_MAGIC_STRING_HAS_INSTANCE, LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE, + LIT_MAGIC_STRING_ITERATOR, LIT_MAGIC_STRING_MATCH, LIT_MAGIC_STRING_REPLACE, + LIT_MAGIC_STRING_SEARCH, LIT_MAGIC_STRING_SPECIES, LIT_MAGIC_STRING_SPLIT, + LIT_MAGIC_STRING_TO_PRIMITIVE, LIT_MAGIC_STRING_TO_STRING_TAG, LIT_MAGIC_STRING_UNSCOPABLES, LIT_MAGIC_STRING_MATCH_ALL, }; @@ -1047,8 +1031,7 @@ ecma_op_compare_string_to_global_symbol (ecma_string_t *string_p, /**< string to uint32_t symbol_index = (uint32_t) property_id - (uint32_t) LIT_GLOBAL_SYMBOL__FIRST; jmem_cpointer_t symbol_cp = JERRY_CONTEXT (global_symbols_cp)[symbol_index]; - return (symbol_cp != JMEM_CP_NULL - && string_p == ECMA_GET_NON_NULL_POINTER (ecma_string_t, symbol_cp)); + return (symbol_cp != JMEM_CP_NULL && string_p == ECMA_GET_NON_NULL_POINTER (ecma_string_t, symbol_cp)); } /* ecma_op_compare_string_to_global_symbol */ /** @@ -1177,10 +1160,7 @@ ecma_op_object_put_by_index (ecma_object_t *object_p, /**< the object */ { if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM)) { - return ecma_op_object_put (object_p, - ECMA_CREATE_DIRECT_UINT32_STRING (index), - value, - is_throw); + return ecma_op_object_put (object_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), value, is_throw); } ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index); @@ -1246,9 +1226,7 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */ ecma_property_descriptor_t prop_desc; /* 5.c */ - ecma_value_t status = ecma_op_object_get_own_property_descriptor (receiver_obj_p, - property_name_p, - &prop_desc); + ecma_value_t status = ecma_op_object_get_own_property_descriptor (receiver_obj_p, property_name_p, &prop_desc); /* 5.d */ if (ECMA_IS_VALUE_ERROR (status)) @@ -1293,12 +1271,8 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */ { ecma_property_descriptor_t desc; /* Based on: ES6 9.1.9 [[Set]] 4.d.i. / ES11 9.1.9.2 OrdinarySetWithOwnDescriptor 2.c.i. */ - desc.flags = (JERRY_PROP_IS_CONFIGURABLE - | JERRY_PROP_IS_CONFIGURABLE_DEFINED - | JERRY_PROP_IS_ENUMERABLE - | JERRY_PROP_IS_ENUMERABLE_DEFINED - | JERRY_PROP_IS_WRITABLE - | JERRY_PROP_IS_WRITABLE_DEFINED + desc.flags = (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE + | JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_VALUE_DEFINED); desc.value = value; ecma_value_t ret_value = ecma_proxy_object_define_own_property (receiver_obj_p, property_name_p, &desc); @@ -1356,8 +1330,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */ ecma_value_t receiver, /**< receiver */ bool is_throw) /**< flag that controls failure handling */ { - JERRY_ASSERT (object_p != NULL - && !ecma_is_lexical_environment (object_p)); + JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p)); JERRY_ASSERT (property_name_p != NULL); #if JERRY_BUILTIN_PROXY @@ -1578,9 +1551,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */ /* There is no need for special casing arrays here because changing the * value of an existing property never changes the length of an array. */ - ecma_named_data_property_assign_value (object_p, - ECMA_PROPERTY_VALUE_PTR (property_p), - value); + ecma_named_data_property_assign_value (object_p, ECMA_PROPERTY_VALUE_PTR (property_p), value); return ECMA_VALUE_TRUE; } } @@ -1614,18 +1585,12 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */ #if JERRY_BUILTIN_PROXY if (ECMA_OBJECT_IS_PROXY (proto_p)) { - return ecma_op_object_put_with_receiver (proto_p, - property_name_p, - value, - receiver, - is_throw); + return ecma_op_object_put_with_receiver (proto_p, property_name_p, value, receiver, is_throw); } #endif /* JERRY_BUILTIN_PROXY */ - ecma_property_t inherited_property = ecma_op_object_get_own_property (proto_p, - property_name_p, - &property_ref, - ECMA_PROPERTY_GET_NO_OPTIONS); + ecma_property_t inherited_property = + ecma_op_object_get_own_property (proto_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_NO_OPTIONS); if (ECMA_PROPERTY_IS_FOUND (inherited_property)) { @@ -1647,16 +1612,14 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */ } #if JERRY_BUILTIN_PROXY - if (create_new_property - && ecma_is_value_object (receiver) + if (create_new_property && ecma_is_value_object (receiver) && ECMA_OBJECT_IS_PROXY (ecma_get_object_from_value (receiver))) { return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw); } #endif /* JERRY_BUILTIN_PROXY */ - if (create_new_property - && ecma_op_ordinary_object_is_extensible (object_p)) + if (create_new_property && ecma_op_ordinary_object_is_extensible (object_p)) { const ecma_object_base_type_t obj_base_type = ecma_get_object_base_type (object_p); @@ -1674,13 +1637,11 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */ uint32_t index = ecma_string_get_array_index (property_name_p); - if (obj_base_type == ECMA_OBJECT_BASE_TYPE_ARRAY - && index != ECMA_STRING_NOT_ARRAY_INDEX) + if (obj_base_type == ECMA_OBJECT_BASE_TYPE_ARRAY && index != ECMA_STRING_NOT_ARRAY_INDEX) { ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p; - if (index < UINT32_MAX - && index >= ext_object_p->u.array.length) + if (index < UINT32_MAX && index >= ext_object_p->u.array.length) { if (!ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count)) { @@ -1712,10 +1673,8 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */ return ecma_raise_readonly_assignment (property_name_p, is_throw); } - ecma_value_t ret_value = ecma_op_function_call (ECMA_GET_NON_NULL_POINTER (ecma_object_t, setter_cp), - receiver, - &value, - 1); + ecma_value_t ret_value = + ecma_op_function_call (ECMA_GET_NON_NULL_POINTER (ecma_object_t, setter_cp), receiver, &value, 1); if (!ECMA_IS_VALUE_ERROR (ret_value)) { @@ -1742,7 +1701,8 @@ ecma_op_object_delete_by_index (ecma_object_t *obj_p, /**< the object */ { if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM)) { - return ecma_op_object_delete (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), is_throw);; + return ecma_op_object_delete (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), is_throw); + ; } ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index); @@ -1769,8 +1729,7 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */ ecma_string_t *property_name_p, /**< property name */ bool is_strict) /**< flag that controls failure handling */ { - JERRY_ASSERT (obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p)); JERRY_ASSERT (property_name_p != NULL); #if JERRY_BUILTIN_PROXY @@ -1782,9 +1741,7 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */ JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p)); - return ecma_op_general_object_delete (obj_p, - property_name_p, - is_strict); + return ecma_op_general_object_delete (obj_p, property_name_p, is_strict); } /* ecma_op_object_delete */ /** @@ -1800,8 +1757,7 @@ ecma_value_t ecma_op_object_default_value (ecma_object_t *obj_p, /**< the object */ ecma_preferred_type_hint_t hint) /**< hint on preferred result type */ { - JERRY_ASSERT (obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p)); JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p)); @@ -1839,8 +1795,7 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */ const ecma_property_descriptor_t *property_desc_p) /**< property * descriptor */ { - JERRY_ASSERT (obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p)); JERRY_ASSERT (property_name_p != NULL); const ecma_object_type_t type = ecma_get_object_type (obj_p); @@ -1918,10 +1873,8 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob ecma_property_ref_t property_ref; property_ref.virtual_value = ECMA_VALUE_EMPTY; - ecma_property_t property = ecma_op_object_get_own_property (object_p, - property_name_p, - &property_ref, - ECMA_PROPERTY_GET_VALUE); + ecma_property_t property = + ecma_op_object_get_own_property (object_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_VALUE); if (!ECMA_PROPERTY_IS_FOUND (property)) { @@ -1932,14 +1885,13 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob } #endif /* JERRY_BUILTIN_TYPEDARRAY */ - JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND - || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP); + JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP); return ECMA_VALUE_FALSE; } uint32_t flags = ecma_is_property_enumerable (property) ? JERRY_PROP_IS_ENUMERABLE : JERRY_PROP_NO_OPTS; - flags |= ecma_is_property_configurable (property) ? JERRY_PROP_IS_CONFIGURABLE: JERRY_PROP_NO_OPTS; + flags |= ecma_is_property_configurable (property) ? JERRY_PROP_IS_CONFIGURABLE : JERRY_PROP_NO_OPTS; prop_desc_p->flags = (uint16_t) (JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE_DEFINED | flags); @@ -1961,8 +1913,8 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob } prop_desc_p->flags |= (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED); - prop_desc_p->flags = (uint16_t) (prop_desc_p->flags | (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE - : JERRY_PROP_NO_OPTS)); + prop_desc_p->flags = (uint16_t) ( + prop_desc_p->flags | (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS)); } else { @@ -2029,8 +1981,7 @@ ecma_value_t ecma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */ ecma_value_t value) /**< argument 'V' */ { - JERRY_ASSERT (obj_p != NULL - && !ecma_is_lexical_environment (obj_p)); + JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p)); JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p)); @@ -2128,8 +2079,7 @@ ecma_op_object_is_prototype_of (ecma_object_t *base_p, /**< base object */ /* Advance up on prototype chain. */ target_p = proto_p; - } - while (true); + } while (true); } /* ecma_op_object_is_prototype_of */ /** @@ -2219,10 +2169,7 @@ ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p, /**< routine 0, names_buffer_p[i], ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); - ecma_builtin_helper_def_prop_by_index (entry_p, - 1, - value, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); + ecma_builtin_helper_def_prop_by_index (entry_p, 1, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); ecma_free_value (value); /* 4.a.ii.2.c.iii */ @@ -2405,7 +2352,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ } ecma_collection_t *prop_names_p = ecma_new_collection (); - ecma_property_counter_t prop_counter = {0, 0, 0}; + ecma_property_counter_t prop_counter = { 0, 0, 0 }; ecma_object_list_lazy_property_names (obj_p, prop_names_p, &prop_counter, filter); @@ -2440,8 +2387,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ { ecma_property_t *property_p = prop_iter_p->types + i; - if (!ECMA_PROPERTY_IS_RAW (*property_p) - || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN)) + if (!ECMA_PROPERTY_IS_RAW (*property_p) || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN)) { continue; } @@ -2455,8 +2401,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ continue; } - ecma_string_t *name_p = ecma_string_from_property_name (*property_p, - prop_pair_p->names_cp[i]); + ecma_string_t *name_p = ecma_string_from_property_name (*property_p, prop_pair_p->names_cp[i]); if (ecma_string_get_array_index (name_p) != ECMA_STRING_NOT_ARRAY_INDEX) { @@ -2518,8 +2463,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ #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) + if (prop_counter.symbol_named_props > 0 && (array_index_named_props + string_named_props) > 0) { memmove ((void *) string_current_p, (void *) (buffer_p + prop_counter.array_index_named_props + prop_counter.string_named_props), @@ -2527,8 +2471,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ } #endif /* JERRY_ESNEXT */ - if (prop_counter.string_named_props > 0 - && array_index_named_props > 0) + if (prop_counter.string_named_props > 0 && array_index_named_props > 0) { memmove ((void *) array_index_current_p, (void *) (buffer_p + prop_counter.array_index_named_props), @@ -2544,8 +2487,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ { ecma_property_t *property_p = prop_iter_p->types + i; - if (!ECMA_PROPERTY_IS_RAW (*property_p) - || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN)) + if (!ECMA_PROPERTY_IS_RAW (*property_p) || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN)) { continue; } @@ -2559,8 +2501,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ continue; } - ecma_string_t *name_p = ecma_string_from_property_name (*property_p, - prop_pair_p->names_cp[i]); + ecma_string_t *name_p = ecma_string_from_property_name (*property_p, prop_pair_p->names_cp[i]); if (ecma_string_get_array_index (name_p) != ECMA_STRING_NOT_ARRAY_INDEX) { @@ -2595,8 +2536,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ prop_iter_cp = prop_iter_p->next_property_cp; } - if (array_index_named_props > 1 - || (array_index_named_props == 1 && prop_counter.array_index_named_props > 0)) + if (array_index_named_props > 1 || (array_index_named_props == 1 && prop_counter.array_index_named_props > 0)) { uint32_t prev_value = 0; ecma_value_t *array_index_p = buffer_p + prop_counter.array_index_named_props; @@ -2619,8 +2559,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ do { ecma_op_object_heap_sort_shift_down (buffer_p, array_props, i); - } - while (i-- > 0); + } while (i-- > 0); i = array_props - 1; @@ -2631,15 +2570,13 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */ buffer_p[0] = tmp; ecma_op_object_heap_sort_shift_down (buffer_p, i, 0); - } - while (--i > 0); + } while (--i > 0); break; } prev_value = value; - } - while (array_index_p < array_index_end_p); + } while (array_index_p < array_index_end_p); } return prop_names_p; @@ -2774,8 +2711,7 @@ ecma_builtin_is (ecma_object_t *object_p, /**< pointer to an object */ { ecma_extended_object_t *built_in_object_p = (ecma_extended_object_t *) object_p; - return (built_in_object_p->u.built_in.id == builtin_id - && built_in_object_p->u.built_in.routine_id == 0); + return (built_in_object_p->u.built_in.id == builtin_id && built_in_object_p->u.built_in.routine_id == 0); } case ECMA_OBJECT_TYPE_BUILT_IN_CLASS: case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY: @@ -2874,8 +2810,7 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */ /** * Used by ecma_object_get_class_name to get the magic string id of class objects */ -static const uint16_t ecma_class_object_magic_string_id[] = -{ +static const uint16_t ecma_class_object_magic_string_id[] = { /* These objects require custom property resolving. */ LIT_MAGIC_STRING_STRING_UL, /**< magic string id of ECMA_OBJECT_CLASS_STRING */ LIT_MAGIC_STRING_ARGUMENTS_UL, /**< magic string id of ECMA_OBJECT_CLASS_ARGUMENTS */ @@ -2884,9 +2819,9 @@ static const uint16_t ecma_class_object_magic_string_id[] = #endif /* JERRY_BUILTIN_TYPEDARRAY */ #if JERRY_MODULE_SYSTEM LIT_MAGIC_STRING_MODULE_UL, /**< magic string id of ECMA_OBJECT_CLASS_MODULE_NAMESPACE */ -#endif +#endif /* JERRY_MODULE_SYSTEM */ - /* These objects are marked by Garbage Collector. */ +/* These objects are marked by Garbage Collector. */ #if JERRY_ESNEXT 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 */ @@ -2899,7 +2834,7 @@ static const uint16_t ecma_class_object_magic_string_id[] = #endif /* JERRY_ESNEXT */ #if JERRY_MODULE_SYSTEM LIT_MAGIC_STRING_MODULE_UL, /**< magic string id of ECMA_OBJECT_CLASS_MODULE */ -#endif +#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 */ @@ -3073,8 +3008,7 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */ } default: { - JERRY_ASSERT (type == ECMA_OBJECT_TYPE_GENERAL - || type == ECMA_OBJECT_TYPE_PROXY); + JERRY_ASSERT (type == ECMA_OBJECT_TYPE_GENERAL || type == ECMA_OBJECT_TYPE_PROXY); return LIT_MAGIC_STRING_OBJECT_UL; } @@ -3116,8 +3050,8 @@ ecma_op_is_concat_spreadable (ecma_value_t arg) /**< argument */ return ECMA_VALUE_FALSE; } - ecma_value_t spreadable = ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg), - LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE); + ecma_value_t spreadable = + ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg), LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE); if (ECMA_IS_VALUE_ERROR (spreadable)) { @@ -3152,8 +3086,7 @@ ecma_op_is_regexp (ecma_value_t arg) /**< argument */ return ECMA_VALUE_FALSE; } - ecma_value_t is_regexp = ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg), - LIT_GLOBAL_SYMBOL_MATCH); + ecma_value_t is_regexp = ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg), LIT_GLOBAL_SYMBOL_MATCH); if (ECMA_IS_VALUE_ERROR (is_regexp)) { @@ -3452,10 +3385,8 @@ ecma_op_ordinary_object_has_own_property (ecma_object_t *object_p, /**< the obje { JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p)); - ecma_property_t property = ecma_op_object_get_own_property (object_p, - property_name_p, - NULL, - ECMA_PROPERTY_GET_NO_OPTIONS); + ecma_property_t property = + ecma_op_object_get_own_property (object_p, property_name_p, NULL, ECMA_PROPERTY_GET_NO_OPTIONS); #if JERRY_BUILTIN_TYPEDARRAY if (JERRY_UNLIKELY (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_THROW)) @@ -3464,8 +3395,7 @@ ecma_op_ordinary_object_has_own_property (ecma_object_t *object_p, /**< the obje } #endif /* JERRY_BUILTIN_TYPEDARRAY */ - JERRY_ASSERT (ECMA_PROPERTY_IS_FOUND (property) - || property == ECMA_PROPERTY_TYPE_NOT_FOUND + JERRY_ASSERT (ECMA_PROPERTY_IS_FOUND (property) || property == ECMA_PROPERTY_TYPE_NOT_FOUND || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP); return ecma_make_boolean_value (ECMA_PROPERTY_IS_FOUND (property)); @@ -3530,8 +3460,8 @@ ecma_op_object_unref_weak (ecma_object_t *object_p, /**< this argument */ ecma_property_t *property_p = ecma_find_named_property (object_p, weak_refs_string_p); JERRY_ASSERT (property_p != NULL); - ecma_collection_t *refs_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, - ECMA_PROPERTY_VALUE_PTR (property_p)->value); + ecma_collection_t *refs_p = + ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, ECMA_PROPERTY_VALUE_PTR (property_p)->value); ecma_value_t *buffer_p = refs_p->buffer_p; while (true) diff --git a/jerry-core/ecma/operations/ecma-objects.h b/jerry-core/ecma/operations/ecma-objects.h index 3044cde1..c4382cb2 100644 --- a/jerry-core/ecma/operations/ecma-objects.h +++ b/jerry-core/ecma/operations/ecma-objects.h @@ -37,35 +37,34 @@ /** * Reject with TypeError depending on 'is_throw' with the given message */ -#define ECMA_REJECT(is_throw, msg) \ - ((is_throw) ? ecma_raise_type_error (msg) : ECMA_VALUE_FALSE) +#define ECMA_REJECT(is_throw, msg) ((is_throw) ? ecma_raise_type_error (msg) : ECMA_VALUE_FALSE) #else /* !JERRY_ERROR_MESSAGES */ /** * Reject with TypeError depending on is_throw flags wit the given format */ -#define ECMA_REJECT_WITH_FORMAT(is_throw, msg, ...) \ - ECMA_REJECT((is_throw), (msg)) +#define ECMA_REJECT_WITH_FORMAT(is_throw, msg, ...) ECMA_REJECT ((is_throw), (msg)) /** * Reject with TypeError depending on is_throw flags wit the given message */ -#define ECMA_REJECT(is_throw, msg) \ - ((is_throw) ? ecma_raise_type_error (NULL) : ECMA_VALUE_FALSE) +#define ECMA_REJECT(is_throw, msg) ((is_throw) ? ecma_raise_type_error (NULL) : ECMA_VALUE_FALSE) #endif /* JERRY_ERROR_MESSAGES */ ecma_value_t ecma_raise_property_redefinition (ecma_string_t *property_name_p, uint16_t flags); ecma_value_t ecma_raise_readonly_assignment (ecma_string_t *property_name_p, bool is_throw); -ecma_property_t ecma_op_object_get_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p, - ecma_property_ref_t *property_ref_p, uint32_t options); +ecma_property_t ecma_op_object_get_own_property (ecma_object_t *object_p, + ecma_string_t *property_name_p, + ecma_property_ref_t *property_ref_p, + uint32_t options); ecma_value_t ecma_op_ordinary_object_has_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p); ecma_value_t ecma_op_object_has_property (ecma_object_t *object_p, ecma_string_t *property_name_p); ecma_value_t ecma_op_object_find_own (ecma_value_t base_value, ecma_object_t *object_p, ecma_string_t *property_name_p); ecma_value_t ecma_op_object_find (ecma_object_t *object_p, ecma_string_t *property_name_p); ecma_value_t ecma_op_object_find_by_index (ecma_object_t *object_p, ecma_length_t index); ecma_value_t ecma_op_object_get (ecma_object_t *object_p, ecma_string_t *property_name_p); -ecma_value_t ecma_op_object_get_with_receiver (ecma_object_t *object_p, ecma_string_t *property_name_p, - ecma_value_t receiver); +ecma_value_t +ecma_op_object_get_with_receiver (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t receiver); 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); @@ -76,27 +75,35 @@ ecma_value_t ecma_op_object_get_by_symbol_id (ecma_object_t *object_p, lit_magic 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, ecma_value_t receiver, bool is_throw); -ecma_value_t ecma_op_object_put (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t value, - bool is_throw); -ecma_value_t ecma_op_object_put_with_receiver (ecma_object_t *object_p, ecma_string_t *property_name_p, - ecma_value_t value, ecma_value_t receiver, bool is_throw); -ecma_value_t ecma_op_object_put_by_index (ecma_object_t *object_p, ecma_length_t index, - ecma_value_t value, bool is_throw); +ecma_value_t ecma_op_object_put_with_receiver (ecma_object_t *object_p, + ecma_string_t *property_name_p, + ecma_value_t value, + ecma_value_t receiver, + bool is_throw); +ecma_value_t +ecma_op_object_put (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t value, bool is_throw); +ecma_value_t ecma_op_object_put_with_receiver (ecma_object_t *object_p, + ecma_string_t *property_name_p, + ecma_value_t value, + ecma_value_t receiver, + bool is_throw); +ecma_value_t +ecma_op_object_put_by_index (ecma_object_t *object_p, ecma_length_t index, ecma_value_t value, bool is_throw); ecma_value_t ecma_op_object_delete (ecma_object_t *obj_p, ecma_string_t *property_name_p, bool is_throw); ecma_value_t ecma_op_object_delete_by_index (ecma_object_t *obj_p, ecma_length_t index, bool is_throw); ecma_value_t ecma_op_object_default_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint); -ecma_value_t ecma_op_object_define_own_property (ecma_object_t *obj_p, ecma_string_t *property_name_p, +ecma_value_t ecma_op_object_define_own_property (ecma_object_t *obj_p, + ecma_string_t *property_name_p, const ecma_property_descriptor_t *property_desc_p); -ecma_value_t ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, ecma_string_t *property_name_p, +ecma_value_t ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, + ecma_string_t *property_name_p, ecma_property_descriptor_t *prop_desc_p); ecma_value_t ecma_op_object_has_instance (ecma_object_t *obj_p, ecma_value_t value); ecma_object_t *ecma_op_object_get_prototype_of (ecma_object_t *obj_p); ecma_value_t ecma_op_object_is_prototype_of (ecma_object_t *base_p, ecma_object_t *target_p); -ecma_collection_t * ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p, - ecma_enumerable_property_names_options_t option); +ecma_collection_t *ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p, + ecma_enumerable_property_names_options_t option); ecma_collection_t *ecma_op_object_own_property_keys (ecma_object_t *obj_p, jerry_property_filter_t filter); ecma_collection_t *ecma_op_object_enumerate (ecma_object_t *obj_p); @@ -108,17 +115,21 @@ bool ecma_object_is_regexp_object (ecma_value_t arg); ecma_value_t ecma_op_is_concat_spreadable (ecma_value_t arg); ecma_value_t ecma_op_is_regexp (ecma_value_t arg); ecma_value_t ecma_op_species_constructor (ecma_object_t *this_value, ecma_builtin_id_t default_constructor_id); -ecma_value_t ecma_op_invoke_by_symbol_id (ecma_value_t object, lit_magic_string_id_t magic_string_id, - ecma_value_t *args_p, uint32_t args_len); +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); #endif /* JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER */ -ecma_value_t ecma_op_invoke (ecma_value_t object, ecma_string_t *property_name_p, ecma_value_t *args_p, - uint32_t args_len); -ecma_value_t ecma_op_invoke_by_magic_id (ecma_value_t object, lit_magic_string_id_t magic_string_id, - ecma_value_t *args_p, uint32_t args_len); +ecma_value_t +ecma_op_invoke (ecma_value_t object, ecma_string_t *property_name_p, ecma_value_t *args_p, uint32_t args_len); +ecma_value_t ecma_op_invoke_by_magic_id (ecma_value_t object, + lit_magic_string_id_t magic_string_id, + ecma_value_t *args_p, + uint32_t args_len); jmem_cpointer_t ecma_op_ordinary_object_get_prototype_of (ecma_object_t *obj_p); ecma_value_t ecma_op_ordinary_object_set_prototype_of (ecma_object_t *base_p, ecma_value_t proto); diff --git a/jerry-core/ecma/operations/ecma-promise-object.c b/jerry-core/ecma/operations/ecma-promise-object.c index a1966dd6..e23112ce 100644 --- a/jerry-core/ecma/operations/ecma-promise-object.c +++ b/jerry-core/ecma/operations/ecma-promise-object.c @@ -13,20 +13,22 @@ * limitations under the License. */ +#include "ecma-promise-object.h" + #include "ecma-alloc.h" #include "ecma-array-object.h" #include "ecma-boolean-object.h" -#include "ecma-builtins.h" #include "ecma-builtin-handlers.h" +#include "ecma-builtins.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-jobqueue.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" -#include "ecma-promise-object.h" +#include "ecma-objects.h" + #include "jcontext.h" #if JERRY_ESNEXT @@ -105,8 +107,8 @@ ecma_promise_set_state (ecma_object_t *obj_p, /**< points to promise object */ JERRY_ASSERT (ecma_is_promise (obj_p)); JERRY_ASSERT (ecma_promise_get_flags (obj_p) & ECMA_PROMISE_IS_PENDING); - uint8_t flags_to_invert = (is_fulfilled ? (ECMA_PROMISE_IS_PENDING | ECMA_PROMISE_IS_FULFILLED) - : ECMA_PROMISE_IS_PENDING); + uint8_t flags_to_invert = + (is_fulfilled ? (ECMA_PROMISE_IS_PENDING | ECMA_PROMISE_IS_FULFILLED) : ECMA_PROMISE_IS_PENDING); ((ecma_extended_object_t *) obj_p)->u.cls.u1.promise_flags ^= flags_to_invert; } /* ecma_promise_set_state */ @@ -198,10 +200,8 @@ ecma_reject_promise (ecma_value_t promise, /**< promise */ if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_REJECT)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_REJECT, - promise, - reason, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_REJECT, promise, reason, JERRY_CONTEXT (promise_callback_user_p)); } #endif /* JERRY_PROMISE_CALLBACK */ @@ -224,10 +224,8 @@ ecma_reject_promise (ecma_value_t promise, /**< promise */ if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER, - promise, - reason, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER, promise, reason, JERRY_CONTEXT (promise_callback_user_p)); } } #endif /* JERRY_PROMISE_CALLBACK */ @@ -285,10 +283,8 @@ ecma_fulfill_promise (ecma_value_t promise, /**< promise */ if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_RESOLVE)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_RESOLVE, - promise, - value, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_RESOLVE, promise, value, JERRY_CONTEXT (promise_callback_user_p)); } #endif /* JERRY_PROMISE_CALLBACK */ @@ -330,10 +326,8 @@ ecma_reject_promise_with_checks (ecma_value_t promise, /**< promise */ if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_REJECT_FULFILLED, - promise, - reason, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_REJECT_FULFILLED, promise, reason, JERRY_CONTEXT (promise_callback_user_p)); } #endif /* JERRY_PROMISE_CALLBACK */ @@ -370,10 +364,8 @@ ecma_fulfill_promise_with_checks (ecma_value_t promise, /**< promise */ if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_RESOLVE_FULFILLED, - promise, - value, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_RESOLVE_FULFILLED, promise, value, JERRY_CONTEXT (promise_callback_user_p)); } #endif /* JERRY_PROMISE_CALLBACK */ @@ -450,16 +442,11 @@ ecma_promise_run_executor (ecma_object_t *promise_p, /**< Promise Object */ ecma_value_t this_value) /**< this value */ { ecma_object_t *resolve_func_p, *reject_func_p; - resolve_func_p = ecma_promise_create_resolving_function (promise_p, - ECMA_NATIVE_HANDLER_PROMISE_RESOLVE); - reject_func_p = ecma_promise_create_resolving_function (promise_p, - ECMA_NATIVE_HANDLER_PROMISE_REJECT); + resolve_func_p = ecma_promise_create_resolving_function (promise_p, ECMA_NATIVE_HANDLER_PROMISE_RESOLVE); + reject_func_p = ecma_promise_create_resolving_function (promise_p, ECMA_NATIVE_HANDLER_PROMISE_REJECT); ecma_value_t argv[] = { ecma_make_object_value (resolve_func_p), ecma_make_object_value (reject_func_p) }; - ecma_value_t result = ecma_op_function_call (ecma_get_object_from_value (executor), - this_value, - argv, - 2); + ecma_value_t result = ecma_op_function_call (ecma_get_object_from_value (executor), this_value, argv, 2); ecma_deref_object (resolve_func_p); ecma_deref_object (reject_func_p); @@ -487,8 +474,7 @@ ecma_op_create_promise_object (ecma_value_t executor, /**< the executor function } /* 3. */ - ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (new_target_p, - ECMA_BUILTIN_ID_PROMISE_PROTOTYPE); + ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (new_target_p, ECMA_BUILTIN_ID_PROMISE_PROTOTYPE); if (JERRY_UNLIKELY (proto_p == NULL)) { @@ -499,9 +485,7 @@ ecma_op_create_promise_object (ecma_value_t executor, /**< the executor function * allocation is performed before the object is constructed. */ ecma_collection_t *reactions = ecma_new_collection (); - ecma_object_t *object_p = ecma_create_object (proto_p, - sizeof (ecma_promise_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_promise_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_deref_object (proto_p); ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p; ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_PROMISE; @@ -517,10 +501,8 @@ ecma_op_create_promise_object (ecma_value_t executor, /**< the executor function if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_CREATE)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_CREATE, - ecma_make_object_value (object_p), - parent, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_CREATE, ecma_make_object_value (object_p), parent, JERRY_CONTEXT (promise_callback_user_p)); } #endif /* JERRY_PROMISE_CALLBACK */ @@ -634,9 +616,8 @@ ecma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p, /**< data_propery_name = LIT_MAGIC_STRING_VALUE; } - ecma_object_t *obj_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), - 0, - ECMA_OBJECT_TYPE_GENERAL); + ecma_object_t *obj_p = + ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL); ecma_property_value_t *prop_value_p; prop_value_p = ecma_create_named_data_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_STATUS), @@ -659,7 +640,7 @@ ecma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p, /**< ecma_value_t obj_val = ecma_make_object_value (obj_p); /* 12. */ ecma_op_object_put_by_index (ecma_get_object_from_value (executor_p->values), - (uint32_t) (executor_p->index - 1), + (uint32_t) (executor_p->index - 1), obj_val, false); ecma_deref_object (obj_p); @@ -676,10 +657,8 @@ ecma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p, /**< if (promise_type == ECMA_PROMISE_ANY_REJECT) { ecma_value_t error_val = ecma_new_aggregate_error (executor_p->values, ECMA_VALUE_UNDEFINED); - ret = ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), - ECMA_VALUE_UNDEFINED, - &error_val, - 1); + ret = + ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), ECMA_VALUE_UNDEFINED, &error_val, 1); ecma_free_value (error_val); } else @@ -842,9 +821,7 @@ ecma_promise_reject_or_resolve (ecma_value_t this_arg, /**< "this" argument */ return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } - if (is_resolve - && ecma_is_value_object (value) - && ecma_is_promise (ecma_get_object_from_value (value))) + if (is_resolve && ecma_is_value_object (value) && ecma_is_promise (ecma_get_object_from_value (value))) { ecma_object_t *object_p = ecma_get_object_from_value (value); ecma_value_t constructor = ecma_op_object_get_by_magic_id (object_p, LIT_MAGIC_STRING_CONSTRUCTOR); @@ -875,10 +852,7 @@ ecma_promise_reject_or_resolve (ecma_value_t this_arg, /**< "this" argument */ ecma_value_t func = is_resolve ? capability_p->resolve : capability_p->reject; - ecma_value_t call_ret = ecma_op_function_call (ecma_get_object_from_value (func), - ECMA_VALUE_UNDEFINED, - &value, - 1); + ecma_value_t call_ret = ecma_op_function_call (ecma_get_object_from_value (func), ECMA_VALUE_UNDEFINED, &value, 1); if (ECMA_IS_VALUE_ERROR (call_ret)) { @@ -1001,10 +975,8 @@ ecma_promise_then_catch_finally_helper (ecma_object_t *function_obj_p, /**< func JERRY_ASSERT (ecma_op_is_callable (finally_func_obj->on_finally)); /* 4. */ - ecma_value_t result = ecma_op_function_call (ecma_get_object_from_value (finally_func_obj->on_finally), - ECMA_VALUE_UNDEFINED, - NULL, - 0); + ecma_value_t result = + ecma_op_function_call (ecma_get_object_from_value (finally_func_obj->on_finally), ECMA_VALUE_UNDEFINED, NULL, 0); if (ECMA_IS_VALUE_ERROR (result)) { @@ -1112,14 +1084,14 @@ ecma_promise_finally (ecma_value_t promise, /**< the promise which call 'finally if (!ecma_op_is_callable (on_finally)) { ecma_free_value (species); - ecma_value_t invoke_args[2] = {on_finally, on_finally}; + ecma_value_t invoke_args[2] = { on_finally, on_finally }; return ecma_op_invoke_by_magic_id (promise, LIT_MAGIC_STRING_THEN, invoke_args, 2); } /* 6.a-b */ ecma_object_t *then_finally_obj_p; - then_finally_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY, - sizeof (ecma_promise_finally_function_t)); + then_finally_obj_p = + ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY, sizeof (ecma_promise_finally_function_t)); /* 6.c-d */ ecma_promise_finally_function_t *then_finally_func_obj_p = (ecma_promise_finally_function_t *) then_finally_obj_p; @@ -1128,8 +1100,8 @@ ecma_promise_finally (ecma_value_t promise, /**< the promise which call 'finally /* 6.e-f */ ecma_object_t *catch_finally_obj_p; - catch_finally_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY, - sizeof (ecma_promise_finally_function_t)); + catch_finally_obj_p = + ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY, sizeof (ecma_promise_finally_function_t)); /* 6.g-h */ ecma_promise_finally_function_t *catch_finally_func_obj = (ecma_promise_finally_function_t *) catch_finally_obj_p; @@ -1139,11 +1111,8 @@ ecma_promise_finally (ecma_value_t promise, /**< the promise which call 'finally ecma_deref_object (ecma_get_object_from_value (species)); /* 7. */ - ecma_value_t invoke_args[2] = - { - ecma_make_object_value (then_finally_obj_p), - ecma_make_object_value (catch_finally_obj_p) - }; + ecma_value_t invoke_args[2] = { ecma_make_object_value (then_finally_obj_p), + ecma_make_object_value (catch_finally_obj_p) }; ecma_value_t ret_value = ecma_op_invoke_by_magic_id (promise, LIT_MAGIC_STRING_THEN, invoke_args, 2); @@ -1164,10 +1133,8 @@ ecma_promise_async_then (ecma_value_t promise, /**< promise object */ if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ASYNC_MAIN)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_ASYNC_AWAIT, - executable_object, - promise, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_ASYNC_AWAIT, executable_object, promise, JERRY_CONTEXT (promise_callback_user_p)); } #endif /* JERRY_PROMISE_CALLBACK */ @@ -1196,10 +1163,8 @@ ecma_promise_async_then (ecma_value_t promise, /**< promise object */ if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED, - promise, - ECMA_VALUE_UNDEFINED, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED, promise, ECMA_VALUE_UNDEFINED, JERRY_CONTEXT (promise_callback_user_p)); } } #endif /* JERRY_PROMISE_CALLBACK */ @@ -1252,10 +1217,8 @@ ecma_op_if_abrupt_reject_promise (ecma_value_t *value_p, /**< [in - out] complet ecma_value_t reason = jcontext_take_exception (); ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p; - ecma_value_t call_ret = ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), - ECMA_VALUE_UNDEFINED, - &reason, - 1); + ecma_value_t call_ret = + ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), ECMA_VALUE_UNDEFINED, &reason, 1); ecma_free_value (reason); if (ECMA_IS_VALUE_ERROR (call_ret)) @@ -1354,10 +1317,11 @@ ecma_promise_perform_then (ecma_value_t promise, /**< the promise which call 'th if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR)) { JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL); - JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED, - promise, - ECMA_VALUE_UNDEFINED, - JERRY_CONTEXT (promise_callback_user_p)); + JERRY_CONTEXT (promise_callback) + (JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED, + promise, + ECMA_VALUE_UNDEFINED, + JERRY_CONTEXT (promise_callback_user_p)); } } #endif /* JERRY_PROMISE_CALLBACK */ diff --git a/jerry-core/ecma/operations/ecma-promise-object.h b/jerry-core/ecma/operations/ecma-promise-object.h index df9cb2ce..54c88d9a 100644 --- a/jerry-core/ecma/operations/ecma-promise-object.h +++ b/jerry-core/ecma/operations/ecma-promise-object.h @@ -16,9 +16,10 @@ #ifndef ECMA_PROMISE_OBJECT_H #define ECMA_PROMISE_OBJECT_H -#if JERRY_ESNEXT #include "ecma-globals.h" +#if JERRY_ESNEXT + /** \addtogroup ecma ECMA * @{ * @@ -96,8 +97,7 @@ typedef struct */ bool ecma_is_promise (ecma_object_t *obj_p); -ecma_value_t ecma_op_create_promise_object (ecma_value_t executor, ecma_value_t parent, - ecma_object_t *new_target_p); +ecma_value_t ecma_op_create_promise_object (ecma_value_t executor, ecma_value_t parent, ecma_object_t *new_target_p); uint8_t ecma_promise_get_flags (ecma_object_t *promise_p); ecma_value_t ecma_promise_get_result (ecma_object_t *promise_p); void ecma_reject_promise (ecma_value_t promise, ecma_value_t reason); @@ -108,22 +108,24 @@ ecma_object_t *ecma_promise_new_capability (ecma_value_t constructor, ecma_value ecma_value_t ecma_promise_reject_or_resolve (ecma_value_t this_arg, ecma_value_t value, bool is_resolve); ecma_value_t ecma_promise_then (ecma_value_t promise, ecma_value_t on_fulfilled, ecma_value_t on_rejected); -ecma_value_t ecma_value_thunk_helper_cb (ecma_object_t *function_obj_p, - const ecma_value_t args_p[], const uint32_t args_count); -ecma_value_t ecma_value_thunk_thrower_cb (ecma_object_t *function_obj_p, - const ecma_value_t args_p[], const uint32_t args_count); -ecma_value_t ecma_promise_then_finally_cb (ecma_object_t *function_obj_p, - const ecma_value_t args_p[], const uint32_t args_count); -ecma_value_t ecma_promise_catch_finally_cb (ecma_object_t *function_obj_p, - const ecma_value_t args_p[], const uint32_t args_count); -ecma_value_t ecma_promise_reject_handler (ecma_object_t *function_obj_p, - const ecma_value_t argv[], const uint32_t args_count); -ecma_value_t ecma_promise_resolve_handler (ecma_object_t *function_obj_p, - const ecma_value_t argv[], const uint32_t args_count); +ecma_value_t +ecma_value_thunk_helper_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count); +ecma_value_t +ecma_value_thunk_thrower_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count); +ecma_value_t +ecma_promise_then_finally_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count); +ecma_value_t +ecma_promise_catch_finally_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count); +ecma_value_t +ecma_promise_reject_handler (ecma_object_t *function_obj_p, const ecma_value_t argv[], const uint32_t args_count); +ecma_value_t +ecma_promise_resolve_handler (ecma_object_t *function_obj_p, const ecma_value_t argv[], const uint32_t args_count); ecma_value_t ecma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p, - const ecma_value_t args_p[], const uint32_t args_count); + const ecma_value_t args_p[], + const uint32_t args_count); ecma_value_t ecma_op_get_capabilities_executor_cb (ecma_object_t *function_obj_p, - const ecma_value_t args_p[], const uint32_t args_count); + const ecma_value_t args_p[], + const uint32_t args_count); ecma_value_t ecma_promise_finally (ecma_value_t promise, ecma_value_t on_finally); void ecma_promise_async_then (ecma_value_t promise, ecma_value_t executable_object); diff --git a/jerry-core/ecma/operations/ecma-proxy-object.c b/jerry-core/ecma/operations/ecma-proxy-object.c index 744805cb..5d218106 100644 --- a/jerry-core/ecma/operations/ecma-proxy-object.c +++ b/jerry-core/ecma/operations/ecma-proxy-object.c @@ -13,19 +13,21 @@ * limitations under the License. */ +#include "ecma-proxy-object.h" + #include "ecma-alloc.h" #include "ecma-array-object.h" -#include "ecma-builtins.h" #include "ecma-builtin-handlers.h" #include "ecma-builtin-object.h" +#include "ecma-builtins.h" #include "ecma-exceptions.h" #include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" -#include "ecma-proxy-object.h" +#include "ecma-objects.h" + #include "jcontext.h" /** \addtogroup ecma ECMA @@ -162,8 +164,7 @@ ecma_proxy_create_revocable (ecma_value_t target, /**< target argument */ /* 3. */ ecma_object_t *func_obj_p; - func_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROXY_REVOKE, - sizeof (ecma_revocable_proxy_object_t)); + func_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROXY_REVOKE, sizeof (ecma_revocable_proxy_object_t)); /* 4. */ ecma_revocable_proxy_object_t *rev_proxy_p = (ecma_revocable_proxy_object_t *) func_obj_p; @@ -173,9 +174,8 @@ ecma_proxy_create_revocable (ecma_value_t target, /**< target argument */ ecma_value_t revoker = ecma_make_object_value (func_obj_p); /* 5. */ - ecma_object_t *obj_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), - 0, - ECMA_OBJECT_TYPE_GENERAL); + ecma_object_t *obj_p = + ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL); /* 6. */ prop_value_p = ecma_create_named_data_property (obj_p, @@ -640,8 +640,7 @@ ecma_proxy_object_prevent_extensions (ecma_object_t *obj_p) /**< proxy object */ ecma_free_value (trap_result); /* 10. */ - if (boolean_trap_result - && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)) + if (boolean_trap_result && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)) { ecma_value_t target_is_ext = ecma_builtin_object_object_is_extensible (target_obj_p); @@ -834,7 +833,7 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy is_extensible); bool target_has_desc = ecma_is_value_true (target_status); - bool target_is_writable = (target_desc.flags & JERRY_PROP_IS_WRITABLE) ; + bool target_is_writable = (target_desc.flags & JERRY_PROP_IS_WRITABLE); bool target_is_configurable = false; if (target_has_desc) @@ -855,10 +854,8 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy { const uint16_t mask = (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE); - if (!target_has_desc - || target_is_configurable - || ((prop_desc_p->flags & mask) == JERRY_PROP_IS_WRITABLE_DEFINED - && target_is_writable)) + if (!target_has_desc || target_is_configurable + || ((prop_desc_p->flags & mask) == JERRY_PROP_IS_WRITABLE_DEFINED && target_is_writable)) { ecma_free_property_descriptor (prop_desc_p); return ecma_raise_type_error (ECMA_ERR_MSG ("The two descriptors are incompatible")); @@ -917,7 +914,7 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object * ecma_object_t *func_obj_p = ecma_get_object_from_value (trap); ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p); ecma_value_t desc_obj_value = ecma_make_object_value (desc_obj); - ecma_value_t args[] = {target, prop_value, desc_obj_value}; + ecma_value_t args[] = { target, prop_value, desc_obj_value }; /* 10. */ ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 3); @@ -976,8 +973,8 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object * } /* 17. */ - bool setting_config_false = ((prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED) - && !(prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE)); + bool setting_config_false = + ((prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED) && !(prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE)); /* 19. */ if (!target_prop_found) @@ -1012,7 +1009,7 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object * /* ES11: 16.c */ else if ((target_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED)) != 0 && (prop_desc_p->flags & (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE)) - == JERRY_PROP_IS_WRITABLE_DEFINED + == JERRY_PROP_IS_WRITABLE_DEFINED && (target_desc.flags & (JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_CONFIGURABLE)) == JERRY_PROP_IS_WRITABLE) { @@ -1076,7 +1073,7 @@ ecma_proxy_object_has (ecma_object_t *obj_p, /**< proxy object */ ecma_object_t *func_obj_p = ecma_get_object_from_value (trap); ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p); - ecma_value_t args[] = {target, prop_value}; + ecma_value_t args[] = { target, prop_value }; /* 9. */ ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 2); @@ -1094,8 +1091,7 @@ ecma_proxy_object_has (ecma_object_t *obj_p, /**< proxy object */ ecma_free_value (trap_result); /* 11. */ - if (!boolean_trap_result - && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)) + if (!boolean_trap_result && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)) { ecma_property_descriptor_t target_desc; @@ -1189,8 +1185,7 @@ ecma_proxy_object_get (ecma_object_t *obj_p, /**< proxy object */ ecma_deref_object (func_obj_p); /* 10. */ - if (ECMA_IS_VALUE_ERROR (trap_result) - || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)) + if (ECMA_IS_VALUE_ERROR (trap_result) || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)) { return trap_result; } @@ -1211,17 +1206,14 @@ ecma_proxy_object_get (ecma_object_t *obj_p, /**< proxy object */ { ecma_value_t ret_value = ECMA_VALUE_EMPTY; - if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED) - && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE) - && !(target_desc.flags & JERRY_PROP_IS_WRITABLE) - && !ecma_op_same_value (trap_result, target_desc.value)) + if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE) + && !(target_desc.flags & JERRY_PROP_IS_WRITABLE) && !ecma_op_same_value (trap_result, target_desc.value)) { ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incorrect value is returned by a Proxy 'get' trap")); } else if (!(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE) && (target_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)) - && target_desc.get_p == NULL - && !ecma_is_value_undefined (trap_result)) + && target_desc.get_p == NULL && !ecma_is_value_undefined (trap_result)) { ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Property of a Proxy is non-configurable and " "does not have a getter function")); @@ -1338,10 +1330,8 @@ ecma_proxy_object_set (ecma_object_t *obj_p, /**< proxy object */ { ecma_value_t ret_value = ECMA_VALUE_EMPTY; - if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED) - && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE) - && !(target_desc.flags & JERRY_PROP_IS_WRITABLE) - && !ecma_op_same_value (value, target_desc.value)) + if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE) + && !(target_desc.flags & JERRY_PROP_IS_WRITABLE) && !ecma_op_same_value (value, target_desc.value)) { ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incorrect value is returned by a Proxy 'set' trap")); } @@ -1650,8 +1640,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */ ecma_free_value (trap_result_array); - if (trap_result == NULL - || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)) + if (trap_result == NULL || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)) { return trap_result; } @@ -1697,9 +1686,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */ ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (target_keys->buffer_p[i]); - ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p, - prop_name_p, - &target_desc); + ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p, prop_name_p, &target_desc); if (ECMA_IS_VALUE_ERROR (status)) { @@ -1709,8 +1696,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */ ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p); - if (ecma_is_value_true (status) - && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)) + if (ecma_is_value_true (status) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)) { ecma_collection_push_back (target_non_configurable_keys, prop_value); } @@ -1806,7 +1792,7 @@ ecma_proxy_object_call (ecma_object_t *obj_p, /**< proxy object */ /* 8. */ ecma_value_t args_array = ecma_op_new_array_object_from_buffer (args_p, argc); - ecma_value_t value_array[] = {target, this_argument, args_array}; + ecma_value_t value_array[] = { target, this_argument, args_array }; ecma_object_t *func_obj_p = ecma_get_object_from_value (trap); /* 9. */ ecma_value_t ret_value = ecma_op_function_call (func_obj_p, handler, value_array, 3); @@ -1836,7 +1822,7 @@ ecma_proxy_object_construct (ecma_object_t *obj_p, /**< proxy object */ JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p)); ECMA_CHECK_STACK_USAGE (); - ecma_proxy_object_t * proxy_obj_p = (ecma_proxy_object_t *) obj_p; + ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p; /* 1. */ ecma_value_t handler = proxy_obj_p->handler; @@ -1868,7 +1854,7 @@ ecma_proxy_object_construct (ecma_object_t *obj_p, /**< proxy object */ ecma_object_t *func_obj_p = ecma_get_object_from_value (trap); ecma_value_t new_target_value = ecma_make_object_value (new_target_p); - ecma_value_t function_call_args[] = {target, args_array, new_target_value}; + ecma_value_t function_call_args[] = { target, args_array, new_target_value }; /* 9. */ ecma_value_t new_obj = ecma_op_function_call (func_obj_p, handler, function_call_args, 3); diff --git a/jerry-core/ecma/operations/ecma-proxy-object.h b/jerry-core/ecma/operations/ecma-proxy-object.h index 1fa23522..82537bca 100644 --- a/jerry-core/ecma/operations/ecma-proxy-object.h +++ b/jerry-core/ecma/operations/ecma-proxy-object.h @@ -27,84 +27,54 @@ #if JERRY_BUILTIN_PROXY -ecma_object_t * -ecma_proxy_create (ecma_value_t target, - ecma_value_t handler, - uint32_t options); +ecma_object_t *ecma_proxy_create (ecma_value_t target, ecma_value_t handler, uint32_t options); -ecma_object_t * -ecma_proxy_create_revocable (ecma_value_t target, - ecma_value_t handler); +ecma_object_t *ecma_proxy_create_revocable (ecma_value_t target, ecma_value_t handler); ecma_value_t -ecma_proxy_revoke_cb (ecma_object_t *function_obj_p, - const ecma_value_t args_p[], - const uint32_t args_count); +ecma_proxy_revoke_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count); -ecma_value_t -ecma_proxy_object_find (ecma_object_t *obj_p, - ecma_string_t *prop_name_p); +ecma_value_t ecma_proxy_object_find (ecma_object_t *obj_p, ecma_string_t *prop_name_p); /* Interal operations */ -ecma_value_t -ecma_proxy_object_get_prototype_of (ecma_object_t *obj_p); +ecma_value_t ecma_proxy_object_get_prototype_of (ecma_object_t *obj_p); -ecma_value_t -ecma_proxy_object_set_prototype_of (ecma_object_t *obj_p, - ecma_value_t proto); +ecma_value_t ecma_proxy_object_set_prototype_of (ecma_object_t *obj_p, ecma_value_t proto); -ecma_value_t -ecma_proxy_object_is_extensible (ecma_object_t *obj_p); +ecma_value_t ecma_proxy_object_is_extensible (ecma_object_t *obj_p); -ecma_value_t -ecma_proxy_object_prevent_extensions (ecma_object_t *obj_p); +ecma_value_t ecma_proxy_object_prevent_extensions (ecma_object_t *obj_p); -ecma_value_t -ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, - ecma_string_t *prop_name_p, - ecma_property_descriptor_t *prop_desc_p); +ecma_value_t ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, + ecma_string_t *prop_name_p, + ecma_property_descriptor_t *prop_desc_p); -ecma_value_t -ecma_proxy_object_define_own_property (ecma_object_t *obj_p, - ecma_string_t *prop_name_p, - const ecma_property_descriptor_t *prop_desc_p); +ecma_value_t ecma_proxy_object_define_own_property (ecma_object_t *obj_p, + ecma_string_t *prop_name_p, + const ecma_property_descriptor_t *prop_desc_p); -ecma_value_t -ecma_proxy_object_has (ecma_object_t *obj_p, - ecma_string_t *prop_name_p); +ecma_value_t ecma_proxy_object_has (ecma_object_t *obj_p, ecma_string_t *prop_name_p); -ecma_value_t -ecma_proxy_object_get (ecma_object_t *obj_p, - ecma_string_t *prop_name_p, - ecma_value_t receiver); +ecma_value_t ecma_proxy_object_get (ecma_object_t *obj_p, ecma_string_t *prop_name_p, ecma_value_t receiver); -ecma_value_t -ecma_proxy_object_set (ecma_object_t *obj_p, - ecma_string_t *prop_name_p, - ecma_value_t name, - ecma_value_t receiver, - bool is_strict); +ecma_value_t ecma_proxy_object_set (ecma_object_t *obj_p, + ecma_string_t *prop_name_p, + ecma_value_t name, + ecma_value_t receiver, + bool is_strict); -ecma_value_t -ecma_proxy_object_delete_property (ecma_object_t *obj_p, - ecma_string_t *prop_name_p, - bool is_strict); +ecma_value_t ecma_proxy_object_delete_property (ecma_object_t *obj_p, ecma_string_t *prop_name_p, bool is_strict); -ecma_collection_t * -ecma_proxy_object_own_property_keys (ecma_object_t *obj_p); +ecma_collection_t *ecma_proxy_object_own_property_keys (ecma_object_t *obj_p); ecma_value_t -ecma_proxy_object_call (ecma_object_t *obj_p, - ecma_value_t this_argument, - const ecma_value_t *args_p, - uint32_t argc); +ecma_proxy_object_call (ecma_object_t *obj_p, ecma_value_t this_argument, const ecma_value_t *args_p, uint32_t argc); -ecma_value_t -ecma_proxy_object_construct (ecma_object_t *obj_p, - ecma_object_t *new_target_p, - const ecma_value_t *args_p, - uint32_t argc); +ecma_value_t ecma_proxy_object_construct (ecma_object_t *obj_p, + ecma_object_t *new_target_p, + const ecma_value_t *args_p, + uint32_t argc); #endif /* JERRY_BUILTIN_PROXY */ diff --git a/jerry-core/ecma/operations/ecma-reference.c b/jerry-core/ecma/operations/ecma-reference.c index 44cf03e3..4693ef15 100644 --- a/jerry-core/ecma/operations/ecma-reference.c +++ b/jerry-core/ecma/operations/ecma-reference.c @@ -13,6 +13,8 @@ * limitations under the License. */ +#include "ecma-reference.h" + #include "ecma-exceptions.h" #include "ecma-function-object.h" #include "ecma-gc.h" @@ -22,7 +24,7 @@ #include "ecma-lex-env.h" #include "ecma-objects.h" #include "ecma-proxy-object.h" -#include "ecma-reference.h" + #include "jrt.h" /** \addtogroup ecma ECMA @@ -405,9 +407,8 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical #if JERRY_ERROR_MESSAGES ecma_value_t name_val = ecma_make_string_value (name_p); - ecma_value_t error_value = ecma_raise_standard_error_with_format (JERRY_ERROR_REFERENCE, - "% is not defined", - name_val); + ecma_value_t error_value = + ecma_raise_standard_error_with_format (JERRY_ERROR_REFERENCE, "% is not defined", name_val); #else /* JERRY_ERROR_MESSAGES */ ecma_value_t error_value = ecma_raise_reference_error (NULL); #endif /* !JERRY_ERROR_MESSAGES */ diff --git a/jerry-core/ecma/operations/ecma-reference.h b/jerry-core/ecma/operations/ecma-reference.h index 5cf6b415..ece9b497 100644 --- a/jerry-core/ecma/operations/ecma-reference.h +++ b/jerry-core/ecma/operations/ecma-reference.h @@ -17,6 +17,7 @@ #define ECMA_REFERENCE_H #include "ecma-globals.h" + #include "jrt.h" /** \addtogroup ecma ECMA diff --git a/jerry-core/ecma/operations/ecma-regexp-object.c b/jerry-core/ecma/operations/ecma-regexp-object.c index 9d2ca38d..a392b141 100644 --- a/jerry-core/ecma/operations/ecma-regexp-object.c +++ b/jerry-core/ecma/operations/ecma-regexp-object.c @@ -13,15 +13,17 @@ * limitations under the License. */ +#include "ecma-regexp-object.h" + #include "ecma-alloc.h" #include "ecma-array-object.h" #include "ecma-builtin-helpers.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-objects.h" -#include "ecma-function-object.h" -#include "ecma-regexp-object.h" + #include "jcontext.h" #include "jrt-libc-includes.h" #include "lit-char-helpers.h" @@ -220,8 +222,7 @@ ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer ctr_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP); } - ecma_object_t *proto_obj_p = ecma_op_get_prototype_from_constructor (ctr_obj_p, - ECMA_BUILTIN_ID_REGEXP_PROTOTYPE); + ecma_object_t *proto_obj_p = ecma_op_get_prototype_from_constructor (ctr_obj_p, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE); if (JERRY_UNLIKELY (proto_obj_p == NULL)) { @@ -233,9 +234,8 @@ ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer 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); + 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); @@ -437,9 +437,7 @@ ecma_regexp_canonicalize_char (lit_code_point_t ch, /**< character */ JERRY_UNUSED (unicode); lit_code_point_t cu = lit_char_to_upper_case (ch, NULL); - if (ch <= LIT_UTF8_1_BYTE_CODE_POINT_MAX - || (cu > LIT_UTF8_1_BYTE_CODE_POINT_MAX - && cu != LIT_MULTIPLE_CU)) + if (ch <= LIT_UTF8_1_BYTE_CODE_POINT_MAX || (cu > LIT_UTF8_1_BYTE_CODE_POINT_MAX && cu != LIT_MULTIPLE_CU)) { return cu; } @@ -523,8 +521,7 @@ ecma_regexp_advance (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */ 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) + 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) { const ecma_char_t next_ch = lit_cesu8_peek_next (*str_p); @@ -553,8 +550,7 @@ ecma_regexp_unicode_advance (const lit_utf8_byte_t **str_p, /**< reference to st const lit_utf8_byte_t *current_p = *str_p; lit_code_point_t ch = lit_cesu8_read_next (¤t_p); - if (lit_is_code_point_utf16_high_surrogate ((ecma_char_t) ch) - && current_p < end_p) + if (lit_is_code_point_utf16_high_surrogate ((ecma_char_t) ch) && current_p < end_p) { const ecma_char_t next_ch = lit_cesu8_peek_next (current_p); if (lit_is_code_point_utf16_low_surrogate (next_ch)) @@ -581,8 +577,7 @@ ecma_regexp_step_back (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */ 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) + 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; @@ -1270,8 +1265,7 @@ ecma_regexp_run (ecma_regexp_ctx_t *re_ctx_p, /**< RegExp matcher context */ const lit_utf8_size_t capture_size = (lit_utf8_size_t) (capture_p->end_p - capture_p->begin_p); - if (str_curr_p + capture_size > re_ctx_p->input_end_p - || memcmp (str_curr_p, capture_p->begin_p, capture_size)) + if (str_curr_p + capture_size > re_ctx_p->input_end_p || memcmp (str_curr_p, capture_p->begin_p, capture_size)) { goto fail; } @@ -1489,7 +1483,7 @@ ecma_regexp_run (ecma_regexp_ctx_t *re_ctx_p, /**< RegExp matcher context */ goto fail; -class_found: + class_found: if (flags & RE_CLASS_INVERT) { goto fail; @@ -1511,8 +1505,7 @@ class_found: const lit_code_point_t cp = ecma_regexp_unicode_advance (&str_curr_p, re_ctx_p->input_end_p); if (!(re_ctx_p->flags & RE_FLAG_DOTALL) - && JERRY_UNLIKELY (cp <= LIT_UTF16_CODE_UNIT_MAX - && lit_char_is_line_terminator ((ecma_char_t) cp))) + && JERRY_UNLIKELY (cp <= LIT_UTF16_CODE_UNIT_MAX && lit_char_is_line_terminator ((ecma_char_t) cp))) { goto fail; } @@ -1562,8 +1555,7 @@ class_found: { JERRY_ASSERT (op == RE_OP_BYTE); - if (str_curr_p >= re_ctx_p->input_end_p - || *bc_p++ != *str_curr_p++) + if (str_curr_p >= re_ctx_p->input_end_p || *bc_p++ != *str_curr_p++) { goto fail; } @@ -1573,7 +1565,7 @@ class_found: } JERRY_UNREACHABLE (); -fail: + fail: bc_p = next_alternative_p; if (bc_p == NULL || *bc_p++ != RE_OP_ALTERNATIVE_NEXT) @@ -1645,10 +1637,7 @@ ecma_regexp_create_result_object (ecma_regexp_ctx_t *re_ctx_p, /**< regexp conte for (uint32_t i = 0; i < re_ctx_p->captures_count; i++) { ecma_value_t capture_value = ecma_regexp_get_capture_value (re_ctx_p->captures_p + i); - ecma_builtin_helper_def_prop_by_index (result_p, - i, - capture_value, - ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); + ecma_builtin_helper_def_prop_by_index (result_p, i, capture_value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE); ecma_free_value (capture_value); } @@ -1742,20 +1731,14 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */ lit_utf8_size_t input_size; lit_utf8_size_t input_length; uint8_t input_flags = ECMA_STRING_FLAG_IS_ASCII; - const lit_utf8_byte_t *input_buffer_p = ecma_string_get_chars (input_string_p, - &input_size, - &input_length, - NULL, - &input_flags); + const lit_utf8_byte_t *input_buffer_p = + ecma_string_get_chars (input_string_p, &input_size, &input_length, NULL, &input_flags); const lit_utf8_byte_t *input_curr_p = input_buffer_p; const lit_utf8_byte_t *input_end_p = input_buffer_p + input_size; ecma_regexp_ctx_t re_ctx; - ecma_regexp_initialize_context (&re_ctx, - bc_p, - input_buffer_p, - input_end_p); + ecma_regexp_initialize_context (&re_ctx, bc_p, input_buffer_p, input_end_p); /* 4. */ ecma_length_t index = 0; @@ -1920,8 +1903,7 @@ match_found: } else { - match_length = lit_utf8_string_length (match_begin_p, - (lit_utf8_size_t) (match_end_p - match_begin_p)); + match_length = lit_utf8_string_length (match_begin_p, (lit_utf8_size_t) (match_end_p - match_begin_p)); } ret_value = ecma_op_object_put (regexp_object_p, @@ -2016,10 +1998,8 @@ ecma_regexp_search_helper (ecma_value_t regexp_arg, /**< regexp argument */ /* 5. */ if (prev_last_index != ecma_make_uint32_value (0)) { - const ecma_value_t status = ecma_op_object_put (regexp_object_p, - last_index_str_p, - ecma_make_uint32_value (0), - true); + const ecma_value_t status = + ecma_op_object_put (regexp_object_p, last_index_str_p, ecma_make_uint32_value (0), true); if (ECMA_IS_VALUE_ERROR (status)) { @@ -2140,11 +2120,8 @@ ecma_regexp_split_helper (ecma_value_t this_arg, /**< this value */ lit_utf8_size_t flags_size; uint8_t flags_str_flags = ECMA_STRING_FLAG_IS_ASCII; - const lit_utf8_byte_t *flags_buffer_p = ecma_string_get_chars (flags_str_p, - &flags_size, - NULL, - NULL, - &flags_str_flags); + const lit_utf8_byte_t *flags_buffer_p = + ecma_string_get_chars (flags_str_p, &flags_size, NULL, NULL, &flags_str_flags); bool unicode = false; bool sticky = false; @@ -2260,10 +2237,7 @@ ecma_regexp_split_helper (ecma_value_t this_arg, /**< this value */ { /* 24.a-b. */ ecma_value_t index_value = ecma_make_length_value (current_index); - result = ecma_op_object_put (splitter_obj_p, - lastindex_str_p, - index_value, - true); + result = ecma_op_object_put (splitter_obj_p, lastindex_str_p, index_value, true); ecma_free_value (index_value); @@ -2325,9 +2299,8 @@ ecma_regexp_split_helper (ecma_value_t this_arg, /**< this value */ /* 24.f.iv.1-4. */ JERRY_ASSERT (previous_index <= string_length && current_index <= string_length); - ecma_string_t *const split_str_p = ecma_string_substr (string_p, - (lit_utf8_size_t) previous_index, - (lit_utf8_size_t) current_index); + ecma_string_t *const split_str_p = + ecma_string_substr (string_p, (lit_utf8_size_t) previous_index, (lit_utf8_size_t) current_index); result = ecma_builtin_helper_def_prop_by_index (array_p, array_length++, @@ -2456,21 +2429,15 @@ cleanup_string: 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 *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); + 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); @@ -2516,8 +2483,8 @@ cleanup_string: } /* 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)); + 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++, @@ -2559,8 +2526,8 @@ cleanup_string: 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)); + 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++, @@ -2616,11 +2583,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII; lit_utf8_size_t string_length; - ctx_p->string_p = ecma_string_get_chars (string_p, - &(ctx_p->string_size), - &string_length, - NULL, - &string_flags); + ctx_p->string_p = ecma_string_get_chars (string_p, &(ctx_p->string_size), &string_length, NULL, &string_flags); const lit_utf8_byte_t *const string_end_p = ctx_p->string_p + ctx_p->string_size; const uint8_t *const bc_start_p = (const uint8_t *) (bc_p + 1); @@ -2630,14 +2593,11 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont ecma_length_t index; ecma_regexp_ctx_t re_ctx; - ecma_regexp_initialize_context (&re_ctx, - bc_p, - ctx_p->string_p, - string_end_p); + ecma_regexp_initialize_context (&re_ctx, bc_p, ctx_p->string_p, string_end_p); /* lastIndex must be accessed to remain consistent with the standard, even though we may not need the value. */ - ecma_value_t lastindex_value = ecma_op_object_get_by_magic_id ((ecma_object_t *) re_obj_p, - LIT_MAGIC_STRING_LASTINDEX_UL); + ecma_value_t lastindex_value = + ecma_op_object_get_by_magic_id ((ecma_object_t *) re_obj_p, LIT_MAGIC_STRING_LASTINDEX_UL); ecma_value_t result = ecma_op_to_length (lastindex_value, &index); ecma_free_value (lastindex_value); @@ -2729,10 +2689,8 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont ecma_collection_push_back (arguments_p, ecma_make_string_value (string_p)); ecma_object_t *function_p = ecma_get_object_from_value (replace_arg); - result = ecma_op_function_call (function_p, - ECMA_VALUE_UNDEFINED, - arguments_p->buffer_p, - arguments_p->item_count); + result = + ecma_op_function_call (function_p, ECMA_VALUE_UNDEFINED, arguments_p->buffer_p, arguments_p->item_count); ecma_collection_free (arguments_p); @@ -2818,8 +2776,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont if ((ctx_p->flags & RE_FLAG_UNICODE) != 0) { index++; - const lit_code_point_t cp = ecma_regexp_unicode_advance (¤t_p, - string_end_p); + const lit_code_point_t cp = ecma_regexp_unicode_advance (¤t_p, string_end_p); if (cp > LIT_UTF16_CODE_UNIT_MAX) { @@ -2951,10 +2908,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */ } #if !JERRY_ESNEXT - result = ecma_regexp_replace_helper_fast (&replace_ctx, - (ecma_extended_object_t *) this_obj_p, - string_p, - replace_arg); + 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 */ @@ -2969,15 +2923,12 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */ if (ecma_op_is_callable (result)) { ecma_extended_object_t *function_p = (ecma_extended_object_t *) ecma_get_object_from_value (result); - if (ecma_object_class_is (this_obj_p, ECMA_OBJECT_CLASS_REGEXP) - && ecma_builtin_is_regexp_exec (function_p)) + if (ecma_object_class_is (this_obj_p, ECMA_OBJECT_CLASS_REGEXP) && ecma_builtin_is_regexp_exec (function_p)) { ecma_deref_object ((ecma_object_t *) function_p); - result = ecma_regexp_replace_helper_fast (&replace_ctx, - (ecma_extended_object_t *) this_obj_p, - string_p, - replace_arg); + result = + ecma_regexp_replace_helper_fast (&replace_ctx, (ecma_extended_object_t *) this_obj_p, string_p, replace_arg); goto cleanup_replace; } @@ -3079,10 +3030,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */ last_index = ecma_make_length_value (index); /* 10.d.iii.3.c */ - result = ecma_op_object_put (this_obj_p, - ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), - last_index, - true); + result = ecma_op_object_put (this_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index, true); ecma_free_value (last_index); @@ -3103,11 +3051,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */ } uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII; - replace_ctx.string_p = ecma_string_get_chars (string_p, - &(replace_ctx.string_size), - NULL, - NULL, - &string_flags); + replace_ctx.string_p = ecma_string_get_chars (string_p, &(replace_ctx.string_size), NULL, NULL, &string_flags); /* 14. */ replace_ctx.builder = ecma_stringbuilder_create (); @@ -3120,8 +3064,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */ const lit_utf8_byte_t *const string_end_p = replace_ctx.string_p + replace_ctx.string_size; /* 16. */ - for (ecma_value_t *current_p = results_p->buffer_p; - current_p < results_p->buffer_p + results_p->item_count; + for (ecma_value_t *current_p = results_p->buffer_p; current_p < results_p->buffer_p + results_p->item_count; current_p++) { /* 16.a */ @@ -3236,8 +3179,8 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */ } ecma_stringbuilder_append_raw (&replace_ctx.builder, - source_position_p, - (lit_utf8_size_t) (match_position_p - source_position_p)); + source_position_p, + (lit_utf8_size_t) (match_position_p - source_position_p)); replace_ctx.match_byte_pos = (lit_utf8_size_t) (match_position_p - replace_ctx.string_p); if ((string_flags & ECMA_STRING_FLAG_IS_ASCII) && matched_str_size == matched_str_length) @@ -3407,10 +3350,8 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */ 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); + 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); if (ECMA_IS_VALUE_ERROR (set_status)) { @@ -3494,19 +3435,15 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */ index = ecma_op_advance_string_index (str_p, index, full_unicode); 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); + 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); + 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); diff --git a/jerry-core/ecma/operations/ecma-regexp-object.h b/jerry-core/ecma/operations/ecma-regexp-object.h index f4cf98d7..5c97049f 100644 --- a/jerry-core/ecma/operations/ecma-regexp-object.h +++ b/jerry-core/ecma/operations/ecma-regexp-object.h @@ -16,11 +16,12 @@ #ifndef ECMA_REGEXP_OBJECT_H #define ECMA_REGEXP_OBJECT_H -#if JERRY_BUILTIN_REGEXP - #include "ecma-globals.h" + #include "re-compiler.h" +#if JERRY_BUILTIN_REGEXP + /** \addtogroup ecma ECMA * @{ * @@ -35,13 +36,13 @@ */ typedef enum { - RE_FLAG_EMPTY = 0u, /* Empty RegExp flags */ - RE_FLAG_GLOBAL = (1u << 1), /**< ECMA-262 v5, 15.10.7.2 */ + RE_FLAG_EMPTY = 0u, /* Empty RegExp flags */ + RE_FLAG_GLOBAL = (1u << 1), /**< ECMA-262 v5, 15.10.7.2 */ RE_FLAG_IGNORE_CASE = (1u << 2), /**< ECMA-262 v5, 15.10.7.3 */ - RE_FLAG_MULTILINE = (1u << 3), /**< ECMA-262 v5, 15.10.7.4 */ - RE_FLAG_STICKY = (1u << 4), /**< ECMA-262 v6, 21.2.5.12 */ - RE_FLAG_UNICODE = (1u << 5), /**< ECMA-262 v6, 21.2.5.15 */ - RE_FLAG_DOTALL = (1u << 6) /**< ECMA-262 v9, 21.2.5.3 */ + RE_FLAG_MULTILINE = (1u << 3), /**< ECMA-262 v5, 15.10.7.4 */ + RE_FLAG_STICKY = (1u << 4), /**< ECMA-262 v6, 21.2.5.12 */ + RE_FLAG_UNICODE = (1u << 5), /**< ECMA-262 v6, 21.2.5.15 */ + RE_FLAG_DOTALL = (1u << 6) /**< ECMA-262 v9, 21.2.5.3 */ /* Bits from bit 13 is reserved for function types (see CBC_FUNCTION_TYPE_SHIFT). */ } ecma_regexp_flags_t; @@ -51,14 +52,14 @@ typedef enum */ typedef enum { - RE_ESCAPE__START, /**< escapes start */ + RE_ESCAPE__START, /**< escapes start */ RE_ESCAPE_DIGIT = RE_ESCAPE__START, /**< digit */ - RE_ESCAPE_NOT_DIGIT, /**< not digit */ - RE_ESCAPE_WORD_CHAR, /**< word char */ - RE_ESCAPE_NOT_WORD_CHAR, /**< not word char */ - RE_ESCAPE_WHITESPACE, /**< whitespace */ - RE_ESCAPE_NOT_WHITESPACE, /**< not whitespace */ - RE_ESCAPE__COUNT, /**< escape count */ + RE_ESCAPE_NOT_DIGIT, /**< not digit */ + RE_ESCAPE_WORD_CHAR, /**< word char */ + RE_ESCAPE_NOT_WORD_CHAR, /**< not word char */ + RE_ESCAPE_WHITESPACE, /**< whitespace */ + RE_ESCAPE_NOT_WHITESPACE, /**< not whitespace */ + RE_ESCAPE__COUNT, /**< escape count */ } ecma_class_escape_t; /** @@ -77,9 +78,9 @@ typedef enum */ typedef enum { - RE_CLASS_HAS_CHARS = (1 << 5), /**< contains individual characters */ - RE_CLASS_HAS_RANGES = (1 << 6), /**< contains character ranges */ - RE_CLASS_INVERT = (1 << 7), /**< inverted */ + RE_CLASS_HAS_CHARS = (1 << 5), /**< contains individual characters */ + RE_CLASS_HAS_RANGES = (1 << 6), /**< contains character ranges */ + RE_CLASS_INVERT = (1 << 7), /**< inverted */ } ecma_char_class_flags_t; /** @@ -88,10 +89,10 @@ typedef enum typedef struct { const lit_utf8_byte_t *begin_p; /**< capture start pointer */ - const lit_utf8_byte_t *end_p; /**< capture end pointer */ - const uint8_t *bc_p; /**< group bytecode pointer */ - uint32_t iterator; /**< iteration counter */ - uint32_t subcapture_count; /**< number of nested capturing groups */ + const lit_utf8_byte_t *end_p; /**< capture end pointer */ + const uint8_t *bc_p; /**< group bytecode pointer */ + uint32_t iterator; /**< iteration counter */ + uint32_t subcapture_count; /**< number of nested capturing groups */ } ecma_regexp_capture_t; /** @@ -100,10 +101,10 @@ typedef struct typedef struct { const lit_utf8_byte_t *begin_p; /**< substring start pointer */ - const uint8_t *bc_p; /**< group bytecode pointer */ - uint32_t iterator; /**< iteration counter */ - uint32_t subcapture_start; /**< first nested capturing group index */ - uint32_t subcapture_count; /**< number of nested capturing groups */ + const uint8_t *bc_p; /**< group bytecode pointer */ + uint32_t iterator; /**< iteration counter */ + uint32_t subcapture_start; /**< first nested capturing group index */ + uint32_t subcapture_count; /**< number of nested capturing groups */ } ecma_regexp_non_capture_t; /** @@ -111,8 +112,7 @@ typedef struct */ #define ECMA_RE_IS_CAPTURE_DEFINED(c) ((c)->begin_p != NULL) -ecma_value_t -ecma_regexp_get_capture_value (const ecma_regexp_capture_t *const capture_p); +ecma_value_t ecma_regexp_get_capture_value (const ecma_regexp_capture_t *const capture_p); #if (JERRY_STACK_LIMIT != 0) /** @@ -141,14 +141,14 @@ ecma_regexp_get_capture_value (const ecma_regexp_capture_t *const capture_p); */ typedef struct { - const lit_utf8_byte_t *input_start_p; /**< start of input string */ - const lit_utf8_byte_t *input_end_p; /**< end of input string */ - uint32_t captures_count; /**< number of capture groups */ - uint32_t non_captures_count; /**< number of non-capture groups */ - ecma_regexp_capture_t *captures_p; /**< capturing groups */ - ecma_regexp_non_capture_t *non_captures_p; /**< non-capturing groups */ - uint16_t flags; /**< RegExp flags */ - uint8_t char_size; /**< size of encoded characters */ + const lit_utf8_byte_t *input_start_p; /**< start of input string */ + const lit_utf8_byte_t *input_end_p; /**< end of input string */ + uint32_t captures_count; /**< number of capture groups */ + uint32_t non_captures_count; /**< number of non-capture groups */ + ecma_regexp_capture_t *captures_p; /**< capturing groups */ + ecma_regexp_non_capture_t *non_captures_p; /**< non-capturing groups */ + uint16_t flags; /**< RegExp flags */ + uint8_t char_size; /**< size of encoded characters */ } ecma_regexp_ctx_t; /** @@ -169,14 +169,11 @@ lit_code_point_t ecma_regexp_unicode_advance (const lit_utf8_byte_t **str_p, con #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_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); lit_code_point_t ecma_regexp_canonicalize_char (lit_code_point_t ch, bool unicode); ecma_value_t ecma_regexp_parse_flags (ecma_string_t *flags_str_p, uint16_t *flags_p); -void ecma_regexp_create_and_initialize_props (ecma_object_t *re_object_p, - ecma_string_t *source_p, - uint16_t flags); +void ecma_regexp_create_and_initialize_props (ecma_object_t *re_object_p, ecma_string_t *source_p, uint16_t flags); ecma_value_t ecma_regexp_replace_helper (ecma_value_t this_arg, ecma_value_t string_arg, ecma_value_t replace_arg); ecma_value_t ecma_regexp_search_helper (ecma_value_t regexp_arg, ecma_value_t string_arg); ecma_value_t ecma_regexp_split_helper (ecma_value_t this_arg, ecma_value_t string_arg, ecma_value_t limit_arg); @@ -185,12 +182,9 @@ ecma_value_t ecma_regexp_match_helper (ecma_value_t this_arg, ecma_value_t strin ecma_value_t ecma_op_regexp_exec (ecma_value_t this_arg, ecma_string_t *str_p); ecma_value_t ecma_op_create_regexp_from_bytecode (ecma_object_t *regexp_obj_p, re_compiled_code_t *bc_p); -ecma_value_t ecma_op_create_regexp_from_pattern (ecma_object_t *regexp_obj_p, - ecma_value_t pattern_value, - ecma_value_t flags_value); -ecma_value_t ecma_op_create_regexp_with_flags (ecma_object_t *regexp_obj_p, - ecma_value_t pattern_value, - uint16_t flags); +ecma_value_t +ecma_op_create_regexp_from_pattern (ecma_object_t *regexp_obj_p, ecma_value_t pattern_value, ecma_value_t flags_value); +ecma_value_t ecma_op_create_regexp_with_flags (ecma_object_t *regexp_obj_p, ecma_value_t pattern_value, uint16_t flags); /** * @} * @} diff --git a/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.c b/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.c index 2ac0c691..d08031e3 100644 --- a/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.c +++ b/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.c @@ -13,6 +13,8 @@ * limitations under the License. */ +#include "ecma-shared-arraybuffer-object.h" + #include "ecma-arraybuffer-object.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" @@ -21,8 +23,8 @@ #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-objects.h" -#include "ecma-shared-arraybuffer-object.h" #include "ecma-typedarray-object.h" + #include "jcontext.h" /** \addtogroup ecma ECMA @@ -60,7 +62,7 @@ ecma_shared_arraybuffer_new_object (uint32_t length) /**< length of the SharedAr */ ecma_value_t ecma_op_create_shared_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< list of arguments that - * are passed to String constructor */ + * are passed to String constructor */ uint32_t arguments_list_len) /**< length of the arguments' list */ { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); diff --git a/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.h b/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.h index f0bc2ede..1053a4b9 100644 --- a/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.h +++ b/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.h @@ -27,19 +27,15 @@ * @{ */ -ecma_value_t -ecma_op_create_shared_arraybuffer_object (const ecma_value_t *, uint32_t); +ecma_value_t ecma_op_create_shared_arraybuffer_object (const ecma_value_t *, uint32_t); /** * Helper functions for SharedArrayBuffer. */ -ecma_object_t * -ecma_shared_arraybuffer_new_object (uint32_t lengh); +ecma_object_t *ecma_shared_arraybuffer_new_object (uint32_t lengh); #endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */ -bool -ecma_is_shared_arraybuffer (ecma_value_t val); -bool -ecma_object_is_shared_arraybuffer (ecma_object_t *val); +bool ecma_is_shared_arraybuffer (ecma_value_t val); +bool ecma_object_is_shared_arraybuffer (ecma_object_t *val); /** * @} diff --git a/jerry-core/ecma/operations/ecma-string-object.c b/jerry-core/ecma/operations/ecma-string-object.c index 23f53a7b..72f7f3aa 100644 --- a/jerry-core/ecma/operations/ecma-string-object.c +++ b/jerry-core/ecma/operations/ecma-string-object.c @@ -13,16 +13,18 @@ * limitations under the License. */ +#include "ecma-string-object.h" + #include "ecma-alloc.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" -#include "ecma-string-object.h" -#include "ecma-function-object.h" +#include "ecma-objects.h" + #include "jcontext.h" /** \addtogroup ecma ECMA @@ -45,8 +47,7 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of are passed to String constructor */ uint32_t arguments_list_len) /**< length of the arguments' list */ { - JERRY_ASSERT (arguments_list_len == 0 - || arguments_list_p != NULL); + JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); ecma_value_t prim_value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY); @@ -80,9 +81,8 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of } } #endif /* JERRY_ESNEXT */ - ecma_object_t *object_p = ecma_create_object (prototype_obj_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = + ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p; ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_STRING; diff --git a/jerry-core/ecma/operations/ecma-string-object.h b/jerry-core/ecma/operations/ecma-string-object.h index da0d7431..0ebb2c12 100644 --- a/jerry-core/ecma/operations/ecma-string-object.h +++ b/jerry-core/ecma/operations/ecma-string-object.h @@ -25,13 +25,12 @@ * @{ */ -ecma_value_t -ecma_op_create_string_object (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len); +ecma_value_t ecma_op_create_string_object (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len); -void -ecma_op_string_list_lazy_property_names (ecma_object_t *obj_p, ecma_collection_t *prop_names_p, - ecma_property_counter_t *prop_counter_p, - jerry_property_filter_t filter); +void ecma_op_string_list_lazy_property_names (ecma_object_t *obj_p, + ecma_collection_t *prop_names_p, + ecma_property_counter_t *prop_counter_p, + jerry_property_filter_t filter); /** * @} diff --git a/jerry-core/ecma/operations/ecma-symbol-object.c b/jerry-core/ecma/operations/ecma-symbol-object.c index 589ef7f1..22cd9d49 100644 --- a/jerry-core/ecma/operations/ecma-symbol-object.c +++ b/jerry-core/ecma/operations/ecma-symbol-object.c @@ -13,15 +13,17 @@ * limitations under the License. */ +#include "ecma-symbol-object.h" + #include "ecma-alloc.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" -#include "ecma-objects.h" #include "ecma-objects-general.h" -#include "ecma-symbol-object.h" +#include "ecma-objects.h" + #include "lit-char-helpers.h" #if JERRY_ESNEXT @@ -85,9 +87,8 @@ ecma_op_create_symbol_object (const ecma_value_t value) /**< symbol value */ JERRY_ASSERT (ecma_is_value_symbol (value)); ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE); - ecma_object_t *object_p = ecma_create_object (prototype_obj_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = + ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p; ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_SYMBOL; diff --git a/jerry-core/ecma/operations/ecma-symbol-object.h b/jerry-core/ecma/operations/ecma-symbol-object.h index 01336767..1ca59930 100644 --- a/jerry-core/ecma/operations/ecma-symbol-object.h +++ b/jerry-core/ecma/operations/ecma-symbol-object.h @@ -16,9 +16,10 @@ #ifndef ECMA_SYMBOL_H #define ECMA_SYMBOL_H -#if JERRY_ESNEXT #include "ecma-globals.h" +#if JERRY_ESNEXT + /** \addtogroup ecma ECMA * @{ * @@ -26,23 +27,17 @@ * @{ */ -ecma_value_t -ecma_op_create_symbol (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len); +ecma_value_t ecma_op_create_symbol (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len); -ecma_value_t -ecma_op_create_symbol_object (const ecma_value_t value); +ecma_value_t ecma_op_create_symbol_object (const ecma_value_t value); -bool -ecma_prop_name_is_symbol (ecma_string_t *string_p); +bool ecma_prop_name_is_symbol (ecma_string_t *string_p); -ecma_value_t -ecma_get_symbol_description (ecma_string_t *symbol_p); +ecma_value_t ecma_get_symbol_description (ecma_string_t *symbol_p); -ecma_value_t -ecma_symbol_this_value (ecma_value_t this_arg); +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); +ecma_value_t ecma_get_symbol_descriptive_string (ecma_value_t symbol_value); #endif /* JERRY_ESNEXT */ /** diff --git a/jerry-core/ecma/operations/ecma-typedarray-object.c b/jerry-core/ecma/operations/ecma-typedarray-object.c index 79245cb8..95af9216 100644 --- a/jerry-core/ecma/operations/ecma-typedarray-object.c +++ b/jerry-core/ecma/operations/ecma-typedarray-object.c @@ -13,23 +13,25 @@ * limitations under the License. */ +#include "ecma-typedarray-object.h" + #include <math.h> -#include "ecma-iterator-object.h" -#include "ecma-typedarray-object.h" #include "ecma-arraybuffer-object.h" -#include "ecma-shared-arraybuffer-object.h" -#include "ecma-function-object.h" -#include "ecma-bigint.h" #include "ecma-big-uint.h" +#include "ecma-bigint.h" #include "ecma-builtin-helpers.h" -#include "ecma-objects.h" -#include "ecma-objects-general.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" +#include "ecma-function-object.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" +#include "ecma-iterator-object.h" +#include "ecma-objects-general.h" +#include "ecma-objects.h" +#include "ecma-shared-arraybuffer-object.h" + #include "jcontext.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -44,36 +46,34 @@ /** * Read and copy a number from a given buffer to a value. **/ -#define ECMA_TYPEDARRAY_GET_ELEMENT(src_p, num, type) \ - do \ - { \ - if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \ - { \ - num = *(type *) ((void*) src_p); \ - } \ - else \ - { \ - memcpy (&num, (void *) src_p, sizeof (type)); \ - } \ - } \ - while (0) +#define ECMA_TYPEDARRAY_GET_ELEMENT(src_p, num, type) \ + do \ + { \ + if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \ + { \ + num = *(type *) ((void *) src_p); \ + } \ + else \ + { \ + memcpy (&num, (void *) src_p, sizeof (type)); \ + } \ + } while (0) /** * Copy a number from a value to the given buffer **/ -#define ECMA_TYPEDARRAY_SET_ELEMENT(src_p, num, type) \ - do \ - { \ - if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \ - { \ - *(type *) ((void*) src_p) = num; \ - } \ - else \ - { \ - memcpy ((void*) src_p, &num, sizeof (type)); \ - } \ - } \ - while (0) +#define ECMA_TYPEDARRAY_SET_ELEMENT(src_p, num, type) \ + do \ + { \ + if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \ + { \ + *(type *) ((void *) src_p) = num; \ + } \ + else \ + { \ + memcpy ((void *) src_p, &num, sizeof (type)); \ + } \ + } while (0) /** * Read an int8_t value from the given arraybuffer @@ -304,10 +304,9 @@ ecma_typedarray_set_uint8_clamped_element (lit_utf8_byte_t *dst_p, /**< the loca { clamped = (uint8_t) result_num; - if (clamped + 0.5 < result_num - || (clamped + 0.5 == result_num && (clamped % 2) == 1)) + if (clamped + 0.5 < result_num || (clamped + 0.5 == result_num && (clamped % 2) == 1)) { - clamped ++; + clamped++; } } @@ -520,21 +519,20 @@ ecma_typedarray_set_bigint_element (lit_utf8_byte_t *dst_p, /**< the location in /** * List of typedarray getters based on their builtin id */ -static const ecma_typedarray_getter_fn_t ecma_typedarray_getters[] = -{ - ecma_typedarray_get_int8_element, /**< Int8Array */ - ecma_typedarray_get_uint8_element, /**< Uint8Array */ - ecma_typedarray_get_uint8_element, /**< Uint8ClampedArray */ - ecma_typedarray_get_int16_element, /**< Int16Array */ +static const ecma_typedarray_getter_fn_t ecma_typedarray_getters[] = { + ecma_typedarray_get_int8_element, /**< Int8Array */ + ecma_typedarray_get_uint8_element, /**< Uint8Array */ + ecma_typedarray_get_uint8_element, /**< Uint8ClampedArray */ + ecma_typedarray_get_int16_element, /**< Int16Array */ ecma_typedarray_get_uint16_element, /**< Int32Array */ - ecma_typedarray_get_int32_element, /**< Uint32Array */ + ecma_typedarray_get_int32_element, /**< Uint32Array */ ecma_typedarray_get_uint32_element, /**< Uint32Array */ - ecma_typedarray_get_float_element, /**< Float32Array */ + ecma_typedarray_get_float_element, /**< Float32Array */ #if JERRY_NUMBER_TYPE_FLOAT64 ecma_typedarray_get_double_element, /**< Float64Array */ #endif /* JERRY_NUMBER_TYPE_FLOAT64 */ #if JERRY_BUILTIN_BIGINT - ecma_typedarray_get_bigint64_element, /**< BigInt64Array*/ + ecma_typedarray_get_bigint64_element, /**< BigInt64Array*/ ecma_typedarray_get_biguint64_element, /**< BigUint64Array */ #endif /* JERRY_BUILTIN_BIGINT */ }; @@ -542,30 +540,28 @@ static const ecma_typedarray_getter_fn_t ecma_typedarray_getters[] = /** * List of typedarray setters based on their builtin id */ -static const ecma_typedarray_setter_fn_t ecma_typedarray_setters[] = -{ - ecma_typedarray_set_int8_element, /**< Int8Array */ - ecma_typedarray_set_uint8_element, /**< Uint8Array */ +static const ecma_typedarray_setter_fn_t ecma_typedarray_setters[] = { + ecma_typedarray_set_int8_element, /**< Int8Array */ + ecma_typedarray_set_uint8_element, /**< Uint8Array */ ecma_typedarray_set_uint8_clamped_element, /**< Uint8ClampedArray */ - ecma_typedarray_set_int16_element, /**< Int16Array */ - ecma_typedarray_set_uint16_element, /**< Int32Array */ - ecma_typedarray_set_int32_element, /**< Uint32Array */ - ecma_typedarray_set_uint32_element, /**< Uint32Array */ - ecma_typedarray_set_float_element, /**< Float32Array */ + ecma_typedarray_set_int16_element, /**< Int16Array */ + ecma_typedarray_set_uint16_element, /**< Int32Array */ + ecma_typedarray_set_int32_element, /**< Uint32Array */ + ecma_typedarray_set_uint32_element, /**< Uint32Array */ + ecma_typedarray_set_float_element, /**< Float32Array */ #if JERRY_NUMBER_TYPE_FLOAT64 - ecma_typedarray_set_double_element, /**< Float64Array */ + ecma_typedarray_set_double_element, /**< Float64Array */ #endif /* JERRY_NUMBER_TYPE_FLOAT64 */ #if JERRY_BUILTIN_BIGINT - ecma_typedarray_set_bigint_element, /**< BigInt64Array */ - ecma_typedarray_set_bigint_element, /**< BigUInt64Array */ + ecma_typedarray_set_bigint_element, /**< BigInt64Array */ + ecma_typedarray_set_bigint_element, /**< BigUInt64Array */ #endif /* JERRY_BUILTIN_BIGINT */ }; /** * List of typedarray element shift sizes based on their builtin id */ -static const uint8_t ecma_typedarray_element_shift_sizes[] = -{ +static const uint8_t ecma_typedarray_element_shift_sizes[] = { 0, /**< Int8Array */ 0, /**< Uint8Array */ 0, /**< Uint8ClampedArray */ @@ -586,22 +582,21 @@ static const uint8_t ecma_typedarray_element_shift_sizes[] = /** * List of typedarray class magic strings based on their builtin id */ -static const uint16_t ecma_typedarray_magic_string_list[] = -{ - (uint16_t) LIT_MAGIC_STRING_INT8_ARRAY_UL, /**< Int8Array */ - (uint16_t) LIT_MAGIC_STRING_UINT8_ARRAY_UL, /**< Uint8Array */ +static const uint16_t ecma_typedarray_magic_string_list[] = { + (uint16_t) LIT_MAGIC_STRING_INT8_ARRAY_UL, /**< Int8Array */ + (uint16_t) LIT_MAGIC_STRING_UINT8_ARRAY_UL, /**< Uint8Array */ (uint16_t) LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL, /**< Uint8ClampedArray */ - (uint16_t) LIT_MAGIC_STRING_INT16_ARRAY_UL, /**< Int16Array */ - (uint16_t) LIT_MAGIC_STRING_UINT16_ARRAY_UL, /**< Uint16Array */ - (uint16_t) LIT_MAGIC_STRING_INT32_ARRAY_UL, /**< Int32Array */ - (uint16_t) LIT_MAGIC_STRING_UINT32_ARRAY_UL, /**< Uint32Array */ - (uint16_t) LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, /**< Float32Array */ + (uint16_t) LIT_MAGIC_STRING_INT16_ARRAY_UL, /**< Int16Array */ + (uint16_t) LIT_MAGIC_STRING_UINT16_ARRAY_UL, /**< Uint16Array */ + (uint16_t) LIT_MAGIC_STRING_INT32_ARRAY_UL, /**< Int32Array */ + (uint16_t) LIT_MAGIC_STRING_UINT32_ARRAY_UL, /**< Uint32Array */ + (uint16_t) LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, /**< Float32Array */ #if JERRY_NUMBER_TYPE_FLOAT64 - (uint16_t) LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, /**< Float64Array */ + (uint16_t) LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, /**< Float64Array */ #endif /* JERRY_NUMBER_TYPE_FLOAT64 */ #if JERRY_BUILTIN_BIGINT - (uint16_t) LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, /**< BigInt64Array */ - (uint16_t) LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, /**< BigUInt64Array */ + (uint16_t) LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, /**< BigInt64Array */ + (uint16_t) LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, /**< BigUInt64Array */ #endif /* JERRY_BUILTIN_BIGINT */ }; @@ -811,9 +806,8 @@ ecma_typedarray_create_object_with_length (uint32_t array_length, /**< length of #if JERRY_ERROR_MESSAGES ecma_value_t array_length_value = ecma_make_number_value (array_length); - ecma_value_t result = ecma_raise_standard_error_with_format (JERRY_ERROR_RANGE, - "Invalid typed array length: %", - array_length_value); + ecma_value_t result = + ecma_raise_standard_error_with_format (JERRY_ERROR_RANGE, "Invalid typed array length: %", array_length_value); ecma_free_value (array_length_value); return result; #else /* !JERRY_ERROR_MESSAGES */ @@ -837,8 +831,8 @@ ecma_typedarray_create_object_with_length (uint32_t array_length, /**< length of ecma_object_t *ctor_proto_p = ecma_get_object_from_value (ctor_proto); - ecma_object_t *prototype_p = ecma_op_get_prototype_from_constructor (ctor_proto_p, - ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE); + ecma_object_t *prototype_p = + ecma_op_get_prototype_from_constructor (ctor_proto_p, ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE); ecma_deref_object (ctor_proto_p); @@ -860,9 +854,7 @@ ecma_typedarray_create_object_with_length (uint32_t array_length, /**< length of } } - ecma_object_t *object_p = ecma_create_object (proto_p, - sizeof (ecma_extended_object_t), - ECMA_OBJECT_TYPE_CLASS); + ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS); ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p; ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_TYPEDARRAY; @@ -1173,11 +1165,8 @@ ecma_typedarray_create_object_with_object (ecma_value_t items_val, /**< the sour uint32_t len = (uint32_t) length_index; /* 10 */ - ecma_value_t new_typedarray = ecma_typedarray_create_object_with_length (len, - NULL, - proto_p, - element_size_shift, - typedarray_id); + ecma_value_t new_typedarray = + ecma_typedarray_create_object_with_length (len, NULL, proto_p, element_size_shift, typedarray_id); if (ECMA_IS_VALUE_ERROR (new_typedarray)) { @@ -1351,12 +1340,8 @@ ecma_op_typedarray_from (ecma_value_t this_val, /**< this value */ /* 6.e */ for (uint32_t index = 0; index < values_p->item_count; index++) { - ecma_value_t set_value = ecma_op_typedarray_from_helper (this_arg, - *next_value_p++, - index, - func_object_p, - buffer_p, - setter_cb); + ecma_value_t set_value = + ecma_op_typedarray_from_helper (this_arg, *next_value_p++, index, func_object_p, buffer_p, setter_cb); if (ECMA_IS_VALUE_ERROR (set_value)) { @@ -1451,12 +1436,8 @@ ecma_op_typedarray_from (ecma_value_t this_val, /**< this value */ value = ECMA_VALUE_UNDEFINED; } - ecma_value_t set_value = ecma_op_typedarray_from_helper (this_arg, - value, - index, - func_object_p, - buffer_p, - setter_cb); + ecma_value_t set_value = + ecma_op_typedarray_from_helper (this_arg, value, index, func_object_p, buffer_p, setter_cb); if (ECMA_IS_VALUE_ERROR (set_value)) { @@ -1483,7 +1464,7 @@ ecma_op_typedarray_from (ecma_value_t this_val, /**< this value */ * * @return the pointer to the internal arraybuffer */ -extern inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE +extern inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE ecma_typedarray_get_arraybuffer (ecma_object_t *typedarray_p) /**< the pointer to the typedarray object */ { JERRY_ASSERT (ecma_object_is_typedarray (typedarray_p)); @@ -1637,11 +1618,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li #endif /* JERRY_ERROR_MESSAGES */ } - return ecma_typedarray_create_object_with_length ((uint32_t) num, - NULL, - proto_p, - element_size_shift, - typedarray_id); + return ecma_typedarray_create_object_with_length ((uint32_t) num, NULL, proto_p, element_size_shift, typedarray_id); } ecma_object_t *obj_p = ecma_get_object_from_value (arguments_list_p[0]); @@ -1650,29 +1627,20 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li { /* 22.2.1.3 */ ecma_object_t *typedarray_p = obj_p; - return ecma_typedarray_create_object_with_typedarray (typedarray_p, - proto_p, - element_size_shift, - typedarray_id); + return ecma_typedarray_create_object_with_typedarray (typedarray_p, proto_p, element_size_shift, typedarray_id); } - if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER) - && !ecma_object_is_shared_arraybuffer (obj_p)) + if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER) && !ecma_object_is_shared_arraybuffer (obj_p)) { /* 22.2.1.4 */ - return ecma_typedarray_create_object_with_object (arguments_list_p[0], - proto_p, - element_size_shift, - typedarray_id); + return ecma_typedarray_create_object_with_object (arguments_list_p[0], proto_p, element_size_shift, typedarray_id); } /* 22.2.1.5 */ ecma_object_t *arraybuffer_p = obj_p; - ecma_value_t byte_offset_value = ((arguments_list_len > 1) ? arguments_list_p[1] - : ECMA_VALUE_UNDEFINED); + ecma_value_t byte_offset_value = ((arguments_list_len > 1) ? arguments_list_p[1] : ECMA_VALUE_UNDEFINED); - ecma_value_t length_value = ((arguments_list_len > 2) ? arguments_list_p[2] - : ECMA_VALUE_UNDEFINED); + ecma_value_t length_value = ((arguments_list_len > 2) ? arguments_list_p[2] : ECMA_VALUE_UNDEFINED); ecma_number_t offset; @@ -1720,8 +1688,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li if (ecma_is_value_undefined (length_value)) { - if ((buf_byte_length % (uint32_t) (1 << element_size_shift) != 0) - || (buf_byte_length < byte_offset)) + if ((buf_byte_length % (uint32_t) (1 << element_size_shift) != 0) || (buf_byte_length < byte_offset)) { return ecma_raise_range_error (invalid_length_p); } @@ -1737,8 +1704,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li new_byte_length = (uint32_t) new_length << element_size_shift; - if (byte_offset > buf_byte_length - || new_byte_length > (buf_byte_length - byte_offset)) + if (byte_offset > buf_byte_length || new_byte_length > (buf_byte_length - byte_offset)) { return ecma_raise_range_error (invalid_length_p); } @@ -1746,8 +1712,8 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li bool needs_ext_typedarray_obj = (byte_offset != 0 || new_byte_length != buf_byte_length); - size_t object_size = (needs_ext_typedarray_obj ? sizeof (ecma_extended_typedarray_object_t) - : sizeof (ecma_extended_object_t)); + size_t object_size = + (needs_ext_typedarray_obj ? sizeof (ecma_extended_typedarray_object_t) : sizeof (ecma_extended_object_t)); ecma_object_t *object_p = ecma_create_object (proto_p, object_size, ECMA_OBJECT_TYPE_CLASS); @@ -1792,10 +1758,7 @@ ecma_typedarray_iterators_helper (ecma_value_t this_arg, /**< this argument */ JERRY_ASSERT (ecma_is_typedarray (this_arg)); ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY_ITERATOR_PROTOTYPE); - return ecma_op_create_iterator_object (this_arg, - prototype_obj_p, - ECMA_OBJECT_CLASS_ARRAY_ITERATOR, - kind); + return ecma_op_create_iterator_object (this_arg, prototype_obj_p, ECMA_OBJECT_CLASS_ARRAY_ITERATOR, kind); } /* ecma_typedarray_iterators_helper */ /** @@ -1857,7 +1820,7 @@ ecma_typedarray_is_element_index (ecma_string_t *property_name_p) /**< property void ecma_op_typedarray_list_lazy_property_names (ecma_object_t *obj_p, /**< a TypedArray object */ ecma_collection_t *prop_names_p, /**< prop name collection */ - ecma_property_counter_t *prop_counter_p, /**< property counters */ + ecma_property_counter_t *prop_counter_p, /**< property counters */ jerry_property_filter_t filter) /**< property name filter options */ { JERRY_ASSERT (ecma_object_is_typedarray (obj_p)); @@ -1901,8 +1864,7 @@ ecma_op_typedarray_define_own_property (ecma_object_t *obj_p, /**< TypedArray ob uint32_t index = ecma_string_get_array_index (property_name_p); - if (index == ECMA_STRING_NOT_ARRAY_INDEX - && !ecma_typedarray_is_element_index (property_name_p)) + if (index == ECMA_STRING_NOT_ARRAY_INDEX && !ecma_typedarray_is_element_index (property_name_p)) { return ecma_op_general_object_define_own_property (obj_p, property_name_p, property_desc_p); } @@ -1920,8 +1882,7 @@ ecma_op_typedarray_define_own_property (ecma_object_t *obj_p, /**< TypedArray ob ecma_typedarray_info_t info = ecma_typedarray_get_info (obj_p); - if (index == ECMA_STRING_NOT_ARRAY_INDEX - || index >= info.length) + if (index == ECMA_STRING_NOT_ARRAY_INDEX || index >= info.length) { return ECMA_VALUE_FALSE; } @@ -1956,10 +1917,8 @@ ecma_typedarray_create (ecma_object_t *constructor_p, /**< constructor function ecma_value_t *arguments_list_p, /**< argument list */ uint32_t arguments_list_len) /**< length of argument list */ { - ecma_value_t ret_val = ecma_op_function_construct (constructor_p, - constructor_p, - arguments_list_p, - arguments_list_len); + ecma_value_t ret_val = + ecma_op_function_construct (constructor_p, constructor_p, arguments_list_p, arguments_list_len); if (ECMA_IS_VALUE_ERROR (ret_val)) { return ret_val; @@ -2062,11 +2021,8 @@ ecma_op_create_typedarray_with_type_and_length (ecma_typedarray_type_t typedarra ecma_object_t *proto_p = ecma_builtin_get (ecma_typedarray_helper_get_prototype_id (typedarray_id)); uint8_t element_size_shift = ecma_typedarray_helper_get_shift_size (typedarray_id); - ecma_value_t new_obj = ecma_typedarray_create_object_with_length (array_length, - NULL, - proto_p, - element_size_shift, - typedarray_id); + ecma_value_t new_obj = + ecma_typedarray_create_object_with_length (array_length, NULL, proto_p, element_size_shift, typedarray_id); return new_obj; } /* ecma_op_create_typedarray_with_type_and_length */ diff --git a/jerry-core/ecma/operations/ecma-typedarray-object.h b/jerry-core/ecma/operations/ecma-typedarray-object.h index bf728e88..ab004265 100644 --- a/jerry-core/ecma/operations/ecma-typedarray-object.h +++ b/jerry-core/ecma/operations/ecma-typedarray-object.h @@ -16,8 +16,8 @@ #ifndef ECMA_TYPEDARRAY_OBJECT_H #define ECMA_TYPEDARRAY_OBJECT_H -#include "ecma-globals.h" #include "ecma-builtins.h" +#include "ecma-globals.h" #if JERRY_BUILTIN_TYPEDARRAY @@ -32,21 +32,16 @@ uint8_t ecma_typedarray_helper_get_shift_size (ecma_typedarray_type_t typedarray lit_magic_string_id_t ecma_get_typedarray_magic_string_id (ecma_typedarray_type_t typedarray_id); ecma_typedarray_getter_fn_t ecma_get_typedarray_getter_fn (ecma_typedarray_type_t typedarray_id); ecma_typedarray_setter_fn_t ecma_get_typedarray_setter_fn (ecma_typedarray_type_t typedarray_id); -ecma_value_t ecma_get_typedarray_element (ecma_typedarray_info_t *info_p, - uint32_t index); -ecma_value_t ecma_set_typedarray_element (ecma_typedarray_info_t *info_p, - ecma_value_t value, - uint32_t index); +ecma_value_t ecma_get_typedarray_element (ecma_typedarray_info_t *info_p, uint32_t index); +ecma_value_t ecma_set_typedarray_element (ecma_typedarray_info_t *info_p, ecma_value_t value, uint32_t index); bool ecma_typedarray_helper_is_typedarray (ecma_builtin_id_t builtin_id); ecma_typedarray_type_t ecma_get_typedarray_id (ecma_object_t *obj_p); ecma_builtin_id_t ecma_typedarray_helper_get_prototype_id (ecma_typedarray_type_t typedarray_id); ecma_builtin_id_t ecma_typedarray_helper_get_constructor_id (ecma_typedarray_type_t typedarray_id); ecma_typedarray_type_t ecma_typedarray_helper_builtin_to_typedarray_id (ecma_builtin_id_t builtin_id); -ecma_value_t ecma_op_typedarray_from (ecma_value_t this_val, - ecma_value_t source_val, - ecma_value_t mapfn_val, - ecma_value_t this_arg); +ecma_value_t +ecma_op_typedarray_from (ecma_value_t this_val, ecma_value_t source_val, ecma_value_t mapfn_val, ecma_value_t this_arg); uint32_t ecma_typedarray_get_length (ecma_object_t *typedarray_p); uint32_t ecma_typedarray_get_offset (ecma_object_t *typedarray_p); uint8_t *ecma_typedarray_get_buffer (ecma_typedarray_info_t *info_p); @@ -57,13 +52,13 @@ ecma_value_t ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, ecma_object_t *proto_p, uint8_t element_size_shift, ecma_typedarray_type_t typedarray_id); -ecma_value_t -ecma_typedarray_iterators_helper (ecma_value_t this_arg, ecma_iterator_kind_t kind); +ecma_value_t ecma_typedarray_iterators_helper (ecma_value_t this_arg, ecma_iterator_kind_t kind); bool ecma_object_is_typedarray (ecma_object_t *obj_p); bool ecma_is_typedarray (ecma_value_t target); bool ecma_typedarray_is_element_index (ecma_string_t *property_name_p); -void ecma_op_typedarray_list_lazy_property_names (ecma_object_t *obj_p, ecma_collection_t *prop_names_p, +void ecma_op_typedarray_list_lazy_property_names (ecma_object_t *obj_p, + ecma_collection_t *prop_names_p, ecma_property_counter_t *prop_counter_p, jerry_property_filter_t filter); ecma_value_t ecma_op_typedarray_define_own_property (ecma_object_t *obj_p, @@ -81,11 +76,9 @@ ecma_value_t ecma_typedarray_create_object_with_object (ecma_value_t items_val, ecma_object_t *proto_p, uint8_t element_size_shift, ecma_typedarray_type_t typedarray_id); -ecma_value_t ecma_typedarray_create (ecma_object_t *constructor_p, ecma_value_t *arguments_list_p, - uint32_t arguments_list_len); -ecma_value_t ecma_typedarray_species_create (ecma_value_t this_arg, - ecma_value_t *length, - uint32_t arguments_list_len); +ecma_value_t +ecma_typedarray_create (ecma_object_t *constructor_p, ecma_value_t *arguments_list_p, uint32_t arguments_list_len); +ecma_value_t ecma_typedarray_species_create (ecma_value_t this_arg, ecma_value_t *length, uint32_t arguments_list_len); /** * @} |