diff --git a/Makefile b/Makefile index 08b64ea63..db5ce6fd9 100644 --- a/Makefile +++ b/Makefile @@ -46,8 +46,9 @@ export TARGET_RELEASE_MODES = release export TARGET_PC_SYSTEMS = linux export TARGET_MCU_SYSTEMS = $(addprefix stm32f,3 4) -export TARGET_PC_MODS = musl sanitize valgrind \ - musl-valgrind float64 +export TARGET_PC_MODS = musl sanitize valgrind float64 cp cp_minimal \ + musl-valgrind \ + musl-cp_minimal export TARGET_MCU_MODS = diff --git a/Makefile.mk b/Makefile.mk index e2983c978..1004b307e 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -171,6 +171,21 @@ else OPTION_FLOAT64 := disable endif +# CompactProfile mode +ifeq ($(filter cp,$(TARGET_MODS)), cp) + OPTION_COMPACT_PROFILE := enable +else + OPTION_COMPACT_PROFILE := disable +endif + +# minimal CompactProfile mode +ifeq ($(filter cp_minimal,$(TARGET_MODS)), cp_minimal) + OPTION_COMPACT_PROFILE := enable + OPTION_CP_MINIMAL := enable +else + OPTION_CP_MINIMAL := disable +endif + # Enabling float64 mode for unittests ifeq ($(filter-out $(TESTS_TARGET),$(TARGET_MODE)),) OPTION_FLOAT64 := enable @@ -355,6 +370,22 @@ ifeq ($(OPTION_FLOAT64),enable) DEFINES_JERRY += -DCONFIG_ECMA_NUMBER_TYPE=CONFIG_ECMA_NUMBER_FLOAT64 endif +ifeq ($(OPTION_COMPACT_PROFILE),enable) + DEFINES_JERRY += -DCONFIG_ECMA_COMPACT_PROFILE +endif + +ifeq ($(OPTION_CP_MINIMAL),enable) + DEFINES_JERRY += -DCONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN \ + -DCONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN \ + -DCONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN \ + -DCONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS \ + -DCONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN \ + -DCONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN \ + -DCONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN \ + -DCONFIG_ECMA_COMPACT_PROFILE_DISABLE_JSON_BUILTIN \ + -DCONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN +endif + ifeq ($(OPTION_MCU),disable) MACHINE_TYPE=$(shell uname -m) ifeq ($(MACHINE_TYPE),x86_64) diff --git a/src/config.h b/src/config.h index 6ecc96548..36c192e60 100644 --- a/src/config.h +++ b/src/config.h @@ -139,6 +139,18 @@ /** * Implementation should correspond to ECMA Compact Profile */ -#define CONFIG_ECMA_COMPACT_PROFILE +// #define CONFIG_ECMA_COMPACT_PROFILE + +#ifdef CONFIG_ECMA_COMPACT_PROFILE +// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN +// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN +// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN +// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS +// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN +// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN +// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN +// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_JSON_BUILTIN +// #define CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN +#endif /* CONFIG_ECMA_COMPACT_PROFILE */ #endif /* !CONFIG_H */ diff --git a/src/libecmabuiltins/ecma-builtin-array-prototype.c b/src/libecmabuiltins/ecma-builtin-array-prototype.c index a7854e8d4..2025a7481 100644 --- a/src/libecmabuiltins/ecma-builtin-array-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-array-prototype.c @@ -25,6 +25,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -62,3 +64,5 @@ ecma_builtin_array_prototype_object_to_string (ecma_value_t this) /**< this argu * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN */ diff --git a/src/libecmabuiltins/ecma-builtin-array.c b/src/libecmabuiltins/ecma-builtin-array.c index a4b8cd01e..c6bae59a4 100644 --- a/src/libecmabuiltins/ecma-builtin-array.c +++ b/src/libecmabuiltins/ecma-builtin-array.c @@ -25,6 +25,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -106,3 +108,5 @@ ecma_builtin_array_dispatch_construct (ecma_value_t *arguments_list_p, /**< argu * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN */ diff --git a/src/libecmabuiltins/ecma-builtin-boolean-prototype.c b/src/libecmabuiltins/ecma-builtin-boolean-prototype.c index 9b9337f75..2201167ab 100644 --- a/src/libecmabuiltins/ecma-builtin-boolean-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-boolean-prototype.c @@ -25,6 +25,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -127,3 +129,5 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_value_t this) /**< this arg * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN */ diff --git a/src/libecmabuiltins/ecma-builtin-boolean.c b/src/libecmabuiltins/ecma-builtin-boolean.c index 76c34f549..9280bef89 100644 --- a/src/libecmabuiltins/ecma-builtin-boolean.c +++ b/src/libecmabuiltins/ecma-builtin-boolean.c @@ -25,6 +25,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -93,3 +95,5 @@ ecma_builtin_boolean_dispatch_construct (ecma_value_t *arguments_list_p, /**< ar * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN */ diff --git a/src/libecmabuiltins/ecma-builtin-error-prototype.c b/src/libecmabuiltins/ecma-builtin-error-prototype.c index 02cec8fc8..85244e07a 100644 --- a/src/libecmabuiltins/ecma-builtin-error-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-error-prototype.c @@ -25,6 +25,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -201,3 +203,5 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this) /**< this argu * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-error.c b/src/libecmabuiltins/ecma-builtin-error.c index 7a10413ed..c3d036805 100644 --- a/src/libecmabuiltins/ecma-builtin-error.c +++ b/src/libecmabuiltins/ecma-builtin-error.c @@ -24,6 +24,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -95,3 +97,5 @@ ecma_builtin_error_dispatch_construct (ecma_value_t *arguments_list_p, /**< argu * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-evalerror-prototype.c b/src/libecmabuiltins/ecma-builtin-evalerror-prototype.c index e6f58354b..a254400ee 100644 --- a/src/libecmabuiltins/ecma-builtin-evalerror-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-evalerror-prototype.c @@ -25,9 +25,13 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-evalerror-prototype.inc.h" #define BUILTIN_UNDERSCORED_ID eval_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-evalerror.c b/src/libecmabuiltins/ecma-builtin-evalerror.c index f4323a44a..0fbf6d831 100644 --- a/src/libecmabuiltins/ecma-builtin-evalerror.c +++ b/src/libecmabuiltins/ecma-builtin-evalerror.c @@ -24,6 +24,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -95,3 +97,5 @@ ecma_builtin_eval_error_dispatch_construct (ecma_value_t *arguments_list_p, /**< * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-global.inc.h b/src/libecmabuiltins/ecma-builtin-global.inc.h index 3d4586cc7..13f2f6a94 100644 --- a/src/libecmabuiltins/ecma-builtin-global.inc.h +++ b/src/libecmabuiltins/ecma-builtin-global.inc.h @@ -89,32 +89,40 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_FUNCTION_UL, ECMA_PROPERTY_CONFIGURABLE) // ECMA-262 v5, 15.1.4.3 +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN OBJECT_VALUE (ECMA_MAGIC_STRING_ARRAY_UL, ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY), ECMA_PROPERTY_WRITABLE, ECMA_PROPERTY_NOT_ENUMERABLE, ECMA_PROPERTY_CONFIGURABLE) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN*/ +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN // ECMA-262 v5, 15.1.4.4 OBJECT_VALUE (ECMA_MAGIC_STRING_STRING_UL, ecma_builtin_get (ECMA_BUILTIN_ID_STRING), ECMA_PROPERTY_WRITABLE, ECMA_PROPERTY_NOT_ENUMERABLE, ECMA_PROPERTY_CONFIGURABLE) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN */ +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN // ECMA-262 v5, 15.1.4.5 OBJECT_VALUE (ECMA_MAGIC_STRING_BOOLEAN_UL, ecma_builtin_get (ECMA_BUILTIN_ID_BOOLEAN), ECMA_PROPERTY_WRITABLE, ECMA_PROPERTY_NOT_ENUMERABLE, ECMA_PROPERTY_CONFIGURABLE) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN */ +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN // ECMA-262 v5, 15.1.4.6 OBJECT_VALUE (ECMA_MAGIC_STRING_NUMBER_UL, ecma_builtin_get (ECMA_BUILTIN_ID_NUMBER), ECMA_PROPERTY_WRITABLE, ECMA_PROPERTY_NOT_ENUMERABLE, ECMA_PROPERTY_CONFIGURABLE) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN */ // ECMA-262 v5, 15.1.4.7 CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_DATE_UL, @@ -130,6 +138,7 @@ CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_REG_EXP_UL, ECMA_PROPERTY_NOT_ENUMERABLE, ECMA_PROPERTY_CONFIGURABLE) +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS // ECMA-262 v5, 15.1.4.9 OBJECT_VALUE (ECMA_MAGIC_STRING_ERROR_UL, ecma_builtin_get (ECMA_BUILTIN_ID_ERROR), @@ -178,13 +187,16 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_URI_ERROR_UL, ECMA_PROPERTY_WRITABLE, ECMA_PROPERTY_NOT_ENUMERABLE, ECMA_PROPERTY_CONFIGURABLE) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN // ECMA-262 v5, 15.1.5.1 OBJECT_VALUE (ECMA_MAGIC_STRING_MATH_UL, ecma_builtin_get (ECMA_BUILTIN_ID_MATH), ECMA_PROPERTY_WRITABLE, ECMA_PROPERTY_NOT_ENUMERABLE, ECMA_PROPERTY_CONFIGURABLE) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN */ // ECMA-262 v5, 15.1.5.2 CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_JSON_U, diff --git a/src/libecmabuiltins/ecma-builtin-math.c b/src/libecmabuiltins/ecma-builtin-math.c index b40f588d2..d3d98de0d 100644 --- a/src/libecmabuiltins/ecma-builtin-math.c +++ b/src/libecmabuiltins/ecma-builtin-math.c @@ -26,6 +26,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -912,3 +914,5 @@ ecma_builtin_math_object_tan (ecma_value_t this_arg, /**< 'this' argument */ * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN */ diff --git a/src/libecmabuiltins/ecma-builtin-number-prototype.c b/src/libecmabuiltins/ecma-builtin-number-prototype.c index 3f068f8fc..5660c0c2f 100644 --- a/src/libecmabuiltins/ecma-builtin-number-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-number-prototype.c @@ -25,6 +25,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -206,3 +208,5 @@ ecma_builtin_number_prototype_object_to_precision (ecma_value_t this, /**< this * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN */ diff --git a/src/libecmabuiltins/ecma-builtin-number.c b/src/libecmabuiltins/ecma-builtin-number.c index 2e6bcd260..6746291ef 100644 --- a/src/libecmabuiltins/ecma-builtin-number.c +++ b/src/libecmabuiltins/ecma-builtin-number.c @@ -25,6 +25,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -103,3 +105,5 @@ ecma_builtin_number_dispatch_construct (ecma_value_t *arguments_list_p, /**< arg * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN */ diff --git a/src/libecmabuiltins/ecma-builtin-rangeerror-prototype.c b/src/libecmabuiltins/ecma-builtin-rangeerror-prototype.c index 8ff4268b2..9c121481d 100644 --- a/src/libecmabuiltins/ecma-builtin-rangeerror-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-rangeerror-prototype.c @@ -25,9 +25,13 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-rangeerror-prototype.inc.h" #define BUILTIN_UNDERSCORED_ID range_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-rangeerror.c b/src/libecmabuiltins/ecma-builtin-rangeerror.c index 0ec776fc8..0c0a90d2e 100644 --- a/src/libecmabuiltins/ecma-builtin-rangeerror.c +++ b/src/libecmabuiltins/ecma-builtin-rangeerror.c @@ -24,6 +24,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -95,3 +97,5 @@ ecma_builtin_range_error_dispatch_construct (ecma_value_t *arguments_list_p, /** * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-referenceerror-prototype.c b/src/libecmabuiltins/ecma-builtin-referenceerror-prototype.c index 0bfc03d10..20f584998 100644 --- a/src/libecmabuiltins/ecma-builtin-referenceerror-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-referenceerror-prototype.c @@ -25,9 +25,13 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-referenceerror-prototype.inc.h" #define BUILTIN_UNDERSCORED_ID reference_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-referenceerror.c b/src/libecmabuiltins/ecma-builtin-referenceerror.c index 4d4e84450..4b191d843 100644 --- a/src/libecmabuiltins/ecma-builtin-referenceerror.c +++ b/src/libecmabuiltins/ecma-builtin-referenceerror.c @@ -24,6 +24,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -95,3 +97,5 @@ ecma_builtin_reference_error_dispatch_construct (ecma_value_t *arguments_list_p, * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-string-prototype.c b/src/libecmabuiltins/ecma-builtin-string-prototype.c index 8db9f4310..ea8f6250a 100644 --- a/src/libecmabuiltins/ecma-builtin-string-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-string-prototype.c @@ -25,6 +25,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -374,3 +376,5 @@ ecma_builtin_string_prototype_object_trim (ecma_value_t this) /**< this argument * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN */ diff --git a/src/libecmabuiltins/ecma-builtin-string.c b/src/libecmabuiltins/ecma-builtin-string.c index 34a4c7c3f..72f2b3056 100644 --- a/src/libecmabuiltins/ecma-builtin-string.c +++ b/src/libecmabuiltins/ecma-builtin-string.c @@ -25,6 +25,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -157,3 +159,5 @@ ecma_builtin_string_dispatch_construct (ecma_value_t *arguments_list_p, /**< arg * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN */ diff --git a/src/libecmabuiltins/ecma-builtin-syntaxerror-prototype.c b/src/libecmabuiltins/ecma-builtin-syntaxerror-prototype.c index 6c6de9756..e82c74051 100644 --- a/src/libecmabuiltins/ecma-builtin-syntaxerror-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-syntaxerror-prototype.c @@ -25,9 +25,13 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-syntaxerror-prototype.inc.h" #define BUILTIN_UNDERSCORED_ID syntax_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-syntaxerror.c b/src/libecmabuiltins/ecma-builtin-syntaxerror.c index ba0ac9f61..a3a043c01 100644 --- a/src/libecmabuiltins/ecma-builtin-syntaxerror.c +++ b/src/libecmabuiltins/ecma-builtin-syntaxerror.c @@ -24,6 +24,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -95,3 +97,5 @@ ecma_builtin_syntax_error_dispatch_construct (ecma_value_t *arguments_list_p, /* * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-typeerror-prototype.c b/src/libecmabuiltins/ecma-builtin-typeerror-prototype.c index efda0b33c..baf3d9497 100644 --- a/src/libecmabuiltins/ecma-builtin-typeerror-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-typeerror-prototype.c @@ -25,9 +25,13 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-typeerror-prototype.inc.h" #define BUILTIN_UNDERSCORED_ID type_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-typeerror.c b/src/libecmabuiltins/ecma-builtin-typeerror.c index 89ad0a13f..a873a2e96 100644 --- a/src/libecmabuiltins/ecma-builtin-typeerror.c +++ b/src/libecmabuiltins/ecma-builtin-typeerror.c @@ -24,6 +24,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -95,3 +97,5 @@ ecma_builtin_type_error_dispatch_construct (ecma_value_t *arguments_list_p, /**< * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-urierror-prototype.c b/src/libecmabuiltins/ecma-builtin-urierror-prototype.c index f9141c2de..532c964ef 100644 --- a/src/libecmabuiltins/ecma-builtin-urierror-prototype.c +++ b/src/libecmabuiltins/ecma-builtin-urierror-prototype.c @@ -25,9 +25,13 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" #define BUILTIN_INC_HEADER_NAME "ecma-builtin-urierror-prototype.inc.h" #define BUILTIN_UNDERSCORED_ID uri_error_prototype #include "ecma-builtin-internal-routines-template.inc.h" + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtin-urierror.c b/src/libecmabuiltins/ecma-builtin-urierror.c index 7cafbc1e1..052d9d7b4 100644 --- a/src/libecmabuiltins/ecma-builtin-urierror.c +++ b/src/libecmabuiltins/ecma-builtin-urierror.c @@ -24,6 +24,8 @@ #include "ecma-try-catch-macro.h" #include "globals.h" +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS + #define ECMA_BUILTINS_INTERNAL #include "ecma-builtins-internal.h" @@ -95,3 +97,5 @@ ecma_builtin_uri_error_dispatch_construct (ecma_value_t *arguments_list_p, /**< * @} * @} */ + +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ diff --git a/src/libecmabuiltins/ecma-builtins.c b/src/libecmabuiltins/ecma-builtins.c index b0a05c87c..48cc132a2 100644 --- a/src/libecmabuiltins/ecma-builtins.c +++ b/src/libecmabuiltins/ecma-builtins.c @@ -112,6 +112,7 @@ ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */ /** Initializing [[PrimitiveValue]] properties of built-in prototype objects */ switch (obj_builtin_id) { +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN case ECMA_BUILTIN_ID_STRING_PROTOTYPE: { ecma_string_t *prim_prop_str_value_p = ecma_get_magic_string (ECMA_MAGIC_STRING__EMPTY); @@ -122,6 +123,9 @@ ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */ ECMA_SET_POINTER (prim_value_prop_p->u.internal_property.value, prim_prop_str_value_p); break; } +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN */ + +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN case ECMA_BUILTIN_ID_NUMBER_PROTOTYPE: { ecma_number_t *prim_prop_num_value_p = ecma_alloc_number (); @@ -133,6 +137,9 @@ ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */ ECMA_SET_POINTER (prim_value_prop_p->u.internal_property.value, prim_prop_num_value_p); break; } +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN */ + +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN case ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE: { ecma_property_t *prim_value_prop_p; @@ -141,6 +148,7 @@ ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */ prim_value_prop_p->u.internal_property.value = ECMA_SIMPLE_VALUE_FALSE; break; } +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN */ default: { diff --git a/src/libecmabuiltins/ecma-builtins.inc.h b/src/libecmabuiltins/ecma-builtins.inc.h index 0d77b18e1..a8a0a1bac 100644 --- a/src/libecmabuiltins/ecma-builtins.inc.h +++ b/src/libecmabuiltins/ecma-builtins.inc.h @@ -24,14 +24,15 @@ BUILTIN (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, object_prototype) -/* The Function.prototype object (15.3.4) */ -BUILTIN (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, +/* The Object object (15.2.1) */ +BUILTIN (ECMA_BUILTIN_ID_OBJECT, ECMA_OBJECT_TYPE_FUNCTION, - ECMA_MAGIC_STRING_FUNCTION_UL, + ECMA_MAGIC_STRING_OBJECT_UL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, - function_prototype) + object) +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN /* The Array.prototype object (15.4.4) */ BUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, ECMA_OBJECT_TYPE_ARRAY, @@ -40,46 +41,6 @@ BUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, true, array_prototype) -/* The Array object (15.4.1) */ -BUILTIN (ECMA_BUILTIN_ID_STRING_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_MAGIC_STRING_STRING_UL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - string_prototype) - -/* The Boolean.prototype object (15.6.4) */ -BUILTIN (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_MAGIC_STRING_BOOLEAN_UL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - boolean_prototype) - -/* The Number.prototype object (15.7.4) */ -BUILTIN (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_MAGIC_STRING_NUMBER_UL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - number_prototype) - -/* The Object object (15.2.1) */ -BUILTIN (ECMA_BUILTIN_ID_OBJECT, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_MAGIC_STRING_OBJECT_UL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - object) - -/* The Math object (15.8) */ -BUILTIN (ECMA_BUILTIN_ID_MATH, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_MAGIC_STRING_MATH_UL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - math) - /* The Array object (15.4.1) */ BUILTIN (ECMA_BUILTIN_ID_ARRAY, ECMA_OBJECT_TYPE_FUNCTION, @@ -87,6 +48,16 @@ BUILTIN (ECMA_BUILTIN_ID_ARRAY, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, array) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN*/ + +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN +/* The String.prototype object (15.5.4) */ +BUILTIN (ECMA_BUILTIN_ID_STRING_PROTOTYPE, + ECMA_OBJECT_TYPE_GENERAL, + ECMA_MAGIC_STRING_STRING_UL, + ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, + true, + string_prototype) /* The String object (15.5.1) */ BUILTIN (ECMA_BUILTIN_ID_STRING, @@ -95,6 +66,16 @@ BUILTIN (ECMA_BUILTIN_ID_STRING, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, string) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN */ + +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN +/* The Boolean.prototype object (15.6.4) */ +BUILTIN (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, + ECMA_OBJECT_TYPE_GENERAL, + ECMA_MAGIC_STRING_BOOLEAN_UL, + ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, + true, + boolean_prototype) /* The Boolean object (15.6.1) */ BUILTIN (ECMA_BUILTIN_ID_BOOLEAN, @@ -103,6 +84,16 @@ BUILTIN (ECMA_BUILTIN_ID_BOOLEAN, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, boolean) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN */ + +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN +/* The Number.prototype object (15.7.4) */ +BUILTIN (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, + ECMA_OBJECT_TYPE_GENERAL, + ECMA_MAGIC_STRING_NUMBER_UL, + ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, + true, + number_prototype) /* The Number object (15.7.1) */ BUILTIN (ECMA_BUILTIN_ID_NUMBER, @@ -111,6 +102,15 @@ BUILTIN (ECMA_BUILTIN_ID_NUMBER, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, number) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN */ + +/* The Function.prototype object (15.3.4) */ +BUILTIN (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, + ECMA_OBJECT_TYPE_FUNCTION, + ECMA_MAGIC_STRING_FUNCTION_UL, + ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, + true, + function_prototype) /* The Function object (15.3.1) */ BUILTIN (ECMA_BUILTIN_ID_FUNCTION, @@ -120,6 +120,17 @@ BUILTIN (ECMA_BUILTIN_ID_FUNCTION, true, function) +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN +/* The Math object (15.8) */ +BUILTIN (ECMA_BUILTIN_ID_MATH, + ECMA_OBJECT_TYPE_GENERAL, + ECMA_MAGIC_STRING_MATH_UL, + ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, + true, + math) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN */ + +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS /* The Error.prototype object (15.11.4) */ BUILTIN (ECMA_BUILTIN_ID_ERROR_PROTOTYPE, ECMA_OBJECT_TYPE_GENERAL, @@ -231,6 +242,7 @@ BUILTIN (ECMA_BUILTIN_ID_URI_ERROR, ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE, true, uri_error) +#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ /**< The [[ThrowTypeError]] object (13.2.3) */ BUILTIN (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER, diff --git a/src/libecmaoperations/ecma-array-object.c b/src/libecmaoperations/ecma-array-object.c index e62bbb386..129f23e2a 100644 --- a/src/libecmaoperations/ecma-array-object.c +++ b/src/libecmaoperations/ecma-array-object.c @@ -101,7 +101,12 @@ ecma_op_create_array_object (ecma_value_t *arguments_list_p, /**< list of argume array_items_count = arguments_list_len; } +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN ecma_object_t *array_prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE); +#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN */ + ecma_object_t *array_prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE); +#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN */ + ecma_object_t *obj_p = ecma_create_object (array_prototype_obj_p, true, ECMA_OBJECT_TYPE_ARRAY); ecma_deref_object (array_prototype_obj_p); diff --git a/src/libecmaoperations/ecma-boolean-object.c b/src/libecmaoperations/ecma-boolean-object.c index a10757780..07e377b48 100644 --- a/src/libecmaoperations/ecma-boolean-object.c +++ b/src/libecmaoperations/ecma-boolean-object.c @@ -52,7 +52,12 @@ ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boo JERRY_ASSERT (bool_value == ECMA_SIMPLE_VALUE_TRUE || bool_value == ECMA_SIMPLE_VALUE_FALSE); +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE); +#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN */ + ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE); +#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN */ + ecma_object_t *obj_p = ecma_create_object (prototype_obj_p, true, ECMA_OBJECT_TYPE_GENERAL); diff --git a/src/libecmaoperations/ecma-exceptions.c b/src/libecmaoperations/ecma-exceptions.c index 28f978e2c..c24a96859 100644 --- a/src/libecmaoperations/ecma-exceptions.c +++ b/src/libecmaoperations/ecma-exceptions.c @@ -38,6 +38,7 @@ ecma_object_t* ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error type */ { +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS ecma_builtin_id_t prototype_id = ECMA_BUILTIN_ID__COUNT; switch (error_type) @@ -98,6 +99,11 @@ ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error typ class_prop_p->u.internal_property.value = ECMA_MAGIC_STRING_ERROR_UL; return new_error_obj_p; +#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ + (void) error_type; + + return ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR); +#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */ } /* ecma_new_standard_error */ /** diff --git a/src/libecmaoperations/ecma-number-object.c b/src/libecmaoperations/ecma-number-object.c index cf1606304..cccf5f787 100644 --- a/src/libecmaoperations/ecma-number-object.c +++ b/src/libecmaoperations/ecma-number-object.c @@ -50,7 +50,12 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb ecma_number_t *prim_value_p = ECMA_GET_POINTER (conv_to_num_completion.u.value.value); +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE); +#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN */ + ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE); +#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN */ + ecma_object_t *obj_p = ecma_create_object (prototype_obj_p, true, ECMA_OBJECT_TYPE_GENERAL); diff --git a/src/libecmaoperations/ecma-string-object.c b/src/libecmaoperations/ecma-string-object.c index b52e45627..9bc0ead5d 100644 --- a/src/libecmaoperations/ecma-string-object.c +++ b/src/libecmaoperations/ecma-string-object.c @@ -77,7 +77,12 @@ ecma_op_create_string_object (ecma_value_t *arguments_list_p, /**< list of argum } } +#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_STRING_PROTOTYPE); +#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN */ + ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE); +#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN */ + ecma_object_t *obj_p = ecma_create_object (prototype_obj_p, true, ECMA_OBJECT_TYPE_STRING); diff --git a/tests/jerry-test-suite/precommit_test_list b/tests/jerry-test-suite/precommit_test_list index aa2f1db4c..02000dafa 100644 --- a/tests/jerry-test-suite/precommit_test_list +++ b/tests/jerry-test-suite/precommit_test_list @@ -961,9 +961,6 @@ ./tests/jerry-test-suite/15/15.02/15.02.04/15.02.04.04/15.02.04.04-008.js ./tests/jerry-test-suite/15/15.02/15.02.04/15.02.04.04/15.02.04.04-009.js ./tests/jerry-test-suite/15/15.02/15.02.04/15.02.04.04/15.02.04.04-010.js -./tests/jerry-test-suite/15/15.03/15.03.02/15.03.02.01/15.03.02.01-002.js -./tests/jerry-test-suite/15/15.03/15.03.02/15.03.02.01/15.03.02.01-004.js -./tests/jerry-test-suite/15/15.03/15.03.02/15.03.02.01/15.03.02.01-007.js ./tests/jerry-test-suite/15/15.03/15.03.03/15.03.03-003.js ./tests/jerry-test-suite/15/15.03/15.03.03/15.03.03.01/15.03.03.01-001.js ./tests/jerry-test-suite/15/15.04/15.04.02/15.04.02.01/15.04.02.01-001.js diff --git a/tests/jerry/compact_profile_error.js b/tests/jerry/N.compact_profile_error.js similarity index 100% rename from tests/jerry/compact_profile_error.js rename to tests/jerry/N.compact_profile_error.js