0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-21 15:04:33 -05:00
Commit graph

455 commits

Author SHA1 Message Date
snek
b2ef529146
feat: cppgc NameProvider (#1528) 2024-09-06 22:35:35 +00:00
snek
8a5f484c71
re-add deprecated cppgc api (#1611) 2024-09-06 19:04:19 +00:00
snek
a97d89614e
feat: add Module::is_graph_async (#1607) 2024-09-04 18:00:29 -07:00
Nathan Whitaker
eb29f6bd8c
fix: Check for null pointer returned by ValueSerializer::Release (#1599)
* Check for null ptr during release

* Add to test

* Reorder
2024-08-29 23:10:06 +00:00
Nathan Whitaker
5989346753
Allow ValueSerializerImpl and ValueDeserializerImpl impls to be re-entrant (#1591)
Currently, if you were to call (for instance) write_value as part of a custom write_host_object implementation, you would be forced to create aliased exclusive references to the serializer (which is instant UB).

The underlying v8 de/serializers are re-entrant, so for the most part we simply need to pass around shared references instead of exclusive references.

Also adds some bindings to some missing functions, and makes ValueSerializer (and deserializer) garbage collectable.
2024-08-28 12:44:40 -07:00
Divy Srivastava
15b2ad2826
Disable relative vtable on Android (#1581) 2024-08-26 09:32:33 +05:30
denobot
3d29396d72
Rolling to V8 12.9.202.1 (#1579)
* Rolling to V8 12.9.202.1

* initial changes for 12.9

* CallbackScope for fast fns

* disable broken thing by default

* use windows 2022 runner

---------

Co-authored-by: snek <the@snek.dev>
2024-08-20 07:48:10 -07:00
snek
68b96d1cae
feat: expose v8 version constants (#1569) 2024-08-13 22:01:04 +00:00
snek
82301490d5
feat: add UseCounterCallback (#1567) 2024-08-13 19:19:27 +02:00
snek
70e18db2ff
update fast calls api (#1564) 2024-08-13 18:15:34 +02:00
snek
adf56a4f0f
feat: changes for vm (#1557) 2024-08-05 11:15:56 +02:00
Satya Rohith
93d18d3eb8
chore: upgrade to rust 1.80 (#1553) 2024-07-30 06:03:27 +00:00
snek
0a478a0b2a
chore: binding cleanup (#1551) 2024-07-26 13:37:39 -07:00
snek
d22c1f9a3c
feat: upgrade ScriptOrigin (#1550) 2024-07-25 22:32:11 +00:00
snek
c9383c2184
fix: QueryCallback should use Integer (#1545) 2024-07-24 11:39:30 -07:00
snek
39631b31d6
feat: add String::ValueView (#1543) 2024-07-24 07:59:18 -07:00
snek
1e4b691905
feat: V8 12.8 (#1539) 2024-07-23 19:43:32 +00:00
Aapo Alasuutari
7b6451aed4
fix: ExternalOneByteStringResource is not guaranteed to be valid UTF-8 (#1532)
A subtle unsoundness / undefined behaviour made its way into the fairly recently added ExternalOneByteStringResource object: The as_str API is not sound as the data inside may be be Latin-1, not ASCII.

As the API was not used anywhere in deno or deno_core, I opted to simply remove it and replace it with an as_bytes API. I also modified the test to showcase the Latin-1 string case and added copious notes and explanations around the code to make sure this doesn't accidentally happen again. The likely reason why the API originally slipped in is because the OneByteConst has this API where it is safe because the OneByteConst creation checks the data for ASCII-ness.

I also tried to add an API to extract an Option<&'static OneByteConst> from an &ExternalOneByteStringResource but run into rust-lang/rust#119618 ie. OneByteConst is actually duplicating the vtables... which is not great.
2024-07-21 01:09:30 +02:00
Nathan Whitaker
6385bd6f32
chore: Add a couple convenience casting functions to v8::Local (#1533)
* Rename cast -> cast_unchecked

* Add cast helpers

* Change a couple tests to use it

* Add some small docs

* Fmt

* Add inline hint

* Address comments
2024-07-20 01:34:32 +00:00
snek
7107d4869e
rust 1.79.0 (#1527) 2024-07-12 09:30:31 -07:00
snek
57fb97a43b
feat: cppgc::Ptr (#1523) 2024-07-10 22:03:49 -07:00
Bartek Iwańczuk
49b92c1e76
feat: Add Source Maps APIs (#1514)
This commit adds bindings for:

- v8::UnboundScript::get_source_mapping_url
- v8::UnboundScript::get_source_url
- v8::UnboundModuleScript::get_source_mapping_url
- v8::UnboundModuleScript::get_source_url
2024-07-04 22:13:11 +00:00
Nathan Whitaker
6bac39b579
Add non-static external onebyte string (#1511)
* Rename existing method

* Enable getting external onebyte resource + fix encoding

* Enable creating an external onebyte string that's freed by v8

* Add basic test

* Boxed str, fix as_str, doc comments

* Cleanup binding + fix adjust memory

* Use bindgen + raw api

* Rm unnecessary cast

* Rm unnecessary lines

* Revert "Use bindgen + raw api"

This reverts commit 8ea00476b6.

* Add raw api, cleanup

* Fix unnecessary conversion

* Address comments

* Trying to retrigger CI
2024-06-28 15:39:23 -07:00
snek
e747f405a4
fix: remove use of deprecated apis (#1488) 2024-06-27 08:29:46 -07:00
Kedas
2bbc9053b5
Add v8::Template::set_intrinsic_data_property (#1496)
* feat: add `v8::Template::set_intrinsic_data_property`

* fix: use assert_eq instead of assert

* fix: cargo fmt
2024-06-10 10:40:14 -07:00
Divy Srivastava
ff92021910
Fix uninitialized context annex slot (#1497) 2024-06-10 20:55:09 +05:30
snek
2a8b117c93
feat: add DataView constructor (#1491) 2024-06-03 13:47:57 -07:00
Bartek Iwańczuk
cf3f19c512
chore: Update use of deprecated APIs (#1481)
This commit updates APIs related to named and indexed property
handlers to not use deprecated V8 APIs. Main change is the change
of return value in callbacks that now requires to return v8::Intercepted enum.

Towards #1478
2024-05-15 23:21:56 +00:00
Matt Mastracci
f9043140a3
v0.92.0 (#1479) 2024-05-15 20:40:07 +00:00
Matt Mastracci
2686f237f8
fix: Re-enable pointer compression (#1473)
* fix: Re-enable pointer compression

* macos-13

* Add a tight loop test

* Better test

* Update tests/test_api.rs
2024-05-15 15:33:59 +00:00
Ardi
9ae2bc2e78
chore: Update toolchain + cargo update (#1469)
* Update toolchain + cargo update

* Update trybuild

* macos-13

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-05-09 16:27:44 +00:00
Pg
d11b720654
For #970 & #1303 : Enable build for aarch64-linux-android & x86_64-linux-android (#1468) 2024-04-22 17:16:26 -04:00
Tom Ballinger
57c2338212
Add Isolate::date_time_configuration_change_notification (#1446)
* Add `Isolate::date_time_configuration_change_notification`

* write some C

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-04-12 23:45:46 +00:00
Matt Mastracci
2ce9b4ca09
chore: Allow Rust ASAN flags to propagate into v8 build (#1449) 2024-04-12 15:26:06 -06:00
Bartek Iwańczuk
943cbcb7c1
feat: Add v8::MicrotaskQueue::new() (#1440) 2024-03-16 04:00:57 +00:00
Bartek Iwańczuk
91bec8216a
fix: mispelling in C binding (#1439)
Fixing a mistake I made in #1428.

Added some tests as well.
2024-03-16 03:32:28 +00:00
Divy Srivastava
69bac645e0
Add v8::MicrotaskQueue bindings (#1423) 2024-03-14 15:37:01 +00:00
Igor Zinkovsky
2371c4534b
feat: pass source as mut ref to script_compiler::compile (#1420) 2024-03-12 16:55:29 -07:00
Divy Srivastava
bc5ac4d486
Add Isolate::add_message_listener_with_error_level (#1424) 2024-03-12 12:05:44 +00:00
Divy Srivastava
8c18c547a3
V8 12.3.219.9 (#1419) 2024-03-08 23:52:23 +05:30
Bartek Iwańczuk
40b2269509
chore: revert V8 upgrade from 12.3 to 12.2. (#1414)
* Revert "V8 12.3.219.1 (#1402)"

This reverts commit f30c18c770.

* Revert "Track V8 12.3 (#1401)"

This reverts commit 07436bdb4c.
2024-03-08 08:42:13 +05:30
Igor Zinkovsky
083f43346c
feat: expose CachedData::rejected (#1413) 2024-03-07 09:36:06 -08:00
Matt Mastracci
be545b7d3d
feat: Add string access methods to OneByteConst (#1409) 2024-03-01 10:55:02 -07:00
Matt Mastracci
63eea06a9a
chore: bump rust-toolchain (#1408) 2024-03-01 17:28:17 +00:00
Divy Srivastava
f30c18c770
V8 12.3.219.1 (#1402)
Rolling to V8 12.3.219.1


Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2024-02-20 13:07:08 +00:00
Matt Mastracci
a8606e3dcb
feat: allow v8::Data as a generic for get_*_from_snapshot_once (#1393) 2024-02-09 20:39:30 +00:00
Divy Srivastava
21e7d7b3f2
Remove AllCanRead flag from PropertyHandlerFlags (#1387) 2024-01-10 08:21:04 +05:30
Divy Srivastava
70a07c050b
isolate->GetCppHeap() can return nullptr if no heap is attached (#1385)
Changes `v8::Isolate::get_cpp_heap` to return a `Option<&Heap>`.
2024-01-06 18:05:15 +00:00
Divy Srivastava
3de68239a5
Upgrade to V8 12.1.285.6 (#1374)
1. [[exceptions] Unify pending and scheduled exceptions](https://chromium-review.googlesource.com/c/v8/v8/+/5050065)

Reset no longer clears exception if it was rethrown. The test had to be adjusted for the same.

2. [[api] Allow passing CppHeap on Isolate creation](https://chromium-review.googlesource.com/c/v8/v8/+/4989254)

`AttachCppHeap` was deprecated but the alternative of passing `CppHeap` via Isolate CreateParams hard crashes (SIGSEGV). There are no tests for this in V8 and it seems the [Chromium CL](https://chromium-review.googlesource.com/c/chromium/src/+/4992764) is also crashing. For now I've just suppressed the deprecation warning until the crash is fixed in V8.

3. v8::Serializer impl must not throw more than one exception. 

I changed `get_shared_buffer_id()` to not throw and return `None`. V8 internally calls data clone error when it's the SAB is not clonable.

Other changes:

- `v8::ScriptCompiler` size increased by 3 words with `v8::ScriptCompiler::CompilationDetails`.
- `v8::ObjectTemplate::SetAccessor` & `v8::ObjectTemplate::SetAccessorProperty` signature changed and also deprecated.
- `v8::Context::SetContinuationPreservedEmbedderData` deprecated. Use `v8::Isolate::GetContinuationPreservedEmbedderData` instead.
- `GetStalledTopLevelAwaitMessage` deprecated. Use `GetStalledTopLevelAwaitMessages` instead.
- `v8::Isolate::AttachCppHeap` deprecated. Set the heap on Isolate creation using CreateParams instead. 
- `v8::ScriptOrigin` deprecated. Use constructor without the isolate.
- `v8::SnapshotCreator` is deprecated. Use the version that passes CreateParams instead.
- `v8::Isolate` assertion failures.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-05 18:50:42 +05:30
Guillaume Bort
60e0859514
Explicit panic instead of silent memory corruption (#1377)
Due to the automatic entry and exit behavior of Isolate upon creation and drop, it is crucial to ensure that v8::OwnedIsolate instances are dropped in the reverse order of their creation. Dropping them in the incorrect order can result in the corruption of the thread-local stack managed by v8, leading to memory corruption and potential segfaults. This introduces a check to verify the `this == Isolate::GetCurrent()` requirement before invoking the exit function. If the requirement is not met, a clean panic is triggered to provide explicit error handling instead of allowing silent memory corruption.
2023-12-12 07:32:40 -07:00