Commit Graph

1035 Commits

Author SHA1 Message Date
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
denobot
1d3572b5aa
Rolling to V8 11.6.189.11 (#1281) 2023-07-18 11:33:51 +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
Matt Mastracci
096c540393
chore: update to Rust 1.71 (#1283) 2023-07-13 12:42:58 -04: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
denobot
ed0aa000ef
Rolling to V8 11.6.189.9 (#1264) 2023-07-11 12:50:04 +00:00
Leo Kettmeir
c6fe9e70d0
feat: v8::Object::PreviewEntries (#1276) 2023-07-10 19:30:11 +02:00
Bartek Iwańczuk
70239dc4ce
v0.74.2 (#1274) 2023-07-09 23:02:29 +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
cions
ca83ce53ba
Fix build for android (#1246) 2023-07-01 13:21:12 -04:00
Bartek Iwańczuk
1990a6dff5
v0.74.1 (#1262) 2023-07-01 22:13:52 +05:30
Matt Mastracci
d706291c5d
fix: Ensure that one-byte strings that are not ASCII go through write_utf8_uninit (#1261) 2023-06-30 09:46:29 -06:00
denobot
c4033caf23
Rolling to V8 11.6.189.7 (#1260) 2023-06-30 14:38:20 +02:00
Bartek Iwańczuk
3f785f0429
v0.74.0 (#1258) 2023-06-29 18:03:17 +02:00
Matt Mastracci
ad0a65d0a5
feat: Use MaybeUninit for to_rust_string_lossy and add to_rust_cow_lossy (#1256)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-28 07:46:50 -06:00
Matt Mastracci
517f4d7032
chore: Add copy, clone and debug to some fast API types (#1257)
chore: Add copy, clone and debug to some types
2023-06-28 07:46:25 -06:00
Rakeeb Hossain
7419b38aac
Add Function::{ScriptId, GetScriptOrigin}, ScriptOrigin::Get{ScriptId, ResourceName, SourceMapUrl} bindings (#1250) 2023-06-28 08:09:07 +02:00
denobot
63df1735fd
Rolling to V8 11.6.189.6 (#1253)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-27 15:50:31 +00:00
Matt Mastracci
672254e113
feat: Fix is_onebyte and add an uninit write for onebyte (#1255)
Some fixes around one-byte strings:

 - `is_onebyte` was calling the wrong v8 API.
 - We didn't have a way to write one-byte strings with uninitialized buffers
 - (bonus) The test_string method was quite slow making testing a bit of a pain
2023-06-26 09:30:16 -06:00
Bartek Iwańczuk
b97dd1b1d8
Track v8 11.6 (#1252) 2023-06-25 07:26:36 +00:00
denobot
8fc39ebdc8
Rolling to V8 11.5.150.10 (#1243) 2023-06-17 20:36:04 -04:00
Matt Mastracci
270f46aa5f
chore: support 128-bit TypeId (#1249) 2023-06-15 19:00:42 +02:00
Francesco Ceccon
5a15d85f2f
Don't preserve V8 archive mode and ownership on build (#1244)
By default, copying a file will preserve its mode and ownership
attributes.
This is an issue when copying the V8 archive from a read-only
filesystem since the archive file also becomes read-only, so
subsequent builds will fail.

We now create a new destination file and copy the content of the archive
to it, this ensures the destination file has the default attributes.
2023-06-05 13:28:56 -04:00
Aapo Alasuutari
6cc61a26b2
feat(fastcall): Int64Representation (#1238)
* feat(fastcall): Int64Representation

* Add tests, new_with_bigint API

* Fix build, actually
2023-06-02 11:28:14 -06:00
Bartek Iwańczuk
2fc52161ce
v0.73.0 (#1241) 2023-05-26 14:49:45 +02:00
denobot
a1cd43d899
Rolling to V8 11.5.150.2 (#1239)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-26 11:38:18 +00:00
Luca Casonato
e7f96ac708
Improved ObjectTemplate::set_*_handlers (#1237)
Prior to this commit, `v8::NamedPropertyHandlerConfiguration`
and `v8::IndexedPropertyHandlerConfiguration` did not expose the
`definer` hook, or `flags`.

This commit adds these options. In the process of doing this a couple of
other changes were made:

- Bitflag enum consts are now member consts of the related struct.
  This is done because PropertyHandlerFlags has conflicts with
  PropertyAttribute.
- PropertyDescriptor gets all C++ introspection methods exposed to Rust.
- NamedPropertyHandlerConfiguration callback types get rustdoc comments.
- IndexedPropertyHandlerConfiguration callback types get rustdoc
  comments.
- GenericNamedPropertySetterCallback gets a ReturnValue parameter, to
  signal trap passthrough.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-26 13:14:18 +02:00
Luca Casonato
43b798a39d
Add more Object methods (#1240)
Specifically Object::get_own_property_descriptor
and Object::get_property_attributes
2023-05-25 13:04:50 +00:00
Bartek Iwańczuk
2aa6debd2b
v0.72.0 (#1236) 2023-05-23 17:39:47 +00:00
denobot
69eb802f4b
Rolling to V8 11.5.150.1 (#1235) 2023-05-23 17:56:40 +02:00
Bartek Iwańczuk
5912ecfe62
Track v8 11.5 (#1234) 2023-05-23 14:17:09 +02:00
Bartek Iwańczuk
367be04178
feat: Add v8::CreateParams::has_set_array_buffer_allocator (#1232) 2023-05-22 12:33:17 +00:00
denobot
c68038bc7d
Rolling to V8 11.4.183.11 (#1228)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-20 03:04:12 +02:00
Bartek Iwańczuk
eb53f628f3
v0.71.2 (#1230) 2023-05-13 01:47:37 +02:00
Bartek Iwańczuk
dec3aa2d0b
Fix exception not caught in debug build for v8::Function::call (#1229) 2023-05-12 18:47:05 +02:00
denobot
a300f93a94 v0.71.1 2023-05-12 00:49:03 +00:00
Bartek Iwańczuk
6ac0fabb56
test: Add tests showing incorrect exception behavior in debug build (#1227)
Reproduces #1226 and denoland/deno#19021

```
// Fails
$ V8_FROM_SOURCE=1 cargo test exception
// Passes
$ V8_FROM_SOURCE=1 cargo test --release exception
```

We bisected this and this problem first appeared with V8 v11.2 upgrade. After further
bisects we established that v8/v8@1f349da#diff-de75fc3e7b84373d94e18b4531827e8b749f9bbe05b59707e894e4e0ce2a1535
is the first V8 commit that causes this failure. However after more investigation we can't
find any reason why that particular commit might cause this problem.

It is only reproducible in debug build, but not release build. Current working theory
is that it is a Rust compiler bug as changing the optimization level for this code
makes the bug go away. This commit should be considered a band-aid that works
around the problem, but doesn't fix it completely. We are gonna go with it as it
unblocks un on day-to-day work, but ultimately we should track it down (or wait
for another Rust upgrade which might fix it?).

---------

Co-authored-by: Bert Belder <bertbelder@gmail.com>
2023-05-12 02:46:42 +02:00
Leo Kettmeir
bf9f7cbcdc
refactor: use Deno.Command instead of Deno.run (#1225) 2023-05-03 23:05:07 +02:00
denobot
5b1417799e
Rolling to V8 11.4.183.2 (#1219) 2023-05-02 01:44:30 +02:00
Giovanny Gutiérrez
5417e2af7f
feat: Add the option to disable generation from strings (#1222) 2023-04-30 12:29:40 +02:00
Giovanny Gutiérrez
e0c8cb50e8
feat: Expose set_accessor_with_configuration to include data and property attribute (#1220) 2023-04-28 00:39:09 +02:00
Giovanny Gutiérrez
fb20194130
feat: Add bindings for "v8::Set" (#1221) 2023-04-28 00:38:16 +02:00
denobot
1ddc7aad87 v0.71.0 2023-04-26 23:13:01 +00:00
Bartek Iwańczuk
68c0466b1f
Fix build for v11.4 (#1218)
Updated "build/" submodule and adjusted to V8
API changes.
2023-04-27 01:03:54 +02:00
denobot
7459d12923
Rolling to V8 11.4.183.1 (#1217) 2023-04-26 17:00:44 +02:00