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

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

Issue 2451623006: Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork." (Closed)
Patch Set: Fix Created 4 years, 1 month 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 | « runtime/lib/collection_sources.gypi ('k') | runtime/lib/core_patch.dart » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:typed_data';
6 import 'dart:_internal' as internal;
7
8 // Hash table with open addressing that separates the index from keys/values. 5 // Hash table with open addressing that separates the index from keys/values.
9 6
10 abstract class _HashFieldBase { 7 abstract class _HashFieldBase {
11 // Each occupied entry in _index is a fixed-size integer that encodes a pair: 8 // Each occupied entry in _index is a fixed-size integer that encodes a pair:
12 // [ hash pattern for key | index of entry in _data ] 9 // [ hash pattern for key | index of entry in _data ]
13 // The hash pattern is based on hashCode, but is guaranteed to be non-zero. 10 // The hash pattern is based on hashCode, but is guaranteed to be non-zero.
14 // The length of _index is always a power of two, and there is always at 11 // The length of _index is always a power of two, and there is always at
15 // least one unoccupied entry. 12 // least one unoccupied entry.
16 // NOTE: When maps are deserialized, their _index and _hashMask is regenerated 13 // NOTE: When maps are deserialized, their _index and _hashMask is regenerated
17 // lazily by _regenerateIndex. 14 // lazily by _regenerateIndex.
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 E lookup(Object o) => _validKey(o) ? super.lookup(o) : null; 589 E lookup(Object o) => _validKey(o) ? super.lookup(o) : null;
593 bool remove(Object o) => _validKey(o) ? super.remove(o) : false; 590 bool remove(Object o) => _validKey(o) ? super.remove(o) : false;
594 591
595 _CompactLinkedCustomHashSet(this._equality, this._hasher, validKey) 592 _CompactLinkedCustomHashSet(this._equality, this._hasher, validKey)
596 : _validKey = (validKey != null) ? validKey : new _TypeTest<E>().test; 593 : _validKey = (validKey != null) ? validKey : new _TypeTest<E>().test;
597 594
598 Set<E> toSet() => 595 Set<E> toSet() =>
599 new _CompactLinkedCustomHashSet<E>(_equality, _hasher, _validKey) 596 new _CompactLinkedCustomHashSet<E>(_equality, _hasher, _validKey)
600 ..addAll(this); 597 ..addAll(this);
601 } 598 }
OLDNEW
« no previous file with comments | « runtime/lib/collection_sources.gypi ('k') | runtime/lib/core_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698