| 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 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 // If runtime type information is needed and the map literal has no type | 1199 // If runtime type information is needed and the map literal has no type |
| 1200 // parameters, 'constructor' is a static function that forwards the call to | 1200 // parameters, 'constructor' is a static function that forwards the call to |
| 1201 // the factory constructor without type parameters. | 1201 // the factory constructor without type parameters. |
| 1202 assert(constructor.kind == ir.ProcedureKind.Method || | 1202 assert(constructor.kind == ir.ProcedureKind.Method || |
| 1203 constructor.kind == ir.ProcedureKind.Factory); | 1203 constructor.kind == ir.ProcedureKind.Factory); |
| 1204 | 1204 |
| 1205 // The instruction type will always be a subtype of the mapLiteralClass, but | 1205 // The instruction type will always be a subtype of the mapLiteralClass, but |
| 1206 // type inference might discover a more specific type, or find nothing (in | 1206 // type inference might discover a more specific type, or find nothing (in |
| 1207 // dart2js unit tests). | 1207 // dart2js unit tests). |
| 1208 TypeMask mapType = new TypeMask.nonNullSubtype( | 1208 TypeMask mapType = new TypeMask.nonNullSubtype( |
| 1209 astAdapter.getElement(astAdapter.mapLiteralClass), closedWorld); | 1209 astAdapter.getClass(astAdapter.mapLiteralClass), closedWorld); |
| 1210 TypeMask returnTypeMask = TypeMaskFactory.inferredReturnTypeForElement( | 1210 TypeMask returnTypeMask = TypeMaskFactory.inferredReturnTypeForElement( |
| 1211 astAdapter.getElement(constructor), globalInferenceResults); | 1211 astAdapter.getElement(constructor), globalInferenceResults); |
| 1212 TypeMask instructionType = | 1212 TypeMask instructionType = |
| 1213 mapType.intersection(returnTypeMask, closedWorld); | 1213 mapType.intersection(returnTypeMask, closedWorld); |
| 1214 | 1214 |
| 1215 addImplicitInstantiation(type); | 1215 addImplicitInstantiation(type); |
| 1216 _pushStaticInvocation(constructor, inputs, instructionType); | 1216 _pushStaticInvocation(constructor, inputs, instructionType); |
| 1217 removeImplicitInstantiation(type); | 1217 removeImplicitInstantiation(type); |
| 1218 } | 1218 } |
| 1219 | 1219 |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2090 push(instruction); | 2090 push(instruction); |
| 2091 } | 2091 } |
| 2092 | 2092 |
| 2093 @override | 2093 @override |
| 2094 void visitConstructorInvocation(ir.ConstructorInvocation invocation) { | 2094 void visitConstructorInvocation(ir.ConstructorInvocation invocation) { |
| 2095 ir.Constructor target = invocation.target; | 2095 ir.Constructor target = invocation.target; |
| 2096 // TODO(sra): For JS-interop targets, process arguments differently. | 2096 // TODO(sra): For JS-interop targets, process arguments differently. |
| 2097 List<HInstruction> arguments = | 2097 List<HInstruction> arguments = |
| 2098 _visitArgumentsForStaticTarget(target.function, invocation.arguments); | 2098 _visitArgumentsForStaticTarget(target.function, invocation.arguments); |
| 2099 TypeMask typeMask = new TypeMask.nonNullExact( | 2099 TypeMask typeMask = new TypeMask.nonNullExact( |
| 2100 astAdapter.getElement(target.enclosingClass), closedWorld); | 2100 astAdapter.getClass(target.enclosingClass), closedWorld); |
| 2101 _pushStaticInvocation(target, arguments, typeMask); | 2101 _pushStaticInvocation(target, arguments, typeMask); |
| 2102 } | 2102 } |
| 2103 | 2103 |
| 2104 @override | 2104 @override |
| 2105 void visitIsExpression(ir.IsExpression isExpression) { | 2105 void visitIsExpression(ir.IsExpression isExpression) { |
| 2106 isExpression.operand.accept(this); | 2106 isExpression.operand.accept(this); |
| 2107 HInstruction expression = pop(); | 2107 HInstruction expression = pop(); |
| 2108 push(buildIsNode(isExpression, isExpression.type, expression)); | 2108 push(buildIsNode(isExpression, isExpression.type, expression)); |
| 2109 } | 2109 } |
| 2110 | 2110 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 kernelBuilder.open(exitBlock); | 2479 kernelBuilder.open(exitBlock); |
| 2480 enterBlock.setBlockFlow( | 2480 enterBlock.setBlockFlow( |
| 2481 new HTryBlockInformation( | 2481 new HTryBlockInformation( |
| 2482 kernelBuilder.wrapStatementGraph(bodyGraph), | 2482 kernelBuilder.wrapStatementGraph(bodyGraph), |
| 2483 exception, | 2483 exception, |
| 2484 kernelBuilder.wrapStatementGraph(catchGraph), | 2484 kernelBuilder.wrapStatementGraph(catchGraph), |
| 2485 kernelBuilder.wrapStatementGraph(finallyGraph)), | 2485 kernelBuilder.wrapStatementGraph(finallyGraph)), |
| 2486 exitBlock); | 2486 exitBlock); |
| 2487 } | 2487 } |
| 2488 } | 2488 } |
| OLD | NEW |