Skip to content
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

N-API: Expose v8::Object::GetIdentityHash #28195

Closed
argv-minus-one opened this issue Jun 13, 2019 · 5 comments
Closed

N-API: Expose v8::Object::GetIdentityHash #28195

argv-minus-one opened this issue Jun 13, 2019 · 5 comments
Labels
feature request Issues that request new features to be added to Node.js. node-api Issues and PRs related to the Node-API. wontfix Issues that will not be fixed.

Comments

@argv-minus-one
Copy link

Is your feature request related to a problem? Please describe.
A solution suggested for #28164 was to keep a big table of JS objects and their types, and use that to verify the type of a wrapper object before napi_unwrapping it. Currently, the only way to do this is to napi_strict_equals against every single object reference in the table, which is very slow if there are a lot of objects to keep track of.

Describe the solution you'd like
Please expose v8::Object::GetIdentityHash through N-API. This will make it possible to maintain a hash table of JS object references.

Describe alternatives you've considered
See #28164.

@bnoordhuis bnoordhuis added feature request Issues that request new features to be added to Node.js. node-api Issues and PRs related to the Node-API. labels Jun 13, 2019
@bnoordhuis
Copy link
Member

n-api is a JS engine abstraction layer and I don't think every JS engine has an equivalent feature. For example, I don't think Spidermonkey has anything like it.

@mhdawson
Copy link
Member

mhdawson commented Jun 13, 2019

It is a pre-req that an N-API call be able to be implemented on top of any of the the leading JS engines (with the goal of it being ALL)

@argv-minus-one
Copy link
Author

That would be a problem, yes. Spidermonkey has mozilla::HashGeneric and friends, which is used by its implementation of the JS Map class, but this does not seem to be part of the public API.

@gabrielschulhof
Copy link
Contributor

@argv-minus-one does #28237 obviate the need for this?

@bnoordhuis
Copy link
Member

I'm going to close this out as "not implementable."

@bnoordhuis bnoordhuis added the wontfix Issues that will not be fixed. label Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. node-api Issues and PRs related to the Node-API. wontfix Issues that will not be fixed.
Projects
None yet
Development

No branches or pull requests

4 participants