Commit Graph

490 Commits

Author SHA1 Message Date
Divy Srivastava
54bdfe722e
Inline hint for default FastFunction trait methods (#1199) 2023-03-16 18:33:21 +05:30
Bartek Iwańczuk
b1884eb1f5
Change signature of FunctionTemplate::build_fast (#1197)
Changes signature of "FunctionTemplate::build_fast" to allow
to pass "CFunctionInfo" explicitly. If it's not passed explicitly,
it's still autogenerated.
2023-03-16 08:23:04 +01:00
Giovanny Gutiérrez
c58f4c08d9
feat: Expose the security token API from V8 (#1192) 2023-03-10 08:31:13 -05:00
Divy Srivastava
ffb875d5ae
Add PropertyDescriptor::new_from_value_writable and new_from_value (#1187) 2023-02-11 22:51:51 +05:30
Bartek Iwańczuk
36cf16b594
refactor: Move set_promise_hooks API to HandleScope (#1186) 2023-02-09 20:38:25 +01:00
Bartek Iwańczuk
3b6d79c0e6
feat: Add bindings for continuation embedder data (#1184)
Adds bindings for:

- v8::Context::GetContinuationPreservedEmbedderData
- v8::Context::SetContinuationPreservedEmbedderData

These APIs are available on the "HandleScope".
---------

Co-authored-by: Bert Belder <bertbelder@gmail.com>
2023-02-09 13:34:28 +01:00
Bartek Iwańczuk
83b54692c1
refactor: v8::Context::set_promise_hooks requires scope (#1185) 2023-02-05 20:14:57 +01:00
Andreu Botella
96673943b7
Update and improve documentation about finalizers (#1182)
This change updates the documentation of `Weak::with_finalizer` to
reflect the fact that the previous stricter guarantees were dropped in
#1181. It also adds documentation to `Weak::with_guaranteed_finalizer`
and `Weak::clone_with_guaranteed_finalizer`.
2023-02-02 11:45:22 +00:00
Bartek Iwańczuk
d3fff51d2d
Don't run GC on isolate disposal (#1181)
Removing this garbage collection trigger removes the guarantee that
"regular" FinalizerCallbacks will be called before the isolate goes away.
It is fine as both spec and V8 do not provide this guarantee and we were
overly strict in this case.
2023-02-02 11:59:14 +01:00
Bartek Iwańczuk
623c6cd81d
feat: v8::Context::set_promise_hooks accepts None (#1178)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2023-02-01 17:42:47 +01:00
Bartek Iwańczuk
72216372d5
fix: don't use C++ references for possibly-null pointers (#1179)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2023-02-01 15:41:52 +00:00
Divy Srivastava
55e8a2d60d
feat: Add v8::Object::DefineProperty (#1172) 2023-01-24 21:03:00 +05:30
Mike Mulchrone
7c1b08e6a8
Avoid referencing uninitalized in Inspector API (#1164) 2023-01-15 20:00:38 +05:30
Bartek Iwańczuk
961a4940b5
feat: Add v8::TypedArray::length (#1166) 2023-01-08 15:11:19 +01:00
linbingquan
cb8573dc0d
chore: update to Rust 1.66.0 (#1156) 2022-12-21 00:11:23 +01:00
Bert Belder
8548b39833 deps: upgrade ICU to 72-1 (#1160)
ICU was upgraded to the version specified in V8's `DEPS` file as of V8
11.0.226.2.
2022-12-18 22:55:12 +01:00
denobot
42dd5390ca deps: upgrade V8 to 11.0.226.2 (#1160) 2022-12-18 22:55:12 +01:00
Bert Belder
b295e4146a chore: run clang-format (#1160) 2022-12-18 22:55:12 +01:00
Bartek Iwańczuk
b53ecc2f65
chore: Update docstring on v8::Global (#1153) 2022-12-09 15:20:40 +01:00
Bartek Iwańczuk
9fc29f439e
feat: v8::Inspector::exception_thrown, v8::Inspector::create_stack_trace (#1149)
Adds APIs required to notify inspector about exceptions raised
by the runtime.
2022-12-07 14:43:55 +01:00
Bartek Iwańczuk
3e8a572ceb
feat: Add v8::Isolate::request_garbage_collection_for_testing (#1148) 2022-12-02 21:10:37 +01:00
Bartek Iwańczuk
caa2ef4510
feat: v8::Isolate::{add,remove}_gc_prologue_callback (#1142) 2022-11-30 19:10:42 +01:00
Ryan Dahl
3783a5c725
feat: Isolate::memory_pressure_notification() (#1139)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-30 17:25:10 +01:00
Divy Srivastava
e57c3ec90f
Optional key in v8::ArrayBuffer:detach (#1141) 2022-11-30 15:33:28 +01:00
Divy Srivastava
0b9423a0ee
Fix length type of FastApiOneByteString (#1140) 2022-11-30 15:32:10 +01:00
Divy Srivastava
f5c9e90c6d
Add SeqOneByteString to fast API calls (#1129) 2022-11-29 22:06:55 +01:00
Mike Mulchrone
3c6d259507
Exposing Value::TypeOf (#1133) 2022-11-27 03:02:08 +01:00
Bartek Iwańczuk
06f385afb6
Add 'aux_data' to v8::Inspector::contextCreated() (#1134) 2022-11-26 16:11:35 +01:00
Bartek Iwańczuk
65ff64e5cd
chore: update Rust to 1.65.0 (#1116) 2022-11-25 14:32:52 +01:00
Nils Hasenbanck
e89d532b57
Remove libc dependency. (#1117)
Use `std` functionality where possible. Only size_t needs
to be defined like was done with the `intptr_t` type before.

Also unifies the usage of `std::os::raw` types that where
already defined in the support module.
2022-11-24 20:23:52 +05:30
Andreu Botella
d718370a07
refactor: Have ArrayBuffer::data return Option<NonNull<c_void>> (#1131)
The pointer returned by `ArrayBuffer::data` might be null if the
backing store has zero length, but the return type `*mut c_void` does
not force the user to consider this case. This change makes the return
type `Option<NonNull<c_void>>`, which is semantically equivalent, but
which forces users of the API to handle the `None` case.

This PR is the `ArrayBuffer` counterpart to #817.

This is a breaking API change.
2022-11-24 15:31:11 +01:00
Divy Srivastava
3a05ab4cd6
Add WasmMemoryObject::buffer method (#1128) 2022-11-23 21:44:37 +05:30
Bartek Iwańczuk
dd5fa705d4
Add v8::V8Inspector::context_destroyed API (#1125) 2022-11-22 23:50:49 +01:00
Andreu Botella
d992c5056b
Update ArrayBuffer::was_detached to not use OpenHandle (#1126)
In #1103, the `ArrayBuffer::was_detached` method was added to rusty_v8
to fill a gap in the C++ API, and it was implemented using the
internal `v8::Utils::OpenHandle`. Since then, a `WasDetached` method
was added to `ArrayBuffer` in V8 10.9. This PR updates the
implementation to use that.
2022-11-21 12:47:12 +01:00
Andreu Botella
acba887fa4
Add ArrayBuffer::set_detach_key (#1127)
This method, introduced in V8 10.9, makes it so an `ArrayBuffer`
object is impossible to detach unless a specific detach key is passed
to the `detach` method. Such `ArrayBuffer`s still count as detachable
as per the `ArrayBuffer::is_detachable` method, but otherwise behave
much like WebAssembly memories.
2022-11-21 12:46:57 +01:00
Bartek Iwańczuk
3d30e7cc82
feat: v8::Module::get_stalled_top_level_await_message (#1123)
This commit adds "v8::Module::get_stalled_top_level_await_message" API
that allows to retrieve a vector of tuples with handles to v8::Module and v8::Message.
This information can be used to display a nice error when event loop runs out
of work to do but there are still unresolved promises.
2022-11-17 19:35:15 +01:00
Bartek Iwańczuk
9d15050214
fix: Rework deprecated v8::ArrayBuffer:detach API (#1121) 2022-11-12 01:51:21 +01:00
Bartek Iwańczuk
b8d7925774
docs: add note how to create a v8::Local out of v8::Global (#1113) 2022-11-02 22:09:07 +01:00
Bert Belder
d85f78527f
perf: optimize FunctionCallbackInfo and PropertyCallbackInfo methods (#1104) 2022-10-19 21:41:22 +02:00
Divy Srivastava
8a3a049d9f
Access to raw v8::Context slots (#1092)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-18 14:01:54 +02:00
Marcos Casagrande
c06986c12e
feat: add ArrayBuffer::was_detached() (#1103) 2022-10-16 22:03:48 +02:00
Leo Kettmeir
885e0163a1
feat: add v8::Isolate::snapshot_creator_from_existing_snapshot API (#973)
This commit adds "v8::Isolate::snapshot_creator_from_existing_snapshot" API,
that allows to create a new snapshot from already existing snapshot.

Following APIs were added as well:

"v8::Context::from_snapshot"
"v8::Isolate::add_context"

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2022-10-14 12:33:09 +02: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
Bert Belder
b2a09e2f14
perf: optimize scope construction and Isolate::get_slot/set_slot() (#1090) 2022-10-08 18:08:37 +05:30
Bert Belder
fc26f634e4
Don't use embedder slot in HostImportModuleDynamicallyCallback ABI adapter (#1089) 2022-10-08 00:30:01 +00:00
PerfectLaugh
403d6c525d
Enable running on 32 bits and several minor fixes (#976) 2022-10-07 15:02:51 +02:00
Divy Srivastava
5dd41e9dba
use Isolate for creating primitives (#1082) 2022-10-06 20:44:16 +02:00
Nugine
8f8636b4f7
feat: add String::write_utf8_uninit (#1019) 2022-10-06 19:26:38 +02:00
Aaron O'Mullan
de7a1acbde
feat(isolate): expose get/set_data (#911)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-06 19:19:38 +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