Adding configuration flag indicating whether Global Environment is bound to Global Object or it is simple declarative lexical environment.

This commit is contained in:
Ruben Ayrapetyan 2014-09-08 19:11:40 +04:00
parent dafbaa742e
commit fbcd393962
2 changed files with 11 additions and 0 deletions

View File

@ -104,4 +104,10 @@
*/
#define CONFIG_ECMA_EXCEPTION_SUPPORT
/**
* Link Global Environment to an empty declarative lexical environment
* instead of lexical environment bound to Global Object.
*/
// #define CONFIG_ECMA_GLOBAL_ENVIRONMENT_DECLARATIVE
#endif /* !CONFIG_H */

View File

@ -498,7 +498,12 @@ ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p, /**< lexical env
ecma_object_t*
ecma_op_create_global_environment (ecma_object_t *glob_obj_p) /**< the Global object */
{
#ifdef CONFIG_ECMA_GLOBAL_ENVIRONMENT_DECLARATIVE
(void) glob_obj_p;
ecma_object_t *glob_env_p = ecma_create_decl_lex_env (NULL);
#else /* !CONFIG_ECMA_GLOBAL_ENVIRONMENT_DECLARATIVE */
ecma_object_t *glob_env_p = ecma_create_object_lex_env (NULL, glob_obj_p, false);
#endif /* !CONFIG_ECMA_GLOBAL_ENVIRONMENT_DECLARATIVE */
return glob_env_p;
} /* ecma_op_create_global_environment */