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

Side by Side Diff: pkg/compiler/lib/src/universe/function_set.dart

Issue 1299413002: Move common identifiers, names and selectors to a separate library. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 4 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/ssa.dart ('k') | pkg/compiler/lib/src/universe/universe.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of universe; 5 part of universe;
6 6
7 // TODO(kasperl): This actually holds getters and setters just fine 7 // TODO(kasperl): This actually holds getters and setters just fine
8 // too and stricly they aren't functions. Maybe this needs a better 8 // too and stricly they aren't functions. Maybe this needs a better
9 // name -- something like ElementSet seems a bit too generic. 9 // name -- something like ElementSet seems a bit too generic.
10 class FunctionSet { 10 class FunctionSet {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return query(selector, mask).functions; 52 return query(selector, mask).functions;
53 } 53 }
54 54
55 TypeMask receiverType(Selector selector, TypeMask mask) { 55 TypeMask receiverType(Selector selector, TypeMask mask) {
56 return query(selector, mask).computeMask(compiler.world); 56 return query(selector, mask).computeMask(compiler.world);
57 } 57 }
58 58
59 FunctionSetQuery query(Selector selector, TypeMask mask) { 59 FunctionSetQuery query(Selector selector, TypeMask mask) {
60 String name = selector.name; 60 String name = selector.name;
61 FunctionSetNode node = nodes[name]; 61 FunctionSetNode node = nodes[name];
62 FunctionSetNode noSuchMethods = nodes[Compiler.NO_SUCH_METHOD]; 62 FunctionSetNode noSuchMethods = nodes[Identifiers.noSuchMethod_];
63 if (node != null) { 63 if (node != null) {
64 return node.query(selector, mask, compiler, noSuchMethods); 64 return node.query(selector, mask, compiler, noSuchMethods);
65 } 65 }
66 // If there is no method that matches [selector] we know we can 66 // If there is no method that matches [selector] we know we can
67 // only hit [:noSuchMethod:]. 67 // only hit [:noSuchMethod:].
68 if (noSuchMethods == null) return const FunctionSetQuery(const <Element>[]); 68 if (noSuchMethods == null) return const FunctionSetQuery(const <Element>[]);
69 return noSuchMethods.query( 69 return noSuchMethods.query(
70 compiler.noSuchMethodSelector, mask, compiler, null); 70 Selectors.noSuchMethod_, mask, compiler, null);
71 } 71 }
72 72
73 void forEach(Function action) { 73 void forEach(Function action) {
74 nodes.forEach((String name, FunctionSetNode node) { 74 nodes.forEach((String name, FunctionSetNode node) {
75 node.forEach(action); 75 node.forEach(action);
76 }); 76 });
77 } 77 }
78 } 78 }
79 79
80 class SelectorMask { 80 class SelectorMask {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 functions.add(element); 197 functions.add(element);
198 } 198 }
199 } 199 }
200 200
201 // If we cannot ensure a method will be found at runtime, we also 201 // If we cannot ensure a method will be found at runtime, we also
202 // add [noSuchMethod] implementations that apply to [mask] as 202 // add [noSuchMethod] implementations that apply to [mask] as
203 // potential targets. 203 // potential targets.
204 if (noSuchMethods != null 204 if (noSuchMethods != null
205 && mask.needsNoSuchMethodHandling(selector, classWorld)) { 205 && mask.needsNoSuchMethodHandling(selector, classWorld)) {
206 FunctionSetQuery noSuchMethodQuery = noSuchMethods.query( 206 FunctionSetQuery noSuchMethodQuery = noSuchMethods.query(
207 compiler.noSuchMethodSelector, 207 Selectors.noSuchMethod_,
208 mask, 208 mask,
209 compiler, 209 compiler,
210 null); 210 null);
211 if (!noSuchMethodQuery.functions.isEmpty) { 211 if (!noSuchMethodQuery.functions.isEmpty) {
212 if (functions == null) { 212 if (functions == null) {
213 functions = new Setlet<Element>.from(noSuchMethodQuery.functions); 213 functions = new Setlet<Element>.from(noSuchMethodQuery.functions);
214 } else { 214 } else {
215 functions.addAll(noSuchMethodQuery.functions); 215 functions.addAll(noSuchMethodQuery.functions);
216 } 216 }
217 } 217 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return const TypeMask.empty(); 255 return const TypeMask.empty();
256 } else { 256 } else {
257 return new TypeMask.nonNullSubclass(cls.declaration, classWorld); 257 return new TypeMask.nonNullSubclass(cls.declaration, classWorld);
258 } 258 }
259 }), 259 }),
260 classWorld); 260 classWorld);
261 } 261 }
262 262
263 FullFunctionSetQuery(functions) : super(functions); 263 FullFunctionSetQuery(functions) : super(functions);
264 } 264 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/ssa.dart ('k') | pkg/compiler/lib/src/universe/universe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698