From f604da64090ea6f8047289c6589248c2025a917d Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 10 Dec 2018 12:36:09 -0800 Subject: [PATCH] Rename dart-non-checked-mode: disable-dart-asserts (flutter/engine#6977) In Dart 2, runtime checked mode has been eliminated. Many of these type checks have been moved to static compile-time checks, the remainder are enforced at runtime, and are no longer optional. --- engine/src/flutter/common/settings.cc | 2 +- engine/src/flutter/common/settings.h | 2 +- engine/src/flutter/runtime/dart_vm.cc | 10 +++++----- engine/src/flutter/shell/common/switches.cc | 4 ++-- engine/src/flutter/shell/common/switches.h | 14 +++++++------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/engine/src/flutter/common/settings.cc b/engine/src/flutter/common/settings.cc index f495bac77f..d03c52157e 100644 --- a/engine/src/flutter/common/settings.cc +++ b/engine/src/flutter/common/settings.cc @@ -35,7 +35,7 @@ std::string Settings::ToString() const { stream << "trace_startup: " << trace_startup << std::endl; stream << "endless_trace_buffer: " << endless_trace_buffer << std::endl; stream << "enable_dart_profiling: " << enable_dart_profiling << std::endl; - stream << "dart_non_checked_mode: " << dart_non_checked_mode << std::endl; + stream << "disable_dart_asserts: " << disable_dart_asserts << std::endl; stream << "enable_observatory: " << enable_observatory << std::endl; stream << "observatory_port: " << observatory_port << std::endl; stream << "ipv6: " << ipv6 << std::endl; diff --git a/engine/src/flutter/common/settings.h b/engine/src/flutter/common/settings.h index 7d9e4e0173..9e61e729d9 100644 --- a/engine/src/flutter/common/settings.h +++ b/engine/src/flutter/common/settings.h @@ -47,7 +47,7 @@ struct Settings { bool trace_startup = false; bool endless_trace_buffer = false; bool enable_dart_profiling = false; - bool dart_non_checked_mode = false; + bool disable_dart_asserts = false; // Used as the script URI in debug messages. Does not affect how the Dart code // is executed. std::string advisory_script_uri = "main.dart"; diff --git a/engine/src/flutter/runtime/dart_vm.cc b/engine/src/flutter/runtime/dart_vm.cc index 4c3f67c9f6..76613f6e4a 100644 --- a/engine/src/flutter/runtime/dart_vm.cc +++ b/engine/src/flutter/runtime/dart_vm.cc @@ -325,18 +325,18 @@ DartVM::DartVM(const Settings& settings, arraysize(kDartPrecompilationArgs)); } - // Enable checked mode if we are not running precompiled code. We run non- + // Enable Dart assertions if we are not running precompiled code. We run non- // precompiled code only in the debug product mode. - bool use_checked_mode = !settings.dart_non_checked_mode; + bool enable_asserts = !settings.disable_dart_asserts; #if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE || \ FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE - use_checked_mode = false; + enable_asserts = false; #endif #if !OS_FUCHSIA if (IsRunningPrecompiledCode()) { - use_checked_mode = false; + enable_asserts = false; } #endif // !OS_FUCHSIA @@ -347,7 +347,7 @@ DartVM::DartVM(const Settings& settings, arraysize(kDartWriteProtectCodeArgs)); #endif - if (use_checked_mode) { + if (enable_asserts) { PushBackAll(&args, kDartAssertArgs, arraysize(kDartAssertArgs)); } diff --git a/engine/src/flutter/shell/common/switches.cc b/engine/src/flutter/shell/common/switches.cc index 8472f27a38..8b17a01729 100644 --- a/engine/src/flutter/shell/common/switches.cc +++ b/engine/src/flutter/shell/common/switches.cc @@ -139,8 +139,8 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { } // Checked mode overrides. - settings.dart_non_checked_mode = - command_line.HasOption(FlagForSwitch(Switch::DartNonCheckedMode)); + settings.disable_dart_asserts = + command_line.HasOption(FlagForSwitch(Switch::DisableDartAsserts)); settings.ipv6 = command_line.HasOption(FlagForSwitch(Switch::IPv6)); diff --git a/engine/src/flutter/shell/common/switches.h b/engine/src/flutter/shell/common/switches.h index 9abaf7951a..829ae9c04f 100644 --- a/engine/src/flutter/shell/common/switches.h +++ b/engine/src/flutter/shell/common/switches.h @@ -120,13 +120,13 @@ DEF_SWITCH(RunForever, "run-forever", "In non-interactive mode, keep the shell running after the Dart " "script has completed.") -DEF_SWITCH(DartNonCheckedMode, - "dart-non-checked-mode", - "Dart code runs in checked mode when the runtime mode is debug. In " - "profile and release product modes, the application code is " - "precompiled and checked mode is unsupported. However, this flag " - "may be specified if the user wishes to run in the debug product " - "mode (i.e. with JIT or DBC) with checked mode off.") +DEF_SWITCH(DisableDartAsserts, + "disable-dart-asserts", + "Dart code runs with assertions enabled when the runtime mode is " + "debug. In profile and release product modes, assertions are " + "disabled. This flag may be specified if the user wishes to run " + "with assertions disabled in the debug product mode (i.e. with JIT " + "or DBC).") DEF_SWITCHES_END void PrintUsage(const std::string& executable_name);