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

src: replace some FIXED_ONE_BYTE_STRING call with env->something_string() in src/ #30266

Closed
wants to merge 1 commit into from

Conversation

js00070
Copy link

@js00070 js00070 commented Nov 5, 2019

replace FIXED_ONE_BYTE_STRING call with env->something_string() in src/api/environment.cc, src/api/hooks.cc and src/async_wrap.cc

this task is a part of nodejs/code-and-learn#97

Checklist

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Nov 5, 2019
@gireeshpunathil gireeshpunathil added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Nov 5, 2019
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
Copy link
Member

@addaleax addaleax left a 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();
Copy link
Member

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

Copy link
Member

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:

const { async_hook_fields, async_id_fields, owner_symbol } = async_wrap;

with const { owner_symbol } = internalBinding('symbols')

And remove this part in C++.

@lundibundi
Copy link
Member

ping @js00070, see comment above.

@gireeshpunathil
Copy link
Member

ping @js00070 again

@js00070
Copy link
Author

js00070 commented Nov 26, 2019

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.

@js00070 js00070 closed this Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants