 Chromium Code Reviews
 Chromium Code Reviews Issue 2841443005:
  [Bindings] Create and use V8 context snapshots  (Closed)
    
  
    Issue 2841443005:
  [Bindings] Create and use V8 context snapshots  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be | 
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. | 
| 4 | 4 | 
| 5 import("//testing/test.gni") | 5 import("//testing/test.gni") | 
| 6 import("//v8/gni/v8.gni") | 6 import("//v8/gni/v8.gni") | 
| 7 | 7 | 
| 8 component("gin") { | 8 component("gin") { | 
| 9 sources = [ | 9 sources = [ | 
| 10 "arguments.cc", | 10 "arguments.cc", | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 ] | 70 ] | 
| 71 | 71 | 
| 72 if (v8_use_external_startup_data) { | 72 if (v8_use_external_startup_data) { | 
| 73 data = [ | 73 data = [ | 
| 74 "$root_out_dir/natives_blob.bin", | 74 "$root_out_dir/natives_blob.bin", | 
| 75 "$root_out_dir/snapshot_blob.bin", | 75 "$root_out_dir/snapshot_blob.bin", | 
| 76 ] | 76 ] | 
| 77 } | 77 } | 
| 78 | 78 | 
| 79 defines = [ "GIN_IMPLEMENTATION" ] | 79 defines = [ "GIN_IMPLEMENTATION" ] | 
| 80 | |
| 81 public_deps = [ | 80 public_deps = [ | 
| 82 "//base", | 81 "//base", | 
| 83 "//v8", | 82 "//v8", | 
| 84 ] | 83 ] | 
| 84 | |
| 85 deps = [ | 85 deps = [ | 
| 86 "//base/third_party/dynamic_annotations", | 86 "//base/third_party/dynamic_annotations", | 
| 87 ] | 87 ] | 
| 88 | 88 | 
| 89 if (is_mac) { | 89 if (is_mac) { | 
| 90 libs = [ "CoreFoundation.framework" ] | 90 libs = [ "CoreFoundation.framework" ] | 
| 91 } | 91 } | 
| 92 | 92 | 
| 93 configs += [ "//v8:external_startup_data" ] | 93 configs += [ "//v8:external_startup_data" ] | 
| 94 } | 94 } | 
| 95 | 95 | 
| 96 executable("gin_shell") { | 96 executable("gin_shell") { | 
| 97 sources = [ | 97 sources = [ | 
| 98 "shell/gin_main.cc", | 98 "shell/gin_main.cc", | 
| 99 ] | 99 ] | 
| 100 | 100 | 
| 101 deps = [ | 101 deps = [ | 
| 102 ":gin", | 102 ":gin", | 
| 103 "//base", | 103 "//base", | 
| 104 "//base:i18n", | 104 "//base:i18n", | 
| 105 "//build/config:exe_and_shlib_deps", | 105 "//build/config:exe_and_shlib_deps", | 
| 106 "//build/win:default_exe_manifest", | 106 "//build/win:default_exe_manifest", | 
| 107 "//v8", | 107 "//v8", | 
| 108 ] | 108 ] | 
| 109 | 109 | 
| 110 configs += [ "//v8:external_startup_data" ] | 110 configs += [ "//v8:external_startup_data" ] | 
| 111 } | 111 } | 
| 112 | 112 | 
| 113 group("blink_v8_snapshot") { | |
| 114 public_deps = [ | |
| 115 ":generate_blink_v8_snapshot", | |
| 116 ] | |
| 117 } | |
| 118 | |
| 119 action("generate_blink_v8_snapshot") { | |
| 120 script = "run.py" | |
| 121 output_file = "$root_out_dir/blink_v8_snapshot.bin" | |
| 122 output_path = rebase_path(output_file, root_build_dir) | |
| 123 | |
| 124 args = [ | |
| 125 "./" + rebase_path( | |
| 126 get_label_info(":blink_v8_snapshot_generator($host_toolchain)", | |
| 127 "root_out_dir") + "/blink_v8_snapshot_generator", | |
| 128 root_build_dir), | |
| 129 "--output_file=$output_path", | |
| 130 ] | |
| 131 | |
| 132 outputs = [ | |
| 133 output_file, | |
| 134 ] | |
| 135 | |
| 136 deps = [ | |
| 137 ":blink_v8_snapshot_generator($host_toolchain)", | |
| 138 ] | |
| 139 } | |
| 140 | |
| 141 # This config disables a link time optimization "ICF", which may merge different | |
| 142 # functions into one if the function signatures and body of them are identical. | |
| 
Yuki
2017/06/20 14:20:10
s/signatures/signature/
 
