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 import("//build/config/c++/c++.gni") |
| 6 import("//v8/snapshot_toolchain.gni") |
| 7 |
| 8 if (is_android) { |
| 9 import("//build/config/android/rules.gni") |
| 10 } |
| 11 |
| 12 if (is_android) { |
| 13 android_assets("v8_context_snapshot_assets") { |
| 14 deps = [ |
| 15 ":v8_context_snapshot", |
| 16 ] |
| 17 sources = [ |
| 18 "$root_out_dir/v8_context_snapshot.bin", |
| 19 ] |
| 20 disable_compression = true |
| 21 } |
| 22 } |
| 23 |
| 24 group("v8_context_snapshot") { |
| 25 if (!is_chromeos) { |
| 26 public_deps = [ |
| 27 ":generate_v8_context_snapshot", |
| 28 ] |
| 29 } |
| 30 } |
| 31 |
| 32 if (!is_chromeos) { |
| 33 action("generate_v8_context_snapshot") { |
| 34 script = "run.py" |
| 35 output_file = "$root_out_dir/v8_context_snapshot.bin" |
| 36 output_path = rebase_path(output_file, root_build_dir) |
| 37 |
| 38 args = [ |
| 39 "./" + rebase_path( |
| 40 get_label_info( |
| 41 ":v8_context_snapshot_generator($v8_snapshot_toolchain)", |
| 42 "root_out_dir") + "/v8_context_snapshot_generator", |
| 43 root_build_dir), |
| 44 "--output_file=$output_path", |
| 45 ] |
| 46 |
| 47 outputs = [ |
| 48 output_file, |
| 49 ] |
| 50 |
| 51 deps = [ |
| 52 ":v8_context_snapshot_generator($v8_snapshot_toolchain)", |
| 53 ] |
| 54 } |
| 55 |
| 56 # This config disables a link time optimization "ICF", which may merge differe
nt |
| 57 # functions into one if the function signature and body of them are identical. |
| 58 config("disable_icf") { |
| 59 visibility = [ ":*" ] # Only targets in this file can depend on this. |
| 60 if (is_win) { |
| 61 ldflags = [ "/OPT:NOICF" ] |
| 62 } else if (is_posix && !is_mac) { |
| 63 ldflags = [ "-Wl,--icf=none" ] |
| 64 } |
| 65 } |
| 66 |
| 67 executable("v8_context_snapshot_generator") { |
| 68 sources = [ |
| 69 "v8_context_snapshot_generator.cc", |
| 70 ] |
| 71 |
| 72 deps = [ |
| 73 "//gin:gin", |
| 74 "//mojo/edk/system:system", |
| 75 "//third_party/WebKit/public:blink", |
| 76 "//v8", |
| 77 ] |
| 78 |
| 79 if (current_toolchain == default_toolchain && |
| 80 (is_component_build || using_sanitizer) && use_custom_libcxx) { |
| 81 sources += [ "$root_out_dir/libc++.so" ] |
| 82 deps += [ "//buildtools/third_party/libc++" ] |
| 83 } |
| 84 |
| 85 # Link time optimization "ICF" breaks 1:1 mappings of the external reference
s |
| 86 # for V8 snapshot. So, we disable it while taking a V8 snapshot. |
| 87 configs += [ |
| 88 "//v8:external_startup_data", |
| 89 ":disable_icf", |
| 90 ] |
| 91 } |
| 92 } |
OLD | NEW |