Index: tools/blink_v8_snapshot/BUILD.gn |
diff --git a/tools/blink_v8_snapshot/BUILD.gn b/tools/blink_v8_snapshot/BUILD.gn |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1976ca60ce27e6197350eb8ead3c6a2f2eaac55f |
--- /dev/null |
+++ b/tools/blink_v8_snapshot/BUILD.gn |
@@ -0,0 +1,85 @@ |
+# Copyright 2017 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import("//v8/snapshot_toolchain.gni") |
+ |
+if (is_android) { |
+ import("//build/config/android/rules.gni") |
+} |
+ |
+if (is_android) { |
+ android_assets("blink_v8_snapshot_assets") { |
+ deps = [ |
+ ":blink_v8_snapshot", |
+ ] |
+ sources = [ |
+ "$root_out_dir/blink_v8_snapshot.bin", |
+ ] |
+ disable_compression = true |
+ } |
+} |
+ |
+group("blink_v8_snapshot") { |
+ if (!is_chromeos) { |
+ public_deps = [ |
+ ":generate_blink_v8_snapshot", |
+ ] |
+ } |
+} |
+ |
+if (!is_chromeos) { |
+ action("generate_blink_v8_snapshot") { |
+ script = "run.py" |
+ output_file = "$root_out_dir/blink_v8_snapshot.bin" |
+ output_path = rebase_path(output_file, root_build_dir) |
+ |
+ args = [ |
+ "./" + rebase_path( |
+ get_label_info( |
+ ":blink_v8_snapshot_generator($v8_snapshot_toolchain)", |
+ "root_out_dir") + "/blink_v8_snapshot_generator", |
+ root_build_dir), |
+ "--output_file=$output_path", |
+ ] |
+ |
+ outputs = [ |
+ output_file, |
+ ] |
+ |
+ deps = [ |
+ ":blink_v8_snapshot_generator($v8_snapshot_toolchain)", |
+ ] |
+ } |
+ |
+ # This config disables a link time optimization "ICF", which may merge different |
+ # functions into one if the function signature and body of them are identical. |
+ config("disable_icf") { |
+ visibility = [ ":*" ] # Only targets in this file can depend on this. |
+ if (is_win) { |
+ ldflags = [ "/OPT:NOICF" ] |
+ } else if (is_posix && !is_mac) { |
+ ldflags = [ "-Wl,--icf=none" ] |
+ } |
+ } |
+ |
+ executable("blink_v8_snapshot_generator") { |
+ sources = [ |
+ "blink_v8_snapshot_generator.cc", |
+ ] |
+ |
+ deps = [ |
+ "//gin:gin", |
+ "//mojo/edk/system:system", |
+ "//third_party/WebKit/public:blink", |
+ "//v8", |
+ ] |
+ |
+ # Link time optimization "ICF" breaks 1:1 mappings of the external references |
+ # for V8 snapshot. So, we disable it while taking a V8 snapshot. |
+ configs += [ |
+ "//v8:external_startup_data", |
+ ":disable_icf", |
+ ] |
+ } |
+} |