-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: use stack-allocated Environment instances #7090
Conversation
(Comment is at #7082 (comment)) Curious, does this buy us anything in reality? Just less management of environment? Seems fine to me, not going to sign-off though. (CI is green fwiw) |
It makes it obvious that the instance's lifetime is correctly scoped, something you don't have with heap-allocated instances. |
Seems like a good idea. Scanning through it the one thing that does come to mind is that it would be helpful to have additional code comments added as these kinds of changes are being made... comments that help explain the flow and intent more so that contributors who are less familiar with the code can grok things a bit easier. Beyond that nothing else comes to mind. LGTM given that CI is green. Would like @trevnorris to review also tho. |
Can you point out a few places where comments would help? In general I try to refrain from comments unless the code does something that's not the obviously correct thing to do but I don't think that's an issue here. |
I'm thinking in terms of general comments that would help someone who is new to node understand what is happening within the code. For instance, a quick one liner that explains what |
We used to have such comments in src/node.cc and src/node.js but they have a habit of getting out of sync with the code. As to your particular example, that's existing code that this PR doesn't fundamentally change. I don't think this PR is the right place to start commenting it, that's mixing two different things. |
I don't disagree :-) I was just using it as an example. No worries :-) |
#include "v8.h" | ||
#include "v8-profiler.h" |
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.
Which header is it that includes SetupProcessObject()
?
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.
node_internals.h, which is included by node.h, which is included by env-inl.h. It's a bit roundabout, I can include it directly.
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.
doesn't worry me. just couldn't see how the header was reaching here.
Like seeing code moved out of |
PR-URL: nodejs#7090 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
Makes it easier to reason about the lifetime of the Environment object. PR-URL: nodejs#7090 Refs: nodejs#7082 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
e4563dc
to
aac79df
Compare
This is not landing cleanly, so holding off on including it in the next v6 release. |
Still conflicts to v6, with or without the inspector, and the inspector depends on it... Going to patch without; I think that conflict is easier to resolve. |
@bnoordhuis safe to assume dont land on v4.x as well? |
Correct. I've added the label. |
Based on a comment @trevnorris made in #7082.
R=@jasnell?
CI: https://ci.nodejs.org/job/node-test-pull-request/2890/