OLD | NEW |
| (Empty) |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 # Targets in ths file are to take a V8 context snapshot on build time. | |
6 # Created V8 context snapshot is used in | |
7 # third_party/WebKit/Source/bindings/core/v8/V8ContextSnapshot.{cpp|h}. | |
8 # to speedup creating a V8 context and setting up around it. | |
9 | |
10 import("//build/config/c++/c++.gni") | |
11 import("//v8/snapshot_toolchain.gni") | |
12 | |
13 if (is_android) { | |
14 import("//build/config/android/rules.gni") | |
15 } | |
16 | |
17 if (is_android) { | |
18 android_assets("v8_context_snapshot_assets") { | |
19 deps = [ | |
20 ":v8_context_snapshot", | |
21 ] | |
22 sources = [ | |
23 "$root_out_dir/v8_context_snapshot.bin", | |
24 ] | |
25 disable_compression = true | |
26 } | |
27 } | |
28 | |
29 group("v8_context_snapshot") { | |
30 if (!is_chromeos) { | |
31 public_deps = [ | |
32 ":generate_v8_context_snapshot", | |
33 ] | |
34 } | |
35 } | |
36 | |
37 if (!is_chromeos && !is_android) { | |
38 action("generate_v8_context_snapshot") { | |
39 script = "run.py" | |
40 output_file = "$root_out_dir/v8_context_snapshot.bin" | |
41 output_path = rebase_path(output_file, root_build_dir) | |
42 | |
43 args = [ | |
44 "./" + rebase_path( | |
45 get_label_info( | |
46 ":v8_context_snapshot_generator($v8_snapshot_toolchain)", | |
47 "root_out_dir") + "/v8_context_snapshot_generator", | |
48 root_build_dir), | |
49 "--output_file=$output_path", | |
50 ] | |
51 | |
52 outputs = [ | |
53 output_file, | |
54 ] | |
55 | |
56 deps = [ | |
57 ":v8_context_snapshot_generator($v8_snapshot_toolchain)", | |
58 ] | |
59 } | |
60 | |
61 # This config disables a link time optimization "ICF", which may merge differe
nt | |
62 # functions into one if the function signature and body of them are identical. | |
63 # | |
64 # ICF breaks 1:1 mappings of the external references for V8 snapshot, so we | |
65 # disable it while taking a V8 snapshot. | |
66 config("disable_icf") { | |
67 visibility = [ ":*" ] # Only targets in this file can depend on this. | |
68 if (is_win) { | |
69 ldflags = [ "/OPT:NOICF" ] | |
70 } else if (is_posix && !is_mac) { | |
71 ldflags = [ "-Wl,--icf=none" ] | |
72 } | |
73 } | |
74 | |
75 executable("v8_context_snapshot_generator") { | |
76 sources = [ | |
77 "v8_context_snapshot_generator.cc", | |
78 ] | |
79 | |
80 deps = [ | |
81 "//gin:gin", | |
82 "//mojo/edk/system:system", | |
83 "//third_party/WebKit/public:blink", | |
84 "//v8", | |
85 ] | |
86 | |
87 if (is_linux && (is_component_build || using_sanitizer) && | |
88 use_custom_libcxx) { | |
89 deps += [ "//buildtools/third_party/libc++:libc++" ] | |
90 } | |
91 | |
92 configs += [ | |
93 "//v8:external_startup_data", | |
94 ":disable_icf", | |
95 ] | |
96 } | |
97 } | |
OLD | NEW |