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:
@@ -44,6 +44,19 @@ main_register_global_function (const char *name_p, /**< name of the function */
|
||||
jerry_release_value (result_val);
|
||||
} /* main_register_global_function */
|
||||
|
||||
static jerry_value_t
|
||||
main_create_realm (const jerry_value_t func_obj_val, /**< function object */
|
||||
const jerry_value_t this_p, /**< this arg */
|
||||
const jerry_value_t args_p[], /**< function arguments */
|
||||
const jerry_length_t args_cnt) /**< number of function arguments */
|
||||
{
|
||||
(void) func_obj_val; /* unused */
|
||||
(void) this_p; /* unused */
|
||||
(void) args_p; /* unused */
|
||||
(void) args_cnt; /* unused */
|
||||
return jerry_create_realm ();
|
||||
} /* main_create_realm */
|
||||
|
||||
/**
|
||||
* Register a method for the $262 object.
|
||||
*/
|
||||
@@ -204,6 +217,7 @@ main_init_engine (main_args_t *arguments_p) /** main arguments */
|
||||
main_register_global_function ("gc", jerryx_handler_gc);
|
||||
main_register_global_function ("print", jerryx_handler_print);
|
||||
main_register_global_function ("resourceName", jerryx_handler_resource_name);
|
||||
main_register_global_function ("createRealm", main_create_realm);
|
||||
} /* main_init_engine */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user