0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-24 15:19:31 -05:00

Upgrade V8 to 10.3.174.3 (#969)

This commit is contained in:
Bert Belder 2022-05-18 10:53:34 +02:00 committed by GitHub
parent 740f751408
commit 2f189e1668
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 69 additions and 83 deletions

View file

@ -24,42 +24,30 @@ jobs:
- os: macOS-latest
target: x86_64-apple-darwin
variant: debug
cargo: cargo
- os: macOS-latest
target: x86_64-apple-darwin
variant: release
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-18.04' }}
target: x86_64-unknown-linux-gnu
variant: debug
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-18.04' }}
target: x86_64-unknown-linux-gnu
variant: release
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'windows-2019-xxl' || 'windows-2019' }}
target: x86_64-pc-windows-msvc
variant: release # Note: we do not support windows debug builds.
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-18.04' }}
target: aarch64-unknown-linux-gnu
variant: debug
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-18.04' }}
target: aarch64-unknown-linux-gnu
variant: release
cargo: cargo
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-20.04-xl' || 'ubuntu-18.04' }}
target: aarch64-linux-android
variant: release # Note: v8 debug builds on QEMU is buggy.
cargo: cross
env:
V8_FROM_SOURCE: true
@ -85,9 +73,9 @@ jobs:
rust-version: 1.60.0
- name: Install python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 2.7.x
python-version: 3.10.x
architecture: x64
- name: Install cross compilation toolchain
@ -170,24 +158,16 @@ jobs:
. $basename/sccache --start-server
echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install cross
if: matrix.config.target == 'aarch64-linux-android'
run: cargo install cross
- name: Build cross docker image
if: matrix.config.target == 'aarch64-linux-android'
run: docker build -t cross:aarch64-linux-android-0.2.1 .
- name: Test
env:
SCCACHE_IDLE_TIMEOUT: 0
run:
${{ matrix.config.cargo }} test -vv --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
cargo test -vv --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
--target ${{ matrix.config.target }}
- name: Clippy
run:
${{ matrix.config.cargo }} clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
cargo clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
--target ${{ matrix.config.target }} -- -D clippy::all
- name: Rustfmt

3
.gn
View file

