OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // VM-specific implementation of the dart:mirrors library. | 5 // VM-specific implementation of the dart:mirrors library. |
6 | 6 |
7 import "dart:collection" show UnmodifiableListView, UnmodifiableMapView; | 7 import "dart:collection" show UnmodifiableListView, UnmodifiableMapView; |
8 import "dart:_internal" show LRUMap; | 8 import "dart:_internal" show LRUMap; |
9 | 9 |
10 final emptyList = new UnmodifiableListView([]); | 10 final emptyList = new UnmodifiableListView([]); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 return other is _LocalInstanceMirror && | 292 return other is _LocalInstanceMirror && |
293 identical(_reflectee, other._reflectee); | 293 identical(_reflectee, other._reflectee); |
294 } | 294 } |
295 | 295 |
296 int get hashCode { | 296 int get hashCode { |
297 // Avoid hash collisions with the reflectee. This constant is in Smi range | 297 // Avoid hash collisions with the reflectee. This constant is in Smi range |
298 // and happens to be the inner padding from RFC 2104. | 298 // and happens to be the inner padding from RFC 2104. |
299 return identityHashCode(_reflectee) ^ 0x36363636; | 299 return identityHashCode(_reflectee) ^ 0x36363636; |
300 } | 300 } |
301 | 301 |
302 static var _getFieldClosures = new LRUMap.withShift(7); | 302 static var _getFieldClosures = new LRUMap.withShift(9); |
303 static var _setFieldClosures = new LRUMap.withShift(7); | 303 static var _setFieldClosures = new LRUMap.withShift(9); |
304 static var _getFieldCallCounts = new LRUMap.withShift(8); | 304 static var _getFieldCallCounts = new LRUMap.withShift(10); |
305 static var _setFieldCallCounts = new LRUMap.withShift(8); | 305 static var _setFieldCallCounts = new LRUMap.withShift(10); |
306 static const _closureThreshold = 20; | 306 static const _closureThreshold = 20; |
307 | 307 |
308 _getFieldSlow(unwrapped) { | 308 _getFieldSlow(unwrapped) { |
309 // Slow path factored out to give the fast path a better chance at being | 309 // Slow path factored out to give the fast path a better chance at being |
310 // inlined. | 310 // inlined. |
311 var callCount = _getFieldCallCounts[unwrapped]; | 311 var callCount = _getFieldCallCounts[unwrapped]; |
312 if (callCount == null) { | 312 if (callCount == null) { |
313 callCount = 0; | 313 callCount = 0; |
314 } | 314 } |
315 if (callCount == _closureThreshold) { | 315 if (callCount == _closureThreshold) { |
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 if (typeMirror == null) { | 1569 if (typeMirror == null) { |
1570 typeMirror = makeLocalTypeMirror(key); | 1570 typeMirror = makeLocalTypeMirror(key); |
1571 _instanitationCache[key] = typeMirror; | 1571 _instanitationCache[key] = typeMirror; |
1572 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { | 1572 if (typeMirror is ClassMirror && !typeMirror._isGeneric) { |
1573 _declarationCache[key] = typeMirror; | 1573 _declarationCache[key] = typeMirror; |
1574 } | 1574 } |
1575 } | 1575 } |
1576 return typeMirror; | 1576 return typeMirror; |
1577 } | 1577 } |
1578 } | 1578 } |
OLD | NEW |