Version 2.12.0-92.0.dev
Merge commit '68a57c59d798491fc000ad83fbda0d4af03962ac' into 'dev'
diff --git a/benchmarks/Omnibus/dart/Omnibus.dart b/benchmarks/Omnibus/dart/Omnibus.dart
new file mode 100644
index 0000000..a59342a
--- /dev/null
+++ b/benchmarks/Omnibus/dart/Omnibus.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2020, 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.
+//
+// A benchmark that contains several other benchmarks.
+//
+// With no arguments, run all benchmarks once.
+// With arguments, run only the specified benchmarks in command-line order.
+//
+// -N: run benchmarks N times, defaults to once.
+
+import '../../ListCopy/dart/ListCopy.dart' as lib_ListCopy;
+import '../../BigIntParsePrint/dart/BigIntParsePrint.dart'
+ as lib_BigIntParsePrint;
+import '../../MD5/dart/md5.dart' as lib_MD5;
+import '../../RuntimeType/dart/RuntimeType.dart' as lib_RuntimeType;
+import '../../SHA1/dart/sha1.dart' as lib_SHA1;
+import '../../SHA256/dart/sha256.dart' as lib_SHA256;
+import '../../SkeletalAnimation/dart/SkeletalAnimation.dart'
+ as lib_SkeletalAnimation;
+import '../../SkeletalAnimationSIMD/dart/SkeletalAnimationSIMD.dart'
+ as lib_SkeletalAnimationSIMD;
+import '../../TypedDataDuplicate/dart/TypedDataDuplicate.dart'
+ as lib_TypedDataDuplicate;
+import '../../Utf8Decode/dart/Utf8Decode.dart' as lib_Utf8Decode;
+import '../../Utf8Encode/dart/Utf8Encode.dart' as lib_Utf8Encode;
+
+final Map<String, Function()> benchmarks = {
+ 'ListCopy': lib_ListCopy.main,
+ 'BigIntParsePrint': lib_BigIntParsePrint.main,
+ 'MD5': lib_MD5.main,
+ 'RuntimeType': lib_RuntimeType.main,
+ 'SHA1': lib_SHA1.main,
+ 'SHA256': lib_SHA256.main,
+ 'SkeletalAnimation': lib_SkeletalAnimation.main,
+ 'SkeletalAnimationSIMD': lib_SkeletalAnimationSIMD.main,
+ 'TypedDataDuplicate': lib_TypedDataDuplicate.main,
+ 'Utf8Decode': () => lib_Utf8Decode.main([]),
+ 'Utf8Encode': () => lib_Utf8Encode.main([]),
+};
+
+main(List<String> originalArguments) {
+ List<String> args = List.of(originalArguments);
+
+ int repeats = 1;
+
+ for (final arg in args.toList()) {
+ int? count = int.tryParse(arg);
+ if (count != null && count < 0) {
+ repeats = 0 - count;
+ args.remove(arg);
+ }
+ }
+
+ List<Function()> mains = [];
+
+ for (final name in args.toList()) {
+ final function = benchmarks[name];
+ if (function == null) {
+ print("Unknown benchmark: '$name'");
+ } else {
+ mains.add(function);
+ args.remove(name);
+ }
+ }
+ if (args.isNotEmpty) return; // We will have printed an error.
+
+ if (mains.isEmpty) mains = benchmarks.values.toList();
+
+ for (var i = 0; i < repeats; i++) {
+ for (final function in mains) {
+ function();
+ }
+ }
+}
diff --git a/benchmarks/Omnibus/dart2/Omnibus.dart b/benchmarks/Omnibus/dart2/Omnibus.dart
new file mode 100644
index 0000000..72587cd
--- /dev/null
+++ b/benchmarks/Omnibus/dart2/Omnibus.dart
@@ -0,0 +1,77 @@
+// Copyright (c) 2020, 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.
+//
+// @dart=2.10
+//
+// A benchmark that contains several other benchmarks.
+//
+// With no arguments, run all benchmarks once.
+// With arguments, run only the specified benchmarks in command-line order.
+//
+// -N: run benchmarks N times, defaults to once.
+
+import '../../ListCopy/dart/ListCopy.dart' as lib_ListCopy;
+import '../../BigIntParsePrint/dart/BigIntParsePrint.dart'
+ as lib_BigIntParsePrint;
+import '../../MD5/dart/md5.dart' as lib_MD5;
+import '../../RuntimeType/dart/RuntimeType.dart' as lib_RuntimeType;
+import '../../SHA1/dart/sha1.dart' as lib_SHA1;
+import '../../SHA256/dart/sha256.dart' as lib_SHA256;
+import '../../SkeletalAnimation/dart/SkeletalAnimation.dart'
+ as lib_SkeletalAnimation;
+import '../../SkeletalAnimationSIMD/dart/SkeletalAnimationSIMD.dart'
+ as lib_SkeletalAnimationSIMD;
+import '../../TypedDataDuplicate/dart/TypedDataDuplicate.dart'
+ as lib_TypedDataDuplicate;
+import '../../Utf8Decode/dart/Utf8Decode.dart' as lib_Utf8Decode;
+import '../../Utf8Encode/dart/Utf8Encode.dart' as lib_Utf8Encode;
+
+final Map<String, Function()> benchmarks = {
+ 'ListCopy': lib_ListCopy.main,
+ 'BigIntParsePrint': lib_BigIntParsePrint.main,
+ 'MD5': lib_MD5.main,
+ 'RuntimeType': lib_RuntimeType.main,
+ 'SHA1': lib_SHA1.main,
+ 'SHA256': lib_SHA256.main,
+ 'SkeletalAnimation': lib_SkeletalAnimation.main,
+ 'SkeletalAnimationSIMD': lib_SkeletalAnimationSIMD.main,
+ 'TypedDataDuplicate': lib_TypedDataDuplicate.main,
+ 'Utf8Decode': () => lib_Utf8Decode.main([]),
+ 'Utf8Encode': () => lib_Utf8Encode.main([]),
+};
+
+main(List<String> originalArguments) {
+ List<String> args = List.of(originalArguments);
+
+ int repeats = 1;
+
+ for (final arg in args.toList()) {
+ int count = int.tryParse(arg);
+ if (count != null && count < 0) {
+ repeats = 0 - count;
+ args.remove(arg);
+ }
+ }
+
+ List<Function()> mains = [];
+
+ for (final name in args.toList()) {
+ final function = benchmarks[name];
+ if (function == null) {
+ print("Unknown benchmark: '$name'");
+ } else {
+ mains.add(function);
+ args.remove(name);
+ }
+ }
+ if (args.isNotEmpty) return; // We will have printed an error.
+
+ if (mains.isEmpty) mains = benchmarks.values.toList();
+
+ for (var i = 0; i < repeats; i++) {
+ for (final function in mains) {
+ function();
+ }
+ }
+}
diff --git a/benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart b/benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart
new file mode 100644
index 0000000..e31cfb6
--- /dev/null
+++ b/benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart
@@ -0,0 +1,121 @@
+// Copyright (c) 2020, 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.
+//
+// A benchmark that contains several other benchmarks.
+//
+// With no arguments, run all benchmarks once.
+// With arguments, run only the specified benchmarks in command-line order.
+//
+// -N: run benchmarks N times, defaults to once.
+
+import '../../ListCopy/dart/ListCopy.dart' deferred as lib_ListCopy;
+import '../../BigIntParsePrint/dart/BigIntParsePrint.dart'
+ deferred as lib_BigIntParsePrint;
+import '../../MD5/dart/md5.dart' deferred as lib_MD5;
+import '../../RuntimeType/dart/RuntimeType.dart' deferred as lib_RuntimeType;
+import '../../SHA1/dart/sha1.dart' deferred as lib_SHA1;
+import '../../SHA256/dart/sha256.dart' deferred as lib_SHA256;
+import '../../SkeletalAnimation/dart/SkeletalAnimation.dart'
+ deferred as lib_SkeletalAnimation;
+import '../../SkeletalAnimationSIMD/dart/SkeletalAnimationSIMD.dart'
+ deferred as lib_SkeletalAnimationSIMD;
+import '../../TypedDataDuplicate/dart/TypedDataDuplicate.dart'
+ deferred as lib_TypedDataDuplicate;
+import '../../Utf8Decode/dart/Utf8Decode.dart' deferred as lib_Utf8Decode;
+import '../../Utf8Encode/dart/Utf8Encode.dart' deferred as lib_Utf8Encode;
+
+class Lib {
+ final Future Function() load;
+ final void Function() main;
+ Lib(this.load, this.main);
+}
+
+final Map<String, Lib> benchmarks = {
+ 'ListCopy': Lib(
+ lib_ListCopy.loadLibrary,
+ () => lib_ListCopy.main(),
+ ),
+ 'BigIntParsePrint': Lib(
+ lib_BigIntParsePrint.loadLibrary,
+ () => lib_BigIntParsePrint.main(),
+ ),
+ 'MD5': Lib(
+ lib_MD5.loadLibrary,
+ () => lib_MD5.main(),
+ ),
+ 'RuntimeType': Lib(
+ lib_RuntimeType.loadLibrary,
+ () => lib_RuntimeType.main(),
+ ),
+ 'SHA1': Lib(
+ lib_SHA1.loadLibrary,
+ () => lib_SHA1.main(),
+ ),
+ 'SHA256': Lib(
+ lib_SHA256.loadLibrary,
+ () => lib_SHA256.main(),
+ ),
+ 'SkeletalAnimation': Lib(
+ lib_SkeletalAnimation.loadLibrary,
+ () => lib_SkeletalAnimation.main(),
+ ),
+ 'SkeletalAnimationSIMD': Lib(
+ lib_SkeletalAnimationSIMD.loadLibrary,
+ () => lib_SkeletalAnimationSIMD.main(),
+ ),
+ 'TypedDataDuplicate': Lib(
+ lib_TypedDataDuplicate.loadLibrary,
+ () => lib_TypedDataDuplicate.main(),
+ ),
+ 'Utf8Decode': Lib(
+ lib_Utf8Decode.loadLibrary,
+ () => lib_Utf8Decode.main([]),
+ ),
+ 'Utf8Encode': Lib(
+ lib_Utf8Encode.loadLibrary,
+ () => lib_Utf8Encode.main([]),
+ ),
+};
+
+main(List<String> originalArguments) async {
+ List<String> args = List.of(originalArguments);
+
+ int repeats = 1;
+
+ for (final arg in args.toList()) {
+ int? count = int.tryParse(arg);
+ if (count != null && count < 0) {
+ repeats = 0 - count;
+ args.remove(arg);
+ }
+ }
+
+ bool preload = args.remove('--preload');
+
+ List<Lib> libs = [];
+
+ for (final name in args.toList()) {
+ final lib = benchmarks[name];
+ if (lib == null) {
+ print("Unknown benchmark: '$name'");
+ } else {
+ libs.add(lib);
+ args.remove(name);
+ }
+ }
+ if (args.isNotEmpty) return; // We will have printed an error.
+
+ if (libs.isEmpty) libs = benchmarks.values.toList();
+
+ if (preload) {
+ for (final lib in libs) await lib.load();
+ }
+
+ for (var i = 0; i < repeats; i++) {
+ for (final lib in libs) {
+ if (!preload) await lib.load();
+ lib.main();
+ }
+ }
+}
diff --git a/benchmarks/OmnibusDeferred/dart2/OmnibusDeferred.dart b/benchmarks/OmnibusDeferred/dart2/OmnibusDeferred.dart
new file mode 100644
index 0000000..20a28bf
--- /dev/null
+++ b/benchmarks/OmnibusDeferred/dart2/OmnibusDeferred.dart
@@ -0,0 +1,123 @@
+// Copyright (c) 2020, 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.
+//
+// @dart=2.10
+//
+// A benchmark that contains several other benchmarks.
+//
+// With no arguments, run all benchmarks once.
+// With arguments, run only the specified benchmarks in command-line order.
+//
+// -N: run benchmarks N times, defaults to once.
+
+import '../../ListCopy/dart/ListCopy.dart' deferred as lib_ListCopy;
+import '../../BigIntParsePrint/dart/BigIntParsePrint.dart'
+ deferred as lib_BigIntParsePrint;
+import '../../MD5/dart/md5.dart' deferred as lib_MD5;
+import '../../RuntimeType/dart/RuntimeType.dart' deferred as lib_RuntimeType;
+import '../../SHA1/dart/sha1.dart' deferred as lib_SHA1;
+import '../../SHA256/dart/sha256.dart' deferred as lib_SHA256;
+import '../../SkeletalAnimation/dart/SkeletalAnimation.dart'
+ deferred as lib_SkeletalAnimation;
+import '../../SkeletalAnimationSIMD/dart/SkeletalAnimationSIMD.dart'
+ deferred as lib_SkeletalAnimationSIMD;
+import '../../TypedDataDuplicate/dart/TypedDataDuplicate.dart'
+ deferred as lib_TypedDataDuplicate;
+import '../../Utf8Decode/dart/Utf8Decode.dart' deferred as lib_Utf8Decode;
+import '../../Utf8Encode/dart/Utf8Encode.dart' deferred as lib_Utf8Encode;
+
+class Lib {
+ final Future Function() load;
+ final void Function() main;
+ Lib(this.load, this.main);
+}
+
+final Map<String, Lib> benchmarks = {
+ 'ListCopy': Lib(
+ lib_ListCopy.loadLibrary,
+ () => lib_ListCopy.main(),
+ ),
+ 'BigIntParsePrint': Lib(
+ lib_BigIntParsePrint.loadLibrary,
+ () => lib_BigIntParsePrint.main(),
+ ),
+ 'MD5': Lib(
+ lib_MD5.loadLibrary,
+ () => lib_MD5.main(),
+ ),
+ 'RuntimeType': Lib(
+ lib_RuntimeType.loadLibrary,
+ () => lib_RuntimeType.main(),
+ ),
+ 'SHA1': Lib(
+ lib_SHA1.loadLibrary,
+ () => lib_SHA1.main(),
+ ),
+ 'SHA256': Lib(
+ lib_SHA256.loadLibrary,
+ () => lib_SHA256.main(),
+ ),
+ 'SkeletalAnimation': Lib(
+ lib_SkeletalAnimation.loadLibrary,
+ () => lib_SkeletalAnimation.main(),
+ ),
+ 'SkeletalAnimationSIMD': Lib(
+ lib_SkeletalAnimationSIMD.loadLibrary,
+ () => lib_SkeletalAnimationSIMD.main(),
+ ),
+ 'TypedDataDuplicate': Lib(
+ lib_TypedDataDuplicate.loadLibrary,
+ () => lib_TypedDataDuplicate.main(),
+ ),
+ 'Utf8Decode': Lib(
+ lib_Utf8Decode.loadLibrary,
+ () => lib_Utf8Decode.main([]),
+ ),
+ 'Utf8Encode': Lib(
+ lib_Utf8Encode.loadLibrary,
+ () => lib_Utf8Encode.main([]),
+ ),
+};
+
+main(List<String> originalArguments) async {
+ List<String> args = List.of(originalArguments);
+
+ int repeats = 1;
+
+ for (final arg in args.toList()) {
+ int count = int.tryParse(arg);
+ if (count != null && count < 0) {
+ repeats = 0 - count;
+ args.remove(arg);
+ }
+ }
+
+ bool preload = args.remove('--preload');
+
+ List<Lib> libs = [];
+
+ for (final name in args.toList()) {
+ final lib = benchmarks[name];
+ if (lib == null) {
+ print("Unknown benchmark: '$name'");
+ } else {
+ libs.add(lib);
+ args.remove(name);
+ }
+ }
+ if (args.isNotEmpty) return; // We will have printed an error.
+
+ if (libs.isEmpty) libs = benchmarks.values.toList();
+
+ if (preload) {
+ for (final lib in libs) await lib.load();
+ }
+
+ for (var i = 0; i < repeats; i++) {
+ for (final lib in libs) {
+ if (!preload) await lib.load();
+ lib.main();
+ }
+ }
+}
diff --git a/pkg/analyzer/lib/src/error/ignore_validator.dart b/pkg/analyzer/lib/src/error/ignore_validator.dart
index 9f81675..a8dd8d8 100644
--- a/pkg/analyzer/lib/src/error/ignore_validator.dart
+++ b/pkg/analyzer/lib/src/error/ignore_validator.dart
@@ -10,6 +10,7 @@
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/ignore_comments/ignore_info.dart';
+import 'package:meta/meta.dart';
/// Used to validate the ignore comments in a single file.
class IgnoreValidator {
@@ -29,7 +30,7 @@
/// be ignored. Note that this list is incomplete. Plugins might well define
/// diagnostics with a severity of `ERROR`, but we won't be able to flag their
/// use because we have no visibility of them here.
- final Set<String> unignorableNames = {};
+ Set<String> _unignorableNames;
/// Initialize a newly created validator to report any issues with ignore
/// comments in the file being analyzed. The diagnostics will be reported to
@@ -37,12 +38,7 @@
IgnoreValidator(this._errorReporter, this._reportedErrors, this._ignoreInfo,
this._lineInfo) {
var filePath = _errorReporter.source.fullName;
- for (var code in errorCodeValues) {
- if (!isIgnorable(filePath, code)) {
- unignorableNames.add(code.name.toLowerCase());
- unignorableNames.add(code.uniqueName.toLowerCase());
- }
- }
+ _unignorableNames = _UnignorableNames.forFile(filePath);
}
/// Report any issues with ignore comments in the file being analyzed.
@@ -60,7 +56,7 @@
var duplicated = <DiagnosticName>[];
for (var ignoredName in ignoredForFile) {
var name = ignoredName.name;
- if (unignorableNames.contains(name)) {
+ if (_unignorableNames.contains(name)) {
unignorable.add(ignoredName);
} else if (!namesIgnoredForFile.add(name)) {
duplicated.add(ignoredName);
@@ -73,7 +69,7 @@
var duplicated = <DiagnosticName>[];
for (var ignoredName in ignoredOnLine) {
var name = ignoredName.name;
- if (unignorableNames.contains(name)) {
+ if (_unignorableNames.contains(name)) {
unignorable.add(ignoredName);
} else if (namesIgnoredForFile.contains(name) ||
!namedIgnoredOnLine.add(name)) {
@@ -137,6 +133,65 @@
}
static bool isIgnorable(String filePath, ErrorCode code) {
+ return _UnignorableNames.isIgnorable(
+ code,
+ isFlutter: filePath.contains('flutter'),
+ isDart2jsTest: filePath.contains('tests/compiler/dart2js') ||
+ filePath.contains('pkg/compiler/test'),
+ );
+ }
+}
+
+/// Helper for caching unignorable names.
+class _UnignorableNames {
+ static Set<String> _forFlutter;
+ static Set<String> _forDart2jsTest;
+ static Set<String> _forOther;
+
+ static Set<String> forFile(String filePath) {
+ var isFlutter = filePath.contains('flutter');
+ var isDart2jsTest = filePath.contains('tests/compiler/dart2js') ||
+ filePath.contains('pkg/compiler/test');
+
+ if (isFlutter) {
+ if (_forFlutter != null) {
+ return _forFlutter;
+ }
+ } else if (isDart2jsTest) {
+ if (_forDart2jsTest != null) {
+ return _forDart2jsTest;
+ }
+ } else {
+ if (_forOther != null) {
+ return _forOther;
+ }
+ }
+
+ var unignorableNames = <String>{};
+ for (var code in errorCodeValues) {
+ if (!isIgnorable(code,
+ isFlutter: isFlutter, isDart2jsTest: isDart2jsTest)) {
+ unignorableNames.add(code.name.toLowerCase());
+ unignorableNames.add(code.uniqueName.toLowerCase());
+ }
+ }
+
+ if (isFlutter) {
+ _forFlutter = unignorableNames;
+ } else if (isDart2jsTest) {
+ _forDart2jsTest = unignorableNames;
+ } else {
+ _forOther = unignorableNames;
+ }
+
+ return unignorableNames;
+ }
+
+ static bool isIgnorable(
+ ErrorCode code, {
+ @required bool isFlutter,
+ @required bool isDart2jsTest,
+ }) {
if (code.isIgnorable) {
return true;
}
@@ -154,7 +209,7 @@
// library, which uses a special version of the "dart:ui" library
// which the Analyzer does not use during analysis. See
// https://github.com/flutter/flutter/issues/52899.
- if (filePath.contains('flutter')) {
+ if (isFlutter) {
return true;
}
}
@@ -162,8 +217,7 @@
if ((code == CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY ||
code == CompileTimeErrorCode.UNDEFINED_ANNOTATION ||
code == ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE) &&
- (filePath.contains('tests/compiler/dart2js') ||
- filePath.contains('pkg/compiler/test'))) {
+ isDart2jsTest) {
// Special case the dart2js language tests. Some of these import
// various internal libraries.
return true;
diff --git a/tools/VERSION b/tools/VERSION
index 1f087df..a56a97d 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 12
PATCH 0
-PRERELEASE 91
+PRERELEASE 92
PRERELEASE_PATCH 0
\ No newline at end of file