@ -29,9 +29,6 @@ default_args = {
# vs. 604745897).
v8_enable_shared_ro_heap = false
# TODO(ry) remove
v8_imminent_deprecation_warnings = false
# https://cs.chromium.org/chromium/src/docs/ccache_mac.md
clang_use_chrome_plugins = false
v8_monolithic = false

View file

@ -1,6 +1,6 @@
# Rusty V8 Binding
V8 Version: 10.0.139.17
V8 Version: 10.3.174.3
[![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)

@ -1 +1 @@
Subproject commit eb94f1c7aa96207f469008f29989a43feb2718f8
Subproject commit d115b033c4e53666b535cbd1985ffe60badad082

2
build

@ -1 +1 @@
Subproject commit b1cbcbce2c71b08bb34ede6add332626e78fa10e
Subproject commit 454490b978ec9fd3b48030f79b497c23f72ec513

View file

@ -132,7 +132,6 @@ fn build_v8() {
if let Some(clang_base_path) = find_compatible_system_clang() {
println!("clang_base_path {}", clang_base_path.display());
gn_args.push(format!("clang_base_path={:?}", clang_base_path));
// TODO: Dedupe this with the one from cc_wrapper()
gn_args.push("treat_warnings_as_errors=false".to_string());
// we can't use chromiums clang plugins with a system clang
gn_args.push("clang_use_chrome_plugins=false".to_string());
@ -217,7 +216,6 @@ fn build_v8() {
let gn_out = maybe_gen(&gn_root, gn_args);
assert!(gn_out.exists());
assert!(gn_out.join("args.gn").exists());
print_gn_args(&gn_out);
build("rusty_v8", None);
}
@ -264,7 +262,7 @@ fn platform() -> &'static str {
fn download_ninja_gn_binaries() {
let target_dir = build_dir();
let bin_dir = target_dir
.join("ninja_gn_binaries-20210101")
.join("ninja_gn_binaries-20220517")
.join(platform());
let gn = bin_dir.join("gn");
let ninja = bin_dir.join("ninja");
@ -461,6 +459,16 @@ fn print_link_flags() {
println!("cargo:rustc-link-lib=dylib=winmm");
println!("cargo:rustc-link-lib=dylib=dbghelp");
}
if cfg!(target_env = "msvc") {
// On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++
// standard library, which libc++ needs for exception_ptr internals.
if cfg!(target_feature = "crt-static") {
println!("cargo:rustc-link-lib=libcpmt");
} else {
println!("cargo:rustc-link-lib=dylib=msvcprt");
}
}
}
// Chromium depot_tools contains helpers
@ -530,11 +538,6 @@ fn clang_download() -> PathBuf {
fn cc_wrapper(gn_args: &mut Vec<String>, sccache_path: &Path) {
gn_args.push(format!("cc_wrapper={:?}", sccache_path));
// Disable treat_warnings_as_errors until this sccache bug is fixed:
// https://github.com/mozilla/sccache/issues/264
if cfg!(target_os = "windows") {
gn_args.push("treat_warnings_as_errors=false".to_string());
}
}
struct Dirs {
@ -677,16 +680,6 @@ fn generate_compdb(
pub type GnArgs = Vec<String>;
fn print_gn_args(gn_out_dir: &Path) {
assert!(Command::new(gn())
.arg("args")
.arg(&gn_out_dir)
.arg("--list")
.status()
.unwrap()
.success());
}
pub fn maybe_gen(manifest_dir: &str, gn_args: GnArgs) -> PathBuf {
let dirs = get_dirs(Some(manifest_dir));
let gn_out_dir = dirs.out.join("gn_out");

@ -1 +1 @@
Subproject commit 3655cd61062a8e8282d2d01df0a19aae410d336d
Subproject commit 84d59fd1464b20cbf96e00e3d463e5f996aecbd7

View file

@ -286,7 +286,7 @@ int64_t v8__Isolate__AdjustAmountOfExternalAllocatedMemory(
}
void v8__Isolate__SetOOMErrorHandler(v8::Isolate* isolate,
v8::OOMErrorCallback callback) {
v8::LegacyOOMErrorCallback callback) {
isolate->SetOOMErrorHandler(callback);
}
@ -827,7 +827,7 @@ v8::BackingStore* v8__ArrayBuffer__NewBackingStore__with_byte_length(
}
v8::BackingStore* v8__ArrayBuffer__NewBackingStore__with_data(
void* data, size_t byte_length, v8::BackingStoreDeleterCallback deleter,
void* data, size_t byte_length, v8::BackingStore::DeleterCallback deleter,
void* deleter_data) {
std::unique_ptr<v8::BackingStore> u = v8::ArrayBuffer::NewBackingStore(
data, byte_length, deleter, deleter_data);
@ -1584,16 +1584,13 @@ const v8::Data* v8__Context__GetDataFromSnapshotOnce(v8::Context& self,
ptr_to_local(&self)->GetDataFromSnapshotOnce<v8::Data>(index));
}
void v8__Context__SetPromiseHooks(v8::Context& self,
v8::Function& init_hook,
void v8__Context__SetPromiseHooks(v8::Context& self, v8::Function& init_hook,
v8::Function& before_hook,
v8::Function& after_hook,
v8::Function& resolve_hook) {
ptr_to_local(&self)->SetPromiseHooks(
ptr_to_local(&init_hook),
ptr_to_local(&before_hook),
ptr_to_local(&after_hook),
ptr_to_local(&resolve_hook));
ptr_to_local(&init_hook), ptr_to_local(&before_hook),
ptr_to_local(&after_hook), ptr_to_local(&resolve_hook));
}
const v8::String* v8__Message__Get(const v8::Message& self) {
@ -2041,7 +2038,7 @@ v8::BackingStore* v8__SharedArrayBuffer__NewBackingStore__with_byte_length(
}
v8::BackingStore* v8__SharedArrayBuffer__NewBackingStore__with_data(
void* data, size_t byte_length, v8::BackingStoreDeleterCallback deleter,
void* data, size_t byte_length, v8::BackingStore::DeleterCallback deleter,
void* deleter_data) {
std::unique_ptr<v8::BackingStore> u = v8::SharedArrayBuffer::NewBackingStore(
data, byte_length, deleter, deleter_data);
@ -2303,10 +2300,10 @@ v8_inspector::V8Inspector* v8_inspector__V8Inspector__create(
v8_inspector::V8InspectorSession* v8_inspector__V8Inspector__connect(
v8_inspector::V8Inspector* self, int context_group_id,
v8_inspector::V8Inspector::Channel* channel,
v8_inspector::StringView state) {
v8_inspector::V8Inspector::Channel* channel, v8_inspector::StringView state,
v8_inspector::V8Inspector::ClientTrustLevel client_trust_level) {
std::unique_ptr<v8_inspector::V8InspectorSession> u =
self->connect(context_group_id, channel, state);
self->connect(context_group_id, channel, state, client_trust_level);
return u.release();
}
@ -2970,8 +2967,7 @@ v8::CompiledWasmModule* v8__WasmModuleObject__GetCompiledModule(
const v8::WasmModuleObject* v8__WasmModuleObject__Compile(
v8::Isolate* isolate, uint8_t* wire_bytes_data, size_t length) {
v8::MemorySpan<const uint8_t> wire_bytes(wire_bytes_data, length);
return maybe_local_to_ptr(
v8::WasmModuleObject::Compile(isolate, wire_bytes));
return maybe_local_to_ptr(v8::WasmModuleObject::Compile(isolate, wire_bytes));
}
const uint8_t* v8__CompiledWasmModule__GetWireBytesRef(

View file

@ -1,5 +1,5 @@
extern "C" {
fn udata_setCommonData_70(this: *const u8, error_code: *mut i32);
fn udata_setCommonData_71(this: *const u8, error_code: *mut i32);
}
/// This function bypasses the normal ICU data loading process and allows you to force ICU's system
@ -35,10 +35,10 @@ extern "C" {
/// This function has no effect on application (non ICU) data. See udata_setAppData() for similar
/// functionality for application data.
// TODO(ry) Map error code to something useful.
pub fn set_common_data_70(data: &'static [u8]) -> Result<(), i32> {
pub fn set_common_data_71(data: &'static [u8]) -> Result<(), i32> {
let mut error_code = 0i32;
unsafe {
udata_setCommonData_70(data.as_ptr(), &mut error_code);
udata_setCommonData_71(data.as_ptr(), &mut error_code);
}
if error_code == 0 {
Ok(())

View file

@ -102,6 +102,7 @@ extern "C" {
context_group_id: int,
channel: *mut Channel,
state: StringView,
client_trust_level: V8InspectorClientTrustLevel,
) -> *mut V8InspectorSession;
fn v8_inspector__V8Inspector__contextCreated(
this: *mut V8Inspector,
@ -881,6 +882,13 @@ fn string_view_display() {
assert_eq!("ØÞ", format!("{}", StringView::from(&[216u8, 222u8][..])));
}
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
#[repr(C)]
pub enum V8InspectorClientTrustLevel {
Untrusted = 0,
FullyTrusted = 1,
}
#[repr(C)]
#[derive(Debug)]
pub struct V8Inspector(Opaque);
@ -906,6 +914,7 @@ impl V8Inspector {
context_group_id: i32,
channel: &mut T,
state: StringView,
client_trust_level: V8InspectorClientTrustLevel,
) -> UniqueRef<V8InspectorSession>
where
T: AsChannel,
@ -916,6 +925,7 @@ impl V8Inspector {
context_group_id,
channel.as_channel_mut(),
state,
client_trust_level,
))
}
}

View file

@ -138,7 +138,7 @@ pub type NearHeapLimitCallback = extern "C" fn(
initial_heap_limit: usize,
) -> usize;
pub type OomErrorCallback =
pub type LegacyOomErrorCallback =
extern "C" fn(location: *const c_char, is_heap_oom: bool);
/// Collection of V8 heap information.
@ -199,7 +199,7 @@ extern "C" {
);
fn v8__Isolate__SetOOMErrorHandler(
isolate: *mut Isolate,
callback: OomErrorCallback,
callback: LegacyOomErrorCallback,
);
fn v8__Isolate__AdjustAmountOfExternalAllocatedMemory(
isolate: *mut Isolate,
@ -651,7 +651,7 @@ impl Isolate {
}
}
pub fn set_oom_error_handler(&mut self, callback: OomErrorCallback) {
pub fn set_oom_error_handler(&mut self, callback: LegacyOomErrorCallback) {
unsafe { v8__Isolate__SetOOMErrorHandler(self, callback) };
}

View file

@ -30,7 +30,7 @@ impl Drop for SetupGuard {
fn setup() -> SetupGuard {
static START: std::sync::Once = std::sync::Once::new();
START.call_once(|| {
assert!(v8::icu::set_common_data_70(align_data::include_aligned!(
assert!(v8::icu::set_common_data_71(align_data::include_aligned!(
align_data::Align16,
"../third_party/icu/common/icudtl.dat"
))
@ -4280,7 +4280,12 @@ fn inspector_dispatch_protocol_message() {
let mut channel = ChannelCounter::new();
let state = b"{}";
let state_view = StringView::from(&state[..]);
let mut session = inspector.connect(1, &mut channel, state_view);
let mut session = inspector.connect(
1,
&mut channel,
state_view,
V8InspectorClientTrustLevel::Untrusted,
);
let message = String::from(
r#"{"id":1,"method":"Network.enable","params":{"maxPostDataSize":65536}}"#,
);
@ -4308,7 +4313,12 @@ fn inspector_schedule_pause_on_next_statement() {
let mut channel = ChannelCounter::new();
let state = b"{}";
let state_view = StringView::from(&state[..]);
let mut session = inspector.connect(1, &mut channel, state_view);
let mut session = inspector.connect(
1,
&mut channel,
state_view,
V8InspectorClientTrustLevel::FullyTrusted,
);
let name = b"";
let name_view = StringView::from(&name[..]);
@ -5697,7 +5707,7 @@ fn icu_date() {
#[test]
fn icu_set_common_data_fail() {
assert!(v8::icu::set_common_data_70(&[1, 2, 3]).is_err());
assert!(v8::icu::set_common_data_71(&[1, 2, 3]).is_err());
}
#[test]
@ -6110,7 +6120,7 @@ fn counter_lookup_callback() {
.find_map(|(name, count)| {
let name = unsafe { CStr::from_ptr(name.0) };
// Note: counter names start with a "c:" prefix.
if "c:V8.TotalParseSize" == name.to_string_lossy() {
if "c:V8.CompilationCacheMisses" == name.to_string_lossy() {
Some(unsafe { *count.0 })
} else {
None

View file

@ -1,6 +1,6 @@
// This is flaky on cross (QEMU bug)
// but otherwise works fine on real device.
#![cfg(not(target_os = "android"))]
#![cfg(not(target_arch = "aarch64"))]
use std::iter::repeat_with;
use std::thread;

2
third_party/icu vendored

@ -1 +1 @@
Subproject commit 2cec8175b83f6145398d30d85a97da283c1a2242
Subproject commit 9673defd90d4c5f2dbf3ebdd9f62525c57fe5a9c

@ -1 +1 @@
Subproject commit 0944e71f4b2cb9a871bcbe353f95e889b64a611a
Subproject commit 1b882ef6372b58bfd55a3285f37ed801be9137cd

2
third_party/zlib vendored

@ -1 +1 @@
Subproject commit e84c9a3fd75fdc39055b7ae27d6ec508e50bd39e
Subproject commit 9979c19f11314156490b53da91df08c934a3c0d4

View file

@ -1,4 +1,4 @@
const V8_TRACKING_BRANCH = "10.0-lkgr-denoland";
const V8_TRACKING_BRANCH = "10.3-lkgr-denoland";
const AUTOROLL_BRANCH = "autoroll";
function extractVersion() {

@ -1 +1 @@
Subproject commit 3aa688cdf8bd54f9e2dad5e1c65d4a385bd0b48d
Subproject commit 9da95105864734ee87f47e0de638a09eb088338b

View file

@ -18,7 +18,7 @@ except ImportError: # For Py3 compatibility
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
URL = "https://github.com/denoland/ninja_gn_binaries/archive/20210101.tar.gz"
URL = "https://github.com/denoland/ninja_gn_binaries/archive/20220517.tar.gz"
DIR = None

2
v8

@ -1 +1 @@
Subproject commit 137f7139b7c72ddc2ac3e40b999c52939596ba01
Subproject commit a89106dffd331db3226642ef173fa8b16e5d61fc