Uh oh!
There was an error while loading. Please reload this page.
vm: make ContextifyContext a BaseObject - #44796
Conversation
There was a problem hiding this comment.
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).
Uh oh!
There was an error while loading. Please reload this page.
- 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.
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.
71c4ed9 to
b5790b7CompareThis reverts commit b9042c87b60184a37d9c8674ec8c8b29b2a8ab5e.
b5790b7 to
cd6ffe3Comparenodejs-github-bot
commented
Sep 28, 2022
legendecas
commented
Sep 29, 2022
Linter is complaining. |
nodejs-github-bot
commented
Sep 29, 2022
nodejs-github-bot
commented
Sep 29, 2022
nodejs-github-bot
commented
Oct 3, 2022
- 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 <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #44796 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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 <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
joyeecheung
commented
Oct 4, 2022
Landed in 00e5617...5b1bcf8 |
danielleadams
commented
Oct 10, 2022
Hi @joyeecheung, can you open up a backport PR for this to v18.x-staging? Thank you. |
PR-URL: #44796 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- 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 <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#44796 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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 <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
`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 <daeyeon.dev@gmail.com> PR-URL: #45128 Refs: #44796 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
`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 <daeyeon.dev@gmail.com> PR-URL: #45128 Refs: #44796 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
- 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 <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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 <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- 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 <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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 <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
`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 <daeyeon.dev@gmail.com> PR-URL: #45128 Refs: #44796 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
`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 <daeyeon.dev@gmail.com> PR-URL: #45128 Refs: #44796 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
- 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 <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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 <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
`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 <daeyeon.dev@gmail.com> PR-URL: #45128 Refs: #44796 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
src: refactor BaseObject methods
into a BaseObject::SetInternalFields() method.
BaseObject::TagNodeObject()
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.