| 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; | 9 import '../common/codegen.dart' show CodegenRegistry; |
| 10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
| (...skipping 3049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3060 } else if (selector.isSetter) { | 3060 } else if (selector.isSetter) { |
| 3061 push(new HInvokeDynamicSetter(selector, mask, null, inputs, type)); | 3061 push(new HInvokeDynamicSetter(selector, mask, null, inputs, type)); |
| 3062 } else { | 3062 } else { |
| 3063 push(new HInvokeDynamicMethod( | 3063 push(new HInvokeDynamicMethod( |
| 3064 selector, mask, inputs, type, isIntercepted)); | 3064 selector, mask, inputs, type, isIntercepted)); |
| 3065 } | 3065 } |
| 3066 } | 3066 } |
| 3067 | 3067 |
| 3068 @override | 3068 @override |
| 3069 visitFunctionNode(ir.FunctionNode node) { | 3069 visitFunctionNode(ir.FunctionNode node) { |
| 3070 Local methodElement = localsMap.getLocalFunction(node.parent); | |
| 3071 ClosureRepresentationInfo closureInfo = | 3070 ClosureRepresentationInfo closureInfo = |
| 3072 closureDataLookup.getClosureRepresentationInfo(methodElement); | 3071 localsMap.getClosureRepresentationInfo(closureDataLookup, node.parent); |
| 3073 ClassEntity closureClassEntity = closureInfo.closureClassEntity; | 3072 ClassEntity closureClassEntity = closureInfo.closureClassEntity; |
| 3074 | 3073 |
| 3075 List<HInstruction> capturedVariables = <HInstruction>[]; | 3074 List<HInstruction> capturedVariables = <HInstruction>[]; |
| 3076 closureInfo.createdFieldEntities.forEach((Local capturedLocal) { | 3075 closureInfo.createdFieldEntities.forEach((Local capturedLocal) { |
| 3077 assert(capturedLocal != null); | 3076 assert(capturedLocal != null); |
| 3078 capturedVariables.add(localsHandler.readLocal(capturedLocal)); | 3077 capturedVariables.add(localsHandler.readLocal(capturedLocal)); |
| 3079 }); | 3078 }); |
| 3080 | 3079 |
| 3081 TypeMask type = new TypeMask.nonNullExact(closureClassEntity, closedWorld); | 3080 TypeMask type = new TypeMask.nonNullExact(closureClassEntity, closedWorld); |
| 3082 // TODO(efortuna): Add source information here. | 3081 // TODO(efortuna): Add source information here. |
| 3083 push(new HCreate(closureClassEntity, capturedVariables, type, | 3082 push(new HCreate(closureClassEntity, capturedVariables, type, |
| 3084 callMethod: closureInfo.callMethod)); | 3083 callMethod: closureInfo.callMethod)); |
| 3085 } | 3084 } |
| 3086 | 3085 |
| 3087 @override | 3086 @override |
| 3088 visitFunctionDeclaration(ir.FunctionDeclaration declaration) { | 3087 visitFunctionDeclaration(ir.FunctionDeclaration declaration) { |
| 3089 assert(isReachable); | 3088 assert(isReachable); |
| 3090 declaration.function.accept(this); | 3089 declaration.function.accept(this); |
| 3091 Local localFunction = localsMap.getLocalFunction(declaration); | 3090 Local local = localsMap.getLocalVariable(declaration.variable); |
| 3092 localsHandler.updateLocal(localFunction, pop()); | 3091 localsHandler.updateLocal(local, pop()); |
| 3093 } | 3092 } |
| 3094 | 3093 |
| 3095 @override | 3094 @override |
| 3096 void visitFunctionExpression(ir.FunctionExpression funcExpression) { | 3095 void visitFunctionExpression(ir.FunctionExpression funcExpression) { |
| 3097 funcExpression.function.accept(this); | 3096 funcExpression.function.accept(this); |
| 3098 } | 3097 } |
| 3099 | 3098 |
| 3100 // TODO(het): Decide when to inline | 3099 // TODO(het): Decide when to inline |
| 3101 @override | 3100 @override |
| 3102 void visitMethodInvocation(ir.MethodInvocation invocation) { | 3101 void visitMethodInvocation(ir.MethodInvocation invocation) { |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3684 enterBlock.setBlockFlow( | 3683 enterBlock.setBlockFlow( |
| 3685 new HTryBlockInformation( | 3684 new HTryBlockInformation( |
| 3686 kernelBuilder.wrapStatementGraph(bodyGraph), | 3685 kernelBuilder.wrapStatementGraph(bodyGraph), |
| 3687 exception, | 3686 exception, |
| 3688 kernelBuilder.wrapStatementGraph(catchGraph), | 3687 kernelBuilder.wrapStatementGraph(catchGraph), |
| 3689 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3688 kernelBuilder.wrapStatementGraph(finallyGraph)), |
| 3690 exitBlock); | 3689 exitBlock); |
| 3691 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3690 kernelBuilder.inTryStatement = previouslyInTryStatement; |
| 3692 } | 3691 } |
| 3693 } | 3692 } |
| OLD | NEW |