| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
| 6 | 6 |
| 7 import '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 /// } | 747 /// } |
| 748 _buildForInIndexable(ir.ForInStatement forInStatement) { | 748 _buildForInIndexable(ir.ForInStatement forInStatement) { |
| 749 SyntheticLocal indexVariable = new SyntheticLocal('_i', targetElement); | 749 SyntheticLocal indexVariable = new SyntheticLocal('_i', targetElement); |
| 750 | 750 |
| 751 // These variables are shared by initializer, condition, body and update. | 751 // These variables are shared by initializer, condition, body and update. |
| 752 HInstruction array; // Set in buildInitializer. | 752 HInstruction array; // Set in buildInitializer. |
| 753 bool isFixed; // Set in buildInitializer. | 753 bool isFixed; // Set in buildInitializer. |
| 754 HInstruction originalLength = null; // Set for growable lists. | 754 HInstruction originalLength = null; // Set for growable lists. |
| 755 | 755 |
| 756 HInstruction buildGetLength() { | 756 HInstruction buildGetLength() { |
| 757 HFieldGet result = new HFieldGet( | 757 HGetLength result = new HGetLength(array, commonMasks.positiveIntType, |
| 758 astAdapter.jsIndexableLength, array, commonMasks.positiveIntType, | |
| 759 isAssignable: !isFixed); | 758 isAssignable: !isFixed); |
| 760 add(result); | 759 add(result); |
| 761 return result; | 760 return result; |
| 762 } | 761 } |
| 763 | 762 |
| 764 void buildConcurrentModificationErrorCheck() { | 763 void buildConcurrentModificationErrorCheck() { |
| 765 if (originalLength == null) return; | 764 if (originalLength == null) return; |
| 766 // The static call checkConcurrentModificationError() is expanded in | 765 // The static call checkConcurrentModificationError() is expanded in |
| 767 // codegen to: | 766 // codegen to: |
| 768 // | 767 // |
| (...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2620 | 2619 |
| 2621 static ir.Class _containingClass(ir.TreeNode node) { | 2620 static ir.Class _containingClass(ir.TreeNode node) { |
| 2622 while (node != null) { | 2621 while (node != null) { |
| 2623 if (node is ir.Class) return node; | 2622 if (node is ir.Class) return node; |
| 2624 node = node.parent; | 2623 node = node.parent; |
| 2625 } | 2624 } |
| 2626 return null; | 2625 return null; |
| 2627 } | 2626 } |
| 2628 | 2627 |
| 2629 HInstruction _buildInvokeSuper( | 2628 HInstruction _buildInvokeSuper( |
| 2630 ir.Expression invocation, List<HInstruction> arguments) { | 2629 ir.Expression invocation, List<HInstruction> arguments) { |
| 2631 // Invocation is either a method invocation or a property get/set. | 2630 // Invocation is either a method invocation or a property get/set. |
| 2632 // TODO(efortuna): Common interface? | 2631 // TODO(efortuna): Common interface? |
| 2633 // TODO(efortuna): Add source information. | 2632 // TODO(efortuna): Add source information. |
| 2634 Selector selector = astAdapter.getSelector(invocation); | 2633 Selector selector = astAdapter.getSelector(invocation); |
| 2635 HInstruction receiver = localsHandler.readThis(); | 2634 HInstruction receiver = localsHandler.readThis(); |
| 2636 ir.Class surroundingClass = _containingClass(invocation); | 2635 ir.Class surroundingClass = _containingClass(invocation); |
| 2637 | 2636 |
| 2638 List<HInstruction> inputs = <HInstruction>[]; | 2637 List<HInstruction> inputs = <HInstruction>[]; |
| 2639 if (astAdapter.isIntercepted(invocation)) { | 2638 if (astAdapter.isIntercepted(invocation)) { |
| 2640 inputs.add(_interceptorFor(receiver)); | 2639 inputs.add(_interceptorFor(receiver)); |
| 2641 } | 2640 } |
| 2642 inputs.add(receiver); | 2641 inputs.add(receiver); |
| 2643 inputs.addAll(arguments); | 2642 inputs.addAll(arguments); |
| 2644 | 2643 |
| 2645 ir.Member interfaceTarget = invocation is ir.SuperMethodInvocation ? | 2644 ir.Member interfaceTarget = invocation is ir.SuperMethodInvocation |
| 2646 (invocation as ir.SuperMethodInvocation).interfaceTarget : | 2645 ? (invocation as ir.SuperMethodInvocation).interfaceTarget |
| 2647 (invocation as ir.SuperPropertyGet).interfaceTarget; | 2646 : (invocation as ir.SuperPropertyGet).interfaceTarget; |
| 2648 | 2647 |
| 2649 HInstruction instruction = new HInvokeSuper( | 2648 HInstruction instruction = new HInvokeSuper( |
| 2650 astAdapter.getMember(interfaceTarget), | 2649 astAdapter.getMember(interfaceTarget), |
| 2651 astAdapter.getClass(surroundingClass), | 2650 astAdapter.getClass(surroundingClass), |
| 2652 selector, | 2651 selector, |
| 2653 inputs, | 2652 inputs, |
| 2654 astAdapter.returnTypeOf(interfaceTarget), | 2653 astAdapter.returnTypeOf(interfaceTarget), |
| 2655 null, | 2654 null, |
| 2656 isSetter: selector.isSetter || selector.isIndexSet); | 2655 isSetter: selector.isSetter || selector.isIndexSet); |
| 2657 instruction.sideEffects = | 2656 instruction.sideEffects = |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3107 enterBlock.setBlockFlow( | 3106 enterBlock.setBlockFlow( |
| 3108 new HTryBlockInformation( | 3107 new HTryBlockInformation( |
| 3109 kernelBuilder.wrapStatementGraph(bodyGraph), | 3108 kernelBuilder.wrapStatementGraph(bodyGraph), |
| 3110 exception, | 3109 exception, |
| 3111 kernelBuilder.wrapStatementGraph(catchGraph), | 3110 kernelBuilder.wrapStatementGraph(catchGraph), |
| 3112 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3111 kernelBuilder.wrapStatementGraph(finallyGraph)), |
| 3113 exitBlock); | 3112 exitBlock); |
| 3114 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3113 kernelBuilder.inTryStatement = previouslyInTryStatement; |
| 3115 } | 3114 } |
| 3116 } | 3115 } |
| OLD | NEW |