| 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 // there is a parameter check expression in the initializer. | 469 // there is a parameter check expression in the initializer. |
| 470 parameters[parameter] = argument; | 470 parameters[parameter] = argument; |
| 471 localsHandler.updateLocal(parameter, argument); | 471 localsHandler.updateLocal(parameter, argument); |
| 472 }); | 472 }); |
| 473 | 473 |
| 474 // TODO(het): set the locals handler state as if we were inlining the | 474 // TODO(het): set the locals handler state as if we were inlining the |
| 475 // constructor. | 475 // constructor. |
| 476 _buildInitializers(constructor, constructorChain, fieldValues); | 476 _buildInitializers(constructor, constructorChain, fieldValues); |
| 477 } | 477 } |
| 478 | 478 |
| 479 HTypeConversion buildFunctionTypeConversion( | |
| 480 HInstruction original, ResolutionDartType type, int kind) { | |
| 481 HInstruction reifiedType = buildFunctionType(type); | |
| 482 return new HTypeConversion.viaMethodOnType( | |
| 483 type, kind, original.instructionType, reifiedType, original); | |
| 484 } | |
| 485 | |
| 486 /// Builds generative constructor body. | 479 /// Builds generative constructor body. |
| 487 void buildConstructorBody(ir.Constructor constructor) { | 480 void buildConstructorBody(ir.Constructor constructor) { |
| 488 openFunction(); | 481 openFunction(); |
| 489 constructor.function.body.accept(this); | 482 constructor.function.body.accept(this); |
| 490 closeFunction(); | 483 closeFunction(); |
| 491 } | 484 } |
| 492 | 485 |
| 493 /// Builds a SSA graph for FunctionNodes, found in FunctionExpressions and | 486 /// Builds a SSA graph for FunctionNodes, found in FunctionExpressions and |
| 494 /// Procedures. | 487 /// Procedures. |
| 495 void buildFunctionNode(ir.FunctionNode functionNode) { | 488 void buildFunctionNode(ir.FunctionNode functionNode) { |
| (...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2849 return; | 2842 return; |
| 2850 } | 2843 } |
| 2851 | 2844 |
| 2852 if (type is ir.DynamicType) { | 2845 if (type is ir.DynamicType) { |
| 2853 stack.add(graph.addConstantBool(true, closedWorld)); | 2846 stack.add(graph.addConstantBool(true, closedWorld)); |
| 2854 return; | 2847 return; |
| 2855 } | 2848 } |
| 2856 | 2849 |
| 2857 ResolutionDartType typeValue = | 2850 ResolutionDartType typeValue = |
| 2858 localsHandler.substInContext(astAdapter.getDartType(type)); | 2851 localsHandler.substInContext(astAdapter.getDartType(type)); |
| 2852 |
| 2859 if (type is ir.FunctionType) { | 2853 if (type is ir.FunctionType) { |
| 2860 List arguments = [buildFunctionType(typeValue), expression]; | 2854 HInstruction representation = |
| 2861 _pushDynamicInvocation(node, null, arguments, | 2855 typeBuilder.analyzeTypeArgument(typeValue, sourceElement); |
| 2862 selector: new Selector.call( | 2856 List<HInstruction> inputs = <HInstruction>[ |
| 2863 new PrivateName('_isTest', backend.helpers.jsHelperLibrary), | 2857 expression, |
| 2864 CallStructure.ONE_ARG)); | 2858 representation, |
| 2865 push( | 2859 ]; |
| 2866 new HIs.compound(typeValue, expression, pop(), commonMasks.boolType)); | 2860 _pushStaticInvocation( |
| 2861 astAdapter.functionTypeTest, inputs, commonMasks.boolType); |
| 2862 HInstruction call = pop(); |
| 2863 push(new HIs.compound(typeValue, expression, call, commonMasks.boolType)); |
| 2867 return; | 2864 return; |
| 2868 } | 2865 } |
| 2869 | 2866 |
| 2870 if (type is ir.TypeParameterType) { | 2867 if (type is ir.TypeParameterType) { |
| 2871 HInstruction runtimeType = | 2868 HInstruction runtimeType = |
| 2872 typeBuilder.addTypeVariableReference(typeValue, sourceElement); | 2869 typeBuilder.addTypeVariableReference(typeValue, sourceElement); |
| 2873 _pushStaticInvocation(astAdapter.checkSubtypeOfRuntimeType, | 2870 _pushStaticInvocation(astAdapter.checkSubtypeOfRuntimeType, |
| 2874 <HInstruction>[expression, runtimeType], commonMasks.boolType); | 2871 <HInstruction>[expression, runtimeType], commonMasks.boolType); |
| 2875 push( | 2872 push( |
| 2876 new HIs.variable(typeValue, expression, pop(), commonMasks.boolType)); | 2873 new HIs.variable(typeValue, expression, pop(), commonMasks.boolType)); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3253 enterBlock.setBlockFlow( | 3250 enterBlock.setBlockFlow( |
| 3254 new HTryBlockInformation( | 3251 new HTryBlockInformation( |
| 3255 kernelBuilder.wrapStatementGraph(bodyGraph), | 3252 kernelBuilder.wrapStatementGraph(bodyGraph), |
| 3256 exception, | 3253 exception, |
| 3257 kernelBuilder.wrapStatementGraph(catchGraph), | 3254 kernelBuilder.wrapStatementGraph(catchGraph), |
| 3258 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3255 kernelBuilder.wrapStatementGraph(finallyGraph)), |
| 3259 exitBlock); | 3256 exitBlock); |
| 3260 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3257 kernelBuilder.inTryStatement = previouslyInTryStatement; |
| 3261 } | 3258 } |
| 3262 } | 3259 } |
| OLD | NEW |