Skip to content

Commit 8cb4d3c

Browse files
fishythefishCommit Queue
authored andcommitted
[dart2js] Remove _CanonicalizedTypeMaskKey and use record
Since #60419 is fixed by #60419, we should be able to use record keys again. Change-Id: I1256d74e80e135b0ba2a38c64c42e0463964baaf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419986 Reviewed-by: Stephen Adams <[email protected]> Commit-Queue: Mayank Patke <[email protected]>
1 parent de3f423 commit 8cb4d3c

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

pkg/compiler/lib/src/inferrer/typemasks/masks.dart

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,6 @@ part 'type_mask.dart';
4343
part 'union_type_mask.dart';
4444
part 'value_type_mask.dart';
4545

46-
// TODO(60419): Go back to using a record as the key when it is no longer slower
47-
// than using a data class.
48-
final class _CanonicalizedTypeMaskKey {
49-
final ClassEntity? _base;
50-
final _Flags _flags;
51-
52-
const _CanonicalizedTypeMaskKey(this._base, this._flags);
53-
54-
@override
55-
int get hashCode => Object.hash(_base, _flags);
56-
57-
@override
58-
bool operator ==(Object other) =>
59-
identical(this, other) ||
60-
other is _CanonicalizedTypeMaskKey &&
61-
_base == other._base &&
62-
_flags == other._flags;
63-
}
64-
6546
class CommonMasks with AbstractValueDomain {
6647
// TODO(sigmund): once we split out the backend common elements, depend
6748
// directly on those instead.
@@ -75,19 +56,15 @@ class CommonMasks with AbstractValueDomain {
7556

7657
final Map<TypeMask, Map<TypeMask, TypeMask>> _intersectionCache = {};
7758

78-
final Map<_CanonicalizedTypeMaskKey, FlatTypeMask> _canonicalizedTypeMasks =
79-
{};
59+
final Map<(ClassEntity?, _Flags), FlatTypeMask> _canonicalizedTypeMasks = {};
8060

8161
/// Return the cached mask for [base] with the given flags, or calls
8262
/// [createMask] to create the mask and cache it.
8363
FlatTypeMask _getCachedMask(
8464
ClassEntity? base,
8565
_Flags flags,
8666
FlatTypeMask Function() createMask,
87-
) => _canonicalizedTypeMasks.putIfAbsent(
88-
_CanonicalizedTypeMaskKey(base, flags),
89-
createMask,
90-
);
67+
) => _canonicalizedTypeMasks.putIfAbsent((base, flags), createMask);
9168

9269
@override
9370
late final TypeMask internalTopType = TypeMask.subclass(

0 commit comments

Comments
 (0)