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

Side by Side Diff: pkg/compiler/lib/src/dart_backend/backend.dart

Issue 1182913003: Split TypedSelector into Selector and TypeMask. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 5 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
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 dart_backend; 5 part of dart_backend;
6 6
7 // TODO(ahe): This class is simply wrong. This backend should use 7 // TODO(ahe): This class is simply wrong. This backend should use
8 // elements when it can, not AST nodes. Perhaps a [Map<Element, 8 // elements when it can, not AST nodes. Perhaps a [Map<Element,
9 // TreeElements>] is what is needed. 9 // TreeElements>] is what is needed.
10 class ElementAst { 10 class ElementAst {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 final LITERAL_TYPE_NAMES = const [ 122 final LITERAL_TYPE_NAMES = const [
123 'Map', 'List', 'num', 'int', 'double', 'bool' 123 'Map', 'List', 'num', 'int', 'double', 'bool'
124 ]; 124 ];
125 final coreLibrary = compiler.coreLibrary; 125 final coreLibrary = compiler.coreLibrary;
126 for (final name in LITERAL_TYPE_NAMES) { 126 for (final name in LITERAL_TYPE_NAMES) {
127 ClassElement classElement = coreLibrary.findLocal(name); 127 ClassElement classElement = coreLibrary.findLocal(name);
128 classElement.ensureResolved(compiler); 128 classElement.ensureResolved(compiler);
129 } 129 }
130 // Enqueue the methods that the VM might invoke on user objects because 130 // Enqueue the methods that the VM might invoke on user objects because
131 // we don't trust the resolution to always get these included. 131 // we don't trust the resolution to always get these included.
132 world.registerInvocation(new Selector.call("toString", null, 0)); 132 world.registerInvocation(
133 world.registerInvokedGetter(new Selector.getter("hashCode", null)); 133 new UniverseSelector(new Selector.call("toString", null, 0), null));
134 world.registerInvocation(new Selector.binaryOperator("==")); 134 world.registerInvokedGetter(
135 world.registerInvocation(new Selector.call("compareTo", null, 1)); 135 new UniverseSelector(new Selector.getter("hashCode", null), null));
136 world.registerInvocation(
137 new UniverseSelector(new Selector.binaryOperator("=="), null));
138 world.registerInvocation(
139 new UniverseSelector(new Selector.call("compareTo", null, 1), null));
136 } 140 }
137 141
138 WorldImpact codegen(CodegenWorkItem work) => const WorldImpact(); 142 WorldImpact codegen(CodegenWorkItem work) => const WorldImpact();
139 143
140 /** 144 /**
141 * Tells whether we should output given element. Corelib classes like 145 * Tells whether we should output given element. Corelib classes like
142 * Object should not be in the resulting code. 146 * Object should not be in the resulting code.
143 */ 147 */
144 @override 148 @override
145 bool shouldOutput(Element element) { 149 bool shouldOutput(Element element) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // Register selectors for all instance methods since these might 297 // Register selectors for all instance methods since these might
294 // be called on user classes from within the platform 298 // be called on user classes from within the platform
295 // implementation. 299 // implementation.
296 superclass.forEachLocalMember((MemberElement element) { 300 superclass.forEachLocalMember((MemberElement element) {
297 if (element.isConstructor || element.isStatic) return; 301 if (element.isConstructor || element.isStatic) return;
298 302
299 FunctionElement function = element.asFunctionElement(); 303 FunctionElement function = element.asFunctionElement();
300 element.computeType(compiler); 304 element.computeType(compiler);
301 Selector selector = new Selector.fromElement(element); 305 Selector selector = new Selector.fromElement(element);
302 if (selector.isGetter) { 306 if (selector.isGetter) {
303 registry.registerDynamicGetter(selector); 307 registry.registerDynamicGetter(
308 new UniverseSelector(selector, null));
304 } else if (selector.isSetter) { 309 } else if (selector.isSetter) {
305 registry.registerDynamicSetter(selector); 310 registry.registerDynamicSetter(
311 new UniverseSelector(selector, null));
306 } else { 312 } else {
307 registry.registerDynamicInvocation(selector); 313 registry.registerDynamicInvocation(
314 new UniverseSelector(selector, null));
308 } 315 }
309 }); 316 });
310 } 317 }
311 } 318 }
312 } 319 }
313 } 320 }
314 321
315 } 322 }
316 323
317 @override 324 @override
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 508 }
502 509
503 // TODO(johnniwinther): Remove this when values are computed from the 510 // TODO(johnniwinther): Remove this when values are computed from the
504 // expressions. 511 // expressions.
505 @override 512 @override
506 void copyConstantValues(DartConstantTask task) { 513 void copyConstantValues(DartConstantTask task) {
507 constantCompiler.constantValueMap.addAll( 514 constantCompiler.constantValueMap.addAll(
508 task.constantCompiler.constantValueMap); 515 task.constantCompiler.constantValueMap);
509 } 516 }
510 } 517 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/dart_backend/dart_backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698