| 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 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2489 astAdapter.getNode(invocation), MessageKind.JS_PLACEHOLDER_CAPTURE); | 2489 astAdapter.getNode(invocation), MessageKind.JS_PLACEHOLDER_CAPTURE); |
| 2490 } | 2490 } |
| 2491 | 2491 |
| 2492 TypeMask ssaType = | 2492 TypeMask ssaType = |
| 2493 astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld); | 2493 astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld); |
| 2494 | 2494 |
| 2495 SourceInformation sourceInformation = null; | 2495 SourceInformation sourceInformation = null; |
| 2496 push(new HForeignCode(nativeBehavior.codeTemplate, ssaType, inputs, | 2496 push(new HForeignCode(nativeBehavior.codeTemplate, ssaType, inputs, |
| 2497 isStatement: !nativeBehavior.codeTemplate.isExpression, | 2497 isStatement: !nativeBehavior.codeTemplate.isExpression, |
| 2498 effects: nativeBehavior.sideEffects, | 2498 effects: nativeBehavior.sideEffects, |
| 2499 nativeBehavior: nativeBehavior)..sourceInformation = sourceInformation); | 2499 nativeBehavior: nativeBehavior) |
| 2500 ..sourceInformation = sourceInformation); |
| 2500 } | 2501 } |
| 2501 | 2502 |
| 2502 void handleJsStringConcat(ir.StaticInvocation invocation) { | 2503 void handleJsStringConcat(ir.StaticInvocation invocation) { |
| 2503 if (_unexpectedForeignArguments(invocation, 2, 2)) { | 2504 if (_unexpectedForeignArguments(invocation, 2, 2)) { |
| 2504 // Result expected on stack. | 2505 // Result expected on stack. |
| 2505 stack.add(graph.addConstantNull(closedWorld)); | 2506 stack.add(graph.addConstantNull(closedWorld)); |
| 2506 return; | 2507 return; |
| 2507 } | 2508 } |
| 2508 List<HInstruction> inputs = _visitPositionalArguments(invocation.arguments); | 2509 List<HInstruction> inputs = _visitPositionalArguments(invocation.arguments); |
| 2509 push(new HStringConcat(inputs[0], inputs[1], commonMasks.stringType)); | 2510 push(new HStringConcat(inputs[0], inputs[1], commonMasks.stringType)); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2593 void visitMethodInvocation(ir.MethodInvocation invocation) { | 2594 void visitMethodInvocation(ir.MethodInvocation invocation) { |
| 2594 // Handle `x == null` specially. When these come from null-aware operators, | 2595 // Handle `x == null` specially. When these come from null-aware operators, |
| 2595 // there is no mapping in the astAdapter. | 2596 // there is no mapping in the astAdapter. |
| 2596 if (_handleEqualsNull(invocation)) return; | 2597 if (_handleEqualsNull(invocation)) return; |
| 2597 invocation.receiver.accept(this); | 2598 invocation.receiver.accept(this); |
| 2598 HInstruction receiver = pop(); | 2599 HInstruction receiver = pop(); |
| 2599 Selector selector = astAdapter.getSelector(invocation); | 2600 Selector selector = astAdapter.getSelector(invocation); |
| 2600 _pushDynamicInvocation( | 2601 _pushDynamicInvocation( |
| 2601 invocation, | 2602 invocation, |
| 2602 astAdapter.typeOfInvocation(invocation, closedWorld), | 2603 astAdapter.typeOfInvocation(invocation, closedWorld), |
| 2603 <HInstruction>[receiver] | 2604 <HInstruction>[receiver]..addAll( |
| 2604 ..addAll( | 2605 _visitArgumentsForDynamicTarget(selector, invocation.arguments))); |
| 2605 _visitArgumentsForDynamicTarget(selector, invocation.arguments))); | |
| 2606 } | 2606 } |
| 2607 | 2607 |
| 2608 bool _handleEqualsNull(ir.MethodInvocation invocation) { | 2608 bool _handleEqualsNull(ir.MethodInvocation invocation) { |
| 2609 if (invocation.name.name == '==') { | 2609 if (invocation.name.name == '==') { |
| 2610 ir.Arguments arguments = invocation.arguments; | 2610 ir.Arguments arguments = invocation.arguments; |
| 2611 if (arguments.types.isEmpty && | 2611 if (arguments.types.isEmpty && |
| 2612 arguments.positional.length == 1 && | 2612 arguments.positional.length == 1 && |
| 2613 arguments.named.isEmpty) { | 2613 arguments.named.isEmpty) { |
| 2614 bool finish(ir.Expression comparand) { | 2614 bool finish(ir.Expression comparand) { |
| 2615 comparand.accept(this); | 2615 comparand.accept(this); |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3218 enterBlock.setBlockFlow( | 3218 enterBlock.setBlockFlow( |
| 3219 new HTryBlockInformation( | 3219 new HTryBlockInformation( |
| 3220 kernelBuilder.wrapStatementGraph(bodyGraph), | 3220 kernelBuilder.wrapStatementGraph(bodyGraph), |
| 3221 exception, | 3221 exception, |
| 3222 kernelBuilder.wrapStatementGraph(catchGraph), | 3222 kernelBuilder.wrapStatementGraph(catchGraph), |
| 3223 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3223 kernelBuilder.wrapStatementGraph(finallyGraph)), |
| 3224 exitBlock); | 3224 exitBlock); |
| 3225 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3225 kernelBuilder.inTryStatement = previouslyInTryStatement; |
| 3226 } | 3226 } |
| 3227 } | 3227 } |
| OLD | NEW |