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: refactor Environment::GetCurrent(isolate) usage #26376

Closed
wants to merge 5 commits into from

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented Mar 1, 2019

src: refactor Environment::GetCurrent(isolate) usage

Do not require an explicit HandleScope, or the ability to create
one, when using Environment::GetCurrent().

isolate->InContext() is used as an indicator that it is probably
okay to create a HandleScope, see also the short discussion in
#25775 (review).

src: prefer to get Environment from Context

We explicitly store the context anyway, and can skip the
extra steps introduced in Environment::GetCurrent().

src: allow running tasks without Environment

There is no real reason to assume that V8 tasks would have
to run in a Node.js Context.

src: forbid handle allocations from Platform tasks

Platform tasks should have their own handle scopes, rather than
leak into outer ones.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Do not require an explicit `HandleScope`, or the ability to create
one, when using `Environment::GetCurrent()`.

`isolate->InContext()` is used as an indicator that it is probably
okay to create a `HandleScope`, see also the short discussion in
nodejs#25775 (review).
We explicitly store the context anyway, and can skip the
extra steps introduced in `Environment::GetCurrent()`.
There is no real reason to assume that V8 tasks would have
to run in a Node.js `Context`.
Platform tasks should have their own handle scopes, rather than
leak into outer ones.
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Mar 1, 2019
@addaleax
Copy link
Member Author

addaleax commented Mar 1, 2019

src/node_perf.cc Outdated Show resolved Hide resolved
@addaleax
Copy link
Member Author

addaleax commented Mar 4, 2019

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 4, 2019
@addaleax
Copy link
Member Author

addaleax commented Mar 5, 2019

Landed in cc4e8e0...820ae61

@addaleax addaleax closed this Mar 5, 2019
@addaleax addaleax deleted the embedding-env-getcurrent branch March 5, 2019 21:50
addaleax added a commit that referenced this pull request Mar 5, 2019
Do not require an explicit `HandleScope`, or the ability to create
one, when using `Environment::GetCurrent()`.

`isolate->InContext()` is used as an indicator that it is probably
okay to create a `HandleScope`, see also the short discussion in
#25775 (review).

PR-URL: #26376
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax added a commit that referenced this pull request Mar 5, 2019
We explicitly store the context anyway, and can skip the
extra steps introduced in `Environment::GetCurrent()`.

PR-URL: #26376
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax added a commit that referenced this pull request Mar 5, 2019
There is no real reason to assume that V8 tasks would have
to run in a Node.js `Context`.

PR-URL: #26376
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax added a commit that referenced this pull request Mar 5, 2019
Platform tasks should have their own handle scopes, rather than
leak into outer ones.

PR-URL: #26376
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Mar 12, 2019
Do not require an explicit `HandleScope`, or the ability to create
one, when using `Environment::GetCurrent()`.

`isolate->InContext()` is used as an indicator that it is probably
okay to create a `HandleScope`, see also the short discussion in
nodejs#25775 (review).

PR-URL: nodejs#26376
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Mar 12, 2019
We explicitly store the context anyway, and can skip the
extra steps introduced in `Environment::GetCurrent()`.

PR-URL: nodejs#26376
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Mar 12, 2019
There is no real reason to assume that V8 tasks would have
to run in a Node.js `Context`.

PR-URL: nodejs#26376
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Mar 12, 2019
Platform tasks should have their own handle scopes, rather than
leak into outer ones.

PR-URL: nodejs#26376
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants