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

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

Issue 11478022: Implement is-checks with typedefs for callable objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // If the intersection of the types is still the incoming type then 504 // If the intersection of the types is still the incoming type then
505 // the incoming type was a subtype of the guarded type, and no check 505 // the incoming type was a subtype of the guarded type, and no check
506 // is required. 506 // is required.
507 HType combinedType = types[value].intersection(node.guardedType, compiler); 507 HType combinedType = types[value].intersection(node.guardedType, compiler);
508 return (combinedType == types[value]) ? value : node; 508 return (combinedType == types[value]) ? value : node;
509 } 509 }
510 510
511 HInstruction visitIs(HIs node) { 511 HInstruction visitIs(HIs node) {
512 DartType type = node.typeExpression; 512 DartType type = node.typeExpression;
513 Element element = type.element; 513 Element element = type.element;
514 if (identical(element.kind, ElementKind.TYPE_VARIABLE)) { 514 if (element.isTypeVariable()) {
515 compiler.unimplemented("visitIs for type variables"); 515 compiler.unimplemented("visitIs for type variables");
516 } if (element.isTypedef()) {
517 return node;
516 } 518 }
517 519
518 HType expressionType = types[node.expression]; 520 HType expressionType = types[node.expression];
519 if (identical(element, compiler.objectClass) 521 if (identical(element, compiler.objectClass)
520 || identical(element, compiler.dynamicClass)) { 522 || identical(element, compiler.dynamicClass)) {
521 return graph.addConstantBool(true, constantSystem); 523 return graph.addConstantBool(true, constantSystem);
522 } else if (expressionType.isInteger()) { 524 } else if (expressionType.isInteger()) {
523 if (identical(element, compiler.intClass) 525 if (identical(element, compiler.intClass)
524 || identical(element, compiler.numClass) 526 || identical(element, compiler.numClass)
525 || Elements.isNumberOrStringSupertype(element, compiler)) { 527 || Elements.isNumberOrStringSupertype(element, compiler)) {
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 HInstruction receiver = interceptor.receiver; 1479 HInstruction receiver = interceptor.receiver;
1478 for (var user in receiver.usedBy) { 1480 for (var user in receiver.usedBy) {
1479 if (user is HInterceptor && interceptor.dominates(user)) { 1481 if (user is HInterceptor && interceptor.dominates(user)) {
1480 user.interceptedClasses = interceptor.interceptedClasses; 1482 user.interceptedClasses = interceptor.interceptedClasses;
1481 } 1483 }
1482 } 1484 }
1483 } 1485 }
1484 1486
1485 // TODO(ngeoffray): Also implement it for non-intercepted calls. 1487 // TODO(ngeoffray): Also implement it for non-intercepted calls.
1486 } 1488 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698