dart2js: turn on sync-async by default

Closes https://github.com/dart-lang/sdk/issues/32869

Change-Id: I79b2d02d13adccdfbbd3a78158805244aceff7de
Reviewed-on: https://dart-review.googlesource.com/52061
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Sigmund Cherem 2018-04-27 19:48:46 +00:00 committed by commit-bot@chromium.org
parent 60f807baa5
commit 3c9d0858b0
12 changed files with 29 additions and 5 deletions

View file

@ -28,6 +28,11 @@
### Tool Changes
#### dart2js
* `async` functions now start synchronously. This will be the default behavior
across all tools. To temporarily opt-out, use the `--no-sync-async` flag.
#### Pub
* Fix another bug where the version solver could crash when resolving a conflict

View file

@ -95,11 +95,19 @@ class Flags {
// https://gist.github.com/eernstg/4353d7b4f669745bed3a5423e04a453c.
static const String genericMethodSyntax = '--generic-method-syntax';
// Starts `async` functions synchronously.
// Deprecated. This flag is no longer in use for dart2js, but we are keeping
// it around for a while longer until all other tools deprecate the same flag.
//
// This is the Dart 2.0 behavior. This flag is only used during the migration.
// It was used to start `async` functions synchronously, but now dart2js
// switched on this behavior by default.
// TODO(sigmund): delete once this is on by default on all of our tools.
static const String syncAsync = '--sync-async';
// Starts `async` functions asynchronously.
//
// This is the old Dart 1.0 behavior. Only used during the migration.
static const String noSyncAsync = '--no-sync-async';
// Initializing-formal access is enabled by default and cannot be disabled.
// For backward compatibility the option is still accepted, but it is ignored.
static const String initializingFormalAccess = '--initializing-formal-access';

View file

@ -317,7 +317,8 @@ Future<api.CompilationResult> compile(List<String> argv,
new OptionHandler(Flags.allowMockCompilation, ignoreOption),
new OptionHandler(Flags.fastStartup, passThrough),
new OptionHandler(Flags.genericMethodSyntax, ignoreOption),
new OptionHandler(Flags.syncAsync, passThrough),
new OptionHandler(Flags.syncAsync, ignoreOption),
new OptionHandler(Flags.noSyncAsync, passThrough),
new OptionHandler(Flags.initializingFormalAccess, ignoreOption),
new OptionHandler(Flags.minify, passThrough),
new OptionHandler(Flags.preserveUris, ignoreOption),

View file

@ -348,7 +348,7 @@ class CompilerOptions implements DiagnosticOptions {
..useMultiSourceInfo = _hasOption(options, Flags.useMultiSourceInfo)
..useNewSourceInfo = _hasOption(options, Flags.useNewSourceInfo)
..useStartupEmitter = _hasOption(options, Flags.fastStartup)
..startAsyncSynchronously = _hasOption(options, Flags.syncAsync)
..startAsyncSynchronously = !_hasOption(options, Flags.noSyncAsync)
..verbose = _hasOption(options, Flags.verbose);
}

View file

@ -9,6 +9,7 @@ class FlagsRepositoryMock implements M.FlagsRepository {
bool isListInvoked = false;
Future<Iterable<M.Flag>> list() async {
await null;
isListInvoked = true;
return _list;
}

View file

@ -17,6 +17,7 @@ Language/Expressions/Function_Invocation/async_cleanup_t06: Skip # https://githu
Language/Expressions/Function_Invocation/async_cleanup_t08: Skip # https://github.com/dart-lang/sdk/issues/28873
Language/Expressions/Function_Invocation/async_generator_invokation_t08: Skip # Issue 25967
Language/Expressions/Function_Invocation/async_generator_invokation_t10: Skip # Issue 25967
Language/Expressions/Function_Invocation/async_invokation_t02: RuntimeError # sync-async is on by default.
Language/Expressions/Function_Invocation/async_invokation_t04: RuntimeError, Pass # co19 issue 57
Language/Expressions/Instance_Creation/New/evaluation_t19: RuntimeError # Please triage this failure
Language/Expressions/Instance_Creation/New/evaluation_t20: RuntimeError # Please triage this failure

View file

@ -11,5 +11,6 @@ main() {
@NoInline()
test() async {
await null;
/*1:test*/ throw '>ExceptionMarker<';
}

View file

@ -16,5 +16,6 @@ test1() async {
@NoInline()
test2() async {
await null;
/*1:test2*/ throw '>ExceptionMarker<';
}

View file

@ -10,6 +10,7 @@ main() {
}
test() async {
await null;
// ignore: UNUSED_LOCAL_VARIABLE
var c = new /*1:test*/ Class();
}

View file

@ -10,6 +10,7 @@ main() {
@NoInline()
test1() async {
await null;
/*1:test1*/ test2();
}

View file

@ -5,8 +5,11 @@
[ $compiler != dart2analyzer ]
switch_case_warn_test: Skip # Analyzer only, see language_analyzer2.status
# VM specific tests that should not be run by dart2js.
[ $compiler == dart2js ]
async_await_test: RuntimeError # sync-async is on by default
asyncstar_throw_in_catch_test: RuntimeError # sync-async is on by default
await_nonfuture_test: RuntimeError # sync-async is on by default
await_not_started_immediately_test: RuntimeError # sync-async is on by default
full_stacktrace1_test: Pass, RuntimeError # Issue 12698
full_stacktrace2_test: Pass, RuntimeError # Issue 12698
full_stacktrace3_test: Pass, RuntimeError # Issue 12698

View file

@ -15,6 +15,7 @@ mirrors/*: Skip # Issue 27929: Triage
*: Skip
[ $compiler == dart2js ]
async/async_await_sync_completer_test: RuntimeError # sync-async is on by default.
async/schedule_microtask6_test: RuntimeError # global error handling is not supported. Issue 5958
convert/base64_test/01: Fail, OK # Uses bit-wise operations to detect invalid values. Some large invalid values accepted by dart2js.
convert/chunked_conversion_utf88_test: Slow, Pass