-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The properties of the builtins are only enumerable after their first usage #152
Comments
@ruben-ayrapetyan, @egavrin I've created a proof-of-concept patch to see how could we initialize the properties, please see commit on the https://github.com/galpeter/jerryscript/commits/builtin_init branch. What do you think about it? One thing I currently see that if we initialize all properties for a given built-in then we can remove the |
@galpeter, could you, please, clarify would properties of built-ins that are not accessed during execution of a script, be initialized if the changes are applied? |
@ruben-ayrapetyan, this would initialize all builtins as once you access the global object (with The code works that it would only initialize the given ( |
@galpeter, currently used version initializes a built-in's property only upon access to the property. Could we implement enumeration without removing the lazy instantiation? Maybe, we could add special ecma_op_object_get_own_property_names for enumerating the names, without instantiating a built-in's properties until they are not not actually accessed. What do you think about this? |
@ruben-ayrapetyan currently the in the property list, which is returned by the In short the approach could help, but it could also be that it just gives more code/memory usage in the end. |
@galpeter, names of properties for each built-in are already stored in memory ( Contrariwise, disabling lazy instantiation of built-in's properties increases memory usage. |
var propertyNames = Object.getOwnPropertyNames(Math);
print(propertyNames.join(", "));
Works on master, closing. |
Jerry version:
OS:
Description:
Asking for the properties of any builtin objects results in a list, that only contains the previously used property names.
E.g:
results an empty list. However:
gives a list with only the "getOwnPropertyNames" property, since it was used already.
The text was updated successfully, but these errors were encountered: