[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 <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
asiva 2019-03-22 17:08:56 +00:00 committed by commit-bot@chromium.org
parent c614b99ae1
commit 1bab46b06f
9 changed files with 15 additions and 98 deletions

View file

@ -8,6 +8,7 @@
### Dart VM ### Dart VM
* Support for deprecated flags '-c' and '--checked' has been removed
* RegExp patterns can now use lookbehind assertions. * RegExp patterns can now use lookbehind assertions.
* RegExp patterns can now use named capture groups and named backreferences. * RegExp patterns can now use named capture groups and named backreferences.
Currently, named group matches can only be retrieved in Dart either by Currently, named group matches can only be retrieved in Dart either by

View file

@ -62,4 +62,4 @@ esac
shift shift
exec "${DART_VM}" "${EXTRA_VM_ARGS[@]}" -c "${SCRIPT}" "$@" exec "${DART_VM}" "${EXTRA_VM_ARGS[@]}" "${SCRIPT}" "$@"

View file

@ -351,8 +351,6 @@ bool Options::ProcessAbiVersionOption(const char* arg,
return true; return true;
} }
static bool checked_set = false;
int Options::ParseArguments(int argc, int Options::ParseArguments(int argc,
char** argv, char** argv,
bool vm_run_app_snapshot, bool vm_run_app_snapshot,
@ -376,14 +374,7 @@ int Options::ParseArguments(int argc,
i++; i++;
} else { } else {
// Check if this flag is a potentially valid VM flag. // Check if this flag is a potentially valid VM flag.
const char* kChecked = "-c"; if (!OptionProcessor::IsValidFlag(argv[i], kPrefix, kPrefixLen)) {
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)) {
break; break;
} }
// The following two flags are processed by both the embedder and // 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"); " run using a snapshot is invalid.\n");
return -1; return -1;
} }
if (checked_set) {
vm_options->AddArgument("--enable-asserts");
}
// If --snapshot is given without --snapshot-kind, default to script snapshot. // If --snapshot is given without --snapshot-kind, default to script snapshot.
if ((snapshot_filename_ != NULL) && (gen_snapshot_kind_ == kNone)) { if ((snapshot_filename_ != NULL) && (gen_snapshot_kind_ == kNone)) {

View file

@ -66,20 +66,6 @@ DECLARE_FLAG(bool, reload_every_back_off);
DECLARE_FLAG(bool, trace_reload); DECLARE_FLAG(bool, trace_reload);
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME) #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) { static void DeterministicModeHandler(bool value) {
if (value) { if (value) {
FLAG_background_compilation = false; // Timing dependent. FLAG_background_compilation = false; // Timing dependent.

View file

@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // 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 // 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. // BSD-style license that can be found in the LICENSE file.
// VMOptions=--enable_checked_mode
import "dart:collection"; import "dart:collection";

View file

@ -1,7 +1,6 @@
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // 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 // 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. // 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 // Tests the type checking when passing code into closure from inside a factory method
import "package:expect/expect.dart"; import "package:expect/expect.dart";

View file

@ -177,21 +177,10 @@ class NoneCompilerConfiguration extends CompilerConfiguration {
List<String> originalArguments, List<String> originalArguments,
CommandArtifact artifact) { CommandArtifact artifact) {
var args = <String>[]; var args = <String>[];
if (previewDart2) { if (_isDebug) {
if (_isDebug) { // Temporarily disable background compilation to avoid flaky crashes
// Temporarily disable background compilation to avoid flaky crashes // (see http://dartbug.com/30016 for details).
// (see http://dartbug.com/30016 for details). args.add('--no-background-compilation');
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 (_useEnableAsserts) { if (_useEnableAsserts) {
args.add('--enable_asserts'); args.add('--enable_asserts');
@ -259,7 +248,7 @@ class VMKernelCompilerConfiguration extends CompilerConfiguration
List<String> originalArguments, List<String> originalArguments,
CommandArtifact artifact) { CommandArtifact artifact) {
var args = <String>[]; var args = <String>[];
if (_isChecked || _useEnableAsserts) { if (_useEnableAsserts) {
args.add('--enable_asserts'); args.add('--enable_asserts');
} }
if (_configuration.hotReload) { if (_configuration.hotReload) {
@ -621,7 +610,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
int get timeoutMultiplier { int get timeoutMultiplier {
var multiplier = 2; var multiplier = 2;
if (_isDebug) multiplier *= 4; if (_isDebug) multiplier *= 4;
if (_isChecked) multiplier *= 2; if (_useEnableAsserts) multiplier *= 2;
return multiplier; return multiplier;
} }
@ -629,15 +618,13 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
List<String> arguments, Map<String, String> environmentOverrides) { List<String> arguments, Map<String, String> environmentOverrides) {
var commands = <Command>[]; var commands = <Command>[];
if (previewDart2) { commands.add(computeCompileToKernelCommand(
commands.add(computeCompileToKernelCommand( tempDir, arguments, environmentOverrides));
tempDir, arguments, environmentOverrides));
}
commands.add( commands.add(
computeDartBootstrapCommand(tempDir, arguments, environmentOverrides)); computeDartBootstrapCommand(tempDir, arguments, environmentOverrides));
if (previewDart2 && !_configuration.keepGeneratedFiles) { if (!_configuration.keepGeneratedFiles) {
commands.add(computeRemoveKernelFileCommand( commands.add(computeRemoveKernelFileCommand(
tempDir, arguments, environmentOverrides)); tempDir, arguments, environmentOverrides));
} }
@ -709,12 +696,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
args.add('--obfuscate'); args.add('--obfuscate');
} }
if (previewDart2) { args.addAll(_replaceDartFiles(arguments, tempKernelFile(tempDir)));
args.addAll(_replaceDartFiles(arguments, tempKernelFile(tempDir)));
} else {
args.add('--no-preview-dart-2');
args.addAll(arguments);
}
return Command.compilation('precompiler', tempDir, bootstrapDependencies(), return Command.compilation('precompiler', tempDir, bootstrapDependencies(),
exec, args, environmentOverrides, exec, args, environmentOverrides,
@ -816,10 +798,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
List<String> ddcOptions, List<String> ddcOptions,
List<String> originalArguments) { List<String> originalArguments) {
List<String> args = []; List<String> args = [];
if (_isChecked) {
args.add('--enable_asserts');
args.add('--enable_type_checks');
}
return args return args
..addAll(filterVmOptions(vmOptions)) ..addAll(filterVmOptions(vmOptions))
..addAll(sharedOptions) ..addAll(sharedOptions)
@ -835,17 +813,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
List<String> originalArguments, List<String> originalArguments,
CommandArtifact artifact) { CommandArtifact artifact) {
var args = <String>[]; var args = <String>[];
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) { if (_useEnableAsserts) {
args.add('--enable_asserts'); args.add('--enable_asserts');
} }
@ -876,7 +843,7 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
int get timeoutMultiplier { int get timeoutMultiplier {
var multiplier = 1; var multiplier = 1;
if (_isDebug) multiplier *= 2; if (_isDebug) multiplier *= 2;
if (_isChecked) multiplier *= 2; if (_useEnableAsserts) multiplier *= 2;
return multiplier; return multiplier;
} }
@ -894,9 +861,6 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
var exec = "${_configuration.buildDirectory}/dart"; var exec = "${_configuration.buildDirectory}/dart";
var snapshot = "$tempDir/out.jitsnapshot"; var snapshot = "$tempDir/out.jitsnapshot";
var args = ["--snapshot=$snapshot", "--snapshot-kind=app-jit"]; var args = ["--snapshot=$snapshot", "--snapshot-kind=app-jit"];
if (!previewDart2) {
args.add("--no-preview-dart-2");
}
args.addAll(arguments); args.addAll(arguments);
return Command.compilation('app_jit', tempDir, bootstrapDependencies(), return Command.compilation('app_jit', tempDir, bootstrapDependencies(),
@ -907,10 +871,6 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
List<String> computeCompilerArguments( List<String> computeCompilerArguments(
vmOptions, sharedOptions, dart2jsOptions, ddcOptions, originalArguments) { vmOptions, sharedOptions, dart2jsOptions, ddcOptions, originalArguments) {
var args = <String>[]; var args = <String>[];
if (_isChecked) {
args.add('--enable_asserts');
args.add('--enable_type_checks');
}
return args return args
..addAll(vmOptions) ..addAll(vmOptions)
..addAll(sharedOptions) ..addAll(sharedOptions)
@ -926,17 +886,6 @@ class AppJitCompilerConfiguration extends CompilerConfiguration {
List<String> originalArguments, List<String> originalArguments,
CommandArtifact artifact) { CommandArtifact artifact) {
var args = <String>[]; var args = <String>[];
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) { if (_useEnableAsserts) {
args.add('--enable_asserts'); args.add('--enable_asserts');
} }
@ -1082,8 +1031,6 @@ abstract class VMKernelCompilerMixin {
bool get _isAot; bool get _isAot;
bool get _isChecked;
bool get _useEnableAsserts; bool get _useEnableAsserts;
String get executableScriptSuffix; String get executableScriptSuffix;
@ -1124,7 +1071,7 @@ abstract class VMKernelCompilerMixin {
!arguments.any((String arg) => noCausalAsyncStacksRegExp.hasMatch(arg)); !arguments.any((String arg) => noCausalAsyncStacksRegExp.hasMatch(arg));
args.add('-Ddart.developer.causal_async_stacks=$causalAsyncStacks'); args.add('-Ddart.developer.causal_async_stacks=$causalAsyncStacks');
if (_isChecked || _useEnableAsserts) { if (_useEnableAsserts) {
args.add('--enable_asserts'); args.add('--enable_asserts');
} }

View file

@ -234,7 +234,6 @@ class TestConfiguration {
} }
var args = ['--test-mode']; var args = ['--test-mode'];
if (isChecked) args.add('--enable-checked-mode');
if (isMinified) args.add("--minify"); if (isMinified) args.add("--minify");
if (isCsp) args.add("--csp"); if (isCsp) args.add("--csp");

View file

@ -150,7 +150,6 @@ simdbc, simdbc64''',
test options, specifying how tests should be run.''', test options, specifying how tests should be run.''',
abbr: 'n', abbr: 'n',
hide: true), hide: true),
new _Option.bool('checked', 'Run tests in checked mode.'),
new _Option.bool('strong', 'Deprecated, no-op.', hide: true), new _Option.bool('strong', 'Deprecated, no-op.', hide: true),
// TODO(sigmund): rename flag once we migrate all dart2js bots to the test // TODO(sigmund): rename flag once we migrate all dart2js bots to the test
// matrix. // matrix.
@ -690,7 +689,6 @@ compiler.''',
useSdk: data["use_sdk"] as bool, useSdk: data["use_sdk"] as bool,
useHotReload: data["hot_reload"] as bool, useHotReload: data["hot_reload"] as bool,
useHotReloadRollback: data["hot_reload_rollback"] as bool, useHotReloadRollback: data["hot_reload_rollback"] as bool,
isChecked: data["checked"] as bool,
isHostChecked: data["host_checked"] as bool, isHostChecked: data["host_checked"] as bool,
isCsp: data["csp"] as bool, isCsp: data["csp"] as bool,
isMinified: data["minified"] as bool, isMinified: data["minified"] as bool,