diff --git a/.gitmodules b/.gitmodules index 4d712d7e..5ff41bf6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,6 @@ [submodule "third_party/icu"] path = third_party/icu url = https://github.com/denoland/icu.git +[submodule "third_party/abseil-cpp"] + path = third_party/abseil-cpp + url = https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git diff --git a/.gn b/.gn index 0ba2aeb9..6b4b9d2b 100644 --- a/.gn +++ b/.gn @@ -51,12 +51,6 @@ default_args = { # compiler" snapshots, and sometimes uses them both at the same time. v8_enable_shared_ro_heap = false - # V8 introduced a bug in 11.1 that causes the External Pointer Table to never - # be cleaned which causes resource exhaustion. Disabling pointer compression - # makes sure that the EPT is not used. - # https://bugs.chromium.org/p/v8/issues/detail?id=13640&q=garbage%20collection&can=2 - v8_enable_pointer_compression = false - # V8 11.6 hardcoded an assumption in `mksnapshot` that shared RO heap # is enabled. In our case it's disabled so without this flag we can't # compile. diff --git a/README.md b/README.md index 7a781ff7..f77bd777 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Rusty V8 Binding -V8 Version: 11.6.189.16 +V8 Version: 11.7.439.1 [![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/build.rs b/build.rs index ce173e24..27e134bf 100644 --- a/build.rs +++ b/build.rs @@ -883,6 +883,6 @@ edge [fontsize=10] fn test_static_lib_size() { let static_lib_size = std::fs::metadata(static_lib_path()).unwrap().len(); eprintln!("static lib size {}", static_lib_size); - assert!(static_lib_size <= 230u64 << 20); // No more than 230 MiB. + assert!(static_lib_size <= 270u64 << 20); // No more than 270 MiB. } } diff --git a/src/binding.cc b/src/binding.cc index 57d8bdae..ebd1c326 100644 --- a/src/binding.cc +++ b/src/binding.cc @@ -484,17 +484,17 @@ bool v8__Data__EQ(const v8::Data& self, const v8::Data& other) { } bool v8__Data__IsBigInt(const v8::Data& self) { - return v8::Utils::OpenHandle(&self)->IsBigInt(); + return IsBigInt(*v8::Utils::OpenHandle(&self)); } bool v8__Data__IsBoolean(const v8::Data& self) { - return v8::Utils::OpenHandle(&self)->IsBoolean(); + return IsBoolean(*v8::Utils::OpenHandle(&self)); } bool v8__Data__IsContext(const v8::Data& self) { return self.IsContext(); } bool v8__Data__IsFixedArray(const v8::Data& self) { - return v8::Utils::OpenHandle(&self)->IsFixedArray(); + return IsFixedArray(*v8::Utils::OpenHandle(&self)); } bool v8__Data__IsFunctionTemplate(const v8::Data& self) { @@ -504,15 +504,15 @@ bool v8__Data__IsFunctionTemplate(const v8::Data& self) { bool v8__Data__IsModule(const v8::Data& self) { return self.IsModule(); } bool v8__Data__IsModuleRequest(const v8::Data& self) { - return v8::Utils::OpenHandle(&self)->IsModuleRequest(); + return IsModuleRequest(*v8::Utils::OpenHandle(&self)); } bool v8__Data__IsName(const v8::Data& self) { - return v8::Utils::OpenHandle(&self)->IsName(); + return IsName(*v8::Utils::OpenHandle(&self)); } bool v8__Data__IsNumber(const v8::Data& self) { - return v8::Utils::OpenHandle(&self)->IsNumber(); + return IsNumber(*v8::Utils::OpenHandle(&self)); } bool v8__Data__IsObjectTemplate(const v8::Data& self) { @@ -520,17 +520,17 @@ bool v8__Data__IsObjectTemplate(const v8::Data& self) { } bool v8__Data__IsPrimitive(const v8::Data& self) { - return v8::Utils::OpenHandle(&self)->IsPrimitive() && !self.IsPrivate(); + return IsPrimitive(*v8::Utils::OpenHandle(&self)) && !self.IsPrivate(); } bool v8__Data__IsPrivate(const v8::Data& self) { return self.IsPrivate(); } bool v8__Data__IsString(const v8::Data& self) { - return v8::Utils::OpenHandle(&self)->IsString(); + return IsString(*v8::Utils::OpenHandle(&self)); } bool v8__Data__IsSymbol(const v8::Data& self) { - return v8::Utils::OpenHandle(&self)->IsPublicSymbol(); + return IsPublicSymbol(*v8::Utils::OpenHandle(&self)); } bool v8__Data__IsValue(const v8::Data& self) { return self.IsValue(); } @@ -3060,11 +3060,19 @@ void v8__HeapProfiler__TakeHeapSnapshot(v8::Isolate* isolate, const_cast(snapshot)->Delete(); } +// This is necessary for v8__internal__GetIsolateFromHeapObject() to be +// reliable enough for our purposes. +#if UINTPTR_MAX == 0xffffffffffffffff && \ + !(defined V8_SHARED_RO_HEAP or defined V8_COMPRESS_POINTERS) +#error V8 must be built with either the 'v8_enable_pointer_compression' or \ +'v8_enable_shared_ro_heap' feature enabled. +#endif + v8::Isolate* v8__internal__GetIsolateFromHeapObject(const v8::Data& data) { namespace i = v8::internal; i::Object object(reinterpret_cast(data)); i::Isolate* isolate; - return object.IsHeapObject() && + return IsHeapObject(object) && i::GetIsolateFromHeapObject(object.GetHeapObject(), &isolate) ? reinterpret_cast(isolate) : nullptr; @@ -3074,10 +3082,10 @@ int v8__Value__GetHash(const v8::Value& data) { namespace i = v8::internal; i::Object object(reinterpret_cast(data)); i::Isolate* isolate; - int hash = object.IsHeapObject() && i::GetIsolateFromHeapObject( + int hash = IsHeapObject(object) && i::GetIsolateFromHeapObject( object.GetHeapObject(), &isolate) - ? object.GetOrCreateHash(isolate).value() - : i::Smi::ToInt(object.GetHash()); + ? i::Object::GetOrCreateHash(object, isolate).value() + : i::Smi::ToInt(i::Object::GetHash(object)); assert(hash != 0); return hash; } @@ -3401,8 +3409,8 @@ void v8__CompiledWasmModule__DELETE(v8::CompiledWasmModule* self) { extern "C" { size_t icu_get_default_locale(char* output, size_t output_len) { - const icu_72::Locale& default_locale = icu::Locale::getDefault(); - icu_72::CheckedArrayByteSink sink(output, static_cast(output_len)); + const icu_73::Locale& default_locale = icu::Locale::getDefault(); + icu_73::CheckedArrayByteSink sink(output, static_cast(output_len)); UErrorCode status = U_ZERO_ERROR; default_locale.toLanguageTag(sink, status); assert(status == U_ZERO_ERROR); diff --git a/src/icu.rs b/src/icu.rs index 71dcd996..15c1be39 100644 --- a/src/icu.rs +++ b/src/icu.rs @@ -5,7 +5,7 @@ use std::ffi::CString; extern "C" { fn icu_get_default_locale(output: *mut char, output_len: usize) -> usize; fn icu_set_default_locale(locale: *const char); - fn udata_setCommonData_72(this: *const u8, error_code: *mut i32); + fn udata_setCommonData_73(this: *const u8, error_code: *mut i32); } /// This function bypasses the normal ICU data loading process and allows you to force ICU's system @@ -42,10 +42,10 @@ extern "C" { /// functionality for application data. // TODO(ry) Map error code to something useful. #[inline(always)] -pub fn set_common_data_72(data: &'static [u8]) -> Result<(), i32> { +pub fn set_common_data_73(data: &'static [u8]) -> Result<(), i32> { let mut error_code = 0i32; unsafe { - udata_setCommonData_72(data.as_ptr(), &mut error_code); + udata_setCommonData_73(data.as_ptr(), &mut error_code); } if error_code == 0 { Ok(()) diff --git a/src/isolate.rs b/src/isolate.rs index b71f8c5e..ade12644 100644 --- a/src/isolate.rs +++ b/src/isolate.rs @@ -543,7 +543,7 @@ impl Isolate { // Byte offset inside `Isolate` where the isolate data slots are stored. This // should be the same as the value of `kIsolateEmbedderDataOffset` which is // defined in `v8-internal.h`. - const EMBEDDER_DATA_OFFSET: usize = size_of::<[*const (); 62]>(); + const EMBEDDER_DATA_OFFSET: usize = size_of::<[*const (); 67]>(); // Isolate data slots used internally by rusty_v8. const ANNEX_SLOT: u32 = 0; diff --git a/tests/test_api.rs b/tests/test_api.rs index fb79fb0a..0f578858 100644 --- a/tests/test_api.rs +++ b/tests/test_api.rs @@ -46,7 +46,7 @@ mod setup { fn initialize_once() { static START: Once = Once::new(); START.call_once(|| { - assert!(v8::icu::set_common_data_72(align_data::include_aligned!( + assert!(v8::icu::set_common_data_73(align_data::include_aligned!( align_data::Align16, "../third_party/icu/common/icudtl.dat" )) @@ -8193,7 +8193,7 @@ fn icu_date() { #[test] fn icu_set_common_data_fail() { - assert!(v8::icu::set_common_data_72(&[1, 2, 3]).is_err()); + assert!(v8::icu::set_common_data_73(&[1, 2, 3]).is_err()); } #[test] diff --git a/third_party/abseil-cpp b/third_party/abseil-cpp new file mode 160000 index 00000000..583dc6d1 --- /dev/null +++ b/third_party/abseil-cpp @@ -0,0 +1 @@ +Subproject commit 583dc6d1b3a0dd44579718699e37cad2f0c41a26 diff --git a/third_party/icu b/third_party/icu index 629a4bb9..a22a8f24 160000 --- a/third_party/icu +++ b/third_party/icu @@ -1 +1 @@ -Subproject commit 629a4bb99bf9f088120a2435deb6f630fc30f351 +Subproject commit a22a8f24224ddda8b856437d7e8560de1da3f8e1 diff --git a/v8 b/v8 index 41f3d891..5163da1e 160000 --- a/v8 +++ b/v8 @@ -1 +1 @@ -Subproject commit 41f3d89183173cccefd080647299ac3ab58ba214 +Subproject commit 5163da1ee15f95956b1cf8da5b0a91e7470f4b0f