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

Side by Side Diff: sdk/lib/collection/hash_table.dart

Issue 12328104: Change new List(n) to return fixed length list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 7 years, 9 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 | Annotate | Revision Log
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 part of dart.collection; 5 part of dart.collection;
6 6
7 class _DeadEntry { 7 class _DeadEntry {
8 const _DeadEntry(); 8 const _DeadEntry();
9 } 9 }
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Value cycles after 2^30 modifications. If you keep hold of an 67 // Value cycles after 2^30 modifications. If you keep hold of an
68 // iterator for that long, you might miss a modification detection, 68 // iterator for that long, you might miss a modification detection,
69 // and iteration can go sour. Don't do that. 69 // and iteration can go sour. Don't do that.
70 _modificationCount = (_modificationCount + 1) & (0x3FFFFFFF); 70 _modificationCount = (_modificationCount + 1) & (0x3FFFFFFF);
71 } 71 }
72 72
73 /** 73 /**
74 * Create an empty table. 74 * Create an empty table.
75 */ 75 */
76 List _createTable(int capacity) { 76 List _createTable(int capacity) {
77 List table = new List.fixedLength(capacity * _entrySize); 77 List table = new List(capacity * _entrySize);
78 return table; 78 return table;
79 } 79 }
80 80
81 /** First table probe. */ 81 /** First table probe. */
82 int _firstProbe(int hashCode, int capacity) { 82 int _firstProbe(int hashCode, int capacity) {
83 return hashCode & (capacity - 1); 83 return hashCode & (capacity - 1);
84 } 84 }
85 85
86 /** Following table probes. */ 86 /** Following table probes. */
87 int _nextProbe(int previousIndex, int probeCount, int capacity) { 87 int _nextProbe(int previousIndex, int probeCount, int capacity) {
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 396
397 class _HashTableValueIterator<V> extends _HashTableIterator<V> { 397 class _HashTableValueIterator<V> extends _HashTableIterator<V> {
398 final int _entryIndex; 398 final int _entryIndex;
399 399
400 _HashTableValueIterator(_HashTable hashTable, this._entryIndex) 400 _HashTableValueIterator(_HashTable hashTable, this._entryIndex)
401 : super(hashTable); 401 : super(hashTable);
402 402
403 V _valueAt(int offset, Object key) => _hashTable._table[offset + _entryIndex]; 403 V _valueAt(int offset, Object key) => _hashTable._table[offset + _entryIndex];
404 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698