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:
@@ -864,14 +864,30 @@ typedef struct
|
||||
uint8_t instantiated_bitset[1]; /**< instantiated property bit set for generic built-ins */
|
||||
uint8_t routine_flags; /**< flags for built-in routines */
|
||||
} u2;
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
ecma_value_t realm_value; /**< realm value */
|
||||
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
uint32_t continue_instantiated_bitset[1]; /**< bit set for instantiated properties */
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
} ecma_built_in_props_t;
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REALMS)
|
||||
|
||||
/**
|
||||
* Number of bits available in the instantiated bitset without allocation
|
||||
*/
|
||||
#define ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE (8)
|
||||
|
||||
#else /* !ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
|
||||
/**
|
||||
* Number of bits available in the instantiated bitset without allocation
|
||||
*/
|
||||
#define ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE (8 + 32)
|
||||
|
||||
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
|
||||
|
||||
/**
|
||||
* Builtin routine function object status flags
|
||||
*/
|
||||
@@ -992,6 +1008,12 @@ typedef struct
|
||||
ecma_built_in_props_t built_in; /**< built-in object part */
|
||||
} ecma_extended_built_in_object_t;
|
||||
|
||||
/**
|
||||
* Checks whether the built-in is an ecma_extended_built_in_object_t
|
||||
*/
|
||||
#define ECMA_BUILTIN_IS_EXTENDED_BUILT_IN(object_type) \
|
||||
((object_type) == ECMA_OBJECT_TYPE_CLASS || (object_type) == ECMA_OBJECT_TYPE_ARRAY)
|
||||
|
||||
/**
|
||||
* Flags for array.length_prop_and_hole_count
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user