Chromium Code Reviews| Index: runtime/BUILD.gn |
| diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn |
| index 5d47c21cb8564771a557956cc4cb7e550c71fc78..f032656ef80125444dd5b32597e94cd8c29af3f5 100644 |
| --- a/runtime/BUILD.gn |
| +++ b/runtime/BUILD.gn |
| @@ -12,9 +12,15 @@ declare_args() { |
| # while themselves doing a Debug build. |
| dart_debug = false |
| - # Product mode drops many features (e.g. debugger, profiler, etc) in order to |
| - # shrink download size and decrease memory and cpu usage. |
| - dart_product = 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. |
| + dart_runtime_mode = "develop" |
| # Explicitly set the target architecture in case of precompilation. Leaving |
| # this unspecified results in automatic target architecture detection. |
| @@ -31,75 +37,29 @@ config("dart_public_config") { |
| config("dart_config") { |
| defines = [] |
| - if (dart_target_arch != "") { |
| - if (dart_target_arch == "arm") { |
| - defines += [ "TARGET_ARCH_ARM" ] |
| - } else if (dart_target_arch == "arm64") { |
| - defines += [ "TARGET_ARCH_ARM64" ] |
| - } else if (dart_target_arch == "mips") { |
| - defines += [ "TARGET_ARCH_MIPS" ] |
| - } else if (dart_target_arch == "x64") { |
| - defines += [ "TARGET_ARCH_X64" ] |
| - } else if (dart_target_arch == "ia32") { |
| - defines += [ "TARGET_ARCH_IA32" ] |
| - } else { |
| - print("Invalid |dart_target_arch|") |
| - assert(false) |
| - } |
| + if ((dart_runtime_mode != "develop") && |
| + (dart_runtime_mode != "profile") && |
| + (dart_runtime_mode != "release")) { |
| + print("Invalid |dart_runtime_mode|") |
| + assert(false) |
| } |
| - if (dart_debug) { |
| - defines += ["DEBUG"] |
| - } else { |
| - defines += ["NDEBUG"] |
| - } |
| - |
| - if (dart_product) { |
| + if (dart_runtime_mode == "release") { |
| if (dart_debug) { |
| - print("Debug and product mode are mutually exclusive.") |
| + print("Debug and release mode are mutually exclusive.") |
| } |
| assert(!dart_debug) |
| + defines += ["DART_PRECOMPILED_RUNTIME"] |
| defines += ["PRODUCT"] |
| } |
| - # Ideally this would only be enabled for gen_snapshot |
| - defines += ["DART_PRECOMPILER"] |
| - |
| - cflags = [ |
| - "-Werror", |
| - "-Wall", |
| - "-Wextra", # Also known as -W. |
| - "-Wno-unused-parameter", |
| - "-Wnon-virtual-dtor", |
| - "-Wvla", |
| - "-Wno-conversion-null", |
| - "-Woverloaded-virtual", |
| - "-g3", |
| - "-ggdb3", |
| - "-fno-rtti", |
| - "-fno-exceptions", |
| - ] |
| - |
| - if (dart_debug) { |
| - cflags += [ |
| - "-O1", |
| - ] |
| - } else { |
| - cflags += [ |
| - "-O3", |
| - ] |
| - } |
| - |
| - if (is_asan) { |
| - ldflags = [ |
| - "-Wl,-u_sanitizer_options_link_helper", |
| - "-fsanitize=address", |
| - ] |
| + if (dart_runtime_mode == "profile") { |
|
Florian Schneider
2016/04/19 22:05:23
else if
|
| + if (dart_debug) { |
| + print("Debug and profile mode are mutually exclusive.") |
| + } |
| + assert(!dart_debug) |
| + defines += ["DART_PRECOMPILED_RUNTIME"] |
| } |
| -} |
| - |
| -config("dart_config_no_precompiler") { |
| - defines = [] |
| if (dart_target_arch != "") { |
| if (dart_target_arch == "arm") { |
| @@ -124,14 +84,6 @@ config("dart_config_no_precompiler") { |
| defines += ["NDEBUG"] |
| } |
| - if (dart_product) { |
| - if (dart_debug) { |
| - print("Debug and product mode are mutually exclusive.") |
| - } |
| - assert(!dart_debug) |
| - defines += ["PRODUCT"] |
| - } |
| - |
| cflags = [ |
| "-Werror", |
| "-Wall", |
| @@ -165,6 +117,9 @@ config("dart_config_no_precompiler") { |
| } |
| } |
| +config("dart_gen_snapshot_config") { |
| + defines = ["DART_PRECOMPILER"] |
| +} |
| static_library("libdart") { |
| configs += [":dart_config"] |
| @@ -193,36 +148,6 @@ static_library("libdart") { |
| } |
| -static_library("libdart_precompiled_runtime") { |
| - configs += [":dart_config_no_precompiler"] |
| - deps = [ |
| - "vm:libdart_lib_precompiled_runtime", |
| - "vm:libdart_vm_precompiled_runtime", |
| - "third_party/double-conversion/src:libdouble_conversion", |
| - ":generate_version_cc_file", |
| - ] |
| - include_dirs = [ |
| - ".", |
| - ] |
| - public_configs = [":dart_public_config"] |
| - sources = [ |
| - "include/dart_api.h", |
| - "include/dart_mirrors_api.h", |
| - "include/dart_native_api.h", |
| - "include/dart_tools_api.h", |
| - "vm/dart_api_impl.cc", |
| - "vm/debugger_api_impl.cc", |
| - "vm/mirrors_api_impl.cc", |
| - "vm/native_api_impl.cc", |
| - "vm/version.h", |
| - "$target_gen_dir/version.cc", |
| - ] |
| - defines = [ |
| - "DART_PRECOMPILED_RUNTIME", |
| - ] |
| -} |
| - |
| - |
| action("generate_version_cc_file") { |
| deps = [ |
| ":libdart_dependency_helper", |