0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-26 09:13:46 -05:00
Commit graph

564 commits

Author SHA1 Message Date
Bartek Iwańczuk
10d12a450e
feat: Add "v8::Object::get_real_named_property_*" methods (#1428) 2024-03-15 00:20:03 +01:00
Divy Srivastava
69bac645e0
Add v8::MicrotaskQueue bindings (#1423) 2024-03-14 15:37:01 +00:00
Bartek Iwańczuk
b83067130f
feat: Add IndexedPropertyHandlerConfiguration::*_raw methods (#1426) 2024-03-13 15:59:39 +01: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
Daniel Miller
9dd629e1c3
Fixed a typo in the parameter capture in v8__Isolate__SetCaptureStackTraceForUncaughtExceptions (#1410) 2024-03-04 08:34:04 +05:30
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
Divy Srivastava
e04dc7baf4
Add String::get_external_string_resource_base and get_external_string_resource (#1396) 2024-02-13 19:48:34 +05:30
Matt Mastracci
a8606e3dcb
feat: allow v8::Data as a generic for get_*_from_snapshot_once (#1393) 2024-02-09 20:39:30 +00:00
Guillaume Bort
477f5af361
Fix misleading BigInt rustdoc (#1379)
* Fix misleading BigInt rustdoc

The original documentation was unclear about the value of the bool. I interpreted it as being `true` if the value was truncated.
2024-02-03 17:44:56 +00:00
Michael Howell
54e93385b8
Fix busted doc comment (#1392)
* Fix busted doc comment

This doc comment contains raw HTML, when it's supposed
to contain generics. Fix this by wrapping them as code.

* Update src/handle.rs

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-02-03 17:44:27 +00:00
Divy Srivastava
9f10d76f59
Retrieve value from cppgc::Member handle (#1388) 2024-01-10 04:30:54 +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
Matt Mastracci
0331922b66
chore: bump deps (#1376) 2023-12-08 16:34:34 -07:00
Laurence Rowe
ec2c901895
feat: Support custom host objects in ValueSerializer (#1322)
Add v8::ValueSerializerImpl::{has_custom_host_object,is_host_object} 
equivalents for v8::ValueSerializer::Delegate::{HasCustomHostObject,IsCustomHostObject}.

This enables serializing custom host objects without embedder fields.
2023-11-21 00:24:59 +01:00
denobot
92f7d41a4c
Rolling to V8 12.0.267.1 (#1361)
Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-01 01:26:06 +01:00
Divy Srivastava
7072da4199
Add cppgc bindings (#1336)
https://v8.dev/blog/high-performance-cpp-gc

Oilpan in Deno design doc: https://www.notion.so/denolandinc/Oilpan-cppgc-in-Deno-e194f4268e9f4135ba97610ff7d3a949?pvs=4

Oilpan can be used to implement GC'able resources in Deno

Closes https://github.com/denoland/rusty_v8/issues/933
2023-10-30 20:40:15 +05:30
Matt Mastracci
01d82405e1
feat: add call_with_context to v8::Function (#1350) 2023-10-26 12:28:14 -06:00
Matt Mastracci
da5ca4f2d1
feat: add get_backing_store to ArrayBufferView (#1342) 2023-10-03 15:23:59 +00:00
Matt Mastracci
efca1408f6
fix: arraybuffer init from vec was broken if vec reallocated to box (#1341) 2023-10-03 09:17:18 -06:00
Matt Mastracci
bf277f4f8e
feat: new_backing_store_from_bytes and empty for ArrayBuffer and SharedArrayBuffer (#1334) 2023-10-02 12:08:51 -06:00
Matt Mastracci
12dca0cf03
feat: add scope-less data() access on ArrayBufferView (#1338) 2023-09-29 18:20:29 -06:00
Matt Mastracci
bb5dadb418
fix: better fix for empty Uint8Array (#1329) 2023-09-22 17:34:30 +00:00
Matt Mastracci
8f282fa04b
chore: typo (#1327) 2023-09-20 11:56:59 -06:00
Matt Mastracci
35578c8580
fix: never create a null slice (#1326) 2023-09-20 14:37:10 +00:00
Laurence Rowe
b2a7cfe0c2
fix(Symbol): deprecate for_global in favour of for_key and for_api (#1324)
`for_global` was documented as `for_key` but implemented as `for_api`.

Closes #1323
2023-09-18 17:48:13 -06:00
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
Matt Mastracci
987d520221
fix: don't allocate for zero-length strings (#1309) 2023-09-01 08:54:52 -04:00
Bert Belder
7c78966d55
chore: turn pointer compression off again (#1302)
The memory leak caused by the EPT table not being subject to garbage
collection is apparently still there.
2023-08-24 03:28:19 +00:00
denobot
4573256203
Rolling to V8 11.7.439.1 (#1296)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-08 23:29:54 +00:00
Aapo Alasuutari
715060df6e
fix: 32-bit build fails on non-size_t based size assertions (#1289) 2023-07-27 09:10:17 -04:00
Bartek Iwańczuk
e908964fc4
feat: Add v8::Value::type_repr() (#1285) 2023-07-21 09:42:18 -06:00
Andreu Botella
f360663e67
feat: Add {Dis,}allowJavascriptExecutionScope (#862)
This commit adds two new types of scopes:
- DisallowJavascriptExecutionScope
- AllowJavascriptExecutionScope

The first one can be used to prevent execution of JavaScript 
(with customizable behavior on an attempt of executing JS, eg.
crashing the process); while the second one can be constructed
from the first to temporarily enable executing JS.

These are useful for "value serializers" to prevent user defined objects
from causing unintended behavior.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-19 14:52:58 +02:00
Aapo Alasuutari
fcf0281d3e
fix(OneByteConst): missing ASCII assertion, assert length (#1282)
Fix missing ASCII assertion, assert length
2023-07-13 17:51:34 -06:00
Aapo Alasuutari
308a113445
feat: Implement Rust-side const ExternalOneByteStringResource subclass (#1275)
MSVC and Itanium C++ ABIs agree that for simple inheritance the basic structure of a vtable contains metadata fields at a "negative offset" from the vtable pointer, and at zero or positive offsets come the virtual function pointers in the order of declaration. The only difference between the two is that MSVC only places the virtual deleting destructor in the vtable while Itanium ABI places both the deleting and the complete object destructors in it, leading to a vtable that is one pointer larger in Itanium / on Linux. Also MSVC only has a single metadata field instead of two for Itanium. Itanium inlines the base offset into the vtable while MSVC keeps it in what is essentially the entry point into the type info data.

Since the two are so similar, creating a custom vtable on Rust-side is pretty easy and can be done entirely at compile-time, meaning that instances of the class can also be created entirely at compile time. This leads to fully const external strings being possible.
2023-07-12 07:22:12 -06:00
Bartek Iwańczuk
4dd8b60bf0
chore: update to Rust 1.70.0 (#1277) 2023-07-11 12:50:03 -06:00
Matt Mastracci
4110d1bf4e
chore: Add Debug for ExternalReference (#1272) 2023-07-11 10:09:29 -06:00
Matt Mastracci
226c662da6
fix: Use unaligned read as copy_nonoverlapping requires alignment (#1278) 2023-07-11 08:07:47 -06:00
Matt Mastracci
9d5c21ae7e
feat: Add Uint8 type for fastcall (#1279) 2023-07-11 08:07:29 -06:00
Leo Kettmeir
c6fe9e70d0
feat: v8::Object::PreviewEntries (#1276) 2023-07-10 19:30:11 +02:00
Bartek Iwańczuk
73dcb46674
Add v8::NamedPropertyHandlerConfiguration::*_raw methods (#1273) 2023-07-09 22:40:15 +02:00
Graham Abbott
e2c6541ea3
silence warning for unused 'must use' (#1269)
this warning only occurs when using the library as a dependency.

warning: unused return value of `Box::<T>::from_raw` that must be used
    --> /rusty_v8/src/scope.rs:1092:16
     |
1092 |       unsafe { Box::from_raw(root) };
     |                ^^^^^^^^^^^^^^^^^^^
     |
   = note: call `drop(Box::from_raw(ptr))` if you intend to drop the `Box`
   = note: `#[warn(unused_must_use)]` on by default
2023-07-08 08:45:50 -06:00