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

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

Issue 12207081: Add a type kind to TypedSelector. A typed selector can either be (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 part of ssa; 5 part of ssa;
6 6
7 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (isFixedSizeListConstructor(node)) { 379 if (isFixedSizeListConstructor(node)) {
380 node.guaranteedType = HType.FIXED_ARRAY; 380 node.guaranteedType = HType.FIXED_ARRAY;
381 } 381 }
382 return node; 382 return node;
383 } 383 }
384 384
385 HInstruction visitInvokeDynamicMethod(HInvokeDynamicMethod node) { 385 HInstruction visitInvokeDynamicMethod(HInvokeDynamicMethod node) {
386 if (node.isInterceptorCall) return handleInterceptorCall(node); 386 if (node.isInterceptorCall) return handleInterceptorCall(node);
387 HType receiverType = types[node.receiver]; 387 HType receiverType = types[node.receiver];
388 if (receiverType.isExact()) { 388 if (receiverType.isExact()) {
389 HBoundedType type = receiverType; 389 Element element = receiverType.lookupMember(node.selector.name, compiler);
390 Element element = type.lookupMember(node.selector.name);
391 // TODO(ngeoffray): Also fold if it's a getter or variable. 390 // TODO(ngeoffray): Also fold if it's a getter or variable.
392 if (element != null && element.isFunction()) { 391 if (element != null && element.isFunction()) {
393 if (node.selector.applies(element, compiler)) { 392 if (node.selector.applies(element, compiler)) {
394 FunctionElement method = element; 393 FunctionElement method = element;
395 FunctionSignature parameters = method.computeSignature(compiler); 394 FunctionSignature parameters = method.computeSignature(compiler);
396 if (parameters.optionalParameterCount == 0) { 395 if (parameters.optionalParameterCount == 0) {
397 node.element = element; 396 node.element = element;
398 } 397 }
399 // TODO(ngeoffray): If the method has optional parameters, 398 // TODO(ngeoffray): If the method has optional parameters,
400 // we should pass the default values here. 399 // we should pass the default values here.
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 1268
1270 HTypeConversion newInput = new HTypeConversion(convertedType, input); 1269 HTypeConversion newInput = new HTypeConversion(convertedType, input);
1271 dominator.addBefore(dominator.first, newInput); 1270 dominator.addBefore(dominator.first, newInput);
1272 dominatedUsers.forEach((HInstruction user) { 1271 dominatedUsers.forEach((HInstruction user) {
1273 user.changeUse(input, newInput); 1272 user.changeUse(input, newInput);
1274 }); 1273 });
1275 } 1274 }
1276 1275
1277 void visitIs(HIs instruction) { 1276 void visitIs(HIs instruction) {
1278 HInstruction input = instruction.expression; 1277 HInstruction input = instruction.expression;
1279 HType convertedType = 1278 HType convertedType = new HType.nonNullSubtype(
1280 new HType.fromBoundedType(instruction.typeExpression, compiler); 1279 instruction.typeExpression, compiler);
1281 1280
1282 List<HInstruction> ifUsers = <HInstruction>[]; 1281 List<HInstruction> ifUsers = <HInstruction>[];
1283 List<HInstruction> notIfUsers = <HInstruction>[]; 1282 List<HInstruction> notIfUsers = <HInstruction>[];
1284 1283
1285 for (HInstruction user in instruction.usedBy) { 1284 for (HInstruction user in instruction.usedBy) {
1286 if (user is HIf) { 1285 if (user is HIf) {
1287 ifUsers.add(user); 1286 ifUsers.add(user);
1288 } else if (user is HNot) { 1287 } else if (user is HNot) {
1289 for (HInstruction notUser in user.usedBy) { 1288 for (HInstruction notUser in user.usedBy) {
1290 if (notUser is HIf) notIfUsers.add(notUser); 1289 if (notUser is HIf) notIfUsers.add(notUser);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 HBasicBlock block = user.block; 1535 HBasicBlock block = user.block;
1537 block.addAfter(user, interceptor); 1536 block.addAfter(user, interceptor);
1538 block.rewrite(user, interceptor); 1537 block.rewrite(user, interceptor);
1539 block.remove(user); 1538 block.remove(user);
1540 1539
1541 // The interceptor will be removed in the dead code elimination 1540 // The interceptor will be removed in the dead code elimination
1542 // phase. Note that removing it here would not work because of how 1541 // phase. Note that removing it here would not work because of how
1543 // the [visitBasicBlock] is implemented. 1542 // the [visitBasicBlock] is implemented.
1544 } 1543 }
1545 } 1544 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698