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

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

Issue 11795002: Revert "Retry "Emit more stuff via ASTs"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 '../tree/tree.dart'; 10 import '../tree/tree.dart';
11 import '../util/util.dart'; 11 import '../util/util.dart';
12 import '../js/js.dart' as js;
13 12
14 part 'function_set.dart'; 13 part 'function_set.dart';
15 part 'partial_type_tree.dart'; 14 part 'partial_type_tree.dart';
16 part 'selector_map.dart'; 15 part 'selector_map.dart';
17 16
18 class Universe { 17 class Universe {
19 /** 18 /**
20 * Documentation wanted -- johnniwinther 19 * Documentation wanted -- johnniwinther
21 * 20 *
22 * Invariant: Key elements are declaration elements. 21 * Invariant: Key elements are declaration elements.
23 */ 22 */
24 Map<Element, js.Expression> generatedCode; 23 Map<Element, CodeBuffer> generatedCode;
25 24
26 /** 25 /**
27 * Documentation wanted -- johnniwinther 26 * Documentation wanted -- johnniwinther
28 * 27 *
29 * Invariant: Key elements are declaration elements. 28 * Invariant: Key elements are declaration elements.
30 */ 29 */
31 Map<Element, js.Expression> generatedBailoutCode; 30 Map<Element, CodeBuffer> generatedBailoutCode;
32 31
33 /** 32 /**
34 * Documentation wanted -- johnniwinther 33 * Documentation wanted -- johnniwinther
35 * 34 *
36 * Invariant: Elements are declaration elements. 35 * Invariant: Elements are declaration elements.
37 */ 36 */
38 // TODO(karlklose): these sets should be merged. 37 // TODO(karlklose): these sets should be merged.
39 final Set<ClassElement> instantiatedClasses; 38 final Set<ClassElement> instantiatedClasses;
40 final Set<DartType> instantiatedTypes; 39 final Set<DartType> instantiatedTypes;
41 40
42 /** 41 /**
43 * Documentation wanted -- johnniwinther 42 * Documentation wanted -- johnniwinther
44 * 43 *
45 * Invariant: Elements are declaration elements. 44 * Invariant: Elements are declaration elements.
46 */ 45 */
47 final Set<FunctionElement> staticFunctionsNeedingGetter; 46 final Set<FunctionElement> staticFunctionsNeedingGetter;
48 final Map<SourceString, Set<Selector>> invokedNames; 47 final Map<SourceString, Set<Selector>> invokedNames;
49 final Map<SourceString, Set<Selector>> invokedGetters; 48 final Map<SourceString, Set<Selector>> invokedGetters;
50 final Map<SourceString, Set<Selector>> invokedSetters; 49 final Map<SourceString, Set<Selector>> invokedSetters;
51 final Map<SourceString, Set<Selector>> fieldGetters; 50 final Map<SourceString, Set<Selector>> fieldGetters;
52 final Map<SourceString, Set<Selector>> fieldSetters; 51 final Map<SourceString, Set<Selector>> fieldSetters;
53 final Set<DartType> isChecks; 52 final Set<DartType> isChecks;
54 53
55 Universe() : generatedCode = new Map<Element, js.Expression>(), 54 Universe() : generatedCode = new Map<Element, CodeBuffer>(),
56 generatedBailoutCode = new Map<Element, js.Expression>(), 55 generatedBailoutCode = new Map<Element, CodeBuffer>(),
57 instantiatedClasses = new Set<ClassElement>(), 56 instantiatedClasses = new Set<ClassElement>(),
58 instantiatedTypes = new Set<DartType>(), 57 instantiatedTypes = new Set<DartType>(),
59 staticFunctionsNeedingGetter = new Set<FunctionElement>(), 58 staticFunctionsNeedingGetter = new Set<FunctionElement>(),
60 invokedNames = new Map<SourceString, Set<Selector>>(), 59 invokedNames = new Map<SourceString, Set<Selector>>(),
61 invokedGetters = new Map<SourceString, Set<Selector>>(), 60 invokedGetters = new Map<SourceString, Set<Selector>>(),
62 invokedSetters = new Map<SourceString, Set<Selector>>(), 61 invokedSetters = new Map<SourceString, Set<Selector>>(),
63 fieldGetters = new Map<SourceString, Set<Selector>>(), 62 fieldGetters = new Map<SourceString, Set<Selector>>(),
64 fieldSetters = new Map<SourceString, Set<Selector>>(), 63 fieldSetters = new Map<SourceString, Set<Selector>>(),
65 isChecks = new Set<DartType>(); 64 isChecks = new Set<DartType>();
66 65
67 void addGeneratedCode(WorkItem work, js.Expression code) { 66 void addGeneratedCode(WorkItem work, CodeBuffer codeBuffer) {
68 assert(invariant(work.element, work.element.isDeclaration)); 67 assert(invariant(work.element, work.element.isDeclaration));
69 generatedCode[work.element] = code; 68 generatedCode[work.element] = codeBuffer;
70 } 69 }
71 70
72 void addBailoutCode(WorkItem work, js.Expression code) { 71 void addBailoutCode(WorkItem work, CodeBuffer codeBuffer) {
73 assert(invariant(work.element, work.element.isDeclaration)); 72 assert(invariant(work.element, work.element.isDeclaration));
74 generatedBailoutCode[work.element] = code; 73 generatedBailoutCode[work.element] = codeBuffer;
75 } 74 }
76 75
77 bool hasMatchingSelector(Set<Selector> selectors, 76 bool hasMatchingSelector(Set<Selector> selectors,
78 Element member, 77 Element member,
79 Compiler compiler) { 78 Compiler compiler) {
80 if (selectors == null) return false; 79 if (selectors == null) return false;
81 for (Selector selector in selectors) { 80 for (Selector selector in selectors) {
82 if (selector.applies(member, compiler)) return true; 81 if (selector.applies(member, compiler)) return true;
83 } 82 }
84 return false; 83 return false;
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 ClassElement cls = self; 464 ClassElement cls = self;
466 if (cls.isSubclassOf(other)) { 465 if (cls.isSubclassOf(other)) {
467 // Resolve an invocation of [element.name] on [self]. If it 466 // Resolve an invocation of [element.name] on [self]. If it
468 // is found, this selector is a candidate. 467 // is found, this selector is a candidate.
469 return hasElementIn(self, element) && appliesUntyped(element, compiler); 468 return hasElementIn(self, element) && appliesUntyped(element, compiler);
470 } 469 }
471 470
472 return false; 471 return false;
473 } 472 }
474 } 473 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/codegen.dart ('k') | tests/compiler/dart2js/class_codegen_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698