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

Unified Diff: sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart

Issue 1188713005: Use an ES6 map for a linked identity hash 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/isolate_serialization.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart b/sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart
index bbf76d3b6a9432954af7865ea0dfb9f5d2f97a90..cef7f93e8ebad24119a6eb7233ff925ba32f34a3 100644
--- a/sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart
+++ b/sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart
@@ -44,7 +44,7 @@ class JsLinkedHashMap<K, V> implements LinkedHashMap<K, V>, InternalMap {
/// If ES6 Maps are available returns a linked hash-map backed by an ES6 Map.
@ForceInline()
factory JsLinkedHashMap.es6() {
- return (_USE_ES6_MAPS && JsLinkedHashMap._supportsEs6Maps)
+ return (_USE_ES6_MAPS && JsLinkedHashMap._supportsEs6Maps)
? new Es6LinkedHashMap<K, V>()
: new JsLinkedHashMap<K, V>();
}
@@ -223,9 +223,10 @@ class JsLinkedHashMap<K, V> implements LinkedHashMap<K, V>, InternalMap {
}
void _modified() {
- // Value cycles after 2^30 modifications. If you keep hold of an
- // iterator for that long, you might miss a modification
- // detection, and iteration can go sour. Don't do that.
+ // Value cycles after 2^30 modifications so that modification counts are
+ // always unboxed (Smi) values. Modification detection will be missed if you
+ // make exactly some multiple of 2^30 modifications between advances of an
+ // iterator.
_modifications = (_modifications + 1) & 0x3ffffff;
}
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/isolate_serialization.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698