-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
lib: convert transfer sequence to array in js #55317
Conversation
Review requested:
|
5f3c150
to
fa84f31
Compare
Tests are failing:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #55317 /- ##
==========================================
- Coverage 88.41% 88.40% -0.02%
==========================================
Files 652 652
Lines 186759 186827 68
Branches 36097 36048 -49
==========================================
Hits 165130 165165 35
- Misses 14898 14911 13
- Partials 6731 6751 20
|
fa84f31
to
f64ce5e
Compare
Should be fixed now. Thanks for the heads up. |
cc @joyeecheung This is more like a RFC right now. I'm keen to hear your thoughts on this approach since you initiated the work moving |
The work wasn't really started to move it entirely to C , it was about getting rid of the unnecessary Lines 1609 to 1613 in b5fb2ff
And this PR is not touching it. The argument conversion should've been done in JS in the first place IMO, just not in the middle of binding, but should be done before the binding is invoked. In fact I actually left a TODO comment in there: Lines 1600 to 1601 in b5fb2ff
Which I think is exactly what this PR is doing? |
Yes, exactly what this PR is trying to achieve : ) |
533ce0a
to
476ff6e
Compare
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.
LGTM with a nit
This commit lets `tranfer` passed to `structuredClone` get validated at JS layer by doing webidl conversion. This avoids the C to JS function call overhead in the native implementaiton of `structuredClone`
476ff6e
to
c9f5904
Compare
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.
lgtm
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.
I'm not going to block this PR, especially with a green CI, but having an object converter is not correct here. As noted in the PR, a dictionary converter is correct - as an idl dictionary can be represented in js, whilst an idl object cannot.
There are some small issues like hitting object.transfer
's getter twice, which is observable via a proxy, and checking the type of options multiple times, but nothing major.
Landed in 50b4ada |
This commit lets `tranfer` passed to `structuredClone` get validated at JS layer by doing webidl conversion. This avoids the C to JS function call overhead in the native implementaiton of `structuredClone` PR-URL: nodejs#55317 Fixes: nodejs#55280 Refs: nodejs#50330 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matthew Aitken <[email protected]>
This commit lets `tranfer` passed to `structuredClone` get validated at JS layer by doing webidl conversion. This avoids the C to JS function call overhead in the native implementaiton of `structuredClone` PR-URL: #55317 Fixes: #55280 Refs: #50330 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matthew Aitken <[email protected]>
This commit lets `tranfer` passed to `structuredClone` get validated at JS layer by doing webidl conversion. This avoids the C to JS function call overhead in the native implementaiton of `structuredClone` PR-URL: nodejs#55317 Fixes: nodejs#55280 Refs: nodejs#50330 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matthew Aitken <[email protected]>
This PR utilizes the webidl sequence converter to convert
transfer
in JS layer. Although this is kind of like undoing some efforts made to move the entirestrucutredClone
to C , it fixes the inconsistency ofstructuredClone
with other runtimes with webidl compliance.Additionally, this reduces the C to JS overhead, as the iterator function is no longer invoked at C layer, when
transfer
is an iterator object.Fixes: #55280
Refs: #50330