Index: gin/BUILD.gn |
diff --git a/gin/BUILD.gn b/gin/BUILD.gn |
index eaf88a8c77da16cc5e773b3f2dc5dca8ab85157c..b8ed4313977f31d68e57793784cd5c4525d00e83 100644 |
--- a/gin/BUILD.gn |
+++ b/gin/BUILD.gn |
@@ -110,6 +110,66 @@ executable("gin_shell") { |
configs += [ "//v8:external_startup_data" ] |
} |
+group("blink_v8_snapshot") { |
+ public_deps = [ |
+ ":generate_blink_v8_snapshot", |
+ ] |
+} |
+ |
+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($host_toolchain)", |
+ "root_out_dir") + "/blink_v8_snapshot_generator", |
+ root_build_dir), |
+ "--output_file=$output_path", |
+ ] |
+ |
+ outputs = [ |
+ output_file, |
+ ] |
+ |
+ deps = [ |
+ ":blink_v8_snapshot_generator($host_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_clang || use_gold) { |
+ ldflags = [ "-Wl,--icf=none" ] |
+ } else if (is_win) { |
+ # Assume using MSVC linker |
+ ldflags = [ "/OPT:NOICF" ] |
+ } |
+} |
+ |
+executable("blink_v8_snapshot_generator") { |
+ sources = [ |
+ "shell/blink_v8_snapshot_generator_main.cc", |
+ ] |
+ |
+ deps = [ |
+ ":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", |
+ ] |
+} |
+ |
source_set("gin_test") { |
testonly = true |
sources = [ |