Skip to content

src: refactor Environment::GetCurrent(isolate) usage - #26376

Closed
addaleax wants to merge 5 commits into
nodejs:masterfrom
addaleax:embedding-env-getcurrent
Closed

src: refactor Environment::GetCurrent(isolate) usage#26376
addaleax wants to merge 5 commits into
nodejs:masterfrom
addaleax:embedding-env-getcurrent

Conversation

@addaleax

Copy link
Copy Markdown
Member
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

Copy link
Copy Markdown
Collaborator

@nodejs-github-botnodejs-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
Comment threadsrc/env-inl.h
@addaleax

Copy link
Copy Markdown
MemberAuthor

Comment threadsrc/node_platform.cc
Comment threadsrc/node_perf.cc Outdated
@addaleax

Copy link
Copy Markdown
MemberAuthor

@addaleaxaddaleax 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
Copy Markdown
MemberAuthor

Landed in cc4e8e0...820ae61

@addaleaxaddaleax 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 <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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 <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs 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 / srcIssues 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

@addaleax@nodejs-github-bot@bnoordhuis@jasnell@cjihrig@gireeshpunathil@ZYSzys