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

V8 builtins PGO

This commit is contained in:
Divy Srivastava 2024-03-08 20:26:08 +05:30
parent a79000c4b1
commit edf3b089bb
2 changed files with 37 additions and 0 deletions

2
.gn
View file

@ -73,6 +73,8 @@ default_args = {
# Enable V8 object print for debugging.
# v8_enable_object_print = true
v8_enable_builtins_optimization = true
# Enable Deno-specific extra bindings
deno_enable_extras = true
}

View file

@ -114,6 +114,9 @@ fn build_v8() {
if need_gn_ninja_download() {
download_ninja_gn_binaries();
}
if need_pgo_data_download() {
download_v8_pgo_data();
}
// On windows, rustc cannot link with a V8 debug build.
let mut gn_args = if is_debug() && !cfg!(target_os = "windows") {
@ -310,6 +313,33 @@ fn download_ninja_gn_binaries() {
env::set_var("NINJA", ninja);
}
fn download_v8_pgo_data() {
// Update $PATH to include depot_tools
//
// required for vpython3 to work.
env::set_var(
"PATH",
format!(
"{}:{}",
env::var("PATH").unwrap(),
std::env::current_dir()
.unwrap()
.join("depot_tools")
.to_str()
.unwrap()
),
);
println!("Downloading PGO data");
assert!(Command::new(python())
.arg("./v8/tools/builtins-pgo/download_profiles.py")
.arg("download")
.arg("--depot-tools")
.arg("./depot_tools")
.status()
.unwrap()
.success());
}
fn static_lib_url() -> String {
if let Ok(custom_archive) = env::var("RUSTY_V8_ARCHIVE") {
return custom_archive;
@ -533,6 +563,11 @@ fn need_gn_ninja_download() -> bool {
!has_ninja || !has_gn
}
fn need_pgo_data_download() -> bool {
let pgo_data = Path::new("v8/tools/builtins-pgo/profiles/x64.profile");
!pgo_data.exists()
}
// Chromiums gn arg clang_base_path is currently compatible with:
// * Apples clang and clang from homebrew's llvm@x packages
// * the official binaries from releases.llvm.org