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>
We may build rusty_v8 on platforms other than the common ones (for
example, linux/riscv64), though they are not officially supported and
prebuilt binaries are not available. This patch adds several
environment variables:
- `DISABLE_CLANG`: use `is_clang=false` and disables Clang-specific
options for building with GCC, etc.
- `EXTRA_GN_ARGS`: allow to pass extra GN arguments, such as custom
toolchain
- `NO_PRINT_GN_ARGS`: Disables printing GN arguments to stdout. GN
currently segfaults on riscv64 when printing arguments. Since it is
trivial, we can have an option to simply disable it.
Also added fallback `arch` and `os` declaration in `platform()` to
remove compile-time error.
Changes signature of "FunctionTemplate::build_fast" to allow
to pass "CFunctionInfo" explicitly. If it's not passed explicitly,
it's still autogenerated.
Adds bindings for:
- v8::Context::GetContinuationPreservedEmbedderData
- v8::Context::SetContinuationPreservedEmbedderData
These APIs are available on the "HandleScope".
---------
Co-authored-by: Bert Belder <bertbelder@gmail.com>
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`.