| 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 library universe; | 5 library universe; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../compiler.dart' show | 10 import '../compiler.dart' show |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 298 |
| 299 bool _registerNewSelector( | 299 bool _registerNewSelector( |
| 300 DynamicUse dynamicUse, | 300 DynamicUse dynamicUse, |
| 301 Map<String, Map<Selector, SelectorConstraints>> selectorMap) { | 301 Map<String, Map<Selector, SelectorConstraints>> selectorMap) { |
| 302 Selector selector = dynamicUse.selector; | 302 Selector selector = dynamicUse.selector; |
| 303 String name = selector.name; | 303 String name = selector.name; |
| 304 ReceiverConstraint mask = dynamicUse.mask; | 304 ReceiverConstraint mask = dynamicUse.mask; |
| 305 Map<Selector, SelectorConstraints> selectors = selectorMap.putIfAbsent( | 305 Map<Selector, SelectorConstraints> selectors = selectorMap.putIfAbsent( |
| 306 name, () => new Maplet<Selector, SelectorConstraints>()); | 306 name, () => new Maplet<Selector, SelectorConstraints>()); |
| 307 UniverseSelectorConstraints constraints = selectors.putIfAbsent( | 307 UniverseSelectorConstraints constraints = selectors.putIfAbsent( |
| 308 selector, () => selectorConstraintsStrategy.createSelectorConstraints(se
lector)); | 308 selector, () { |
| 309 return selectorConstraintsStrategy.createSelectorConstraints(selector); |
| 310 }); |
| 309 return constraints.addReceiverConstraint(mask); | 311 return constraints.addReceiverConstraint(mask); |
| 310 } | 312 } |
| 311 | 313 |
| 312 Map<Selector, SelectorConstraints> _asUnmodifiable( | 314 Map<Selector, SelectorConstraints> _asUnmodifiable( |
| 313 Map<Selector, SelectorConstraints> map) { | 315 Map<Selector, SelectorConstraints> map) { |
| 314 if (map == null) return null; | 316 if (map == null) return null; |
| 315 return new UnmodifiableMapView(map); | 317 return new UnmodifiableMapView(map); |
| 316 } | 318 } |
| 317 | 319 |
| 318 Map<Selector, SelectorConstraints> invocationsByName(String name) { | 320 Map<Selector, SelectorConstraints> invocationsByName(String name) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 if (Elements.isStaticOrTopLevel(element) && element.isField) { | 359 if (Elements.isStaticOrTopLevel(element) && element.isField) { |
| 358 allReferencedStaticFields.add(element); | 360 allReferencedStaticFields.add(element); |
| 359 } | 361 } |
| 360 switch (staticUse.kind) { | 362 switch (staticUse.kind) { |
| 361 case StaticUseKind.STATIC_TEAR_OFF: | 363 case StaticUseKind.STATIC_TEAR_OFF: |
| 362 staticFunctionsNeedingGetter.add(element); | 364 staticFunctionsNeedingGetter.add(element); |
| 363 break; | 365 break; |
| 364 case StaticUseKind.FIELD_GET: | 366 case StaticUseKind.FIELD_GET: |
| 365 fieldGetters.add(element); | 367 fieldGetters.add(element); |
| 366 break; | 368 break; |
| 369 case StaticUseKind.SUPER_FIELD_SET: |
| 367 case StaticUseKind.FIELD_SET: | 370 case StaticUseKind.FIELD_SET: |
| 368 fieldSetters.add(element); | 371 fieldSetters.add(element); |
| 369 break; | 372 break; |
| 370 case StaticUseKind.SUPER_TEAR_OFF: | 373 case StaticUseKind.SUPER_TEAR_OFF: |
| 371 methodsNeedingSuperGetter.add(element); | 374 methodsNeedingSuperGetter.add(element); |
| 372 break; | 375 break; |
| 373 case StaticUseKind.GENERAL: | 376 case StaticUseKind.GENERAL: |
| 374 break; | 377 break; |
| 375 case StaticUseKind.CLOSURE: | 378 case StaticUseKind.CLOSURE: |
| 376 allClosures.add(element); | 379 allClosures.add(element); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 398 // TODO(ahe): Replace this method with something that is O(1), for example, | 401 // TODO(ahe): Replace this method with something that is O(1), for example, |
| 399 // by using a map. | 402 // by using a map. |
| 400 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) { | 403 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) { |
| 401 // Return new list to guard against concurrent modifications. | 404 // Return new list to guard against concurrent modifications. |
| 402 return new List<LocalFunctionElement>.from( | 405 return new List<LocalFunctionElement>.from( |
| 403 allClosures.where((LocalFunctionElement closure) { | 406 allClosures.where((LocalFunctionElement closure) { |
| 404 return closure.executableContext == element; | 407 return closure.executableContext == element; |
| 405 })); | 408 })); |
| 406 } | 409 } |
| 407 } | 410 } |
| OLD | NEW |