| 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 import '../closure.dart'; | 5 import '../closure.dart'; |
| 6 import '../common.dart'; | 6 import '../common.dart'; |
| 7 import '../common_elements.dart' show CommonElements; | 7 import '../common_elements.dart' show CommonElements; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 int length = inputs.length; | 1204 int length = inputs.length; |
| 1205 for (int i = 0; i < length; i++) { | 1205 for (int i = 0; i < length; i++) { |
| 1206 result = (result * 19) + (inputs[i].nonCheck().id) + (result >> 7); | 1206 result = (result * 19) + (inputs[i].nonCheck().id) + (result >> 7); |
| 1207 } | 1207 } |
| 1208 return result; | 1208 return result; |
| 1209 } | 1209 } |
| 1210 | 1210 |
| 1211 // These methods should be overwritten by instructions that | 1211 // These methods should be overwritten by instructions that |
| 1212 // participate in global value numbering. | 1212 // participate in global value numbering. |
| 1213 int typeCode() => HInstruction.UNDEFINED_TYPECODE; | 1213 int typeCode() => HInstruction.UNDEFINED_TYPECODE; |
| 1214 bool typeEquals(HInstruction other) => false; | 1214 bool typeEquals(covariant HInstruction other) => false; |
| 1215 bool dataEquals(HInstruction other) => false; | 1215 bool dataEquals(covariant HInstruction other) => false; |
| 1216 | 1216 |
| 1217 accept(HVisitor visitor); | 1217 accept(HVisitor visitor); |
| 1218 | 1218 |
| 1219 void notifyAddedToBlock(HBasicBlock targetBlock) { | 1219 void notifyAddedToBlock(HBasicBlock targetBlock) { |
| 1220 assert(!isInBasicBlock()); | 1220 assert(!isInBasicBlock()); |
| 1221 assert(block == null); | 1221 assert(block == null); |
| 1222 // Add [this] to the inputs' uses. | 1222 // Add [this] to the inputs' uses. |
| 1223 for (int i = 0; i < inputs.length; i++) { | 1223 for (int i = 0; i < inputs.length; i++) { |
| 1224 assert(inputs[i].isInBasicBlock()); | 1224 assert(inputs[i].isInBasicBlock()); |
| 1225 inputs[i].usedBy.add(this); | 1225 inputs[i].usedBy.add(this); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1688 | 1688 |
| 1689 abstract class HInvokeDynamic extends HInvoke { | 1689 abstract class HInvokeDynamic extends HInvoke { |
| 1690 final InvokeDynamicSpecializer specializer; | 1690 final InvokeDynamicSpecializer specializer; |
| 1691 Selector selector; | 1691 Selector selector; |
| 1692 TypeMask mask; | 1692 TypeMask mask; |
| 1693 MemberEntity element; | 1693 MemberEntity element; |
| 1694 | 1694 |
| 1695 HInvokeDynamic(Selector selector, this.mask, this.element, | 1695 HInvokeDynamic(Selector selector, this.mask, this.element, |
| 1696 List<HInstruction> inputs, TypeMask type, | 1696 List<HInstruction> inputs, TypeMask type, |
| 1697 [bool isIntercepted = false]) | 1697 [bool isIntercepted = false]) |
| 1698 : super(inputs, type), | 1698 : this.selector = selector, |
| 1699 this.selector = selector, | |
| 1700 specializer = isIntercepted | 1699 specializer = isIntercepted |
| 1701 ? InvokeDynamicSpecializer.lookupSpecializer(selector) | 1700 ? InvokeDynamicSpecializer.lookupSpecializer(selector) |
| 1702 : const InvokeDynamicSpecializer(); | 1701 : const InvokeDynamicSpecializer(), |
| 1702 super(inputs, type); |
| 1703 toString() => 'invoke dynamic: selector=$selector, mask=$mask'; | 1703 toString() => 'invoke dynamic: selector=$selector, mask=$mask'; |
| 1704 HInstruction get receiver => inputs[0]; | 1704 HInstruction get receiver => inputs[0]; |
| 1705 HInstruction getDartReceiver(ClosedWorld closedWorld) { | 1705 HInstruction getDartReceiver(ClosedWorld closedWorld) { |
| 1706 return isCallOnInterceptor(closedWorld) ? inputs[1] : inputs[0]; | 1706 return isCallOnInterceptor(closedWorld) ? inputs[1] : inputs[0]; |
| 1707 } | 1707 } |
| 1708 | 1708 |
| 1709 /** | 1709 /** |
| 1710 * Returns whether this call is on an interceptor object. | 1710 * Returns whether this call is on an interceptor object. |
| 1711 */ | 1711 */ |
| 1712 bool isCallOnInterceptor(ClosedWorld closedWorld) { | 1712 bool isCallOnInterceptor(ClosedWorld closedWorld) { |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2505 } | 2505 } |
| 2506 | 2506 |
| 2507 toString() => 'parameter ${sourceElement.name}'; | 2507 toString() => 'parameter ${sourceElement.name}'; |
| 2508 accept(HVisitor visitor) => visitor.visitParameterValue(this); | 2508 accept(HVisitor visitor) => visitor.visitParameterValue(this); |
| 2509 } | 2509 } |
| 2510 | 2510 |
| 2511 class HThis extends HParameterValue { | 2511 class HThis extends HParameterValue { |
| 2512 HThis(ThisLocal element, TypeMask type) : super(element, type); | 2512 HThis(ThisLocal element, TypeMask type) : super(element, type); |
| 2513 | 2513 |
| 2514 ThisLocal get sourceElement => super.sourceElement; | 2514 ThisLocal get sourceElement => super.sourceElement; |
| 2515 void set sourceElement(ThisLocal local) { | 2515 void set sourceElement(covariant ThisLocal local) { |
| 2516 super.sourceElement = local; | 2516 super.sourceElement = local; |
| 2517 } | 2517 } |
| 2518 | 2518 |
| 2519 accept(HVisitor visitor) => visitor.visitThis(this); | 2519 accept(HVisitor visitor) => visitor.visitThis(this); |
| 2520 | 2520 |
| 2521 bool isCodeMotionInvariant() => true; | 2521 bool isCodeMotionInvariant() => true; |
| 2522 | 2522 |
| 2523 bool isInterceptor(ClosedWorld closedWorld) { | 2523 bool isInterceptor(ClosedWorld closedWorld) { |
| 2524 return closedWorld.interceptorData | 2524 return closedWorld.interceptorData |
| 2525 .isInterceptedClass(sourceElement.enclosingClass); | 2525 .isInterceptedClass(sourceElement.enclosingClass); |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 : checkedType = type, | 2994 : checkedType = type, |
| 2995 super(<HInstruction>[input], type) { | 2995 super(<HInstruction>[input], type) { |
| 2996 assert(!isReceiverTypeCheck || receiverTypeCheckSelector != null); | 2996 assert(!isReceiverTypeCheck || receiverTypeCheckSelector != null); |
| 2997 assert(typeExpression == null || !typeExpression.isTypedef); | 2997 assert(typeExpression == null || !typeExpression.isTypedef); |
| 2998 sourceElement = input.sourceElement; | 2998 sourceElement = input.sourceElement; |
| 2999 } | 2999 } |
| 3000 | 3000 |
| 3001 HTypeConversion.withTypeRepresentation(this.typeExpression, this.kind, | 3001 HTypeConversion.withTypeRepresentation(this.typeExpression, this.kind, |
| 3002 TypeMask type, HInstruction input, HInstruction typeRepresentation) | 3002 TypeMask type, HInstruction input, HInstruction typeRepresentation) |
| 3003 : checkedType = type, | 3003 : checkedType = type, |
| 3004 super(<HInstruction>[input, typeRepresentation], type), | 3004 receiverTypeCheckSelector = null, |
| 3005 receiverTypeCheckSelector = null { | 3005 super(<HInstruction>[input, typeRepresentation], type) { |
| 3006 assert(!typeExpression.isTypedef); | 3006 assert(!typeExpression.isTypedef); |
| 3007 sourceElement = input.sourceElement; | 3007 sourceElement = input.sourceElement; |
| 3008 } | 3008 } |
| 3009 | 3009 |
| 3010 HTypeConversion.viaMethodOnType(this.typeExpression, this.kind, TypeMask type, | 3010 HTypeConversion.viaMethodOnType(this.typeExpression, this.kind, TypeMask type, |
| 3011 HInstruction reifiedType, HInstruction input) | 3011 HInstruction reifiedType, HInstruction input) |
| 3012 : checkedType = type, | 3012 : checkedType = type, |
| 3013 super(<HInstruction>[reifiedType, input], type), | 3013 receiverTypeCheckSelector = null, |
| 3014 receiverTypeCheckSelector = null { | 3014 super(<HInstruction>[reifiedType, input], type) { |
| 3015 // This form is currently used only for function types. | 3015 // This form is currently used only for function types. |
| 3016 assert(typeExpression.isFunctionType); | 3016 assert(typeExpression.isFunctionType); |
| 3017 assert(kind == CHECKED_MODE_CHECK || kind == CAST_TYPE_CHECK); | 3017 assert(kind == CHECKED_MODE_CHECK || kind == CAST_TYPE_CHECK); |
| 3018 sourceElement = input.sourceElement; | 3018 sourceElement = input.sourceElement; |
| 3019 } | 3019 } |
| 3020 | 3020 |
| 3021 bool get hasTypeRepresentation { | 3021 bool get hasTypeRepresentation { |
| 3022 return typeExpression.isInterfaceType && inputs.length > 1; | 3022 return typeExpression.isInterfaceType && inputs.length > 1; |
| 3023 } | 3023 } |
| 3024 | 3024 |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3544 // ignore: MISSING_RETURN | 3544 // ignore: MISSING_RETURN |
| 3545 String get kindAsString { | 3545 String get kindAsString { |
| 3546 switch (kind) { | 3546 switch (kind) { |
| 3547 case TypeInfoExpressionKind.COMPLETE: | 3547 case TypeInfoExpressionKind.COMPLETE: |
| 3548 return 'COMPLETE'; | 3548 return 'COMPLETE'; |
| 3549 case TypeInfoExpressionKind.INSTANCE: | 3549 case TypeInfoExpressionKind.INSTANCE: |
| 3550 return 'INSTANCE'; | 3550 return 'INSTANCE'; |
| 3551 } | 3551 } |
| 3552 } | 3552 } |
| 3553 } | 3553 } |
| OLD | NEW |