-
Notifications
You must be signed in to change notification settings - Fork 673
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
Disguise accessor properties as data properties #4374
base: master
Are you sure you want to change the base?
Conversation
What's this for? any design notes? |
8e29bbe
to
4598550
Compare
This is a non-standard feature inspired by v8 engine. This allows disguising an accessor as data property. I.e. a message object created from a network packet can have a sender data property, but the property value is actually computed when the property is read. If this never happens, the property is never computed. Furthermore these accessor functions cannot be queried from the JS code, so it cannot be misused by the application. Since this feature is non-standard, we can make our decisions about it. The most important thing for me: the performance impact should be minimal. These properties can be created by setting a flag in the C API. This flag is also set, when the property descriptor is read, so the API functions can get these accessors. If an application never creates such properties, it can ignore this flag, which is useful for backward compatibility. Form JS side, Property definition: Configurable properties: currently reconfiguring these accessors can be done. Non-configurable properties: when the property is defined as data property, the setter is called. If the setter is not present, it is compared to the returned value of the getter. Even in non-configurable case, writable can be changed from true to false. Currently the setter is released in this case. |
An reference link to v8 are appreciated, also what's the advantage of this, any demo of it?
|
Needed to implement this https://v8.dev/docs/stack-trace-api |
Depends on #4373 |
@@ -194,6 +194,9 @@ typedef struct | |||
/** [[Configurable]] */ | |||
bool is_configurable; | |||
|
|||
/** Is data accessor property */ | |||
bool is_data_accessor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an API breaking change and should be documented.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
This is a non-standard feature, and we can discuss how it should work. The only important thing is that it should have a negligible effect on performance.