Commit e792bd73 authored by brucedawson's avatar brucedawson Committed by Commit bot

Shrink gn's chrome.dll - now smaller than gyp's

More work to shrink gn's chrome.dll

The three largest globals that were present in gn's chrome.dll but not in gyp's chrome.dll were eliminated by using /verbose linker output to track the object files that pulled them in and then conditionally changing source_set targets to static_library targets. Specifically:

unigram_table, in compact_enc_det.obj
- Referenced by TextResourceDecoder.obj from //third_party/WebKit/Source/core:html - some other source_set targets in this file were also modified

gpu::ApplyFramebufferAttachmentCMAAINTELResourceManager::cmaa_frag_s1_ and cmaa_frag_s2_, in gles2_cmd_apply_framebuffer_attachment_cmaa_intel.obj from //gpu/command_buffer/service:service_sources
- Referenced by gpu_command_buffer_stub.obj from //gpu/ipc/service:ipc_service_sources
- Referenced by gpu_video_decode_accelerator.obj from //media/gpu/ipc/service:service
- Referenced by gpu_child_thread.obj from //content/gpu:gpu_sources
- Referenced by gpu_video_decode_accelerator_factory.obj from //content/public/gpu:gpu_sources

As of R406709 this shrinks gn's 32-bit official chrome.dll file size from 38,907,904 bytes to 37,571,584 bytes - an unexpected 1,336,320 byte savings, mostly from the .text section. There is also ~67,000 bytes of memory-only savings in the zero-init part of the .data section.

At the same revision gyp's 32-bit official chrome.dll file size is 37,843,456 bytes - 271,872 bytes *larger* than the gn version.

There are still globals that are present in gn's chrome.dll but not gyp's chrome.dll, so the optimization technique can still be applied some more, but the priority is much lower now that gn is winning.

This is a follow-on to crrev.com/2163823002.