peria
2017/06/21 07:19:15
Done.
 | |
| 143 config("disable_icf") { | |
| 144 visibility = [ ":*" ] # Only targets in this file can depend on this. | |
| 145 if (is_win) { | |
| 146 ldflags = [ "/OPT:NOICF" ] | |
| 147 } else if (is_posix && !is_mac) { | |
| 
Yuki
2017/06/20 14:20:10
nit: It would be better to depend on toolchain rat
 
peria
2017/06/23 02:22:05
Trying...
 
peria
2017/06/27 09:52:36
ldflags seems to be set depend on platforms, and i
 | |
| 148 ldflags = [ "-Wl,--icf=none" ] | |
| 149 } | |
| 150 } | |
| 151 | |
| 152 executable("blink_v8_snapshot_generator") { | |
| 153 sources = [ | |
| 154 "shell/blink_v8_snapshot_generator_main.cc", | |
| 
Yuki
2017/06/20 14:20:10
This program highly depends on Blink (and it actua
 
peria
2017/06/23 02:22:05
I think //tools is a place for developer tools, wh
 
peria
2017/06/27 09:52:36
moved to tools/blink_v8_snapshot
 | |
| 155 ] | |
| 156 | |
| 157 deps = [ | |
| 158 ":gin", | |
| 159 "//mojo/edk/system:system", | |
| 160 "//third_party/WebKit/public:blink", | |
| 161 "//v8", | |
| 162 ] | |
| 163 | |
| 164 # Link time optimization "ICF" breaks 1:1 mappings of the external references | |
| 165 # for V8 snapshot. So, we disable it while taking a V8 snapshot. | |
| 166 configs += [ | |
| 167 "//v8:external_startup_data", | |
| 168 ":disable_icf", | |
| 169 ] | |
| 170 } | |
| 171 | |
| 113 source_set("gin_test") { | 172 source_set("gin_test") { | 
| 114 testonly = true | 173 testonly = true | 
| 115 sources = [ | 174 sources = [ | 
| 116 "test/file.cc", | 175 "test/file.cc", | 
| 117 "test/file.h", | 176 "test/file.h", | 
| 118 "test/file_runner.cc", | 177 "test/file_runner.cc", | 
| 119 "test/file_runner.h", | 178 "test/file_runner.h", | 
| 120 "test/gc.cc", | 179 "test/gc.cc", | 
| 121 "test/gc.h", | 180 "test/gc.h", | 
| 122 "test/gtest.cc", | 181 "test/gtest.cc", | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 "shell/hello_world.js", | 231 "shell/hello_world.js", | 
| 173 "test/file_unittests.js", | 232 "test/file_unittests.js", | 
| 174 "test/gtest_unittests.js", | 233 "test/gtest_unittests.js", | 
| 175 "../OWNERS", | 234 "../OWNERS", | 
| 176 ] | 235 ] | 
| 177 | 236 | 
| 178 data_deps = [ | 237 data_deps = [ | 
| 179 ":gin_shell", | 238 ":gin_shell", | 
| 180 ] | 239 ] | 
| 181 } | 240 } | 
| OLD | NEW |