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

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

Issue 1199343006: Don't use ES6 map if browser has no Map (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 | no next file » | 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 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 7 import 'dart:_js_helper' show
8 fillLiteralMap, InternalMap, NoInline, NoSideEffects, NoThrows, patch, 8 fillLiteralMap, InternalMap, NoInline, NoSideEffects, NoThrows, patch,
9 JsLinkedHashMap, LinkedHashMapCell, LinkedHashMapKeyIterable, 9 JsLinkedHashMap, LinkedHashMapCell, LinkedHashMapKeyIterable,
10 LinkedHashMapKeyIterator; 10 LinkedHashMapKeyIterator;
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 547 }
548 548
549 class _LinkedIdentityHashMap<K, V> extends JsLinkedHashMap<K, V> { 549 class _LinkedIdentityHashMap<K, V> extends JsLinkedHashMap<K, V> {
550 static bool get _supportsEs6Maps { 550 static bool get _supportsEs6Maps {
551 return JS('returns:bool;depends:none;effects:none;throws:never;gvn:true', 551 return JS('returns:bool;depends:none;effects:none;throws:never;gvn:true',
552 'typeof Map != "undefined"'); 552 'typeof Map != "undefined"');
553 } 553 }
554 554
555 factory _LinkedIdentityHashMap.es6() { 555 factory _LinkedIdentityHashMap.es6() {
556 return (_USE_ES6_MAPS && _LinkedIdentityHashMap._supportsEs6Maps) 556 return (_USE_ES6_MAPS && _LinkedIdentityHashMap._supportsEs6Maps)
557 ? new _LinkedIdentityHashMap<K, V>() 557 ? new _Es6LinkedIdentityHashMap<K, V>()
558 : new _Es6LinkedIdentityHashMap<K, V>(); 558 : new _LinkedIdentityHashMap<K, V>();
559 } 559 }
560 560
561 _LinkedIdentityHashMap(); 561 _LinkedIdentityHashMap();
562 562
563 int internalComputeHashCode(var key) { 563 int internalComputeHashCode(var key) {
564 // We force the hash codes to be unsigned 30-bit integers to avoid 564 // We force the hash codes to be unsigned 30-bit integers to avoid
565 // issues with problematic keys like '__proto__'. Another option 565 // issues with problematic keys like '__proto__'. Another option
566 // would be to throw an exception if the hash code isn't a number. 566 // would be to throw an exception if the hash code isn't a number.
567 return JS('int', '# & 0x3ffffff', identityHashCode(key)); 567 return JS('int', '# & 0x3ffffff', identityHashCode(key));
568 } 568 }
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 } else if (_cell == null) { 1648 } else if (_cell == null) {
1649 _current = null; 1649 _current = null;
1650 return false; 1650 return false;
1651 } else { 1651 } else {
1652 _current = _cell._element; 1652 _current = _cell._element;
1653 _cell = _cell._next; 1653 _cell = _cell._next;
1654 return true; 1654 return true;
1655 } 1655 }
1656 } 1656 }
1657 } 1657 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698