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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/codegen.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 class SsaCodeGeneratorTask extends CompilerTask { 7 class SsaCodeGeneratorTask extends CompilerTask {
8 8
9 final JavaScriptBackend backend; 9 final JavaScriptBackend backend;
10 10
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 Selector defaultSelector) { 1560 Selector defaultSelector) {
1561 // If [JSInvocationMirror.invokeOn] has been called, we must not create a 1561 // If [JSInvocationMirror.invokeOn] has been called, we must not create a
1562 // typed selector based on the receiver type. 1562 // typed selector based on the receiver type.
1563 if (node.element == null && // Invocation is not exact. 1563 if (node.element == null && // Invocation is not exact.
1564 backend.compiler.enabledInvokeOn) { 1564 backend.compiler.enabledInvokeOn) {
1565 return defaultSelector; 1565 return defaultSelector;
1566 } 1566 }
1567 int receiverIndex = node.isInterceptorCall ? 1 : 0; 1567 int receiverIndex = node.isInterceptorCall ? 1 : 0;
1568 HType receiverHType = types[node.inputs[receiverIndex]]; 1568 HType receiverHType = types[node.inputs[receiverIndex]];
1569 DartType receiverType = receiverHType.computeType(compiler); 1569 DartType receiverType = receiverHType.computeType(compiler);
1570 if (receiverType != null && 1570 if (receiverType != null && !receiverType.isMalformed) {
1571 !identical(receiverType.kind, TypeKind.MALFORMED_TYPE)) { 1571 TypedSelectorKind kind;
1572 return new TypedSelector(receiverType, defaultSelector); 1572 if (receiverHType.isExact()) {
1573 kind = TypedSelectorKind.EXACT;
1574 } else if (receiverHType.isInterfaceType()) {
1575 kind = TypedSelectorKind.INTERFACE;
1576 } else {
1577 kind = TypedSelectorKind.SUBCLASS;
1578 }
1579 return new TypedSelector(receiverType, kind, defaultSelector);
1573 } else { 1580 } else {
1574 return defaultSelector; 1581 return defaultSelector;
1575 } 1582 }
1576 } 1583 }
1577 1584
1578 void registerInvoke(HInvokeDynamic node) { 1585 void registerInvoke(HInvokeDynamic node) {
1579 bool inLoop = node.block.enclosingLoopHeader != null; 1586 bool inLoop = node.block.enclosingLoopHeader != null;
1580 SourceString name = node.selector.name; 1587 SourceString name = node.selector.name;
1581 if (inLoop) { 1588 if (inLoop) {
1582 Element target = node.element; 1589 Element target = node.element;
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
2997 if (leftType.canBeNull() && rightType.canBeNull()) { 3004 if (leftType.canBeNull() && rightType.canBeNull()) {
2998 if (left.isConstantNull() || right.isConstantNull() || 3005 if (left.isConstantNull() || right.isConstantNull() ||
2999 (leftType.isPrimitive() && leftType == rightType)) { 3006 (leftType.isPrimitive() && leftType == rightType)) {
3000 return '=='; 3007 return '==';
3001 } 3008 }
3002 return null; 3009 return null;
3003 } else { 3010 } else {
3004 return '==='; 3011 return '===';
3005 } 3012 }
3006 } 3013 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698