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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/universe/universe.dart

Issue 12499005: dart2js: Create noSuchMethod handlers at runtime to reduce overhead. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
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 '../closure.dart'; 7 import '../closure.dart';
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../dart2jslib.dart'; 9 import '../dart2jslib.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 19 matching lines...) Expand all
30 /** 30 /**
31 * Documentation wanted -- johnniwinther 31 * Documentation wanted -- johnniwinther
32 * 32 *
33 * Invariant: Elements are declaration elements. 33 * Invariant: Elements are declaration elements.
34 */ 34 */
35 final Set<FunctionElement> staticFunctionsNeedingGetter; 35 final Set<FunctionElement> staticFunctionsNeedingGetter;
36 final Map<SourceString, Set<Selector>> invokedNames; 36 final Map<SourceString, Set<Selector>> invokedNames;
37 final Map<SourceString, Set<Selector>> invokedGetters; 37 final Map<SourceString, Set<Selector>> invokedGetters;
38 final Map<SourceString, Set<Selector>> invokedSetters; 38 final Map<SourceString, Set<Selector>> invokedSetters;
39 39
40 final List<Selector> trivialNsmHandlers;
ngeoffray 2013/03/11 09:41:27 It does not look right to put something here, that
erikcorry 2013/03/13 08:55:45 Moved to the emitter.
41
40 /** 42 /**
41 * Fields accessed. Currently only the codegen knows this 43 * Fields accessed. Currently only the codegen knows this
42 * information. The resolver is too conservative when seeing a 44 * information. The resolver is too conservative when seeing a
43 * getter and only registers an invoked getter. 45 * getter and only registers an invoked getter.
44 */ 46 */
45 final Set<Element> fieldGetters; 47 final Set<Element> fieldGetters;
46 48
47 /** 49 /**
48 * Fields set. See comment in [fieldGetters]. 50 * Fields set. See comment in [fieldGetters].
49 */ 51 */
50 final Set<Element> fieldSetters; 52 final Set<Element> fieldSetters;
51 final Set<DartType> isChecks; 53 final Set<DartType> isChecks;
52 54
53 Universe() : instantiatedClasses = new Set<ClassElement>(), 55 Universe() : instantiatedClasses = new Set<ClassElement>(),
54 instantiatedTypes = new Set<DartType>(), 56 instantiatedTypes = new Set<DartType>(),
55 staticFunctionsNeedingGetter = new Set<FunctionElement>(), 57 staticFunctionsNeedingGetter = new Set<FunctionElement>(),
56 invokedNames = new Map<SourceString, Set<Selector>>(), 58 invokedNames = new Map<SourceString, Set<Selector>>(),
57 invokedGetters = new Map<SourceString, Set<Selector>>(), 59 invokedGetters = new Map<SourceString, Set<Selector>>(),
58 invokedSetters = new Map<SourceString, Set<Selector>>(), 60 invokedSetters = new Map<SourceString, Set<Selector>>(),
61 trivialNsmHandlers = <Selector>[],
59 fieldGetters = new Set<Element>(), 62 fieldGetters = new Set<Element>(),
60 fieldSetters = new Set<Element>(), 63 fieldSetters = new Set<Element>(),
61 isChecks = new Set<DartType>(); 64 isChecks = new Set<DartType>();
62 65
63 bool hasMatchingSelector(Set<Selector> selectors, 66 bool hasMatchingSelector(Set<Selector> selectors,
64 Element member, 67 Element member,
65 Compiler compiler) { 68 Compiler compiler) {
66 if (selectors == null) return false; 69 if (selectors == null) return false;
67 for (Selector selector in selectors) { 70 for (Selector selector in selectors) {
68 if (selector.appliesUnnamed(member, compiler)) return true; 71 if (selector.appliesUnnamed(member, compiler)) return true;
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 ClassElement cls = self; 533 ClassElement cls = self;
531 if (cls.isSubclassOf(other)) { 534 if (cls.isSubclassOf(other)) {
532 // Resolve an invocation of [element.name] on [self]. If it 535 // Resolve an invocation of [element.name] on [self]. If it
533 // is found, this selector is a candidate. 536 // is found, this selector is a candidate.
534 return hasElementIn(cls, element) && appliesUntyped(element, compiler); 537 return hasElementIn(cls, element) && appliesUntyped(element, compiler);
535 } 538 }
536 } 539 }
537 return false; 540 return false;
538 } 541 }
539 } 542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698