denoland / rusty_v8

Rust bindings for the V8 JavaScript engine
https://crates.io/crates/v8
MIT License
3.08k stars 300 forks source link

fix: remove use of deprecated apis #1488

Closed devsnek closed 1 week ago

devsnek commented 1 month ago

Fixes: https://github.com/denoland/rusty_v8/issues/1478

https://docs.google.com/document/d/1FWnrKxjl0P-jY0CMPlzbXkH8xkKoX6nM4e2OXq1EGHU

tldr some* v8 objects now directly store a "wrapped pointer" field which is traced by cppgc. cppgc no longer requires embedder field information when being set up, and this field is set using Object::wrap/Object::unwrap.

* objects must use the JSObjectWithEmbedderSlots map

CLAassistant commented 1 month ago

CLA assistant check
All committers have signed the CLA.

0f-0b commented 1 month ago

the only way to get one of those afaik is by creating a template with internal fields, even if those internal fields end up not being used.

Another way is by calling a constructor created from a FunctionTemplate. In this case there's no need to add internal fields, which saves 8 bytes per object compared to what is done now.

devsnek commented 1 month ago

@0f-0b thanks for the pointer