Exclude Observatory assets from PRODUCT build dart, dart_precompiled_runtime

This CL also removes some compiler flags that increase space somewhat
that help the profiler find symbols, which isn't included in a PRODUCT
build.

Before:
zra@zach:~/dart/sdk$ ls -la out/ProductX64/exe.stripped/
-rwxr-x--- 1 zra eng  9693064 Jun 29 14:52 dart
-rwxr-x--- 1 zra eng  7391080 Jun 29 14:52 dart_precompiled_runtime

R=askesc@google.com, rmacnak@google.com

After:
-rwxr-x--- 1 zra eng  6809424 Jun 29 15:11 dart
-rwxr-x--- 1 zra eng  3299120 Jun 29 15:11 dart_precompiled_runtime
Review-Url: https://codereview.chromium.org/2964133002 .
This commit is contained in:
Zachary Anderson 2017-06-30 08:09:35 -07:00
parent 56a881d563
commit 1a8174b08d
8 changed files with 89 additions and 57 deletions

View file

@ -236,6 +236,10 @@ if (is_win) {
}
if (is_posix) {
_native_compiler_configs += [ "//build/config/gcc:no_exceptions" ]
if (is_product) {
_native_compiler_configs +=
[ "//build/config/gcc:symbol_visibility_hidden" ]
}
}
if (is_linux) {

View file

@ -75,10 +75,13 @@ config("compiler") {
# so we do so here. Normal function visibility is controlled by
# //build/config/gcc:symbol_visibility_hidden.
"-fvisibility-inlines-hidden",
# We need the frame pointer for CPU and heap profiling.
"-fno-omit-frame-pointer",
]
if (!is_product) {
common_flags += [
# We need the frame pointer for CPU and heap profiling.
"-fno-omit-frame-pointer",
]
}
cflags_cc += common_flags
cflags_objcc += common_flags

View file

@ -4,35 +4,6 @@
import("runtime_args.gni")
declare_args() {
# Instead of using is_debug, we introduce a different flag for specifying a
# Debug build of Dart so that clients can still use a Release build of Dart
# while themselves doing a Debug build.
dart_debug = false
# Set the runtime mode. This affects how the runtime is built and what
# features it has. Valid values are:
# 'develop' (the default) - VM is built to run as a JIT with all development
# features enabled.
# 'profile' - The VM is built to run with AOT compiled code with only the
# CPU profiling features enabled.
# 'release' - The VM is built to run with AOT compiled code with no developer
# features enabled.
#
# These settings are only used for Flutter, at the moment. A standalone build
# of the Dart VM should leave this set to "develop", and should set
# 'is_debug', 'is_release', or 'is_product'.
dart_runtime_mode = "develop"
# Explicitly set the target architecture in case of precompilation. Leaving
# this unspecified results in automatic target architecture detection.
# Available options are: arm, arm64, x64, and ia32
dart_target_arch = ""
# The optimization level to use for debug builds.
dart_debug_optimization_level = "2"
}
config("dart_public_config") {
include_dirs = [ "." ]
}

View file

@ -619,7 +619,7 @@ template("dart_executable") {
if (is_fuchsia) {
configs -= [ "//build/config:symbol_visibility_hidden" ]
}
if (defined(is_fuchsia_host) && is_fuchsia_host) {
if (is_fuchsia_host) {
# We already have these in the standalone build, but Fuchsia doesn't
# have them. They are needed for running Fuchsia binaries built for the
# host.
@ -631,7 +631,6 @@ template("dart_executable") {
}
deps = [
":gen_resources_cc",
":standalone_dart_io",
":libdart_builtin",
"$dart_zlib_path",
@ -651,7 +650,6 @@ template("dart_executable") {
"snapshot_utils.h",
"vmservice_impl.cc",
"vmservice_impl.h",
"$target_gen_dir/resources_gen.cc",
] + extra_sources
include_dirs = [
@ -662,7 +660,9 @@ template("dart_executable") {
if (is_win) {
ldflags = [ "/EXPORT:Dart_True" ]
} else {
ldflags = [ "-rdynamic" ]
if (dart_runtime_mode != "release") {
ldflags = [ "-rdynamic" ]
}
}
if (is_win) {
@ -685,29 +685,39 @@ dart_executable("dart") {
extra_deps = [
"..:libdart_jit",
":dart_snapshot_cc",
"../observatory:standalone_observatory_archive",
":gen_resources_cc",
]
if (dart_runtime_mode != "release") {
extra_deps += [ "../observatory:standalone_observatory_archive" ]
}
extra_sources = [
"builtin_nolib.cc",
"dfe.cc",
"dfe.h",
"loader.cc",
"loader.h",
"$target_gen_dir/resources_gen.cc",
]
if (dart_runtime_mode == "release") {
extra_sources += [ "observatory_assets_empty.cc" ]
}
}
dart_executable("dart_precompiled_runtime") {
extra_configs = [ "..:dart_precompiled_runtime_config" ]
extra_deps = [
"..:libdart_precompiled_runtime",
"../observatory:standalone_observatory_archive",
]
extra_deps = [ "..:libdart_precompiled_runtime" ]
if (dart_runtime_mode != "release") {
extra_deps += [ "../observatory:standalone_observatory_archive" ]
}
extra_sources = [
"builtin_nolib.cc",
"snapshot_empty.cc",
"loader.cc",
"loader.h",
]
if (dart_runtime_mode == "release") {
extra_sources += [ "observatory_assets_empty.cc" ]
}
}
dart_executable("dart_bootstrap") {
@ -716,21 +726,22 @@ dart_executable("dart_bootstrap") {
"..:dart_no_snapshot_config",
]
extra_deps = [
":gen_resources_cc",
":generate_blink_cc_file",
":generate_builtin_cc_file",
":generate_io_cc_file",
":generate_io_patch_cc_file",
":generate_cached_patches_cc_file",
":generate_html_cc_file",
":generate_html_common_cc_file",
":generate_indexed_db_cc_file",
":generate_io_cc_file",
":generate_io_patch_cc_file",
":generate_js_cc_file",
":generate_js_util_cc_file",
":generate_blink_cc_file",
":generate_indexed_db_cc_file",
":generate_cached_patches_cc_file",
":generate_web_gl_cc_file",
":generate_metadata_cc_file",
":generate_web_sql_cc_file",
":generate_svg_cc_file",
":generate_web_audio_cc_file",
":generate_web_gl_cc_file",
":generate_web_sql_cc_file",
"..:libdart_nosnapshot_with_precompiler",
]
extra_defines = [ "NO_OBSERVATORY" ]
@ -745,21 +756,22 @@ dart_executable("dart_bootstrap") {
"snapshot_empty.cc",
# Include generated source files.
"$target_gen_dir/blink_gen.cc",
"$target_gen_dir/builtin_gen.cc",
"$target_gen_dir/cached_patches_gen.cc",
"$target_gen_dir/html_common_gen.cc",
"$target_gen_dir/html_gen.cc",
"$target_gen_dir/indexed_db_gen.cc",
"$target_gen_dir/io_gen.cc",
"$target_gen_dir/io_patch_gen.cc",
"$target_gen_dir/html_gen.cc",
"$target_gen_dir/html_common_gen.cc",
"$target_gen_dir/js_gen.cc",
"$target_gen_dir/js_util_gen.cc",
"$target_gen_dir/blink_gen.cc",
"$target_gen_dir/indexed_db_gen.cc",
"$target_gen_dir/cached_patches_gen.cc",
"$target_gen_dir/web_gl_gen.cc",
"$target_gen_dir/metadata_gen.cc",
"$target_gen_dir/web_sql_gen.cc",
"$target_gen_dir/resources_gen.cc",
"$target_gen_dir/svg_gen.cc",
"$target_gen_dir/web_audio_gen.cc",
"$target_gen_dir/web_gl_gen.cc",
"$target_gen_dir/web_sql_gen.cc",
]
}

View file

@ -41,7 +41,11 @@ struct ResourcesEntry {
int length_;
};
#if defined(DART_PRECOMPILED_RUNTIME)
ResourcesEntry __service_bin_resources_[] = {{NULL, NULL, 0}};
#else
extern ResourcesEntry __service_bin_resources_[];
#endif
class Resources {
public:

View file

@ -3,6 +3,38 @@
# BSD-style license that can be found in the LICENSE file.
declare_args() {
# Instead of using is_debug, we introduce a different flag for specifying a
# Debug build of Dart so that clients can still use a Release build of Dart
# while themselves doing a Debug build.
dart_debug = false
# Set the runtime mode. This affects how the runtime is built and what
# features it has. Valid values are:
# 'develop' (the default) - VM is built to run as a JIT with all development
# features enabled.
# 'profile' - The VM is built to run with AOT compiled code with only the
# CPU profiling features enabled.
# 'release' - The VM is built to run with AOT compiled code with no developer
# features enabled.
#
# These settings are only used for Flutter, at the moment. A standalone build
# of the Dart VM should leave this set to "develop", and should set
# 'is_debug', 'is_release', or 'is_product'.
#
# TODO(rmacnak): dart_runtime_mode no longer selects whether libdart is build
# for JIT or AOT, since libdart waw split into libdart_jit and
# libdart_precompiled_runtime. We should remove this flag and just set
# dart_debug/dart_product.
dart_runtime_mode = "develop"
# Explicitly set the target architecture in case of precompilation. Leaving
# this unspecified results in automatic target architecture detection.
# Available options are: arm, arm64, x64, ia32, and dbc.
dart_target_arch = ""
# The optimization level to use for debug builds.
dart_debug_optimization_level = "2"
# Whether to fall back to built-in root certificates when they cannot be
# verified at the operating system level.
dart_use_fallback_root_certificates = false

View file

@ -92,9 +92,12 @@ source_set("tcmalloc") {
"NDEBUG",
]
# Disable stack sampling for heap profiling in Product builds.
if (is_product) {
# Disable stack sampling for heap profiling in Product builds.
defines += [ "NO_TCMALLOC_SAMPLES" ]
# To override the C library functions, we can't hide symbols.
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
}
cflags = [

View file

@ -189,7 +189,10 @@ def ToGnArgs(args, mode, arch, target_os):
# This setting is only meaningful for Flutter. Standalone builds of the VM
# should leave this set to 'develop', which causes the build to defer to
# 'is_debug', 'is_release' and 'is_product'.
gn_args['dart_runtime_mode'] = 'develop'
if mode == 'product':
gn_args['dart_runtime_mode'] = 'release'
else:
gn_args['dart_runtime_mode'] = 'develop'
dont_use_clang = DontUseClang(args, gn_args['target_os'],
gn_args['host_cpu'],