Skip to content

Commit f14ce9e

Browse files
rakudramaCommit Queue
authored andcommitted
[dart2js] Remove unused Map/Set literal helper functions
These functions have not been used since we switched to the new Rti. In modern Dart it is not worth special-casing `<dynamic,dynamic>{}` and `<dynamic>{}`. Bug: #37715 Change-Id: I535bc67055a7dc02016b14d1a0ae43ca1f850e79 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430320 Commit-Queue: Stephen Adams <[email protected]> Reviewed-by: Mayank Patke <[email protected]>
1 parent 612c9f6 commit f14ce9e

File tree

4 files changed

+2
-83
lines changed

4 files changed

+2
-83
lines changed

pkg/compiler/lib/src/common/elements.dart

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -483,18 +483,6 @@ abstract class CommonElements {
483483
)!;
484484
late final ConstructorEntity mapLiteralConstructorEmpty = _env
485485
.lookupConstructor(mapLiteralClass, '_empty')!;
486-
late final FunctionEntity mapLiteralUntypedMaker =
487-
_env.lookupLocalClassMember(
488-
mapLiteralClass,
489-
PrivateName('_makeLiteral', mapLiteralClass.library.canonicalUri),
490-
)
491-
as FunctionEntity;
492-
late final FunctionEntity mapLiteralUntypedEmptyMaker =
493-
_env.lookupLocalClassMember(
494-
mapLiteralClass,
495-
PrivateName('_makeEmpty', mapLiteralClass.library.canonicalUri),
496-
)
497-
as FunctionEntity;
498486

499487
late final ClassEntity setLiteralClass = _findClass(
500488
collectionLibrary,
@@ -507,18 +495,6 @@ abstract class CommonElements {
507495
)!;
508496
late final ConstructorEntity setLiteralConstructorEmpty = _env
509497
.lookupConstructor(setLiteralClass, '_empty')!;
510-
late final FunctionEntity setLiteralUntypedMaker =
511-
_env.lookupLocalClassMember(
512-
setLiteralClass,
513-
PrivateName('_makeLiteral', setLiteralClass.library.canonicalUri),
514-
)
515-
as FunctionEntity;
516-
late final FunctionEntity setLiteralUntypedEmptyMaker =
517-
_env.lookupLocalClassMember(
518-
setLiteralClass,
519-
PrivateName('_makeEmpty', setLiteralClass.library.canonicalUri),
520-
)
521-
as FunctionEntity;
522498

523499
late final FunctionEntity? objectNoSuchMethod =
524500
_env.lookupLocalClassMember(

pkg/compiler/lib/src/js_backend/backend_impact.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,17 +445,13 @@ class BackendImpacts {
445445
globalUses: [
446446
_commonElements.mapLiteralConstructor,
447447
_commonElements.mapLiteralConstructorEmpty,
448-
_commonElements.mapLiteralUntypedMaker,
449-
_commonElements.mapLiteralUntypedEmptyMaker,
450448
],
451449
);
452450

453451
late final BackendImpact setLiteralClass = BackendImpact(
454452
globalUses: [
455453
_commonElements.setLiteralConstructor,
456454
_commonElements.setLiteralConstructorEmpty,
457-
_commonElements.setLiteralUntypedMaker,
458-
_commonElements.setLiteralUntypedEmptyMaker,
459455
],
460456
);
461457

pkg/compiler/lib/src/ssa/builder.dart

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4153,21 +4153,7 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault<void>
41534153
_typeBuilder.analyzeTypeArgument(argument, sourceElement),
41544154
);
41554155
}
4156-
4157-
// We lift this common call pattern into a helper function to save space
4158-
// in the output.
4159-
if (typeInputs.every(
4160-
(HInstruction input) =>
4161-
input.isNull(_abstractValueDomain).isDefinitelyTrue,
4162-
)) {
4163-
if (elements.isEmpty) {
4164-
constructor = _commonElements.setLiteralUntypedEmptyMaker;
4165-
} else {
4166-
constructor = _commonElements.setLiteralUntypedMaker;
4167-
}
4168-
} else {
4169-
inputs.addAll(typeInputs);
4170-
}
4156+
inputs.addAll(typeInputs);
41714157
}
41724158

41734159
// If runtime type information is needed and the set literal has no type
@@ -4256,21 +4242,7 @@ class KernelSsaGraphBuilder extends ir.VisitorDefault<void>
42564242
_typeBuilder.analyzeTypeArgument(argument, sourceElement),
42574243
);
42584244
}
4259-
4260-
// We lift this common call pattern into a helper function to save space
4261-
// in the output.
4262-
if (typeInputs.every(
4263-
(HInstruction input) =>
4264-
input.isNull(_abstractValueDomain).isDefinitelyTrue,
4265-
)) {
4266-
if (constructorArgs.isEmpty) {
4267-
constructor = _commonElements.mapLiteralUntypedEmptyMaker;
4268-
} else {
4269-
constructor = _commonElements.mapLiteralUntypedMaker;
4270-
}
4271-
} else {
4272-
inputs.addAll(typeInputs);
4273-
}
4245+
inputs.addAll(typeInputs);
42744246
}
42754247

42764248
// If runtime type information is needed and the map literal has no type

sdk/lib/_internal/js_runtime/lib/collection_patch.dart

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -551,19 +551,6 @@ class LinkedHashMap<K, V> {
551551
factory LinkedHashMap._empty() {
552552
return JsLinkedHashMap<K, V>();
553553
}
554-
555-
// Private factory static function called by generated code for map literals.
556-
// This version is for map literals without type parameters.
557-
@pragma('dart2js:noThrows')
558-
@pragma('dart2js:noInline')
559-
@pragma('dart2js:noSideEffects')
560-
static _makeEmpty() => JsLinkedHashMap();
561-
562-
// Private factory static function called by generated code for map literals.
563-
// This version is for map literals without type parameters.
564-
@pragma('dart2js:noInline')
565-
static _makeLiteral(keyValuePairs) =>
566-
fillLiteralMap(keyValuePairs, JsLinkedHashMap());
567554
}
568555

569556
// TODO(sra): Move to same library as JsLinkedHashMap and make the `internalXXX`
@@ -1079,18 +1066,6 @@ class LinkedHashSet<E> {
10791066
@pragma('dart2js:noInline')
10801067
factory LinkedHashSet._literal(List values) =>
10811068
fillLiteralSet(values, _LinkedHashSet<E>());
1082-
1083-
// Private factory static function called by generated code for set literals.
1084-
// This version is for set literals without type parameters.
1085-
@pragma('dart2js:noThrows')
1086-
@pragma('dart2js:noInline')
1087-
@pragma('dart2js:noSideEffects')
1088-
static _makeEmpty() => _LinkedHashSet();
1089-
1090-
// Private factory static function called by generated code for set literals.
1091-
// This version is for set literals without type parameters.
1092-
@pragma('dart2js:noInline')
1093-
static _makeLiteral(List values) => fillLiteralSet(values, _LinkedHashSet());
10941069
}
10951070

10961071
base class _LinkedHashSet<E> extends _SetBase<E> implements LinkedHashSet<E> {

0 commit comments

Comments
 (0)