-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
src: replace some FIXED_ONE_BYTE_STRING call with env->something_string() in src/ #30266
Conversation
replace FIXED_ONE_BYTE_STRING call with env->something_string() in src/api/environment.cc, src/api/hooks.cc and src/async_wrap.cc Fixes: nodejs/code-and-learn#97 Refs: nodejs/code-and-learn#97
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.
Fwiw, I don't think any of these strings are created more than once in a typical Node.js application
@@ -508,7 +508,7 @@ void AsyncWrap::Initialize(Local<Object> target, | |||
env->async_hooks()->async_ids_stack().GetJSArray()).Check(); | |||
|
|||
target->Set(context, | |||
FIXED_ONE_BYTE_STRING(env->isolate(), "owner_symbol"), | |||
env->owner_symbol_string(), | |||
env->owner_symbol()).Check(); |
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 think we could actually drop this property altogether and use internalBinding ('symbols')
in JS land instead
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.
To elaborate: you can replace the owner_symbol
here:
node/lib/internal/async_hooks.js
Line 36 in 618fcbd
const { async_hook_fields, async_id_fields, owner_symbol } = async_wrap; |
with const { owner_symbol } = internalBinding('symbols')
And remove this part in C++.
ping @js00070, see comment above. |
ping @js00070 again |
sorry guys, I'm not familiar with the architecture of nodejs now. I have been busy recently. I can close this PR temporarily. I will try to contribute to nodejs after spending some time reading the source code. |
replace
FIXED_ONE_BYTE_STRING
call withenv->something_string()
insrc/api/environment.cc
,src/api/hooks.cc
andsrc/async_wrap.cc
this task is a part of nodejs/code-and-learn#97
Checklist
make -j2 test
(UNIX) passes