Commit Graph

15 Commits

Author SHA1 Message Date
Bert Belder
53e048ffc7
fix: crash on x86_64 systems that support memory protection keys (#1318)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-12 23:26:42 +00:00
Bartek Iwańczuk
4b704ed8a9
refactor: v8::Isolate::snapshot_creator instead of v8::SnapshotCreator (#1098)
This commit removes "v8::SnapshotCreator" in favor of
"v8::Isolate::snapshot_creator" API. All methods from
"v8::SnapshotCreator" are now available on the "v8::Isolate".
If a method is called and isolate was not set up as a snapshot
creator then it will panic.

This commit gets rid of long standing unsoundness in typing
that allowed to easily induce a panic or segfault if a user didn't
use snapshot creator API properly.
2022-10-14 10:46:54 +02:00
Andreu Botella
cfdb8b0ccd
feat: Guaranteed finalizers (#1076)
Currently, when a finalizer callback is registered, it is not
guaranteed to be called if there is a global reference to the
corresponding object that survives the isolate. This is because the
finalizer callback takes a `&mut Isolate`, and so it must be called
before the isolate is fully destroyed, but all existing globals
(including possibly the one being currently finalized) are still
usable while there still exists a mutable reference to the isolate.

However, there are still use cases for having finalizers that are
guaranteed to run regardless of any remaining globals, but that don't
require any interaction with the isolate. This change adds them.

This change also changes the context annex to use a guaranteed
finalizer, fixing a bug with context slots not being freed if there
were any globals to the context at the time the isolate is dropped.
2022-10-06 17:25:45 +02:00
Andreu Botella
15ac9f4533
feat: Context slots (#937) 2022-05-19 23:24:58 +02:00
Bert Belder
25dd770570
perf: avoid double boxing of Arc/Box/Rc in Isolate slot (#925) 2022-03-21 11:50:45 +01:00
Luca Casonato
5ee0a375f2
chore: rename rusty_v8 to v8 (#803) 2021-10-27 14:32:12 +02:00
Rami Sabbagh
16708359bc
feat: Implement Isolate::remove_slot (#769) 2021-09-09 00:41:50 +02:00
Tim Ramlot
14bcf04bef
Add support for Platform::pump_message_loop and Platform::run_idle_tasks (#706)
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
2021-07-01 16:05:07 +02:00
Bert Belder
b31dbc89dc
Simplify 'Isolate::get/set_slot()' and use optimized hasher (#461) 2020-09-07 19:50:36 +02:00
Ben Noordhuis
6b2c7a56a7
Add Isolate::[gs]et_microtasks_policy() (#439)
Isolate::run_microtasks() already exists but the microtasks queue
is also flushed on script entry and exit. Some embedders want strict
control over when microtasks run, which is set by the policy.

And deprecate Isolate::run_microtasks(). The corresponding V8 API is
tagged with V8_DEPRECATE_SOON.
2020-08-23 10:25:16 -04:00
Bert Belder
4e64cefc9c
Remove unnecessary 'DerefMut' impl from 'Local<T>' (#406)
Local handles never need to be mutable. This patch also rounds up the
last few places where we were still asking the user to pass an `&mut T`
to an API method.
2020-06-26 15:05:39 +02:00
Bert Belder
b1a4dfea8b
Remove 'context' param from (almost) all public methods (#406) 2020-06-26 03:00:06 +02:00
Bert Belder
3b6ed67f5e
Rewrite the scope system from scratch (#406) 2020-06-26 01:42:00 +02:00
Bert Belder
cc626550b1
Explicitly drop slots when disposing an isolate (#364) 2020-04-23 19:48:07 +02:00
Bert Belder
0d636de447
Add safe alternative to get_data/set_data (#360) 2020-04-23 03:34:28 -04:00