| 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 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import '../common.dart'; | 6 import '../common.dart'; |
| 7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 7 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 8 import '../common/tasks.dart' show CompilerTask; | 8 import '../common/tasks.dart' show CompilerTask; |
| 9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
| 10 import '../constants/constant_system.dart'; | 10 import '../constants/constant_system.dart'; |
| (...skipping 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 use(node.receiver); | 1822 use(node.receiver); |
| 1823 push(js | 1823 push(js |
| 1824 .propertyCall(pop(), backend.namer.invocationName(call), | 1824 .propertyCall(pop(), backend.namer.invocationName(call), |
| 1825 visitArguments(node.inputs)) | 1825 visitArguments(node.inputs)) |
| 1826 .withSourceInformation(node.sourceInformation)); | 1826 .withSourceInformation(node.sourceInformation)); |
| 1827 registry.registerDynamicUse(new DynamicUse(call, null)); | 1827 registry.registerDynamicUse(new DynamicUse(call, null)); |
| 1828 } | 1828 } |
| 1829 | 1829 |
| 1830 visitInvokeStatic(HInvokeStatic node) { | 1830 visitInvokeStatic(HInvokeStatic node) { |
| 1831 MemberEntity element = node.element; | 1831 MemberEntity element = node.element; |
| 1832 List<DartType> instantiatedTypes = node.instantiatedTypes; | 1832 List<ResolutionDartType> instantiatedTypes = node.instantiatedTypes; |
| 1833 | 1833 |
| 1834 if (instantiatedTypes != null && !instantiatedTypes.isEmpty) { | 1834 if (instantiatedTypes != null && !instantiatedTypes.isEmpty) { |
| 1835 instantiatedTypes.forEach((type) { | 1835 instantiatedTypes.forEach((type) { |
| 1836 registry.registerInstantiation(type); | 1836 registry.registerInstantiation(type); |
| 1837 }); | 1837 }); |
| 1838 } | 1838 } |
| 1839 | 1839 |
| 1840 List<js.Expression> arguments = visitArguments(node.inputs, start: 0); | 1840 List<js.Expression> arguments = visitArguments(node.inputs, start: 0); |
| 1841 | 1841 |
| 1842 if (element == backend.helpers.checkConcurrentModificationError) { | 1842 if (element == backend.helpers.checkConcurrentModificationError) { |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2557 void checkNull(HInstruction input) { | 2557 void checkNull(HInstruction input) { |
| 2558 use(input); | 2558 use(input); |
| 2559 push(new js.Binary('==', pop(), new js.LiteralNull())); | 2559 push(new js.Binary('==', pop(), new js.LiteralNull())); |
| 2560 } | 2560 } |
| 2561 | 2561 |
| 2562 void checkNonNull(HInstruction input) { | 2562 void checkNonNull(HInstruction input) { |
| 2563 use(input); | 2563 use(input); |
| 2564 push(new js.Binary('!=', pop(), new js.LiteralNull())); | 2564 push(new js.Binary('!=', pop(), new js.LiteralNull())); |
| 2565 } | 2565 } |
| 2566 | 2566 |
| 2567 void checkType(HInstruction input, HInstruction interceptor, DartType type, | 2567 void checkType(HInstruction input, HInstruction interceptor, |
| 2568 SourceInformation sourceInformation, | 2568 ResolutionDartType type, SourceInformation sourceInformation, |
| 2569 {bool negative: false}) { | 2569 {bool negative: false}) { |
| 2570 if (type.isInterfaceType) { | 2570 if (type.isInterfaceType) { |
| 2571 InterfaceType interfaceType = type; | 2571 ResolutionInterfaceType interfaceType = type; |
| 2572 ClassEntity element = interfaceType.element; | 2572 ClassEntity element = interfaceType.element; |
| 2573 if (element == helpers.jsArrayClass) { | 2573 if (element == helpers.jsArrayClass) { |
| 2574 checkArray(input, negative ? '!==' : '==='); | 2574 checkArray(input, negative ? '!==' : '==='); |
| 2575 return; | 2575 return; |
| 2576 } else if (element == helpers.jsMutableArrayClass) { | 2576 } else if (element == helpers.jsMutableArrayClass) { |
| 2577 if (negative) { | 2577 if (negative) { |
| 2578 checkImmutableArray(input); | 2578 checkImmutableArray(input); |
| 2579 } else { | 2579 } else { |
| 2580 checkMutableArray(input); | 2580 checkMutableArray(input); |
| 2581 } | 2581 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2604 } | 2604 } |
| 2605 } | 2605 } |
| 2606 if (interceptor != null) { | 2606 if (interceptor != null) { |
| 2607 checkTypeViaProperty(interceptor, type, sourceInformation, | 2607 checkTypeViaProperty(interceptor, type, sourceInformation, |
| 2608 negative: negative); | 2608 negative: negative); |
| 2609 } else { | 2609 } else { |
| 2610 checkTypeViaProperty(input, type, sourceInformation, negative: negative); | 2610 checkTypeViaProperty(input, type, sourceInformation, negative: negative); |
| 2611 } | 2611 } |
| 2612 } | 2612 } |
| 2613 | 2613 |
| 2614 void checkTypeViaProperty( | 2614 void checkTypeViaProperty(HInstruction input, ResolutionDartType type, |
| 2615 HInstruction input, DartType type, SourceInformation sourceInformation, | 2615 SourceInformation sourceInformation, |
| 2616 {bool negative: false}) { | 2616 {bool negative: false}) { |
| 2617 registry.registerTypeUse(new TypeUse.isCheck(type)); | 2617 registry.registerTypeUse(new TypeUse.isCheck(type)); |
| 2618 | 2618 |
| 2619 use(input); | 2619 use(input); |
| 2620 | 2620 |
| 2621 js.PropertyAccess field = | 2621 js.PropertyAccess field = |
| 2622 new js.PropertyAccess(pop(), backend.namer.operatorIsType(type)) | 2622 new js.PropertyAccess(pop(), backend.namer.operatorIsType(type)) |
| 2623 .withSourceInformation(sourceInformation); | 2623 .withSourceInformation(sourceInformation); |
| 2624 // We always negate at least once so that the result is boolified. | 2624 // We always negate at least once so that the result is boolified. |
| 2625 push(new js.Prefix('!', field).withSourceInformation(sourceInformation)); | 2625 push(new js.Prefix('!', field).withSourceInformation(sourceInformation)); |
| 2626 // If the result is not negated, put another '!' in front. | 2626 // If the result is not negated, put another '!' in front. |
| 2627 if (!negative) { | 2627 if (!negative) { |
| 2628 push(new js.Prefix('!', pop()).withSourceInformation(sourceInformation)); | 2628 push(new js.Prefix('!', pop()).withSourceInformation(sourceInformation)); |
| 2629 } | 2629 } |
| 2630 } | 2630 } |
| 2631 | 2631 |
| 2632 void checkTypeViaInstanceof( | 2632 void checkTypeViaInstanceof(HInstruction input, ResolutionDartType type, |
| 2633 HInstruction input, DartType type, SourceInformation sourceInformation, | 2633 SourceInformation sourceInformation, |
| 2634 {bool negative: false}) { | 2634 {bool negative: false}) { |
| 2635 registry.registerTypeUse(new TypeUse.isCheck(type)); | 2635 registry.registerTypeUse(new TypeUse.isCheck(type)); |
| 2636 | 2636 |
| 2637 use(input); | 2637 use(input); |
| 2638 | 2638 |
| 2639 js.Expression jsClassReference = | 2639 js.Expression jsClassReference = |
| 2640 backend.emitter.constructorAccess(type.element); | 2640 backend.emitter.constructorAccess(type.element); |
| 2641 push(js.js('# instanceof #', | 2641 push(js.js('# instanceof #', |
| 2642 [pop(), jsClassReference]).withSourceInformation(sourceInformation)); | 2642 [pop(), jsClassReference]).withSourceInformation(sourceInformation)); |
| 2643 if (negative) { | 2643 if (negative) { |
| 2644 push(new js.Prefix('!', pop()).withSourceInformation(sourceInformation)); | 2644 push(new js.Prefix('!', pop()).withSourceInformation(sourceInformation)); |
| 2645 } | 2645 } |
| 2646 registry.registerInstantiation(type); | 2646 registry.registerInstantiation(type); |
| 2647 } | 2647 } |
| 2648 | 2648 |
| 2649 void handleNumberOrStringSupertypeCheck( | 2649 void handleNumberOrStringSupertypeCheck( |
| 2650 HInstruction input, | 2650 HInstruction input, |
| 2651 HInstruction interceptor, | 2651 HInstruction interceptor, |
| 2652 DartType type, | 2652 ResolutionDartType type, |
| 2653 SourceInformation sourceInformation, | 2653 SourceInformation sourceInformation, |
| 2654 {bool negative: false}) { | 2654 {bool negative: false}) { |
| 2655 assert(!identical(type.element, commonElements.listClass) && | 2655 assert(!identical(type.element, commonElements.listClass) && |
| 2656 !commonElements.isListSupertype(type.element) && | 2656 !commonElements.isListSupertype(type.element) && |
| 2657 !commonElements.isStringOnlySupertype(type.element)); | 2657 !commonElements.isStringOnlySupertype(type.element)); |
| 2658 String relation = negative ? '!==' : '==='; | 2658 String relation = negative ? '!==' : '==='; |
| 2659 checkNum(input, relation, sourceInformation); | 2659 checkNum(input, relation, sourceInformation); |
| 2660 js.Expression numberTest = pop(); | 2660 js.Expression numberTest = pop(); |
| 2661 checkString(input, relation, sourceInformation); | 2661 checkString(input, relation, sourceInformation); |
| 2662 js.Expression stringTest = pop(); | 2662 js.Expression stringTest = pop(); |
| 2663 checkObject(input, relation, sourceInformation); | 2663 checkObject(input, relation, sourceInformation); |
| 2664 js.Expression objectTest = pop(); | 2664 js.Expression objectTest = pop(); |
| 2665 checkType(input, interceptor, type, sourceInformation, negative: negative); | 2665 checkType(input, interceptor, type, sourceInformation, negative: negative); |
| 2666 String combiner = negative ? '&&' : '||'; | 2666 String combiner = negative ? '&&' : '||'; |
| 2667 String combiner2 = negative ? '||' : '&&'; | 2667 String combiner2 = negative ? '||' : '&&'; |
| 2668 push(new js.Binary( | 2668 push(new js.Binary( |
| 2669 combiner, | 2669 combiner, |
| 2670 new js.Binary(combiner, numberTest, stringTest) | 2670 new js.Binary(combiner, numberTest, stringTest) |
| 2671 .withSourceInformation(sourceInformation), | 2671 .withSourceInformation(sourceInformation), |
| 2672 new js.Binary(combiner2, objectTest, pop()) | 2672 new js.Binary(combiner2, objectTest, pop()) |
| 2673 .withSourceInformation(sourceInformation)) | 2673 .withSourceInformation(sourceInformation)) |
| 2674 .withSourceInformation(sourceInformation)); | 2674 .withSourceInformation(sourceInformation)); |
| 2675 } | 2675 } |
| 2676 | 2676 |
| 2677 void handleStringSupertypeCheck(HInstruction input, HInstruction interceptor, | 2677 void handleStringSupertypeCheck(HInstruction input, HInstruction interceptor, |
| 2678 DartType type, SourceInformation sourceInformation, | 2678 ResolutionDartType type, SourceInformation sourceInformation, |
| 2679 {bool negative: false}) { | 2679 {bool negative: false}) { |
| 2680 assert(!identical(type.element, commonElements.listClass) && | 2680 assert(!identical(type.element, commonElements.listClass) && |
| 2681 !commonElements.isListSupertype(type.element) && | 2681 !commonElements.isListSupertype(type.element) && |
| 2682 !commonElements.isNumberOrStringSupertype(type.element)); | 2682 !commonElements.isNumberOrStringSupertype(type.element)); |
| 2683 String relation = negative ? '!==' : '==='; | 2683 String relation = negative ? '!==' : '==='; |
| 2684 checkString(input, relation, sourceInformation); | 2684 checkString(input, relation, sourceInformation); |
| 2685 js.Expression stringTest = pop(); | 2685 js.Expression stringTest = pop(); |
| 2686 checkObject(input, relation, sourceInformation); | 2686 checkObject(input, relation, sourceInformation); |
| 2687 js.Expression objectTest = pop(); | 2687 js.Expression objectTest = pop(); |
| 2688 checkType(input, interceptor, type, sourceInformation, negative: negative); | 2688 checkType(input, interceptor, type, sourceInformation, negative: negative); |
| 2689 String combiner = negative ? '||' : '&&'; | 2689 String combiner = negative ? '||' : '&&'; |
| 2690 push(new js.Binary(negative ? '&&' : '||', stringTest, | 2690 push(new js.Binary(negative ? '&&' : '||', stringTest, |
| 2691 new js.Binary(combiner, objectTest, pop()))); | 2691 new js.Binary(combiner, objectTest, pop()))); |
| 2692 } | 2692 } |
| 2693 | 2693 |
| 2694 void handleListOrSupertypeCheck(HInstruction input, HInstruction interceptor, | 2694 void handleListOrSupertypeCheck(HInstruction input, HInstruction interceptor, |
| 2695 DartType type, SourceInformation sourceInformation, | 2695 ResolutionDartType type, SourceInformation sourceInformation, |
| 2696 {bool negative: false}) { | 2696 {bool negative: false}) { |
| 2697 assert(!identical(type.element, commonElements.stringClass) && | 2697 assert(!identical(type.element, commonElements.stringClass) && |
| 2698 !commonElements.isStringOnlySupertype(type.element) && | 2698 !commonElements.isStringOnlySupertype(type.element) && |
| 2699 !commonElements.isNumberOrStringSupertype(type.element)); | 2699 !commonElements.isNumberOrStringSupertype(type.element)); |
| 2700 String relation = negative ? '!==' : '==='; | 2700 String relation = negative ? '!==' : '==='; |
| 2701 checkObject(input, relation, sourceInformation); | 2701 checkObject(input, relation, sourceInformation); |
| 2702 js.Expression objectTest = pop(); | 2702 js.Expression objectTest = pop(); |
| 2703 checkArray(input, relation); | 2703 checkArray(input, relation); |
| 2704 js.Expression arrayTest = pop(); | 2704 js.Expression arrayTest = pop(); |
| 2705 checkType(input, interceptor, type, sourceInformation, negative: negative); | 2705 checkType(input, interceptor, type, sourceInformation, negative: negative); |
| 2706 String combiner = negative ? '&&' : '||'; | 2706 String combiner = negative ? '&&' : '||'; |
| 2707 push(new js.Binary(negative ? '||' : '&&', objectTest, | 2707 push(new js.Binary(negative ? '||' : '&&', objectTest, |
| 2708 new js.Binary(combiner, arrayTest, pop())) | 2708 new js.Binary(combiner, arrayTest, pop())) |
| 2709 .withSourceInformation(sourceInformation)); | 2709 .withSourceInformation(sourceInformation)); |
| 2710 } | 2710 } |
| 2711 | 2711 |
| 2712 void visitIs(HIs node) { | 2712 void visitIs(HIs node) { |
| 2713 emitIs(node, "===", node.sourceInformation); | 2713 emitIs(node, "===", node.sourceInformation); |
| 2714 } | 2714 } |
| 2715 | 2715 |
| 2716 void visitIsViaInterceptor(HIsViaInterceptor node) { | 2716 void visitIsViaInterceptor(HIsViaInterceptor node) { |
| 2717 emitIsViaInterceptor(node, node.sourceInformation, negative: false); | 2717 emitIsViaInterceptor(node, node.sourceInformation, negative: false); |
| 2718 } | 2718 } |
| 2719 | 2719 |
| 2720 void emitIs(HIs node, String relation, SourceInformation sourceInformation) { | 2720 void emitIs(HIs node, String relation, SourceInformation sourceInformation) { |
| 2721 DartType type = node.typeExpression; | 2721 ResolutionDartType type = node.typeExpression; |
| 2722 registry.registerTypeUse(new TypeUse.isCheck(type)); | 2722 registry.registerTypeUse(new TypeUse.isCheck(type)); |
| 2723 HInstruction input = node.expression; | 2723 HInstruction input = node.expression; |
| 2724 | 2724 |
| 2725 // If this is changed to single == there are several places below that must | 2725 // If this is changed to single == there are several places below that must |
| 2726 // be changed to match. | 2726 // be changed to match. |
| 2727 assert(relation == '===' || relation == '!=='); | 2727 assert(relation == '===' || relation == '!=='); |
| 2728 bool negative = relation == '!=='; | 2728 bool negative = relation == '!=='; |
| 2729 | 2729 |
| 2730 if (node.isVariableCheck || node.isCompoundCheck) { | 2730 if (node.isVariableCheck || node.isCompoundCheck) { |
| 2731 use(node.checkCall); | 2731 use(node.checkCall); |
| 2732 if (negative) push(new js.Prefix('!', pop())); | 2732 if (negative) push(new js.Prefix('!', pop())); |
| 2733 } else { | 2733 } else { |
| 2734 assert(node.isRawCheck); | 2734 assert(node.isRawCheck); |
| 2735 HInstruction interceptor = node.interceptor; | 2735 HInstruction interceptor = node.interceptor; |
| 2736 InterfaceType interfaceType = type; | 2736 ResolutionInterfaceType interfaceType = type; |
| 2737 ClassEntity element = interfaceType.element; | 2737 ClassEntity element = interfaceType.element; |
| 2738 if (element == commonElements.nullClass) { | 2738 if (element == commonElements.nullClass) { |
| 2739 if (negative) { | 2739 if (negative) { |
| 2740 checkNonNull(input); | 2740 checkNonNull(input); |
| 2741 } else { | 2741 } else { |
| 2742 checkNull(input); | 2742 checkNull(input); |
| 2743 } | 2743 } |
| 2744 } else if (element == | 2744 } else if (element == |
| 2745 commonElements.objectClass /* || type.treatAsDynamic*/) { | 2745 commonElements.objectClass /* || type.treatAsDynamic*/) { |
| 2746 // The constant folder also does this optimization, but we make | 2746 // The constant folder also does this optimization, but we make |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2868 pushStatement(new js.Return(call)); | 2868 pushStatement(new js.Return(call)); |
| 2869 } | 2869 } |
| 2870 currentContainer = oldContainer; | 2870 currentContainer = oldContainer; |
| 2871 body = unwrapStatement(body); | 2871 body = unwrapStatement(body); |
| 2872 pushStatement(new js.If.noElse(test, body) | 2872 pushStatement(new js.If.noElse(test, body) |
| 2873 .withSourceInformation(node.sourceInformation)); | 2873 .withSourceInformation(node.sourceInformation)); |
| 2874 return; | 2874 return; |
| 2875 } | 2875 } |
| 2876 | 2876 |
| 2877 assert(node.isCheckedModeCheck || node.isCastTypeCheck); | 2877 assert(node.isCheckedModeCheck || node.isCastTypeCheck); |
| 2878 DartType type = node.typeExpression; | 2878 ResolutionDartType type = node.typeExpression; |
| 2879 assert(!type.isTypedef); | 2879 assert(!type.isTypedef); |
| 2880 if (type.isFunctionType) { | 2880 if (type.isFunctionType) { |
| 2881 // TODO(5022): We currently generate $isFunction checks for | 2881 // TODO(5022): We currently generate $isFunction checks for |
| 2882 // function types. | 2882 // function types. |
| 2883 registry.registerTypeUse( | 2883 registry.registerTypeUse( |
| 2884 new TypeUse.isCheck(compiler.commonElements.functionType)); | 2884 new TypeUse.isCheck(compiler.commonElements.functionType)); |
| 2885 } | 2885 } |
| 2886 registry.registerTypeUse(new TypeUse.isCheck(type)); | 2886 registry.registerTypeUse(new TypeUse.isCheck(type)); |
| 2887 | 2887 |
| 2888 CheckedModeHelper helper; | 2888 CheckedModeHelper helper; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2914 push(helper.generateCall(this, node)); | 2914 push(helper.generateCall(this, node)); |
| 2915 } | 2915 } |
| 2916 } | 2916 } |
| 2917 | 2917 |
| 2918 void visitTypeKnown(HTypeKnown node) { | 2918 void visitTypeKnown(HTypeKnown node) { |
| 2919 // [HTypeKnown] instructions are removed before generating code. | 2919 // [HTypeKnown] instructions are removed before generating code. |
| 2920 assert(false); | 2920 assert(false); |
| 2921 } | 2921 } |
| 2922 | 2922 |
| 2923 void visitFunctionType(HFunctionType node) { | 2923 void visitFunctionType(HFunctionType node) { |
| 2924 FunctionType type = node.dartType; | 2924 ResolutionFunctionType type = node.dartType; |
| 2925 int inputCount = 0; | 2925 int inputCount = 0; |
| 2926 use(node.inputs[inputCount++]); | 2926 use(node.inputs[inputCount++]); |
| 2927 js.Expression returnType = pop(); | 2927 js.Expression returnType = pop(); |
| 2928 | 2928 |
| 2929 List<js.Expression> parameterTypes = <js.Expression>[]; | 2929 List<js.Expression> parameterTypes = <js.Expression>[]; |
| 2930 for (var _ in type.parameterTypes) { | 2930 for (var _ in type.parameterTypes) { |
| 2931 use(node.inputs[inputCount++]); | 2931 use(node.inputs[inputCount++]); |
| 2932 parameterTypes.add(pop()); | 2932 parameterTypes.add(pop()); |
| 2933 } | 2933 } |
| 2934 | 2934 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3004 List<js.Expression> arguments = <js.Expression>[]; | 3004 List<js.Expression> arguments = <js.Expression>[]; |
| 3005 for (HInstruction input in node.inputs) { | 3005 for (HInstruction input in node.inputs) { |
| 3006 use(input); | 3006 use(input); |
| 3007 arguments.add(pop()); | 3007 arguments.add(pop()); |
| 3008 } | 3008 } |
| 3009 | 3009 |
| 3010 switch (node.kind) { | 3010 switch (node.kind) { |
| 3011 case TypeInfoExpressionKind.COMPLETE: | 3011 case TypeInfoExpressionKind.COMPLETE: |
| 3012 int index = 0; | 3012 int index = 0; |
| 3013 js.Expression result = backend.rtiEncoder.getTypeRepresentation( | 3013 js.Expression result = backend.rtiEncoder.getTypeRepresentation( |
| 3014 node.dartType, (TypeVariableType variable) => arguments[index++]); | 3014 node.dartType, |
| 3015 (ResolutionTypeVariableType variable) => arguments[index++]); |
| 3015 assert(index == node.inputs.length); | 3016 assert(index == node.inputs.length); |
| 3016 push(result); | 3017 push(result); |
| 3017 return; | 3018 return; |
| 3018 | 3019 |
| 3019 case TypeInfoExpressionKind.INSTANCE: | 3020 case TypeInfoExpressionKind.INSTANCE: |
| 3020 // We expect only flat types for the INSTANCE representation. | 3021 // We expect only flat types for the INSTANCE representation. |
| 3021 assert( | 3022 assert(node.dartType == |
| 3022 node.dartType == (node.dartType as InterfaceType).element.thisType); | 3023 (node.dartType as ResolutionInterfaceType).element.thisType); |
| 3023 registry.registerInstantiatedClass(commonElements.listClass); | 3024 registry.registerInstantiatedClass(commonElements.listClass); |
| 3024 push(new js.ArrayInitializer(arguments) | 3025 push(new js.ArrayInitializer(arguments) |
| 3025 .withSourceInformation(node.sourceInformation)); | 3026 .withSourceInformation(node.sourceInformation)); |
| 3026 } | 3027 } |
| 3027 } | 3028 } |
| 3028 | 3029 |
| 3029 bool typeVariableAccessNeedsSubstitution( | 3030 bool typeVariableAccessNeedsSubstitution( |
| 3030 TypeVariableEntity element, TypeMask receiverMask) { | 3031 TypeVariableEntity element, TypeMask receiverMask) { |
| 3031 ClassEntity cls = element.typeDeclaration; | 3032 ClassEntity cls = element.typeDeclaration; |
| 3032 | 3033 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3080 [backend.emitter.staticFunctionAccess(helperElement), pop()])); | 3081 [backend.emitter.staticFunctionAccess(helperElement), pop()])); |
| 3081 } | 3082 } |
| 3082 } | 3083 } |
| 3083 | 3084 |
| 3084 void visitInterfaceType(HInterfaceType node) { | 3085 void visitInterfaceType(HInterfaceType node) { |
| 3085 List<js.Expression> typeArguments = <js.Expression>[]; | 3086 List<js.Expression> typeArguments = <js.Expression>[]; |
| 3086 for (HInstruction type in node.inputs) { | 3087 for (HInstruction type in node.inputs) { |
| 3087 use(type); | 3088 use(type); |
| 3088 typeArguments.add(pop()); | 3089 typeArguments.add(pop()); |
| 3089 } | 3090 } |
| 3090 InterfaceType type = node.dartType; | 3091 ResolutionInterfaceType type = node.dartType; |
| 3091 ClassEntity cls = type.element; | 3092 ClassEntity cls = type.element; |
| 3092 var arguments = [backend.emitter.typeAccess(cls)]; | 3093 var arguments = [backend.emitter.typeAccess(cls)]; |
| 3093 if (!typeArguments.isEmpty) { | 3094 if (!typeArguments.isEmpty) { |
| 3094 arguments.add(new js.ArrayInitializer(typeArguments)); | 3095 arguments.add(new js.ArrayInitializer(typeArguments)); |
| 3095 } | 3096 } |
| 3096 push(js.js('#(#)', [ | 3097 push(js.js('#(#)', [ |
| 3097 accessHelper(helpers.buildInterfaceType, arguments.length), | 3098 accessHelper(helpers.buildInterfaceType, arguments.length), |
| 3098 arguments | 3099 arguments |
| 3099 ])); | 3100 ])); |
| 3100 } | 3101 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3116 registry.registerStaticUse(new StaticUse.staticInvoke( | 3117 registry.registerStaticUse(new StaticUse.staticInvoke( |
| 3117 helper, new CallStructure.unnamed(argumentCount))); | 3118 helper, new CallStructure.unnamed(argumentCount))); |
| 3118 return backend.emitter.staticFunctionAccess(helper); | 3119 return backend.emitter.staticFunctionAccess(helper); |
| 3119 } | 3120 } |
| 3120 | 3121 |
| 3121 @override | 3122 @override |
| 3122 void visitRef(HRef node) { | 3123 void visitRef(HRef node) { |
| 3123 visit(node.value); | 3124 visit(node.value); |
| 3124 } | 3125 } |
| 3125 } | 3126 } |
| OLD | NEW |