| 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 import 'package:kernel/text/ast_to_text.dart' show debugNodeToString; | 6 import 'package:kernel/text/ast_to_text.dart' show debugNodeToString; |
| 7 | 7 |
| 8 import '../closure.dart'; | 8 import '../closure.dart'; |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 10 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 class SsaKernelBuilderTask extends CompilerTask { | 46 class SsaKernelBuilderTask extends CompilerTask { |
| 47 final JavaScriptBackend backend; | 47 final JavaScriptBackend backend; |
| 48 final SourceInformationStrategy sourceInformationFactory; | 48 final SourceInformationStrategy sourceInformationFactory; |
| 49 | 49 |
| 50 String get name => 'SSA kernel builder'; | 50 String get name => 'SSA kernel builder'; |
| 51 | 51 |
| 52 SsaKernelBuilderTask(JavaScriptBackend backend, this.sourceInformationFactory) | 52 SsaKernelBuilderTask(JavaScriptBackend backend, this.sourceInformationFactory) |
| 53 : backend = backend, | 53 : backend = backend, |
| 54 super(backend.compiler.measurer); | 54 super(backend.compiler.measurer); |
| 55 | 55 |
| 56 HGraph build(CodegenWorkItem work) { | 56 HGraph build(CodegenWorkItem work, ClosedWorld closedWorld) { |
| 57 return measure(() { | 57 return measure(() { |
| 58 AstElement element = work.element.implementation; | 58 AstElement element = work.element.implementation; |
| 59 Kernel kernel = backend.kernelTask.kernel; | 59 Kernel kernel = backend.kernelTask.kernel; |
| 60 KernelSsaBuilder builder = new KernelSsaBuilder(element, work.resolvedAst, | 60 KernelSsaBuilder builder = new KernelSsaBuilder( |
| 61 backend.compiler, work.registry, sourceInformationFactory, kernel); | 61 element, |
| 62 work.resolvedAst, |
| 63 backend.compiler, |
| 64 closedWorld, |
| 65 work.registry, |
| 66 sourceInformationFactory, |
| 67 kernel); |
| 62 HGraph graph = builder.build(); | 68 HGraph graph = builder.build(); |
| 63 | 69 |
| 64 if (backend.compiler.tracer.isEnabled) { | 70 if (backend.tracer.isEnabled) { |
| 65 String name; | 71 String name; |
| 66 if (element.isClassMember) { | 72 if (element.isClassMember) { |
| 67 String className = element.enclosingClass.name; | 73 String className = element.enclosingClass.name; |
| 68 String memberName = element.name; | 74 String memberName = element.name; |
| 69 name = "$className.$memberName"; | 75 name = "$className.$memberName"; |
| 70 if (element.isGenerativeConstructorBody) { | 76 if (element.isGenerativeConstructorBody) { |
| 71 name = "$name (body)"; | 77 name = "$name (body)"; |
| 72 } | 78 } |
| 73 } else { | 79 } else { |
| 74 name = "${element.name}"; | 80 name = "${element.name}"; |
| 75 } | 81 } |
| 76 backend.compiler.tracer.traceCompilation(name); | 82 backend.tracer.traceCompilation(name); |
| 77 backend.compiler.tracer.traceGraph('builder', graph); | 83 backend.tracer.traceGraph('builder', graph); |
| 78 } | 84 } |
| 79 | 85 |
| 80 return graph; | 86 return graph; |
| 81 }); | 87 }); |
| 82 } | 88 } |
| 83 } | 89 } |
| 84 | 90 |
| 85 class KernelSsaBuilder extends ir.Visitor with GraphBuilder { | 91 class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
| 86 ir.Node target; | 92 ir.Node target; |
| 87 final AstElement targetElement; | 93 final AstElement targetElement; |
| 88 final ResolvedAst resolvedAst; | 94 final ResolvedAst resolvedAst; |
| 95 final ClosedWorld closedWorld; |
| 89 final CodegenRegistry registry; | 96 final CodegenRegistry registry; |
| 90 | 97 |
| 91 /// Helper accessor for all kernel function-like targets (Procedure, | 98 /// Helper accessor for all kernel function-like targets (Procedure, |
| 92 /// FunctionExpression, FunctionDeclaration) of the inner FunctionNode itself. | 99 /// FunctionExpression, FunctionDeclaration) of the inner FunctionNode itself. |
| 93 /// If the current target is not a function-like target, _targetFunction will | 100 /// If the current target is not a function-like target, _targetFunction will |
| 94 /// be null. | 101 /// be null. |
| 95 ir.FunctionNode _targetFunction; | 102 ir.FunctionNode _targetFunction; |
| 96 | 103 |
| 97 /// A stack of [DartType]s that have been seen during inlining of factory | 104 /// A stack of [DartType]s that have been seen during inlining of factory |
| 98 /// constructors. These types are preserved in [HInvokeStatic]s and | 105 /// constructors. These types are preserved in [HInvokeStatic]s and |
| (...skipping 18 matching lines...) Expand all Loading... |
| 117 <ir.VariableDeclaration, HInstruction>{}; | 124 <ir.VariableDeclaration, HInstruction>{}; |
| 118 | 125 |
| 119 /// True if we are visiting the expression of a throw statement; we assume | 126 /// True if we are visiting the expression of a throw statement; we assume |
| 120 /// this is a slow path. | 127 /// this is a slow path. |
| 121 bool _inExpressionOfThrow = false; | 128 bool _inExpressionOfThrow = false; |
| 122 | 129 |
| 123 KernelSsaBuilder( | 130 KernelSsaBuilder( |
| 124 this.targetElement, | 131 this.targetElement, |
| 125 this.resolvedAst, | 132 this.resolvedAst, |
| 126 Compiler compiler, | 133 Compiler compiler, |
| 134 this.closedWorld, |
| 127 this.registry, | 135 this.registry, |
| 128 SourceInformationStrategy sourceInformationFactory, | 136 SourceInformationStrategy sourceInformationFactory, |
| 129 Kernel kernel) { | 137 Kernel kernel) { |
| 130 this.compiler = compiler; | 138 this.compiler = compiler; |
| 131 this.loopHandler = new KernelLoopHandler(this); | 139 this.loopHandler = new KernelLoopHandler(this); |
| 132 typeBuilder = new TypeBuilder(this); | 140 typeBuilder = new TypeBuilder(this); |
| 133 graph.element = targetElement; | 141 graph.element = targetElement; |
| 134 // TODO(het): Should sourceInformationBuilder be in GraphBuilder? | 142 // TODO(het): Should sourceInformationBuilder be in GraphBuilder? |
| 135 this.sourceInformationBuilder = | 143 this.sourceInformationBuilder = |
| 136 sourceInformationFactory.createBuilderForContext(resolvedAst); | 144 sourceInformationFactory.createBuilderForContext(resolvedAst); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 } | 563 } |
| 556 | 564 |
| 557 @override | 565 @override |
| 558 void visitForInStatement(ir.ForInStatement forInStatement) { | 566 void visitForInStatement(ir.ForInStatement forInStatement) { |
| 559 if (forInStatement.isAsync) { | 567 if (forInStatement.isAsync) { |
| 560 compiler.reporter.internalError(astAdapter.getNode(forInStatement), | 568 compiler.reporter.internalError(astAdapter.getNode(forInStatement), |
| 561 "Cannot compile async for-in using kernel."); | 569 "Cannot compile async for-in using kernel."); |
| 562 } | 570 } |
| 563 // If the expression being iterated over is a JS indexable type, we can | 571 // If the expression being iterated over is a JS indexable type, we can |
| 564 // generate an optimized version of for-in that uses indexing. | 572 // generate an optimized version of for-in that uses indexing. |
| 565 if (astAdapter.isJsIndexableIterator(forInStatement)) { | 573 if (astAdapter.isJsIndexableIterator(forInStatement, closedWorld)) { |
| 566 _buildForInIndexable(forInStatement); | 574 _buildForInIndexable(forInStatement); |
| 567 } else { | 575 } else { |
| 568 _buildForInIterator(forInStatement); | 576 _buildForInIterator(forInStatement); |
| 569 } | 577 } |
| 570 } | 578 } |
| 571 | 579 |
| 572 /// Builds the graph for a for-in node with an indexable expression. | 580 /// Builds the graph for a for-in node with an indexable expression. |
| 573 /// | 581 /// |
| 574 /// In this case we build: | 582 /// In this case we build: |
| 575 /// | 583 /// |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 _pushStaticInvocation( | 616 _pushStaticInvocation( |
| 609 astAdapter.checkConcurrentModificationError, | 617 astAdapter.checkConcurrentModificationError, |
| 610 [pop(), array], | 618 [pop(), array], |
| 611 astAdapter.checkConcurrentModificationErrorReturnType); | 619 astAdapter.checkConcurrentModificationErrorReturnType); |
| 612 pop(); | 620 pop(); |
| 613 } | 621 } |
| 614 | 622 |
| 615 void buildInitializer() { | 623 void buildInitializer() { |
| 616 forInStatement.iterable.accept(this); | 624 forInStatement.iterable.accept(this); |
| 617 array = pop(); | 625 array = pop(); |
| 618 isFixed = astAdapter.isFixedLength(array.instructionType); | 626 isFixed = astAdapter.isFixedLength(array.instructionType, closedWorld); |
| 619 localsHandler.updateLocal( | 627 localsHandler.updateLocal( |
| 620 indexVariable, graph.addConstantInt(0, compiler)); | 628 indexVariable, graph.addConstantInt(0, compiler)); |
| 621 originalLength = buildGetLength(); | 629 originalLength = buildGetLength(); |
| 622 } | 630 } |
| 623 | 631 |
| 624 HInstruction buildCondition() { | 632 HInstruction buildCondition() { |
| 625 HInstruction index = localsHandler.readLocal(indexVariable); | 633 HInstruction index = localsHandler.readLocal(indexVariable); |
| 626 HInstruction length = buildGetLength(); | 634 HInstruction length = buildGetLength(); |
| 627 HInstruction compare = | 635 HInstruction compare = |
| 628 new HLess(index, length, null, commonMasks.boolType); | 636 new HLess(index, length, null, commonMasks.boolType); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 element.accept(this); | 904 element.accept(this); |
| 897 elements.add(pop()); | 905 elements.add(pop()); |
| 898 } | 906 } |
| 899 listInstruction = | 907 listInstruction = |
| 900 new HLiteralList(elements, commonMasks.extendableArrayType); | 908 new HLiteralList(elements, commonMasks.extendableArrayType); |
| 901 add(listInstruction); | 909 add(listInstruction); |
| 902 listInstruction = | 910 listInstruction = |
| 903 setListRuntimeTypeInfoIfNeeded(listInstruction, listLiteral); | 911 setListRuntimeTypeInfoIfNeeded(listInstruction, listLiteral); |
| 904 } | 912 } |
| 905 | 913 |
| 906 TypeMask type = astAdapter.typeOfListLiteral(targetElement, listLiteral); | 914 TypeMask type = |
| 915 astAdapter.typeOfListLiteral(targetElement, listLiteral, closedWorld); |
| 907 if (!type.containsAll(closedWorld)) { | 916 if (!type.containsAll(closedWorld)) { |
| 908 listInstruction.instructionType = type; | 917 listInstruction.instructionType = type; |
| 909 } | 918 } |
| 910 stack.add(listInstruction); | 919 stack.add(listInstruction); |
| 911 } | 920 } |
| 912 | 921 |
| 913 @override | 922 @override |
| 914 void visitMapLiteral(ir.MapLiteral mapLiteral) { | 923 void visitMapLiteral(ir.MapLiteral mapLiteral) { |
| 915 if (mapLiteral.isConst) { | 924 if (mapLiteral.isConst) { |
| 916 stack.add( | 925 stack.add( |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 stack.add(localsHandler.readLocal(local)); | 1098 stack.add(localsHandler.readLocal(local)); |
| 1090 } | 1099 } |
| 1091 | 1100 |
| 1092 @override | 1101 @override |
| 1093 void visitPropertySet(ir.PropertySet propertySet) { | 1102 void visitPropertySet(ir.PropertySet propertySet) { |
| 1094 propertySet.receiver.accept(this); | 1103 propertySet.receiver.accept(this); |
| 1095 HInstruction receiver = pop(); | 1104 HInstruction receiver = pop(); |
| 1096 propertySet.value.accept(this); | 1105 propertySet.value.accept(this); |
| 1097 HInstruction value = pop(); | 1106 HInstruction value = pop(); |
| 1098 | 1107 |
| 1099 _pushDynamicInvocation(propertySet, astAdapter.typeOfSet(propertySet), | 1108 _pushDynamicInvocation( |
| 1109 propertySet, |
| 1110 astAdapter.typeOfSet(propertySet, closedWorld), |
| 1100 <HInstruction>[receiver, value]); | 1111 <HInstruction>[receiver, value]); |
| 1101 | 1112 |
| 1102 pop(); | 1113 pop(); |
| 1103 stack.add(value); | 1114 stack.add(value); |
| 1104 } | 1115 } |
| 1105 | 1116 |
| 1106 @override | 1117 @override |
| 1107 void visitVariableSet(ir.VariableSet variableSet) { | 1118 void visitVariableSet(ir.VariableSet variableSet) { |
| 1108 variableSet.value.accept(this); | 1119 variableSet.value.accept(this); |
| 1109 HInstruction value = pop(); | 1120 HInstruction value = pop(); |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 String globalName = _foreignConstantStringArgument( | 1531 String globalName = _foreignConstantStringArgument( |
| 1521 invocation, 1, 'JS_EMBEDDED_GLOBAL', 'second '); | 1532 invocation, 1, 'JS_EMBEDDED_GLOBAL', 'second '); |
| 1522 js.Template expr = js.js.expressionTemplateYielding( | 1533 js.Template expr = js.js.expressionTemplateYielding( |
| 1523 backend.emitter.generateEmbeddedGlobalAccess(globalName)); | 1534 backend.emitter.generateEmbeddedGlobalAccess(globalName)); |
| 1524 | 1535 |
| 1525 native.NativeBehavior nativeBehavior = | 1536 native.NativeBehavior nativeBehavior = |
| 1526 astAdapter.getNativeBehavior(invocation); | 1537 astAdapter.getNativeBehavior(invocation); |
| 1527 assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null, | 1538 assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null, |
| 1528 message: "No NativeBehavior for $invocation")); | 1539 message: "No NativeBehavior for $invocation")); |
| 1529 | 1540 |
| 1530 TypeMask ssaType = astAdapter.typeFromNativeBehavior(nativeBehavior); | 1541 TypeMask ssaType = |
| 1542 astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld); |
| 1531 push(new HForeignCode(expr, ssaType, const <HInstruction>[], | 1543 push(new HForeignCode(expr, ssaType, const <HInstruction>[], |
| 1532 nativeBehavior: nativeBehavior)); | 1544 nativeBehavior: nativeBehavior)); |
| 1533 } | 1545 } |
| 1534 | 1546 |
| 1535 void handleForeignJsBuiltin(ir.StaticInvocation invocation) { | 1547 void handleForeignJsBuiltin(ir.StaticInvocation invocation) { |
| 1536 if (_unexpectedForeignArguments(invocation, 2)) { | 1548 if (_unexpectedForeignArguments(invocation, 2)) { |
| 1537 stack.add(graph.addConstantNull(compiler)); // Result expected on stack. | 1549 stack.add(graph.addConstantNull(compiler)); // Result expected on stack. |
| 1538 return; | 1550 return; |
| 1539 } | 1551 } |
| 1540 | 1552 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1561 for (ir.Expression argument in arguments.skip(2)) { | 1573 for (ir.Expression argument in arguments.skip(2)) { |
| 1562 argument.accept(this); | 1574 argument.accept(this); |
| 1563 inputs.add(pop()); | 1575 inputs.add(pop()); |
| 1564 } | 1576 } |
| 1565 | 1577 |
| 1566 native.NativeBehavior nativeBehavior = | 1578 native.NativeBehavior nativeBehavior = |
| 1567 astAdapter.getNativeBehavior(invocation); | 1579 astAdapter.getNativeBehavior(invocation); |
| 1568 assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null, | 1580 assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null, |
| 1569 message: "No NativeBehavior for $invocation")); | 1581 message: "No NativeBehavior for $invocation")); |
| 1570 | 1582 |
| 1571 TypeMask ssaType = astAdapter.typeFromNativeBehavior(nativeBehavior); | 1583 TypeMask ssaType = |
| 1584 astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld); |
| 1572 push(new HForeignCode(template, ssaType, inputs, | 1585 push(new HForeignCode(template, ssaType, inputs, |
| 1573 nativeBehavior: nativeBehavior)); | 1586 nativeBehavior: nativeBehavior)); |
| 1574 } | 1587 } |
| 1575 | 1588 |
| 1576 void handleForeignJsGetFlag(ir.StaticInvocation invocation) { | 1589 void handleForeignJsGetFlag(ir.StaticInvocation invocation) { |
| 1577 if (_unexpectedForeignArguments(invocation, 1, 1)) { | 1590 if (_unexpectedForeignArguments(invocation, 1, 1)) { |
| 1578 stack.add( | 1591 stack.add( |
| 1579 graph.addConstantBool(false, compiler)); // Result expected on stack. | 1592 graph.addConstantBool(false, compiler)); // Result expected on stack. |
| 1580 return; | 1593 return; |
| 1581 } | 1594 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 }); | 1662 }); |
| 1650 stack.add(graph.addConstantNull(compiler)); // Result expected on stack. | 1663 stack.add(graph.addConstantNull(compiler)); // Result expected on stack. |
| 1651 return; | 1664 return; |
| 1652 } | 1665 } |
| 1653 | 1666 |
| 1654 if (native.HasCapturedPlaceholders.check(nativeBehavior.codeTemplate.ast)) { | 1667 if (native.HasCapturedPlaceholders.check(nativeBehavior.codeTemplate.ast)) { |
| 1655 compiler.reporter.reportErrorMessage( | 1668 compiler.reporter.reportErrorMessage( |
| 1656 astAdapter.getNode(invocation), MessageKind.JS_PLACEHOLDER_CAPTURE); | 1669 astAdapter.getNode(invocation), MessageKind.JS_PLACEHOLDER_CAPTURE); |
| 1657 } | 1670 } |
| 1658 | 1671 |
| 1659 TypeMask ssaType = astAdapter.typeFromNativeBehavior(nativeBehavior); | 1672 TypeMask ssaType = |
| 1673 astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld); |
| 1660 | 1674 |
| 1661 SourceInformation sourceInformation = null; | 1675 SourceInformation sourceInformation = null; |
| 1662 push(new HForeignCode(nativeBehavior.codeTemplate, ssaType, inputs, | 1676 push(new HForeignCode(nativeBehavior.codeTemplate, ssaType, inputs, |
| 1663 isStatement: !nativeBehavior.codeTemplate.isExpression, | 1677 isStatement: !nativeBehavior.codeTemplate.isExpression, |
| 1664 effects: nativeBehavior.sideEffects, | 1678 effects: nativeBehavior.sideEffects, |
| 1665 nativeBehavior: nativeBehavior)..sourceInformation = sourceInformation); | 1679 nativeBehavior: nativeBehavior)..sourceInformation = sourceInformation); |
| 1666 } | 1680 } |
| 1667 | 1681 |
| 1668 void handleJsStringConcat(ir.StaticInvocation invocation) { | 1682 void handleJsStringConcat(ir.StaticInvocation invocation) { |
| 1669 if (_unexpectedForeignArguments(invocation, 2, 2)) { | 1683 if (_unexpectedForeignArguments(invocation, 2, 2)) { |
| 1670 stack.add(graph.addConstantNull(compiler)); // Result expected on stack. | 1684 stack.add(graph.addConstantNull(compiler)); // Result expected on stack. |
| 1671 return; | 1685 return; |
| 1672 } | 1686 } |
| 1673 List<HInstruction> inputs = _visitPositionalArguments(invocation.arguments); | 1687 List<HInstruction> inputs = _visitPositionalArguments(invocation.arguments); |
| 1674 push(new HStringConcat(inputs[0], inputs[1], commonMasks.stringType)); | 1688 push(new HStringConcat(inputs[0], inputs[1], commonMasks.stringType)); |
| 1675 } | 1689 } |
| 1676 | 1690 |
| 1677 void _pushStaticInvocation( | 1691 void _pushStaticInvocation( |
| 1678 ir.Node target, List<HInstruction> arguments, TypeMask typeMask) { | 1692 ir.Node target, List<HInstruction> arguments, TypeMask typeMask) { |
| 1679 HInvokeStatic instruction = new HInvokeStatic( | 1693 HInvokeStatic instruction = new HInvokeStatic( |
| 1680 astAdapter.getMember(target), arguments, typeMask, | 1694 astAdapter.getMember(target), arguments, typeMask, |
| 1681 targetCanThrow: astAdapter.getCanThrow(target)); | 1695 targetCanThrow: astAdapter.getCanThrow(target, closedWorld)); |
| 1682 if (currentImplicitInstantiations.isNotEmpty) { | 1696 if (currentImplicitInstantiations.isNotEmpty) { |
| 1683 instruction.instantiatedTypes = | 1697 instruction.instantiatedTypes = |
| 1684 new List<DartType>.from(currentImplicitInstantiations); | 1698 new List<DartType>.from(currentImplicitInstantiations); |
| 1685 } | 1699 } |
| 1686 instruction.sideEffects = astAdapter.getSideEffects(target); | 1700 instruction.sideEffects = astAdapter.getSideEffects(target, closedWorld); |
| 1687 | 1701 |
| 1688 push(instruction); | 1702 push(instruction); |
| 1689 } | 1703 } |
| 1690 | 1704 |
| 1691 void _pushDynamicInvocation( | 1705 void _pushDynamicInvocation( |
| 1692 ir.Node node, TypeMask mask, List<HInstruction> arguments, | 1706 ir.Node node, TypeMask mask, List<HInstruction> arguments, |
| 1693 {Selector selector}) { | 1707 {Selector selector}) { |
| 1694 HInstruction receiver = arguments.first; | 1708 HInstruction receiver = arguments.first; |
| 1695 List<HInstruction> inputs = <HInstruction>[]; | 1709 List<HInstruction> inputs = <HInstruction>[]; |
| 1696 | 1710 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 @override | 1776 @override |
| 1763 void visitMethodInvocation(ir.MethodInvocation invocation) { | 1777 void visitMethodInvocation(ir.MethodInvocation invocation) { |
| 1764 // Handle `x == null` specially. When these come from null-aware operators, | 1778 // Handle `x == null` specially. When these come from null-aware operators, |
| 1765 // there is no mapping in the astAdapter. | 1779 // there is no mapping in the astAdapter. |
| 1766 if (_handleEqualsNull(invocation)) return; | 1780 if (_handleEqualsNull(invocation)) return; |
| 1767 invocation.receiver.accept(this); | 1781 invocation.receiver.accept(this); |
| 1768 HInstruction receiver = pop(); | 1782 HInstruction receiver = pop(); |
| 1769 Selector selector = astAdapter.getSelector(invocation); | 1783 Selector selector = astAdapter.getSelector(invocation); |
| 1770 _pushDynamicInvocation( | 1784 _pushDynamicInvocation( |
| 1771 invocation, | 1785 invocation, |
| 1772 astAdapter.typeOfInvocation(invocation), | 1786 astAdapter.typeOfInvocation(invocation, closedWorld), |
| 1773 <HInstruction>[receiver] | 1787 <HInstruction>[receiver] |
| 1774 ..addAll( | 1788 ..addAll( |
| 1775 _visitArgumentsForDynamicTarget(selector, invocation.arguments))); | 1789 _visitArgumentsForDynamicTarget(selector, invocation.arguments))); |
| 1776 } | 1790 } |
| 1777 | 1791 |
| 1778 bool _handleEqualsNull(ir.MethodInvocation invocation) { | 1792 bool _handleEqualsNull(ir.MethodInvocation invocation) { |
| 1779 if (invocation.name.name == '==') { | 1793 if (invocation.name.name == '==') { |
| 1780 ir.Arguments arguments = invocation.arguments; | 1794 ir.Arguments arguments = invocation.arguments; |
| 1781 if (arguments.types.isEmpty && | 1795 if (arguments.types.isEmpty && |
| 1782 arguments.positional.length == 1 && | 1796 arguments.positional.length == 1 && |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 push(new HNot(popBoolified(), commonMasks.boolType)); | 1948 push(new HNot(popBoolified(), commonMasks.boolType)); |
| 1935 } | 1949 } |
| 1936 | 1950 |
| 1937 @override | 1951 @override |
| 1938 void visitStringConcatenation(ir.StringConcatenation stringConcat) { | 1952 void visitStringConcatenation(ir.StringConcatenation stringConcat) { |
| 1939 KernelStringBuilder stringBuilder = new KernelStringBuilder(this); | 1953 KernelStringBuilder stringBuilder = new KernelStringBuilder(this); |
| 1940 stringConcat.accept(stringBuilder); | 1954 stringConcat.accept(stringBuilder); |
| 1941 stack.add(stringBuilder.result); | 1955 stack.add(stringBuilder.result); |
| 1942 } | 1956 } |
| 1943 } | 1957 } |
| OLD | NEW |