Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
v8 module: allow TypedArray and DataView#23953
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
vsemozhetbyt commented Oct 29, 2018
refack left a comment
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.
Nits made me ask a question about timing.
test/parallel/test-v8-serdes.js Outdated
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.
Please const
test/parallel/test-v8-serdes.js Outdated
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.
Could these be const length2 and const buf2 please?
Recycling variables should be avoided.
test/parallel/test-v8-serdes.js Outdated
refackOct 29, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
Could this be const arrayBufferViewsLength instead.
.
.
.
Which made be think isn't there a race here?
Is the callbacks guaranteed to be in order?
At minimum this should be documented in a comment
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.
Is the callbacks guaranteed to be in order?
Yes. We have only one HostObject so that the callback will be called only once.
I think v8.Serializer.writeRawBytes() being expected to be called inside of the callback of _writeHostObject makes the test a bit confusing. I'm going to refactor this.
refack commented Oct 29, 2018
@oyyd as alway thank you for the contribution. While reviewing the code and looking at cases of variable recycling I found that I don't understand the operation order guarantee. |
test/parallel/test-v8-serdes.js Outdated
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.
Maybe simplest solution is to add a sentinel:
lethas_writeHostObjectCalled=false;the in _writeHostObject
has_writeHostObjectCalled=true;the first line of _readHostObject
assert.ok(has_writeHostObjectCalled);
refackOct 29, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
or dual use arrayBufferViewsLength - initialise it to false, and then assert
des._readHostObject=common.mustCall(()=>{assert.notStrictEqual(false,arrayBufferViewsLength); ...oyyd commented Oct 30, 2018
@refack Thanks for your advice! Comments addressed. I have separated the test for |
refack commented Oct 30, 2018
Looks 💯. Thank you for following up! |
refack commented Oct 30, 2018
This commit allow passing `TypedArray` and `DataView` to: - v8.deserialize() - new v8.Deserializer() - v8.serializer.writeRawBytes() PR-URL: nodejs#23953 Refs: nodejs#1826 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
refack commented Oct 31, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Landed in 56881b0 🎉 |
This commit allow passing `TypedArray` and `DataView` to: - v8.deserialize() - new v8.Deserializer() - v8.serializer.writeRawBytes() PR-URL: #23953 Refs: #1826 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
This commit allow passing `TypedArray` and `DataView` to: - v8.deserialize() - new v8.Deserializer() - v8.serializer.writeRawBytes() PR-URL: #23953 Refs: #1826 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
This commit allow passing
TypedArrayandDataViewto:v8.deserialize()new v8.Deserializer()v8.serializer.writeRawBytes()Refs: #1826
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes