Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Unified Diff: tools/v8_context_snapshot/BUILD.gn

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Work for comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/v8_context_snapshot/BUILD.gn
diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..7d8c5220f4dd768e3840ffc442a98295a9ad52b6
--- /dev/null
+++ b/tools/v8_context_snapshot/BUILD.gn
@@ -0,0 +1,92 @@
+# 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("//build/config/c++/c++.gni")
+import("//v8/snapshot_toolchain.gni")
+
+if (is_android) {
+ import("//build/config/android/rules.gni")
+}
+
+if (is_android) {
+ android_assets("v8_context_snapshot_assets") {
+ deps = [
+ ":v8_context_snapshot",
+ ]
+ sources = [
+ "$root_out_dir/v8_context_snapshot.bin",
+ ]
+ disable_compression = true
+ }
+}
+
+group("v8_context_snapshot") {
+ if (!is_chromeos) {
+ public_deps = [
+ ":generate_v8_context_snapshot",
+ ]
+ }
+}
+
+if (!is_chromeos) {
+ action("generate_v8_context_snapshot") {
+ script = "run.py"
+ output_file = "$root_out_dir/v8_context_snapshot.bin"
+ output_path = rebase_path(output_file, root_build_dir)
+
+ args = [
+ "./" + rebase_path(
+ get_label_info(
+ ":v8_context_snapshot_generator($v8_snapshot_toolchain)",
+ "root_out_dir") + "/v8_context_snapshot_generator",
+ root_build_dir),
+ "--output_file=$output_path",
+ ]
+
+ outputs = [
+ output_file,
+ ]
+
+ deps = [
+ ":v8_context_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("v8_context_snapshot_generator") {
+ sources = [
+ "v8_context_snapshot_generator.cc",
+ ]
+
+ deps = [
+ "//gin:gin",
+ "//mojo/edk/system:system",
+ "//third_party/WebKit/public:blink",
+ "//v8",
+ ]
+
+ if (current_toolchain == default_toolchain &&
+ (is_component_build || using_sanitizer) && use_custom_libcxx) {
+ sources += [ "$root_out_dir/libc++.so" ]
+ deps += [ "//buildtools/third_party/libc++" ]
+ }
+
+ # 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",
+ ]
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698