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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/collection_patch.dart

Issue 742873002: Isolates: allow sending of arbitrary objects in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and map-serialization fix. Created 6 years 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 // Patch file for dart:collection classes. 5 // Patch file for dart:collection classes.
6 import 'dart:_foreign_helper' show JS; 6 import 'dart:_foreign_helper' show JS;
7 import 'dart:_js_helper' show fillLiteralMap, NoInline, patch; 7 import 'dart:_js_helper' show fillLiteralMap, InternalMap, NoInline, patch;
8 8
9 @patch 9 @patch
10 class HashMap<K, V> { 10 class HashMap<K, V> {
11 @patch 11 @patch
12 factory HashMap({ bool equals(K key1, K key2), 12 factory HashMap({ bool equals(K key1, K key2),
13 int hashCode(K key), 13 int hashCode(K key),
14 bool isValidKey(potentialKey) }) { 14 bool isValidKey(potentialKey) }) {
15 if (isValidKey == null) { 15 if (isValidKey == null) {
16 if (hashCode == null) { 16 if (hashCode == null) {
17 if (equals == null) { 17 if (equals == null) {
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 return fillLiteralMap(keyValuePairs, new _LinkedHashMap<K, V>()); 522 return fillLiteralMap(keyValuePairs, new _LinkedHashMap<K, V>());
523 } 523 }
524 524
525 // Private factory constructor called by generated code for map literals. 525 // Private factory constructor called by generated code for map literals.
526 @NoInline() 526 @NoInline()
527 factory LinkedHashMap._empty() { 527 factory LinkedHashMap._empty() {
528 return new _LinkedHashMap<K, V>(); 528 return new _LinkedHashMap<K, V>();
529 } 529 }
530 } 530 }
531 531
532 class _LinkedHashMap<K, V> implements LinkedHashMap<K, V> { 532 class _LinkedHashMap<K, V> implements LinkedHashMap<K, V>, InternalMap {
533 int _length = 0; 533 int _length = 0;
534 534
535 // The hash map contents are divided into three parts: one part for 535 // The hash map contents are divided into three parts: one part for
536 // string keys, one for numeric keys, and one for the rest. String 536 // string keys, one for numeric keys, and one for the rest. String
537 // and numeric keys map directly to their linked cells, but the rest 537 // and numeric keys map directly to their linked cells, but the rest
538 // of the entries are stored in bucket lists of the form: 538 // of the entries are stored in bucket lists of the form:
539 // 539 //
540 // [cell-0, cell-1, ...] 540 // [cell-0, cell-1, ...]
541 // 541 //
542 // where all keys in the same bucket share the same hash code. 542 // where all keys in the same bucket share the same hash code.
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 } else if (_cell == null) { 1828 } else if (_cell == null) {
1829 _current = null; 1829 _current = null;
1830 return false; 1830 return false;
1831 } else { 1831 } else {
1832 _current = _cell._element; 1832 _current = _cell._element;
1833 _cell = _cell._next; 1833 _cell = _cell._next;
1834 return true; 1834 return true;
1835 } 1835 }
1836 } 1836 }
1837 } 1837 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698