Implement realm object and support realms for built-ins and JS functions (#4354)

- Type for realm objects is introduced (ecma_global_object_t)
- Realm reference is added to built-in objects and ECMAScript functions
- Resolving built-ins, global environments, and scopes require realm object
- Unnecessary global object accesses are removed from the code

Missing: external functions and static snapshot functions have no realm reference

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-12-08 14:36:36 +01:00
committed by GitHub
parent 7cb9f808f7
commit df92c86ecf
32 changed files with 1128 additions and 188 deletions
+7
View File
@@ -852,6 +852,9 @@ typedef struct
uint8_t ident_end; /**< end position of the identifier group */
uint8_t const_literal_end; /**< end position of the const literal group */
uint8_t literal_end; /**< end position of the literal group */
#if ENABLED (JERRY_BUILTIN_REALMS)
ecma_value_t realm_value; /**< realm value */
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
} cbc_uint8_arguments_t;
/**
@@ -867,6 +870,9 @@ typedef struct
uint16_t const_literal_end; /**< end position of the const literal group */
uint16_t literal_end; /**< end position of the literal group */
uint16_t padding; /**< an unused value */
#if ENABLED (JERRY_BUILTIN_REALMS)
ecma_value_t realm_value; /**< realm value */
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
} cbc_uint16_arguments_t;
/**
@@ -901,6 +907,7 @@ typedef enum
CBC_FUNCTION_CONSTRUCTOR, /**< constructor function */
/* The following functions cannot be constructed (see CBC_FUNCTION_IS_CONSTRUCTABLE) */
CBC_FUNCTION_SCRIPT, /**< script (global) function */
CBC_FUNCTION_GENERATOR, /**< generator function */
CBC_FUNCTION_ASYNC, /**< async function */
CBC_FUNCTION_ASYNC_GENERATOR, /**< async generator function */