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

(vee-eight-4.9) contextify: update deprecated SetWeak usage #5392

Closed
wants to merge 4 commits into from

Conversation

ofrobots
Copy link
Contributor

Description of change

Follow on from #5204 (which is pending landing once the CI resumes).

This PR cleans up the complexity with how weakness was being used in node_contextify and updates to the new style Phantom weakness API.

Pull Request check-list

Please make sure to review and check all of these items:

  • Does make -j8 test (UNIX) or vcbuild test nosign (Windows) pass with
    this change (including linting)?
  • Is the commit message formatted according to CONTRIBUTING.md?
  • If this change fixes a bug (or a performance problem), is a regression
    test (or a benchmark) included?
  • Is a documentation update included (if this change modifies
    existing APIs, or introduces new ones)?

NOTE: these things are not required to open a PR and can be done afterwards /
while the PR is open.

Affected core subsystem(s)

contextify

R=@bnoordhuis, @indutny
/cc @nodejs/v8

@ofrobots ofrobots added the v8 engine Issues and PRs related to the V8 dependency. label Feb 23, 2016
sandbox_.MarkIndependent();
references_++;
explicit ContextifyContext(Environment* env, Local<Object> sandbox_obj)
: env_(env) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can drop the explicit keyword and put everything on one line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Cleanup how node_contextify keeps weak references in order to prepare
for new style phantom weakness API. We didn't need to keep a weak
reference to the context's global proxy, as the context holds it.
Simplify how node_contextify was keeping a weak reference to the
sandbox object in order to prepare for new style phantom weakness V8
API. It is simpler (and more robust) for the context to hold a
reference to the sandbox in an embedder data field. Doing otherwise
meant that the sandbox could become weak while the context was still
alive. This wasn't a problem because we would make the reference
strong at that point.

Since the sandbox must live at least as long as the context, it
would be better for the context to hold onto the sandbox.
@ofrobots
Copy link
Contributor Author

CI: https://ci.nodejs.org/job/node-test-pull-request/1749/.

This is ready for review.

@bnoordhuis
Copy link
Member

LGTM

ofrobots added a commit that referenced this pull request Feb 26, 2016
Cleanup how node_contextify keeps weak references in order to prepare
for new style phantom weakness API. We didn't need to keep a weak
reference to the context's global proxy, as the context holds it.

PR-URL: #5392
Reviewed-By: Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
ofrobots added a commit that referenced this pull request Feb 26, 2016
Simplify how node_contextify was keeping a weak reference to the
sandbox object in order to prepare for new style phantom weakness V8
API. It is simpler (and more robust) for the context to hold a
reference to the sandbox in an embedder data field. Doing otherwise
meant that the sandbox could become weak while the context was still
alive. This wasn't a problem because we would make the reference
strong at that point.

Since the sandbox must live at least as long as the context, it
would be better for the context to hold onto the sandbox.

PR-URL: #5392
Reviewed-By: Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
ofrobots added a commit that referenced this pull request Feb 26, 2016
PR-URL: #5392
Reviewed-By: Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
ofrobots added a commit that referenced this pull request Feb 26, 2016
PR-URL: #5392
Reviewed-By: Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
@ofrobots
Copy link
Contributor Author

Thanks. Landed on vee-eight-4.9 as 7a863af...3921770.

@ofrobots ofrobots closed this Feb 26, 2016
@ofrobots ofrobots deleted the setweak-contextify branch February 26, 2016 22:18
ofrobots added a commit to ofrobots/node that referenced this pull request Mar 1, 2016
Cleanup how node_contextify keeps weak references in order to prepare
for new style phantom weakness API. We didn't need to keep a weak
reference to the context's global proxy, as the context holds it.

PR-URL: nodejs#5392
Reviewed-By: Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
ofrobots added a commit to ofrobots/node that referenced this pull request Mar 1, 2016
Simplify how node_contextify was keeping a weak reference to the
sandbox object in order to prepare for new style phantom weakness V8
API. It is simpler (and more robust) for the context to hold a
reference to the sandbox in an embedder data field. Doing otherwise
meant that the sandbox could become weak while the context was still
alive. This wasn't a problem because we would make the reference
strong at that point.

Since the sandbox must live at least as long as the context, it
would be better for the context to hold onto the sandbox.

PR-URL: nodejs#5392
Reviewed-By: Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
ofrobots added a commit to ofrobots/node that referenced this pull request Mar 1, 2016
PR-URL: nodejs#5392
Reviewed-By: Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorins MylesBorins mentioned this pull request Mar 21, 2016
3 tasks
@MylesBorins
Copy link
Contributor

A fix for the regression in v5.9.0 has just landed and will be included in v5.9.1

Let's wait some more to see if this ends up working as expected

@ofrobots
Copy link
Contributor Author

I would also be good to wait for more feedback on #3113 before backporting to LTS.

@MylesBorins
Copy link
Contributor

MylesBorins commented May 17, 2016

@ofrobots would you be able to prepare a backport? it looks like this solved some pretty nasty bugs 😄

edit: including --> #5800 of course 😄

@ofrobots
Copy link
Contributor Author

Sure thing. I will put together a PR for 4.x, sometime later this week.

rvagg pushed a commit to rvagg/io.js that referenced this pull request May 20, 2016
Cleanup how node_contextify keeps weak references in order to prepare
for new style phantom weakness API. We didn't need to keep a weak
reference to the context's global proxy, as the context holds it.

PR-URL: nodejs#5392
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
rvagg pushed a commit to rvagg/io.js that referenced this pull request May 20, 2016
Simplify how node_contextify was keeping a weak reference to the
sandbox object in order to prepare for new style phantom weakness V8
API. It is simpler (and more robust) for the context to hold a
reference to the sandbox in an embedder data field. Doing otherwise
meant that the sandbox could become weak while the context was still
alive. This wasn't a problem because we would make the reference
strong at that point.

Since the sandbox must live at least as long as the context, it
would be better for the context to hold onto the sandbox.

PR-URL: nodejs#5392
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
rvagg pushed a commit to rvagg/io.js that referenced this pull request May 20, 2016
PR-URL: nodejs#5392
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
rvagg pushed a commit to rvagg/io.js that referenced this pull request May 20, 2016
PR-URL: nodejs#5392
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request May 20, 2016
Cleanup how node_contextify keeps weak references in order to prepare
for new style phantom weakness API. We didn't need to keep a weak
reference to the context's global proxy, as the context holds it.

PR-URL: #5392
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request May 20, 2016
Simplify how node_contextify was keeping a weak reference to the
sandbox object in order to prepare for new style phantom weakness V8
API. It is simpler (and more robust) for the context to hold a
reference to the sandbox in an embedder data field. Doing otherwise
meant that the sandbox could become weak while the context was still
alive. This wasn't a problem because we would make the reference
strong at that point.

Since the sandbox must live at least as long as the context, it
would be better for the context to hold onto the sandbox.

PR-URL: #5392
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request May 20, 2016
PR-URL: #5392
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request May 20, 2016
PR-URL: #5392
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorins MylesBorins mentioned this pull request May 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants