GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — vm: make ContextifyContext a BaseObject by joyeecheung · Pull Request #44796 · nodejs/node

Conversation

@joyeecheung

@joyeecheung joyeecheung commented Sep 26, 2022

Copy link
Copy Markdown
Member

src: refactor BaseObject methods

  • Wrap the initialization of the kSlot and kEmbedderType fields
    into a BaseObject::SetInternalFields() method.
  • Move the tagging of kEmbedderType field into
    BaseObject::TagNodeObject()
  • Add a variant of BaseObject::MakeLazilyInitializedJSTemplate()
    that only needs IsolateData.
    This makes it easier to create BaseObject subclasses.

benchmark: add vm context global proxy benchmark

vm: make ContextifyContext a BaseObject

Instead of adding a reference to the ContextifyContext by using
a v8::External, we make ContextifyContext a weak BaseObject that
whose wrapper is referenced by the sandbox via a private symbol.
This makes it easier to snapshot the contexts, in addition to
reusing the BaseObject lifetime management for ContextifyContexts.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jhjimenez-lktn reacted with thumbs up emoji bricss reacted with eyes emoji
All reactions
  • 👍 1 reaction
  • 👀 1 reaction
@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 involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Sep 26, 2022
joyeecheung
joyeecheung commented Sep 26, 2022
View reviewed changes
Comment thread src/node_contextify.cc Outdated

@joyeecheung joyeecheung Sep 26, 2022

Copy link
Copy Markdown
Member Author

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.

I tried using a private symbol from the receiver to the wrapper and then unwrap to get to the ContextifyContext*, which is a bit slower than the current approach, so we are still using the context embedder field here. In any case, as long as the context is alive, the sandbox must be alive (through the kSandboxObject internal field), then the wrapper must be alive (through the contextify_context_private_symbol), so the ContextifyContext is also alive. On the other hand as long as the ContextifyContext is alive, the wrapper is alive, then the context must also be alive (through the constructor).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@legendecas legendecas added the vm Issues and PRs related to the vm subsystem. label Sep 26, 2022
legendecas
legendecas reviewed Sep 27, 2022
View reviewed changes
Comment thread src/node_contextify.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

joyeecheung added 3 commits September 28, 2022 19:52
@joyeecheung
src: refactor BaseObject methods
b8f371e
- Wrap the initialization of the kSlot and kEmbedderType fields
  into a BaseObject::SetInternalFields() method.
- Move the tagging of kEmbedderType field into
  BaseObject::TagNodeObject()
- Add a variant of BaseObject::MakeLazilyInitializedJSTemplate()
  that only needs IsolateData.
This makes it easier to create BaseObject subclasses.
@joyeecheung
benchmark: add vm context global proxy benchmark
6769aff
@joyeecheung
vm: make ContextifyContext a BaseObject
2a7de3e
Instead of adding a reference to the ContextifyContext by using
a v8::External, we make ContextifyContext a weak BaseObject that
whose wrapper is referenced by the sandbox via a private symbol.
This makes it easier to snapshot the contexts, in addition to
reusing the BaseObject lifetime management for ContextifyContexts.
@joyeecheung
joyeecheung force-pushed the contextify-baseobject branch from 71c4ed9 to b5790b7 Compare September 28, 2022 11:55
@joyeecheung
fixup! vm: make ContextifyContext a BaseObject
cd6ffe3
This reverts commit b9042c87b60184a37d9c8674ec8c8b29b2a8ab5e.
@joyeecheung
joyeecheung force-pushed the contextify-baseobject branch from b5790b7 to cd6ffe3 Compare September 28, 2022 12:00
@nodejs-github-bot

nodejs-github-bot commented Sep 28, 2022

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Sep 29, 2022
CI Reliability 2022-09-29 nodejs/reliability#388
Open
16 tasks
legendecas
legendecas approved these changes Sep 29, 2022
View reviewed changes
@legendecas

legendecas commented Sep 29, 2022

Copy link
Copy Markdown
Member

Linter is complaining.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung
fixup! fixup! vm: make ContextifyContext a BaseObject
7f3cece
@nodejs-github-bot

nodejs-github-bot commented Sep 29, 2022

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Sep 29, 2022

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Sep 30, 2022
CI Reliability 2022-09-30 nodejs/reliability#390
Open
CI Reliability 2022-10-01 nodejs/reliability#391
Open
CI Reliability 2022-10-02 nodejs/reliability#392
Open
jasnell
jasnell approved these changes Oct 2, 2022
View reviewed changes
@github-actions github-actions Bot mentioned this pull request Oct 3, 2022
CI Reliability 2022-10-03 nodejs/reliability#393
Open
9 tasks
@nodejs-github-bot

nodejs-github-bot commented Oct 3, 2022

Copy link
Copy Markdown
Collaborator

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joyeecheung added a commit that referenced this pull request Oct 4, 2022
@joyeecheung
src: refactor BaseObject methods
d5ce285
- Wrap the initialization of the kSlot and kEmbedderType fields
  into a BaseObject::SetInternalFields() method.
- Move the tagging of kEmbedderType field into
  BaseObject::TagNodeObject()
- Add a variant of BaseObject::MakeLazilyInitializedJSTemplate()
  that only needs IsolateData.
This makes it easier to create BaseObject subclasses.

PR-URL: #44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
joyeecheung added a commit that referenced this pull request Oct 4, 2022
@joyeecheung
benchmark: add vm context global proxy benchmark
b3531bf
PR-URL: #44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
joyeecheung added a commit that referenced this pull request Oct 4, 2022
@joyeecheung
vm: make ContextifyContext a BaseObject
5b1bcf8
Instead of adding a reference to the ContextifyContext by using
a v8::External, we make ContextifyContext a weak BaseObject that
whose wrapper is referenced by the sandbox via a private symbol.
This makes it easier to snapshot the contexts, in addition to
reusing the BaseObject lifetime management for ContextifyContexts.

PR-URL: #44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@joyeecheung

joyeecheung commented Oct 4, 2022

Copy link
Copy Markdown
Member Author

Landed in 00e5617...5b1bcf8

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung joyeecheung closed this Oct 4, 2022
@danielleadams danielleadams added the backport-requested-v18.x label Oct 10, 2022
@danielleadams

danielleadams commented Oct 10, 2022

Copy link
Copy Markdown
Contributor

Hi @joyeecheung, can you open up a backport PR for this to v18.x-staging? Thank you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

danielleadams pushed a commit that referenced this pull request Oct 11, 2022
@joyeecheung @danielleadams
benchmark: add vm context global proxy benchmark
27b4b78
PR-URL: #44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@danielleadams danielleadams mentioned this pull request Oct 11, 2022
v18.11.0 proposal #44968
Merged
@joyeecheung joyeecheung mentioned this pull request Oct 12, 2022
Node.js Technical Steering Committee (TSC) Meeting 2022-10-12 nodejs/TSC#1291
Closed
@RafaelGSS RafaelGSS mentioned this pull request Oct 14, 2022
2022-10-18, Version 19.0.0 (Current) #44626
Merged
@joyeecheung joyeecheung mentioned this pull request Oct 18, 2022
[v18.x] backport various patches of internal refactorings for snapshot and realms #45007
Closed
joyeecheung added a commit to joyeecheung/node that referenced this pull request Oct 18, 2022
@joyeecheung
src: refactor BaseObject methods
7499284
- Wrap the initialization of the kSlot and kEmbedderType fields
  into a BaseObject::SetInternalFields() method.
- Move the tagging of kEmbedderType field into
  BaseObject::TagNodeObject()
- Add a variant of BaseObject::MakeLazilyInitializedJSTemplate()
  that only needs IsolateData.
This makes it easier to create BaseObject subclasses.

PR-URL: nodejs#44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
joyeecheung added a commit to joyeecheung/node that referenced this pull request Oct 18, 2022
@joyeecheung
benchmark: add vm context global proxy benchmark
d2192e6
PR-URL: nodejs#44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
joyeecheung added a commit to joyeecheung/node that referenced this pull request Oct 18, 2022
@joyeecheung
vm: make ContextifyContext a BaseObject
45f23ef
Instead of adding a reference to the ContextifyContext by using
a v8::External, we make ContextifyContext a weak BaseObject that
whose wrapper is referenced by the sandbox via a private symbol.
This makes it easier to snapshot the contexts, in addition to
reusing the BaseObject lifetime management for ContextifyContexts.

PR-URL: nodejs#44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@daeyeon daeyeon mentioned this pull request Oct 22, 2022
src: remove unused contextify_global_private_symbol #45128
Merged
nodejs-github-bot pushed a commit that referenced this pull request Oct 24, 2022
@daeyeon
src: remove unused contextify_global_private_symbol
deb7710
`contextify_global_private_symbol` is no longer used. It was used
to hold a new context's global object, but the approach has been
changed to hold a ContextifyContext wrapper using
`contextify_context_private_symbol`.

Signed-off-by: Daeyeon Jeong <[email protected]>
PR-URL: #45128
Refs: #44796
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Nov 1, 2022
@daeyeon @RafaelGSS
src: remove unused contextify_global_private_symbol
27228b0
`contextify_global_private_symbol` is no longer used. It was used
to hold a new context's global object, but the approach has been
changed to hold a ContextifyContext wrapper using
`contextify_context_private_symbol`.

Signed-off-by: Daeyeon Jeong <[email protected]>
PR-URL: #45128
Refs: #44796
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
joyeecheung added a commit that referenced this pull request Nov 1, 2022
@joyeecheung
src: refactor BaseObject methods
b27329b
- Wrap the initialization of the kSlot and kEmbedderType fields
  into a BaseObject::SetInternalFields() method.
- Move the tagging of kEmbedderType field into
  BaseObject::TagNodeObject()
- Add a variant of BaseObject::MakeLazilyInitializedJSTemplate()
  that only needs IsolateData.
This makes it easier to create BaseObject subclasses.

PR-URL: #44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
joyeecheung added a commit that referenced this pull request Nov 1, 2022
@joyeecheung
vm: make ContextifyContext a BaseObject
c37dc7c
Instead of adding a reference to the ContextifyContext by using
a v8::External, we make ContextifyContext a weak BaseObject that
whose wrapper is referenced by the sandbox via a private symbol.
This makes it easier to snapshot the contexts, in addition to
reusing the BaseObject lifetime management for ContextifyContexts.

PR-URL: #44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
juanarbol pushed a commit that referenced this pull request Nov 4, 2022
@joyeecheung @juanarbol
src: refactor BaseObject methods
ad8baa5
- Wrap the initialization of the kSlot and kEmbedderType fields
  into a BaseObject::SetInternalFields() method.
- Move the tagging of kEmbedderType field into
  BaseObject::TagNodeObject()
- Add a variant of BaseObject::MakeLazilyInitializedJSTemplate()
  that only needs IsolateData.
This makes it easier to create BaseObject subclasses.

PR-URL: #44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
juanarbol pushed a commit that referenced this pull request Nov 4, 2022
@joyeecheung @juanarbol
vm: make ContextifyContext a BaseObject
1ca34fd
Instead of adding a reference to the ContextifyContext by using
a v8::External, we make ContextifyContext a weak BaseObject that
whose wrapper is referenced by the sandbox via a private symbol.
This makes it easier to snapshot the contexts, in addition to
reusing the BaseObject lifetime management for ContextifyContexts.

PR-URL: #44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Nov 10, 2022
@daeyeon @RafaelGSS
src: remove unused contextify_global_private_symbol
4e14ed8
`contextify_global_private_symbol` is no longer used. It was used
to hold a new context's global object, but the approach has been
changed to hold a ContextifyContext wrapper using
`contextify_context_private_symbol`.

Signed-off-by: Daeyeon Jeong <[email protected]>
PR-URL: #45128
Refs: #44796
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
@danielleadams danielleadams mentioned this pull request Dec 30, 2022
v18.13.0 release proposal #46025
Merged
danielleadams pushed a commit that referenced this pull request Dec 30, 2022
@daeyeon @danielleadams
src: remove unused contextify_global_private_symbol
d4baa5a
`contextify_global_private_symbol` is no longer used. It was used
to hold a new context's global object, but the approach has been
changed to hold a ContextifyContext wrapper using
`contextify_context_private_symbol`.

Signed-off-by: Daeyeon Jeong <[email protected]>
PR-URL: #45128
Refs: #44796
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@joyeecheung @danielleadams
src: refactor BaseObject methods
2d2e71c
- Wrap the initialization of the kSlot and kEmbedderType fields
  into a BaseObject::SetInternalFields() method.
- Move the tagging of kEmbedderType field into
  BaseObject::TagNodeObject()
- Add a variant of BaseObject::MakeLazilyInitializedJSTemplate()
  that only needs IsolateData.
This makes it easier to create BaseObject subclasses.

PR-URL: #44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@joyeecheung @danielleadams
vm: make ContextifyContext a BaseObject
39cf8b4
Instead of adding a reference to the ContextifyContext by using
a v8::External, we make ContextifyContext a weak BaseObject that
whose wrapper is referenced by the sandbox via a private symbol.
This makes it easier to snapshot the contexts, in addition to
reusing the BaseObject lifetime management for ContextifyContexts.

PR-URL: #44796
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
danielleadams pushed a commit that referenced this pull request Jan 3, 2023
@daeyeon @danielleadams
src: remove unused contextify_global_private_symbol
f748f5d
`contextify_global_private_symbol` is no longer used. It was used
to hold a new context's global object, but the approach has been
changed to hold a ContextifyContext wrapper using
`contextify_context_private_symbol`.

Signed-off-by: Daeyeon Jeong <[email protected]>
PR-URL: #45128
Refs: #44796
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@legendecas legendecas legendecas approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. vm Issues and PRs related to the vm subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@joyeecheung @nodejs-github-bot @legendecas @danielleadams @jasnell
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.