Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: runtime/lib/collection_patch.dart

Issue 1151523002: VM-internalize the default Map implementation. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix fingerprints. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/lib/collection_sources.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 patch class HashMap<K, V> { 5 patch class HashMap<K, V> {
6 /* patch */ factory HashMap({ bool equals(K key1, K key2), 6 /* patch */ factory HashMap({ bool equals(K key1, K key2),
7 int hashCode(K key), 7 int hashCode(K key),
8 bool isValidKey(potentialKey) }) { 8 bool isValidKey(potentialKey) }) {
9 if (isValidKey == null) { 9 if (isValidKey == null) {
10 if (hashCode == null) { 10 if (hashCode == null) {
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 /// only the head entry itself). 909 /// only the head entry itself).
910 var _nextEntry; 910 var _nextEntry;
911 var _previousEntry; 911 var _previousEntry;
912 912
913 /* patch */ factory LinkedHashMap({ bool equals(K key1, K key2), 913 /* patch */ factory LinkedHashMap({ bool equals(K key1, K key2),
914 int hashCode(K key), 914 int hashCode(K key),
915 bool isValidKey(potentialKey) }) { 915 bool isValidKey(potentialKey) }) {
916 if (isValidKey == null) { 916 if (isValidKey == null) {
917 if (hashCode == null) { 917 if (hashCode == null) {
918 if (equals == null) { 918 if (equals == null) {
919 if (_useInternalCached) { 919 return new _InternalLinkedHashMap<K, V>();
920 return new _InternalLinkedHashMap<K, V>();
921 } else {
922 return new _CompactLinkedHashMap<K, V>();
923 }
924 } 920 }
925 hashCode = _defaultHashCode; 921 hashCode = _defaultHashCode;
926 } else { 922 } else {
927 if (identical(identityHashCode, hashCode) && 923 if (identical(identityHashCode, hashCode) &&
928 identical(identical, equals)) { 924 identical(identical, equals)) {
929 return new _CompactLinkedIdentityHashMap<K, V>(); 925 return new _CompactLinkedIdentityHashMap<K, V>();
930 } 926 }
931 if (equals == null) { 927 if (equals == null) {
932 equals = _defaultEquals; 928 equals = _defaultEquals;
933 } 929 }
934 } 930 }
935 } else { 931 } else {
936 if (hashCode == null) { 932 if (hashCode == null) {
937 hashCode = _defaultHashCode; 933 hashCode = _defaultHashCode;
938 } 934 }
939 if (equals == null) { 935 if (equals == null) {
940 equals = _defaultEquals; 936 equals = _defaultEquals;
941 } 937 }
942 } 938 }
943 return new _CompactLinkedCustomHashMap<K, V>(equals, hashCode, isValidKey); 939 return new _CompactLinkedCustomHashMap<K, V>(equals, hashCode, isValidKey);
944 } 940 }
945 941
946 /* patch */ factory LinkedHashMap.identity() = 942 /* patch */ factory LinkedHashMap.identity() =
947 _CompactLinkedIdentityHashMap<K, V>; 943 _CompactLinkedIdentityHashMap<K, V>;
948
949 static final bool _useInternalCached = _useInternal;
950 static bool get _useInternal native "LinkedHashMap_useInternal";
951 } 944 }
952 945
953 patch class LinkedHashSet<E> { 946 patch class LinkedHashSet<E> {
954 /* patch */ factory LinkedHashSet({ bool equals(E e1, E e2), 947 /* patch */ factory LinkedHashSet({ bool equals(E e1, E e2),
955 int hashCode(E e), 948 int hashCode(E e),
956 bool isValidKey(potentialKey) }) { 949 bool isValidKey(potentialKey) }) {
957 if (isValidKey == null) { 950 if (isValidKey == null) {
958 if (hashCode == null) { 951 if (hashCode == null) {
959 if (equals == null) { 952 if (equals == null) {
960 return new _CompactLinkedHashSet<E>(); 953 return new _CompactLinkedHashSet<E>();
(...skipping 15 matching lines...) Expand all
976 if (equals == null) { 969 if (equals == null) {
977 equals = _defaultEquals; 970 equals = _defaultEquals;
978 } 971 }
979 } 972 }
980 return new _CompactLinkedCustomHashSet<E>(equals, hashCode, isValidKey); 973 return new _CompactLinkedCustomHashSet<E>(equals, hashCode, isValidKey);
981 } 974 }
982 975
983 /* patch */ factory LinkedHashSet.identity() = 976 /* patch */ factory LinkedHashSet.identity() =
984 _CompactLinkedIdentityHashSet<E>; 977 _CompactLinkedIdentityHashSet<E>;
985 } 978 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/collection_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698