BUG=624274
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2163933003
Cr-Commit-Position: refs/heads/master@{#406912}
parent a0be1c38
...@@ -20,7 +20,12 @@ group("gpu") { ...@@ -20,7 +20,12 @@ group("gpu") {
} }
} }
source_set("gpu_sources") { if (is_component_build) {
link_target_type = "source_set"
} else {
link_target_type = "static_library"
}
target(link_target_type, "gpu_sources") {
# This is an internal content API. Code outside of the content "component" # This is an internal content API. Code outside of the content "component"
# (like content/test and content/shell) should depend on ":gpu" above. # (like content/test and content/shell) should depend on ":gpu" above.
visibility = [ "//content/*" ] visibility = [ "//content/*" ]
......
...@@ -15,7 +15,12 @@ group("gpu") { ...@@ -15,7 +15,12 @@ group("gpu") {
} }
} }
source_set("gpu_sources") { if (is_component_build) {
link_target_type = "source_set"
} else {
link_target_type = "static_library"
}
target(link_target_type, "gpu_sources") {
# You must depend on this via //content/public/gpu above for the component # You must depend on this via //content/public/gpu above for the component
# build to work properly. # build to work properly.
visibility = [ "//content/*" ] visibility = [ "//content/*" ]
......
...@@ -17,7 +17,12 @@ group("service") { ...@@ -17,7 +17,12 @@ group("service") {
} }
} }
source_set("service_sources") { if (is_component_build) {
link_target_type = "source_set"
} else {
link_target_type = "static_library"
}
target(link_target_type, "service_sources") {
# External code should depend on this via //gpu/command_buffer/service above # External code should depend on this via //gpu/command_buffer/service above
# rather than depending on this directly or the component build will break. # rather than depending on this directly or the component build will break.
visibility = [ "//gpu/*" ] visibility = [ "//gpu/*" ]
......
...@@ -20,7 +20,12 @@ group("service") { ...@@ -20,7 +20,12 @@ group("service") {
} }
} }
source_set("ipc_service_sources") { if (is_component_build) {
link_target_type = "source_set"
} else {
link_target_type = "static_library"
}
target(link_target_type, "ipc_service_sources") {
visibility = [ "//gpu/*" ] visibility = [ "//gpu/*" ]
sources = [ sources = [
"gpu_channel.cc", "gpu_channel.cc",
......
...@@ -2,7 +2,12 @@ ...@@ -2,7 +2,12 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
source_set("service") { if (is_component_build) {
link_target_type = "source_set"
} else {
link_target_type = "static_library"
}
target(link_target_type, "service") {
visibility = [ visibility = [
"//media/*", "//media/*",
"//content/gpu/*", "//content/gpu/*",
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni") import("//build/config/chromecast_build.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//build/split_static_library.gni")
import("//third_party/WebKit/Source/bindings/bindings.gni") import("//third_party/WebKit/Source/bindings/bindings.gni")
import("//third_party/WebKit/Source/bindings/core/v8/generated.gni") import("//third_party/WebKit/Source/bindings/core/v8/generated.gni")
import("//third_party/WebKit/Source/bindings/modules/modules.gni") import("//third_party/WebKit/Source/bindings/modules/modules.gni")
...@@ -69,6 +70,16 @@ config("core_include_dirs") { ...@@ -69,6 +70,16 @@ config("core_include_dirs") {
} }
} }
if (is_component_build) {
link_target_type = "source_set"
} else {
link_target_type = "split_static_library"
# Safe split count for all of these split libraries - largest is ~6 GB in 32-bit
# official builds.
split_count = 6
}
# GYP version: WebKit/Source/core/core.gyp:webcore_generated # GYP version: WebKit/Source/core/core.gyp:webcore_generated
source_set("generated") { source_set("generated") {
deps = [ deps = [
...@@ -188,7 +199,7 @@ component("core") { ...@@ -188,7 +199,7 @@ component("core") {
} }
# GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_dom # GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_dom
source_set("dom") { target(link_target_type, "dom") {
sources = rebase_path(webcore_dom_files, ".", "//") sources = rebase_path(webcore_dom_files, ".", "//")
configs -= core_config_remove configs -= core_config_remove
...@@ -203,7 +214,7 @@ source_set("dom") { ...@@ -203,7 +214,7 @@ source_set("dom") {
} }
# GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_html # GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_html
source_set("html") { target(link_target_type, "html") {
sources = rebase_path(webcore_html_files, ".", "//") sources = rebase_path(webcore_html_files, ".", "//")
configs -= core_config_remove configs -= core_config_remove
...@@ -215,7 +226,7 @@ source_set("html") { ...@@ -215,7 +226,7 @@ source_set("html") {
} }
# GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_svg # GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_svg
source_set("svg") { target(link_target_type, "svg") {
sources = rebase_path(webcore_svg_files, ".", "//") sources = rebase_path(webcore_svg_files, ".", "//")
configs -= core_config_remove configs -= core_config_remove
...@@ -227,7 +238,7 @@ source_set("svg") { ...@@ -227,7 +238,7 @@ source_set("svg") {
} }
# GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_remaining # GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_remaining
source_set("remaining") { target(link_target_type, "remaining") {
# This is currently a mashup of "webcore_rendering" and "webcore_remaining" # This is currently a mashup of "webcore_rendering" and "webcore_remaining"
# in GYP. The file list variable is the same and then GYP filters on wether # in GYP. The file list variable is the same and then GYP filters on wether
# the path starts with "rendering/" or not. We should tweak the .gypis a bit # the path starts with "rendering/" or not. We should tweak the .gypis a bit
...@@ -336,7 +347,7 @@ source_set("testing") { ...@@ -336,7 +347,7 @@ source_set("testing") {
} }
# GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_generated # GYP version: //third_party/WebKit/Source/core/core.gyp:webcore_generated
source_set("core_generated") { target(link_target_type, "core_generated") {
sources = bindings_core_v8_files sources = bindings_core_v8_files
# These files include all the .cpp files generated from the .idl files # These files include all the .cpp files generated from the .idl files
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment