Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 TypedSelector optimizedSelector; |
| 1572 return new TypedSelector(receiverType, defaultSelector); | 1572 if (receiverHType.isExact()) { |
| 1573 optimizedSelector = new TypedSelector.exact( | |
|
kasperl
2013/02/11 13:11:50
How about just returning it here and get rid of th
ngeoffray
2013/02/11 14:20:29
Done.
| |
| 1574 receiverType, defaultSelector); | |
| 1575 } else if (receiverHType.isInterfaceType()) { | |
| 1576 optimizedSelector = new TypedSelector.subtype( | |
| 1577 receiverType, defaultSelector); | |
| 1578 } else { | |
| 1579 optimizedSelector = new TypedSelector.subclass( | |
| 1580 receiverType, defaultSelector); | |
| 1581 } | |
| 1582 return optimizedSelector; | |
| 1573 } else { | 1583 } else { |
| 1574 return defaultSelector; | 1584 return defaultSelector; |
| 1575 } | 1585 } |
| 1576 } | 1586 } |
| 1577 | 1587 |
| 1578 void registerInvoke(HInvokeDynamic node) { | 1588 void registerInvoke(HInvokeDynamic node) { |
| 1579 bool inLoop = node.block.enclosingLoopHeader != null; | 1589 bool inLoop = node.block.enclosingLoopHeader != null; |
| 1580 SourceString name = node.selector.name; | 1590 SourceString name = node.selector.name; |
| 1581 if (inLoop) { | 1591 if (inLoop) { |
| 1582 Element target = node.element; | 1592 Element target = node.element; |
| (...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2997 if (leftType.canBeNull() && rightType.canBeNull()) { | 3007 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2998 if (left.isConstantNull() || right.isConstantNull() || | 3008 if (left.isConstantNull() || right.isConstantNull() || |
| 2999 (leftType.isPrimitive() && leftType == rightType)) { | 3009 (leftType.isPrimitive() && leftType == rightType)) { |
| 3000 return '=='; | 3010 return '=='; |
| 3001 } | 3011 } |
| 3002 return null; | 3012 return null; |
| 3003 } else { | 3013 } else { |
| 3004 return '==='; | 3014 return '==='; |
| 3005 } | 3015 } |
| 3006 } | 3016 } |
| OLD | NEW |