From 1bab46b06f610742d9c35390a0b7d64c3c1297ef Mon Sep 17 00:00:00 2001 From: asiva Date: Fri, 22 Mar 2019 17:08:56 +0000 Subject: [PATCH] [vm] Remove support for '-c', '--checked' flags and '--enable-checked-mode' 1. Remove support for the following flags '-c', '--checked' and '--enable-checked-mode' 2. Cleanup some of the tests and test scripts where these options were being passed. https://github.com/dart-lang/sdk/issues/34660 Change-Id: I4d8aa0d14bd054cfba08d78a411a0df4fc829df1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97550 Commit-Queue: Siva Annamalai Reviewed-by: Ryan Macnak --- CHANGELOG.md | 1 + pkg/front_end/tool/fasta | 2 +- runtime/bin/main_options.cc | 14 +--- runtime/vm/isolate.cc | 14 ---- tests/language_2/factory3_test.dart | 1 - .../type_checks_in_factory_method_test.dart | 1 - .../testing/dart/compiler_configuration.dart | 77 +++---------------- tools/testing/dart/configuration.dart | 1 - tools/testing/dart/options.dart | 2 - 9 files changed, 15 insertions(+), 98 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a14d7dda644..767c90079ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Dart VM +* Support for deprecated flags '-c' and '--checked' has been removed * RegExp patterns can now use lookbehind assertions. * RegExp patterns can now use named capture groups and named backreferences. Currently, named group matches can only be retrieved in Dart either by diff --git a/pkg/front_end/tool/fasta b/pkg/front_end/tool/fasta index 465f05b01b9..8118b1fb3e1 100755 --- a/pkg/front_end/tool/fasta +++ b/pkg/front_end/tool/fasta @@ -62,4 +62,4 @@ esac shift -exec "${DART_VM}" "${EXTRA_VM_ARGS[@]}" -c "${SCRIPT}" "$@" +exec "${DART_VM}" "${EXTRA_VM_ARGS[@]}" "${SCRIPT}" "$@" diff --git a/runtime/bin/main_options.cc b/runtime/bin/main_options.cc index d68bfaa8ab2..a0db7aa9245 100644 --- a/runtime/bin/main_options.cc +++ b/runtime/bin/main_options.cc @@ -351,8 +351,6 @@ bool Options::ProcessAbiVersionOption(const char* arg, return true; } -static bool checked_set = false; - int Options::ParseArguments(int argc, char** argv, bool vm_run_app_snapshot, @@ -376,14 +374,7 @@ int Options::ParseArguments(int argc, i++; } else { // Check if this flag is a potentially valid VM flag. - const char* kChecked = "-c"; - const char* kCheckedFull = "--checked"; - if ((strncmp(argv[i], kChecked, strlen(kChecked)) == 0) || - (strncmp(argv[i], kCheckedFull, strlen(kCheckedFull)) == 0)) { - checked_set = true; - i++; - continue; // '-c' is not a VM flag so don't add to vm options. - } else if (!OptionProcessor::IsValidFlag(argv[i], kPrefix, kPrefixLen)) { + if (!OptionProcessor::IsValidFlag(argv[i], kPrefix, kPrefixLen)) { break; } // The following two flags are processed by both the embedder and @@ -485,9 +476,6 @@ int Options::ParseArguments(int argc, " run using a snapshot is invalid.\n"); return -1; } - if (checked_set) { - vm_options->AddArgument("--enable-asserts"); - } // If --snapshot is given without --snapshot-kind, default to script snapshot. if ((snapshot_filename_ != NULL) && (gen_snapshot_kind_ == kNone)) { diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc index ce8ed3feb15..e287ffacda9 100644 --- a/runtime/vm/isolate.cc +++ b/runtime/vm/isolate.cc @@ -66,20 +66,6 @@ DECLARE_FLAG(bool, reload_every_back_off); DECLARE_FLAG(bool, trace_reload); #endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) -#if !defined(PRODUCT) -static void CheckedModeHandler(bool value) { - FLAG_enable_asserts = value; -} - -// --enable-checked-mode and --checked both enable checked mode which is -// equivalent to setting --enable-asserts and --enable-type-checks. -DEFINE_FLAG_HANDLER(CheckedModeHandler, - enable_checked_mode, - "Enable checked mode."); - -DEFINE_FLAG_HANDLER(CheckedModeHandler, checked, "Enable checked mode."); -#endif // !defined(PRODUCT) - static void DeterministicModeHandler(bool value) { if (value) { FLAG_background_compilation = false; // Timing dependent. diff --git a/tests/language_2/factory3_test.dart b/tests/language_2/factory3_test.dart index ad7f97cf302..fe15ad9dae2 100644 --- a/tests/language_2/factory3_test.dart +++ b/tests/language_2/factory3_test.dart @@ -1,7 +1,6 @@ // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// VMOptions=--enable_checked_mode import "dart:collection"; diff --git a/tests/language_2/type_checks_in_factory_method_test.dart b/tests/language_2/type_checks_in_factory_method_test.dart index 687264e44eb..f0d116d83d6 100644 --- a/tests/language_2/type_checks_in_factory_method_test.dart +++ b/tests/language_2/type_checks_in_factory_method_test.dart @@ -1,7 +1,6 @@ // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// VMOptions=--enable_checked_mode // Tests the type checking when passing code into closure from inside a factory method import "package:expect/expect.dart"; diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart index 85c63367407..5112daa995f 100644 --- a/tools/testing/dart/compiler_configuration.dart +++ b/tools/testing/dart/compiler_configuration.dart @@ -177,21 +177,10 @@ class NoneCompilerConfiguration extends CompilerConfiguration { List originalArguments, CommandArtifact artifact) { var args = []; - if (previewDart2) { - if (_isDebug) { - // Temporarily disable background compilation to avoid flaky crashes - // (see http://dartbug.com/30016 for details). - args.add('--no-background-compilation'); - } - if (_isChecked) { - args.add('--enable_asserts'); - } - } else { - args.add('--no-preview-dart-2'); - if (_isChecked) { - args.add('--enable_asserts'); - args.add('--enable_type_checks'); - } + if (_isDebug) { + // Temporarily disable background compilation to avoid flaky crashes + // (see http://dartbug.com/30016 for details). + args.add('--no-background-compilation'); } if (_useEnableAsserts) { args.add('--enable_asserts'); @@ -259,7 +248,7 @@ class VMKernelCompilerConfiguration extends CompilerConfiguration List originalArguments, CommandArtifact artifact) { var args = []; - if (_isChecked || _useEnableAsserts) { + if (_useEnableAsserts) { args.add('--enable_asserts'); } if (_configuration.hotReload) { @@ -621,7 +610,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration int get timeoutMultiplier { var multiplier = 2; if (_isDebug) multiplier *= 4; - if (_isChecked) multiplier *= 2; + if (_useEnableAsserts) multiplier *= 2; return multiplier; } @@ -629,15 +618,13 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration List arguments, Map environmentOverrides) { var commands = []; - if (previewDart2) { - commands.add(computeCompileToKernelCommand( - tempDir, arguments, environmentOverrides)); - } + commands.add(computeCompileToKernelCommand( + tempDir, arguments, environmentOverrides)); commands.add( computeDartBootstrapCommand(tempDir, arguments, environmentOverrides)); - if (previewDart2 && !_configuration.keepGeneratedFiles) { + if (!_configuration.keepGeneratedFiles) { commands.add(computeRemoveKernelFileCommand( tempDir, arguments, environmentOverrides)); } @@ -709,12 +696,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration args.add('--obfuscate'); } - if (previewDart2) { - args.addAll(_replaceDartFiles(arguments, tempKernelFile(tempDir))); - } else { - args.add('--no-preview-dart-2'); - args.addAll(arguments); - } + args.addAll(_replaceDartFiles(arguments, tempKernelFile(tempDir))); return Command.compilation('precompiler', tempDir, bootstrapDependencies(), exec, args, environmentOverrides, @@ -816,10 +798,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration List ddcOptions, List originalArguments) { List args = []; - if (_isChecked) { - args.add('--enable_asserts'); - args.add('--enable_type_checks'); - } return args ..addAll(filterVmOptions(vmOptions)) ..addAll(sharedOptions) @@ -835,17 +813,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration List originalArguments, CommandArtifact artifact) { var args = []; - if (previewDart2) { - if (_isChecked) { - args.add('--enable_asserts'); - } - } else { - args.add('--no-preview-dart-2'); - if (_isChecked) { - args.add('--enable_asserts'); - args.add('--enable_type_checks'); - } - } if (_useEnableAsserts) { args.add('--enable_asserts'); } @@ -876,7 +843,7 @@ class AppJitCompilerConfiguration extends CompilerConfiguration { int get timeoutMultiplier { var multiplier = 1; if (_isDebug) multiplier *= 2; - if (_isChecked) multiplier *= 2; + if (_useEnableAsserts) multiplier *= 2; return multiplier; } @@ -894,9 +861,6 @@ class AppJitCompilerConfiguration extends CompilerConfiguration { var exec = "${_configuration.buildDirectory}/dart"; var snapshot = "$tempDir/out.jitsnapshot"; var args = ["--snapshot=$snapshot", "--snapshot-kind=app-jit"]; - if (!previewDart2) { - args.add("--no-preview-dart-2"); - } args.addAll(arguments); return Command.compilation('app_jit', tempDir, bootstrapDependencies(), @@ -907,10 +871,6 @@ class AppJitCompilerConfiguration extends CompilerConfiguration { List computeCompilerArguments( vmOptions, sharedOptions, dart2jsOptions, ddcOptions, originalArguments) { var args = []; - if (_isChecked) { - args.add('--enable_asserts'); - args.add('--enable_type_checks'); - } return args ..addAll(vmOptions) ..addAll(sharedOptions) @@ -926,17 +886,6 @@ class AppJitCompilerConfiguration extends CompilerConfiguration { List originalArguments, CommandArtifact artifact) { var args = []; - if (previewDart2) { - if (_isChecked) { - args.add('--enable_asserts'); - } - } else { - args.add("--no-preview-dart-2"); - if (_isChecked) { - args.add('--enable_asserts'); - args.add('--enable_type_checks'); - } - } if (_useEnableAsserts) { args.add('--enable_asserts'); } @@ -1082,8 +1031,6 @@ abstract class VMKernelCompilerMixin { bool get _isAot; - bool get _isChecked; - bool get _useEnableAsserts; String get executableScriptSuffix; @@ -1124,7 +1071,7 @@ abstract class VMKernelCompilerMixin { !arguments.any((String arg) => noCausalAsyncStacksRegExp.hasMatch(arg)); args.add('-Ddart.developer.causal_async_stacks=$causalAsyncStacks'); - if (_isChecked || _useEnableAsserts) { + if (_useEnableAsserts) { args.add('--enable_asserts'); } diff --git a/tools/testing/dart/configuration.dart b/tools/testing/dart/configuration.dart index 59399f3ac4c..85a0433410f 100644 --- a/tools/testing/dart/configuration.dart +++ b/tools/testing/dart/configuration.dart @@ -234,7 +234,6 @@ class TestConfiguration { } var args = ['--test-mode']; - if (isChecked) args.add('--enable-checked-mode'); if (isMinified) args.add("--minify"); if (isCsp) args.add("--csp"); diff --git a/tools/testing/dart/options.dart b/tools/testing/dart/options.dart index 11113319d50..439ae3e2716 100644 --- a/tools/testing/dart/options.dart +++ b/tools/testing/dart/options.dart @@ -150,7 +150,6 @@ simdbc, simdbc64''', test options, specifying how tests should be run.''', abbr: 'n', hide: true), - new _Option.bool('checked', 'Run tests in checked mode.'), new _Option.bool('strong', 'Deprecated, no-op.', hide: true), // TODO(sigmund): rename flag once we migrate all dart2js bots to the test // matrix. @@ -690,7 +689,6 @@ compiler.''', useSdk: data["use_sdk"] as bool, useHotReload: data["hot_reload"] as bool, useHotReloadRollback: data["hot_reload_rollback"] as bool, - isChecked: data["checked"] as bool, isHostChecked: data["host_checked"] as bool, isCsp: data["csp"] as bool, isMinified: data["minified"] as bool,