| # Copyright 2025 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # Targets in this file are used to create compiled bytecode for chromium bundled |
| # JS scripts at build time. The resulting compiled bytecode can be used during |
| # runtime to improve load performance. |
| |
| import("//build/buildflag_header.gni") |
| import("//build/config/c++/c++.gni") |
| import("//build/config/compiler/compiler.gni") |
| import("//tools/v8_context_snapshot/v8_context_snapshot.gni") |
| import("//v8/gni/snapshot_toolchain.gni") |
| |
| if (is_android) { |
| import("//build/config/android/rules.gni") |
| } |
| |
| # The generator runs on the build host. Code cache actions use the copy built |
| # in the V8 snapshot toolchain, like v8_context_snapshot_generator, and pass it |
| # the target's snapshot. The default-toolchain copy serves the Python unit |
| # tests, which run it next to the snapshot in the root build directory. |
| if (v8_snapshot_toolchain == current_toolchain || |
| current_toolchain == default_toolchain) { |
| executable("code_cache_generator") { |
| sources = [ "code_cache_generator.cc" ] |
| |
| deps = [ |
| "//gin", |
| "//mojo/core/embedder", |
| "//third_party/blink/public:blink", |
| "//tools/v8_context_snapshot:buildflags", |
| "//v8", |
| ] |
| data = [] |
| |
| if (v8_use_external_startup_data && |
| current_toolchain == default_toolchain) { |
| if (use_v8_context_snapshot) { |
| data += [ "$root_out_dir/$v8_context_snapshot_filename" ] |
| } |
| if (!use_v8_context_snapshot || include_both_v8_snapshots) { |
| data += [ "$root_out_dir/snapshot_blob.bin" ] |
| } |
| } |
| |
| configs += [ "//v8:external_startup_data" ] |
| } |
| } |