From c53d85114ed4b740197d4d0f4eef3d09beb0e2a8 Mon Sep 17 00:00:00 2001 From: denobot <33910674+denobot@users.noreply.github.com> Date: Tue, 14 Jun 2022 16:26:50 -0600 Subject: [PATCH] Rolling to V8 10.4.132.5 (#1002) Co-authored-by: Divy Srivastava --- Cargo.toml | 2 +- README.md | 2 +- src/binding.cc | 2 +- src/isolate.rs | 14 ++++++++++---- src/lib.rs | 2 ++ tests/test_api.rs | 5 ++++- v8 | 2 +- 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 34e71c8c..67af71ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -103,7 +103,7 @@ name = "shell" name = "process" [[test]] -name = "buid" +name = "build" path = "build.rs" [workspace] diff --git a/README.md b/README.md index 64ec5179..f1ccd4fc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Rusty V8 Binding -V8 Version: 10.3.174.8 +V8 Version: 10.4.132.5 [![ci](https://github.com/denoland/rusty_v8/workflows/ci/badge.svg?branch=main)](https://github.com/denoland/rusty_v8/actions) [![crates](https://img.shields.io/crates/v/v8.svg)](https://crates.io/crates/v8) diff --git a/src/binding.cc b/src/binding.cc index 9dfba86c..693fca95 100644 --- a/src/binding.cc +++ b/src/binding.cc @@ -292,7 +292,7 @@ int64_t v8__Isolate__AdjustAmountOfExternalAllocatedMemory( } void v8__Isolate__SetOOMErrorHandler(v8::Isolate* isolate, - v8::LegacyOOMErrorCallback callback) { + v8::OOMErrorCallback callback) { isolate->SetOOMErrorHandler(callback); } diff --git a/src/isolate.rs b/src/isolate.rs index 736c098d..bfd21bb9 100644 --- a/src/isolate.rs +++ b/src/isolate.rs @@ -151,8 +151,14 @@ pub type NearHeapLimitCallback = extern "C" fn( initial_heap_limit: usize, ) -> usize; -pub type LegacyOomErrorCallback = - extern "C" fn(location: *const c_char, is_heap_oom: bool); +#[repr(C)] +pub struct OomDetails { + pub is_heap_oom: bool, + pub detail: *const c_char, +} + +pub type OomErrorCallback = + extern "C" fn(location: *const c_char, details: &OomDetails); /// Collection of V8 heap information. /// @@ -212,7 +218,7 @@ extern "C" { ); fn v8__Isolate__SetOOMErrorHandler( isolate: *mut Isolate, - callback: LegacyOomErrorCallback, + callback: OomErrorCallback, ); fn v8__Isolate__AdjustAmountOfExternalAllocatedMemory( isolate: *mut Isolate, @@ -727,7 +733,7 @@ impl Isolate { } } - pub fn set_oom_error_handler(&mut self, callback: LegacyOomErrorCallback) { + pub fn set_oom_error_handler(&mut self, callback: OomErrorCallback) { unsafe { v8__Isolate__SetOOMErrorHandler(self, callback) }; } diff --git a/src/lib.rs b/src/lib.rs index 2f5f1d6a..53404a30 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -100,6 +100,8 @@ pub use isolate::IsolateHandle; pub use isolate::MessageCallback; pub use isolate::MicrotasksPolicy; pub use isolate::NearHeapLimitCallback; +pub use isolate::OomDetails; +pub use isolate::OomErrorCallback; pub use isolate::OwnedIsolate; pub use isolate::PromiseHook; pub use isolate::PromiseHookType; diff --git a/tests/test_api.rs b/tests/test_api.rs index 2ba49be8..9be3c776 100644 --- a/tests/test_api.rs +++ b/tests/test_api.rs @@ -5636,7 +5636,10 @@ fn run_with_rust_allocator() { #[test] fn oom_callback() { - extern "C" fn oom_handler(_: *const std::os::raw::c_char, _: bool) { + extern "C" fn oom_handler( + _: *const std::os::raw::c_char, + _: &v8::OomDetails, + ) { unreachable!() } diff --git a/v8 b/v8 index ae2661fe..a5ae0382 160000 --- a/v8 +++ b/v8 @@ -1 +1 @@ -Subproject commit ae2661fe05354ba2115a66c8a63ef3aef0059c9d +Subproject commit a5ae0382548204c60025cb26618231ba48ad83f1