From 5ff2459d88a585c2d675b9fc91b4ab787a46fd5b Mon Sep 17 00:00:00 2001 From: Stephen Adams Date: Wed, 4 Aug 2021 23:27:18 +0000 Subject: [PATCH] Remove obsolete internal dart2js annotations These annotations have all been replaced with @pragma('dart2js:xxx') versions: @ForceInline, @NoInline, @NoThrows, @NoSideEffects, @AssumeDynamic. Change-Id: Ia4730670c6864ccbe0fa4120108c3c16ab887c23 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208863 Reviewed-by: Sigmund Cherem Commit-Queue: Stephen Adams --- .../lib/src/js_backend/annotations.dart | 23 ++++++++++--------- .../patch/collection_patch.dart | 3 --- .../js_dev_runtime/patch/core_patch.dart | 2 -- .../js_dev_runtime/private/annotations.dart | 11 --------- .../js_dev_runtime/private/js_helper.dart | 4 ---- .../js_runtime/lib/collection_patch.dart | 3 --- .../_internal/js_runtime/lib/core_patch.dart | 1 - .../js_runtime/lib/developer_patch.dart | 2 +- .../js_runtime/lib/interceptors.dart | 3 +-- sdk/lib/html/dart2js/html_dart2js.dart | 1 - tests/lib/html/js_dispatch_property_test.dart | 2 -- .../js_interop_constructor_name/util.dart | 1 - ...js_typed_interop_callable_object_test.dart | 1 - .../lib_2/html/js_dispatch_property_test.dart | 2 -- .../js_interop_constructor_name/util.dart | 1 - ...js_typed_interop_callable_object_test.dart | 1 - tests/web/deferred_inheritance_test.dart | 2 +- tests/web/internal/mock_libraries.dart | 4 ---- tests/web/native/compiler_test_internals.dart | 2 -- tests/web_2/deferred_inheritance_test.dart | 2 +- tests/web_2/internal/mock_libraries.dart | 4 ---- .../web_2/native/compiler_test_internals.dart | 2 -- .../html/dart2js/html_dart2js.darttemplate | 2 +- 23 files changed, 17 insertions(+), 62 deletions(-) diff --git a/pkg/compiler/lib/src/js_backend/annotations.dart b/pkg/compiler/lib/src/js_backend/annotations.dart index f702ca37324..98ebf0c472d 100644 --- a/pkg/compiler/lib/src/js_backend/annotations.dart +++ b/pkg/compiler/lib/src/js_backend/annotations.dart @@ -265,15 +265,15 @@ abstract class AnnotationsData { /// Serializes this [AnnotationsData] to [sink]. void writeToDataSink(DataSink sink); - /// Returns `true` if [member] has an `@pragma('dart2js:assumeDynamic')` annotation. + /// Returns `true` if [member] has an `@pragma('dart2js:assumeDynamic')` + /// annotation. bool hasAssumeDynamic(MemberEntity member); - /// Returns `true` if [member] has a `@pragma('dart2js:noInline')`, or - /// `@pragma('dart2js:noInline')` annotation. + /// Returns `true` if [member] has a `@pragma('dart2js:noInline')` annotation. bool hasNoInline(MemberEntity member); - /// Returns `true` if [member] has a `@pragma('dart2js:tryInline')`, or - /// `@pragma('dart2js:tryInline')` annotation. + /// Returns `true` if [member] has a `@pragma('dart2js:tryInline')` + /// annotation. bool hasTryInline(MemberEntity member); /// Returns `true` if [member] has a `@pragma('dart2js:disableFinal')` @@ -284,18 +284,19 @@ abstract class AnnotationsData { /// annotation. bool hasNoElision(MemberEntity member); - /// Returns `true` if [member] has a `@NoThrows()` annotation. + /// Returns `true` if [member] has a `@pragma('dart2js:noThrows')` annotation. bool hasNoThrows(MemberEntity member); - /// Returns `true` if [member] has a `@NoSideEffects()` annotation. + /// Returns `true` if [member] has a `@pragma('dart2js:noSideEffects')` + /// annotation. bool hasNoSideEffects(MemberEntity member); - /// Calls [f] for all functions with a `@pragma('dart2js:noInline')`, or - /// `@pragma('dart2js:noInline')` annotation. + /// Calls [f] for all functions with a `@pragma('dart2js:noInline')` + /// annotation. void forEachNoInline(void f(FunctionEntity function)); - /// Calls [f] for all functions with a `@pragma('dart2js:tryInline')`, or - /// `@pragma('dart2js:tryInline')` annotation. + /// Calls [f] for all functions with a `@pragma('dart2js:tryInline')` + /// annotation. void forEachTryInline(void f(FunctionEntity function)); /// Calls [f] for all functions with a `@pragma('dart2js:noThrows')` diff --git a/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart index 1f585c105ee..41ac9d6cd6c 100644 --- a/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart +++ b/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart @@ -8,9 +8,6 @@ import 'dart:_runtime' as dart; import 'dart:_interceptors' show JSArray; import 'dart:_js_helper' show - NoInline, - NoSideEffects, - NoThrows, patch, LinkedMap, IdentityMap, diff --git a/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart index 148016db1fc..e07844bbaa6 100644 --- a/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart +++ b/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart @@ -12,7 +12,6 @@ import 'dart:_js_helper' getRuntimeType, LinkedMap, JSSyntaxRegExp, - NoInline, notNull, nullCheck, Primitives, @@ -903,7 +902,6 @@ class _Uri { @patch class StackTrace { @patch - @NoInline() static StackTrace get current { return dart.stackTrace(JS('', 'Error()')); } diff --git a/sdk/lib/_internal/js_dev_runtime/private/annotations.dart b/sdk/lib/_internal/js_dev_runtime/private/annotations.dart index 9062f3170e6..b2bc4b74b00 100644 --- a/sdk/lib/_internal/js_dev_runtime/private/annotations.dart +++ b/sdk/lib/_internal/js_dev_runtime/private/annotations.dart @@ -59,17 +59,6 @@ class _Undefined { /// of a variable with null const nullCheck = _NullCheck(); -/// Tells the optimizing compiler that the annotated method cannot throw. -/// Requires @NoInline() to function correctly. -class NoThrows { - const NoThrows(); -} - -/// Tells the optimizing compiler to not inline the annotated method. -class NoInline { - const NoInline(); -} - /// Marks a class as native and defines its JavaScript name(s). class Native { final String name; diff --git a/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart b/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart index 08a1e1e13b0..c32af9b3d02 100644 --- a/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart +++ b/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart @@ -479,7 +479,6 @@ class Primitives { * Diagnoses an indexing error. Returns the ArgumentError or RangeError that * describes the problem. */ -@NoInline() Error diagnoseIndexError(indexable, int index) { int length = indexable.length; // The following returns the same error that would be thrown by calling @@ -495,7 +494,6 @@ Error diagnoseIndexError(indexable, int index) { * Diagnoses a range error. Returns the ArgumentError or RangeError that * describes the problem. */ -@NoInline() Error diagnoseRangeError(int? start, int? end, int length) { if (start == null) { return ArgumentError.value(start, 'start'); @@ -517,7 +515,6 @@ int stringLastIndexOfUnchecked(receiver, element, start) => JS('!', r'#.lastIndexOf(#, #)', receiver, element, start); /// 'factory' for constructing ArgumentError.value to keep the call sites small. -@NoInline() ArgumentError argumentErrorValue(object) { return ArgumentError.value(object); } @@ -539,7 +536,6 @@ throwAbstractClassInstantiationError(className) { throw AbstractClassInstantiationError(className); } -@NoInline() throwConcurrentModificationError(collection) { throw ConcurrentModificationError(collection); } diff --git a/sdk/lib/_internal/js_runtime/lib/collection_patch.dart b/sdk/lib/_internal/js_runtime/lib/collection_patch.dart index 6ff4a1f6a15..b01ebb6d45b 100644 --- a/sdk/lib/_internal/js_runtime/lib/collection_patch.dart +++ b/sdk/lib/_internal/js_runtime/lib/collection_patch.dart @@ -9,9 +9,6 @@ import 'dart:_js_helper' fillLiteralMap, fillLiteralSet, InternalMap, - NoInline, - NoSideEffects, - NoThrows, patch, JsLinkedHashMap, LinkedHashMapCell, diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart index abd63e21f1e..5726f96f62f 100644 --- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart +++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart @@ -17,7 +17,6 @@ import 'dart:_js_helper' JsLinkedHashMap, jsonEncodeNative, JSSyntaxRegExp, - NoInline, objectHashCode, patch, Primitives, diff --git a/sdk/lib/_internal/js_runtime/lib/developer_patch.dart b/sdk/lib/_internal/js_runtime/lib/developer_patch.dart index e7833f58b7e..feb0d485b37 100644 --- a/sdk/lib/_internal/js_runtime/lib/developer_patch.dart +++ b/sdk/lib/_internal/js_runtime/lib/developer_patch.dart @@ -4,7 +4,7 @@ // Patch file for dart:developer library. -import 'dart:_js_helper' show patch, ForceInline; +import 'dart:_js_helper' show patch; import 'dart:_foreign_helper' show JS; import 'dart:async' show Zone; import 'dart:isolate'; diff --git a/sdk/lib/_internal/js_runtime/lib/interceptors.dart b/sdk/lib/_internal/js_runtime/lib/interceptors.dart index 189bb8c281a..5a062abe56a 100644 --- a/sdk/lib/_internal/js_runtime/lib/interceptors.dart +++ b/sdk/lib/_internal/js_runtime/lib/interceptors.dart @@ -40,8 +40,7 @@ import 'dart:_js_helper' throwConcurrentModificationError, lookupAndCacheInterceptor, StringMatch, - firstMatchAfter, - NoInline; + firstMatchAfter; import 'dart:_foreign_helper' show diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart index 15695c15c4c..50660b919fd 100644 --- a/sdk/lib/html/dart2js/html_dart2js.dart +++ b/sdk/lib/html/dart2js/html_dart2js.dart @@ -50,7 +50,6 @@ import 'dart:_js_helper' JSName, Native, Returns, - ForceInline, findDispatchTagForInterceptorClass, setNativeSubclassDispatchRecord, makeLeafDispatchRecord, diff --git a/tests/lib/html/js_dispatch_property_test.dart b/tests/lib/html/js_dispatch_property_test.dart index 3fbe2eaeec1..f20a4ffa6ab 100644 --- a/tests/lib/html/js_dispatch_property_test.dart +++ b/tests/lib/html/js_dispatch_property_test.dart @@ -6,8 +6,6 @@ import 'package:expect/minitest.dart'; -import 'package:expect/expect.dart' show NoInline, AssumeDynamic; - import 'js_dispatch_property_test_lib.dart'; @pragma('dart2js:noInline') diff --git a/tests/lib/html/js_interop_constructor_name/util.dart b/tests/lib/html/js_interop_constructor_name/util.dart index 03659f0b10c..3ec45633c54 100644 --- a/tests/lib/html/js_interop_constructor_name/util.dart +++ b/tests/lib/html/js_interop_constructor_name/util.dart @@ -5,7 +5,6 @@ @JS() library util; -import 'package:expect/expect.dart' show NoInline, AssumeDynamic; import 'package:js/js.dart'; @JS() diff --git a/tests/lib/html/js_typed_interop_callable_object_test.dart b/tests/lib/html/js_typed_interop_callable_object_test.dart index 659d2a915a5..663a789a38a 100644 --- a/tests/lib/html/js_typed_interop_callable_object_test.dart +++ b/tests/lib/html/js_typed_interop_callable_object_test.dart @@ -7,7 +7,6 @@ library js_typed_interop_callable_object_test; import 'dart:html'; -import 'package:expect/expect.dart' show NoInline, AssumeDynamic; import 'package:js/js.dart'; import 'package:expect/minitest.dart'; diff --git a/tests/lib_2/html/js_dispatch_property_test.dart b/tests/lib_2/html/js_dispatch_property_test.dart index 3ca4a9eb3a1..866b7e69444 100644 --- a/tests/lib_2/html/js_dispatch_property_test.dart +++ b/tests/lib_2/html/js_dispatch_property_test.dart @@ -8,8 +8,6 @@ import 'package:expect/minitest.dart'; -import 'package:expect/expect.dart' show NoInline, AssumeDynamic; - import 'js_dispatch_property_test_lib.dart'; @pragma('dart2js:noInline') diff --git a/tests/lib_2/html/js_interop_constructor_name/util.dart b/tests/lib_2/html/js_interop_constructor_name/util.dart index 6eecab4226a..c98f612e046 100644 --- a/tests/lib_2/html/js_interop_constructor_name/util.dart +++ b/tests/lib_2/html/js_interop_constructor_name/util.dart @@ -7,7 +7,6 @@ @JS() library util; -import 'package:expect/expect.dart' show NoInline, AssumeDynamic; import 'package:js/js.dart'; @JS() diff --git a/tests/lib_2/html/js_typed_interop_callable_object_test.dart b/tests/lib_2/html/js_typed_interop_callable_object_test.dart index 1a89ff67400..9ede0a2e2dc 100644 --- a/tests/lib_2/html/js_typed_interop_callable_object_test.dart +++ b/tests/lib_2/html/js_typed_interop_callable_object_test.dart @@ -9,7 +9,6 @@ library js_typed_interop_callable_object_test; import 'dart:html'; -import 'package:expect/expect.dart' show NoInline, AssumeDynamic; import 'package:js/js.dart'; import 'package:expect/minitest.dart'; diff --git a/tests/web/deferred_inheritance_test.dart b/tests/web/deferred_inheritance_test.dart index 24436823d60..45a62facff5 100644 --- a/tests/web/deferred_inheritance_test.dart +++ b/tests/web/deferred_inheritance_test.dart @@ -16,7 +16,7 @@ import 'package:expect/expect.dart'; class B extends A {} /// If the check `y is A` is generated as `y.$isA` then the issue is not -/// exposed. We use `AssumeDynamic` to ensure that we generate as `y instanceof +/// exposed. We use `assumeDynamic` to ensure that we generate as `y instanceof /// A` in JS. @pragma('dart2js:noInline') @pragma('dart2js:assumeDynamic') diff --git a/tests/web/internal/mock_libraries.dart b/tests/web/internal/mock_libraries.dart index 9f0be35a91b..d279e0cc14a 100644 --- a/tests/web/internal/mock_libraries.dart +++ b/tests/web/internal/mock_libraries.dart @@ -246,10 +246,6 @@ const Map DEFAULT_JS_HELPER_LIBRARY = const { 'listTypeCheck': 'listTypeCheck(value) {}', 'makeLiteralMap': 'makeLiteralMap(List keyValuePairs) {}', 'Native': 'class Native {}', - 'NoInline': 'class NoInline {}', - 'ForceInline': 'class ForceInline {}', - 'NoSideEffects': 'class NoSideEffects {}', - 'NoThrows': 'class NoThrows {}', 'numberOrStringSuperNativeTypeCast': 'numberOrStringSuperNativeTypeCast(value) {}', 'numberOrStringSuperNativeTypeCheck': diff --git a/tests/web/native/compiler_test_internals.dart b/tests/web/native/compiler_test_internals.dart index 08e96d0d2ba..3278e340919 100644 --- a/tests/web/native/compiler_test_internals.dart +++ b/tests/web/native/compiler_test_internals.dart @@ -4,6 +4,4 @@ library compiler_test_internals; -export 'dart:_js_helper' show NoSideEffects, NoThrows, NoInline; - export 'dart:_foreign_helper' show JS; diff --git a/tests/web_2/deferred_inheritance_test.dart b/tests/web_2/deferred_inheritance_test.dart index 03739072d38..8f16b55893b 100644 --- a/tests/web_2/deferred_inheritance_test.dart +++ b/tests/web_2/deferred_inheritance_test.dart @@ -18,7 +18,7 @@ import 'package:expect/expect.dart'; class B extends A {} /// If the check `y is A` is generated as `y.$isA` then the issue is not -/// exposed. We use `AssumeDynamic` to ensure that we generate as `y instanceof +/// exposed. We use `assumeDynamic` to ensure that we generate as `y instanceof /// A` in JS. @pragma('dart2js:noInline') @pragma('dart2js:assumeDynamic') diff --git a/tests/web_2/internal/mock_libraries.dart b/tests/web_2/internal/mock_libraries.dart index adec88ae984..9aa36ad97aa 100644 --- a/tests/web_2/internal/mock_libraries.dart +++ b/tests/web_2/internal/mock_libraries.dart @@ -218,10 +218,6 @@ const Map DEFAULT_JS_HELPER_LIBRARY = const { }''', 'makeLiteralMap': 'makeLiteralMap(List keyValuePairs) {}', 'Native': 'class Native {}', - 'NoInline': 'class NoInline {}', - 'ForceInline': 'class ForceInline {}', - 'NoSideEffects': 'class NoSideEffects {}', - 'NoThrows': 'class NoThrows {}', '_Patch': 'class _Patch { final tag; const _Patch(this.tag); }', 'patch': 'const patch = const _Patch(null);', 'patch_full': 'const patch_full = const _Patch("full");', diff --git a/tests/web_2/native/compiler_test_internals.dart b/tests/web_2/native/compiler_test_internals.dart index c7b02181c6f..a0ce071d8a8 100644 --- a/tests/web_2/native/compiler_test_internals.dart +++ b/tests/web_2/native/compiler_test_internals.dart @@ -6,6 +6,4 @@ library compiler_test_internals; -export 'dart:_js_helper' show NoSideEffects, NoThrows, NoInline; - export 'dart:_foreign_helper' show JS; diff --git a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate index fd4069b638e..1559461ff4d 100644 --- a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate +++ b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate @@ -42,7 +42,7 @@ import 'dart:web_gl' show RenderingContext,RenderingContext2; import 'dart:web_sql'; import 'dart:_js_helper' show convertDartClosureToJS, Creates, JavaScriptIndexingBehavior, - JSName, Native, Returns, ForceInline, + JSName, Native, Returns, findDispatchTagForInterceptorClass, setNativeSubclassDispatchRecord, makeLeafDispatchRecord, registerGlobalObject, applyExtension; import 'dart:_interceptors' show