Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
[submodule "third_party/abseil-cpp"]
path = third_party/abseil-cpp
url = https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git
[submodule "depot_tools"]
path = depot_tools
url = https://github.com/denoland/depot_tools
2 changes: 2 additions & 0 deletions .gn
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ default_args = {
# Enable V8 object print for debugging.
# v8_enable_object_print = true

v8_enable_builtins_optimization = true

# V8 12.3 added google/fuzztest as a third party dependency.
# https://chromium.googlesource.com/v8/v8.git/+/d5acece0c9b89b18716c177d1fcc8f734191e1e2%5E%21/#F4
#
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ exclude = [
"!v8/tools/run.py",
"!v8/tools/snapshot/asm_to_inline_asm.py",
"!v8/tools/testrunner/utils/dump_build_config.py",
"!v8/tools/builtins-pgo",
]

[features]
Expand Down
36 changes: 36 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -310,6 +313,34 @@ 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");
#[cfg(not(target_os = "windows"))]
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;
Expand Down Expand Up @@ -533,6 +564,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
Expand Down
1 change: 1 addition & 0 deletions depot_tools
Submodule depot_tools added at 726042