Index: gin/BUILD.gn |
diff --git a/gin/BUILD.gn b/gin/BUILD.gn |
index 212acaeb7fd178a8f6650542170f1522ead447f4..f0cbdcab41fb2f15052b137117e654671828d2a1 100644 |
--- a/gin/BUILD.gn |
+++ b/gin/BUILD.gn |
@@ -95,11 +95,11 @@ component("gin") { |
} |
defines = [ "GIN_IMPLEMENTATION" ] |
- |
public_deps = [ |
"//base", |
"//v8", |
] |
+ |
deps = [ |
":gin_features", |
"//base/third_party/dynamic_annotations", |
@@ -129,6 +129,65 @@ 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 signatures 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 = [ |
+ "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 = [ |