| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
There was a problem hiding this comment.
Instead of calculateX could you maybe have div(a, b) as an example and have divide by 0 as example for when to switch to slow path?
Sorry, something went wrong.
There was a problem hiding this comment.
internal C functions is rather ambiguous. Also, V8 internals usually refers to the non-public V8 API, which we try not to use in any case. Lastly, if I remember correctly, V8 API calls are allowed to some degree. Not performing any allocations on the V8 heap is what's critical. (Unless this changed since I last worked on fast API calls.)
Sorry, something went wrong.
There was a problem hiding this comment.
I see. Thanks! Can you give an example of V8 API call, without any allocation on the V8 heap?
Sorry, something went wrong.
There was a problem hiding this comment.
I might be wrong, but I think @MayaLekova implemented a fast API that relies on GetAlignedPointerFromInternalField in 6cfba9f, for example. @devsnek might know more about the exact conditions for which APIs are allowed.
Sorry, something went wrong.
There was a problem hiding this comment.
You are right. You can access pre-existing/pre-allocated data from the fast apis. I thought it was inferred from the documentation (at least I assumed). Is there any specific wording you'd like me to change?
Sorry, something went wrong.
There was a problem hiding this comment.
I've updated the documentation.
Sorry, something went wrong.
There was a problem hiding this comment.
[...] Not performing any allocations on the V8 heap is what's critical.
Indeed that's still the case, and until we have the current GC architecture, it will stay like this. Possible future relaxation of this rule might come with conservative stack scanning. Please note that this also leads to the limitation for not calling back into JS code (I think this was discussed in this thread too).
Some brief background on the support for various types in V8 could be found in this external doc.
Sorry, something went wrong.
I updated the example. Thanks for the hint! 🥇 💯 |
Sorry, something went wrong.
There was a problem hiding this comment.
I think you should mention this file in the src/README.md too.
Sorry, something went wrong.
|
Awesome @anonrig 🙌🏼 Learned a lot just by reading the PR ^^ |
Sorry, something went wrong.
Sorry, something went wrong.
| * Throwing errors is not available on fast API, but can be done | ||
| through the fallback to slow API. |
There was a problem hiding this comment.
| * Throwing errors is not available on fast API, but can be done | |
| through the fallback to slow API. | |
| * Throwing errors is not available from within a fast API call, but can be done | |
| through the fallback to the slow API. |
Sorry, something went wrong.
There was a problem hiding this comment.
Perhaps it's also better to suggest that since in principal, the fast API and the slow API should behave the same to avoid bugs, it's better not to throw errors in the slow API either and just update some flags and return to the JS land to throw?
Sorry, something went wrong.
There was a problem hiding this comment.
I agree in principal with @joyeecheung, but that is not a limitation of a V8 Fast API declaration, but an implementation recommendation. I think it should not be included in this documentation, but in a more style specific documentation like README.md?
Sorry, something went wrong.
| In V8, the options fallback is defined as `FastApiCallbackOptions` inside | ||
| [`v8-fast-api-calls.h`](../../deps/v8/include/v8-fast-api-calls.h). | ||
|
|
||
| * C++ land |
There was a problem hiding this comment.
Why is this a bullet point?
Sorry, something went wrong.
There was a problem hiding this comment.
It aligns with other sections in the same file for mentioning the context of the example it's referring to. Do you have a recommendation for an alternative?
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
Commit Queue failed- Loading data for nodejs/node/pull/46199 ✔ Done loading data for nodejs/node/pull/46199 ----------------------------------- PR info ------------------------------------ Title doc: add v8 fast api contribution guidelines (#46199) Author Yagiz Nizipli (@anonrig) Branch anonrig:docs-fast-api -> nodejs:main Labels doc, author ready, commit-queue-squash Commits 7 - doc: add v8 fast api contribution guidelines - fixup! doc: add v8 fast api contribution guidelines - fixup! doc: add v8 fast api contribution guidelines - fixup! doc: add v8 fast api contribution guidelines - fixup! doc: add v8 fast api contribution guidelines - fixup! doc: add v8 fast api contribution guidelines - fixup! doc: add v8 fast api contribution guidelines Committers 1 - Yagiz Nizipli PR-URL: https://github.com/nodejs/node/pull/46199 Reviewed-By: Matteo Collina Reviewed-By: Robert Nagy Reviewed-By: Darshan Sen Reviewed-By: Rafael Gonzaga Reviewed-By: James M Snell ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/46199 Reviewed-By: Matteo Collina Reviewed-By: Robert Nagy Reviewed-By: Darshan Sen Reviewed-By: Rafael Gonzaga Reviewed-By: James M Snell -------------------------------------------------------------------------------- ℹ This PR was created on Fri, 13 Jan 2023 14:07:12 GMT ✔ Approvals: 5 ✔ - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/46199#pullrequestreview-1266448194 ✔ - Robert Nagy (@ronag) (TSC): https://github.com/nodejs/node/pull/46199#pullrequestreview-1248744183 ✔ - Darshan Sen (@RaisinTen) (TSC): https://github.com/nodejs/node/pull/46199#pullrequestreview-1249572133 ✔ - Rafael Gonzaga (@RafaelGSS) (TSC): https://github.com/nodejs/node/pull/46199#pullrequestreview-1253500941 ✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/46199#pullrequestreview-1262907890 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2023-01-20T03:25:41Z: https://ci.nodejs.org/job/node-test-pull-request/49099/ ⚠ Commits were pushed after the last Full PR CI run: ⚠ - fixup! doc: add v8 fast api contribution guidelines - Querying data for job/node-test-pull-request/49099/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/3992434537 |
Sorry, something went wrong.
Sorry, something went wrong.
PR-URL: #46199 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #46199 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #46199 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
I'm introducing a guideline to define and share the limitations/caveats and experiences I've gained from researching on this topic. This would help new contributors to add fast APIs to existing functions.
Referencing: nodejs/performance#23