Commit 51e35dd
fix(core): store Global<Context> ptr for libuv-compat callbacks
Instead of storing a `v8::Local<Context>` pointer in `loop_.data` at
the start of each event loop tick (which is only valid for that tick),
store a `v8::Global<Context>` via `Global::into_raw()` once during
`register_uv_loop`. V8 keeps the persistent-handle slot updated across
GC cycles, so the pointer remains valid for the lifetime of the runtime.
The raw Global is reconstructed and dropped in `JsRealmInner::destroy`.
Ported from denoland/deno_core#1315
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent ad52a9f commit 51e35dd
2 files changed
Lines changed: 37 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
247 | 266 | | |
248 | 267 | | |
249 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1546 | 1546 | | |
1547 | 1547 | | |
1548 | 1548 | | |
1549 | | - | |
1550 | | - | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
1551 | 1552 | | |
1552 | 1553 | | |
1553 | 1554 | | |
| |||
1556 | 1557 | | |
1557 | 1558 | | |
1558 | 1559 | | |
1559 | | - | |
| 1560 | + | |
| 1561 | + | |
1560 | 1562 | | |
1561 | 1563 | | |
1562 | 1564 | | |
1563 | 1565 | | |
1564 | 1566 | | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
1565 | 1577 | | |
1566 | 1578 | | |
1567 | 1579 | | |
| |||
2011 | 2023 | | |
2012 | 2024 | | |
2013 | 2025 | | |
2014 | | - | |
2015 | | - | |
2016 | | - | |
2017 | | - | |
2018 | | - | |
2019 | | - | |
2020 | | - | |
2021 | | - | |
2022 | | - | |
2023 | | - | |
2024 | | - | |
2025 | | - | |
2026 | | - | |
2027 | | - | |
2028 | | - | |
2029 | | - | |
2030 | | - | |
2031 | | - | |
2032 | 2026 | | |
2033 | 2027 | | |
2034 | 2028 | | |
| |||
0 commit comments