Split globalThis to be configurable. (#4575)

JERRY_BUILTIN_GLOBAL_THIS can be enabled without JERRY_ESNEXT

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
This commit is contained in:
Yonggang Luo
2021-02-09 15:20:05 +00:00
committed by GitHub
parent f7c817efcf
commit 818cc8ddab
8 changed files with 24 additions and 5 deletions
+3 -1
View File
@@ -220,8 +220,10 @@ enum
#if JERRY_ESNEXT
ECMA_VALUE_SYNC_ITERATOR = ECMA_MAKE_VALUE (13), /**< option for ecma_op_get_iterator: sync iterator is requested */
ECMA_VALUE_ASYNC_ITERATOR = ECMA_MAKE_VALUE (14), /**< option for ecma_op_get_iterator: async iterator is requested */
ECMA_VALUE_GLOBAL_THIS = ECMA_MAKE_VALUE (15), /**< globalThis built-in */
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_GLOBAL_THIS
ECMA_VALUE_GLOBAL_THIS = ECMA_MAKE_VALUE (15), /**< globalThis built-in */
#endif /* JERRY_BUILTIN_GLOBAL_THIS */
};
#if !JERRY_NUMBER_TYPE_FLOAT64
@@ -247,12 +247,14 @@ OBJECT_VALUE (LIT_MAGIC_STRING_WEAKSET_UL,
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)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_GLOBAL_THIS */
#if JERRY_BUILTIN_DATAVIEW
/* ECMA-262 v6, 23.1.1.1 */
@@ -1080,7 +1080,7 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
{
value = curr_property_p->value;
#if JERRY_ESNEXT
#if JERRY_BUILTIN_GLOBAL_THIS
if (value == ECMA_VALUE_GLOBAL_THIS)
{
/* Only the global object has globalThis property. */
@@ -1088,7 +1088,7 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
ecma_ref_object (object_p);
value = ecma_make_object_value (object_p);
}
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_GLOBAL_THIS */
break;
}
case ECMA_BUILTIN_PROPERTY_NUMBER: