| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of ssa; | 5 part of ssa; | 
| 6 | 6 | 
| 7 class SsaFunctionCompiler implements FunctionCompiler { | 7 class SsaFunctionCompiler implements FunctionCompiler { | 
| 8   final SsaCodeGeneratorTask generator; | 8   final SsaCodeGeneratorTask generator; | 
| 9   final SsaBuilderTask builder; | 9   final SsaBuilderTask builder; | 
| 10   final SsaOptimizerTask optimizer; | 10   final SsaOptimizerTask optimizer; | 
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1332                        Selector selector, | 1332                        Selector selector, | 
| 1333                        TypeMask mask, | 1333                        TypeMask mask, | 
| 1334                        List<HInstruction> providedArguments, | 1334                        List<HInstruction> providedArguments, | 
| 1335                        ast.Node currentNode, | 1335                        ast.Node currentNode, | 
| 1336                        {InterfaceType instanceType}) { | 1336                        {InterfaceType instanceType}) { | 
| 1337     // TODO(johnniwinther): Register this on the [registry]. Currently the | 1337     // TODO(johnniwinther): Register this on the [registry]. Currently the | 
| 1338     // [CodegenRegistry] calls the enqueuer, but [element] should _not_ be | 1338     // [CodegenRegistry] calls the enqueuer, but [element] should _not_ be | 
| 1339     // enqueued. | 1339     // enqueued. | 
| 1340     backend.registerStaticUse(element, compiler.enqueuer.codegen); | 1340     backend.registerStaticUse(element, compiler.enqueuer.codegen); | 
| 1341 | 1341 | 
|  | 1342     if (element.isJsInterop && !element.isFactoryConstructor) { | 
|  | 1343       // We only inline factory JavaScript interop constructors. | 
|  | 1344       return false; | 
|  | 1345     } | 
|  | 1346 | 
| 1342     // Ensure that [element] is an implementation element. | 1347     // Ensure that [element] is an implementation element. | 
| 1343     element = element.implementation; | 1348     element = element.implementation; | 
| 1344 | 1349 | 
| 1345     if (compiler.elementHasCompileTimeError(element)) return false; | 1350     if (compiler.elementHasCompileTimeError(element)) return false; | 
| 1346 | 1351 | 
| 1347     FunctionElement function = element; | 1352     FunctionElement function = element; | 
| 1348     bool insideLoop = loopNesting > 0 || graph.calledInLoop; | 1353     bool insideLoop = loopNesting > 0 || graph.calledInLoop; | 
| 1349 | 1354 | 
| 1350     // Bail out early if the inlining decision is in the cache and we can't | 1355     // Bail out early if the inlining decision is in the cache and we can't | 
| 1351     // inline (no need to check the hard constraints). | 1356     // inline (no need to check the hard constraints). | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 1362           Elements.isStaticOrTopLevel(element) || | 1367           Elements.isStaticOrTopLevel(element) || | 
| 1363           element.isGenerativeConstructorBody, | 1368           element.isGenerativeConstructorBody, | 
| 1364           message: "Missing selector for inlining of $element.")); | 1369           message: "Missing selector for inlining of $element.")); | 
| 1365       if (selector != null) { | 1370       if (selector != null) { | 
| 1366         if (!selector.applies(function, compiler.world)) return false; | 1371         if (!selector.applies(function, compiler.world)) return false; | 
| 1367         if (mask != null && !mask.canHit(function, selector, compiler.world)) { | 1372         if (mask != null && !mask.canHit(function, selector, compiler.world)) { | 
| 1368           return false; | 1373           return false; | 
| 1369         } | 1374         } | 
| 1370       } | 1375       } | 
| 1371 | 1376 | 
|  | 1377       if (element.isJsInterop) return false; | 
|  | 1378 | 
| 1372       // Don't inline operator== methods if the parameter can be null. | 1379       // Don't inline operator== methods if the parameter can be null. | 
| 1373       if (element.name == '==') { | 1380       if (element.name == '==') { | 
| 1374         if (element.enclosingClass != compiler.objectClass | 1381         if (element.enclosingClass != compiler.objectClass | 
| 1375             && providedArguments[1].canBeNull()) { | 1382             && providedArguments[1].canBeNull()) { | 
| 1376           return false; | 1383           return false; | 
| 1377         } | 1384         } | 
| 1378       } | 1385       } | 
| 1379 | 1386 | 
| 1380       // Generative constructors of native classes should not be called directly | 1387       // Generative constructors of native classes should not be called directly | 
| 1381       // and have an extra argument that causes problems with inlining. | 1388       // and have an extra argument that causes problems with inlining. | 
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1540       sourceInformationBuilder = | 1547       sourceInformationBuilder = | 
| 1541           sourceInformationBuilder.forContext(element.implementation); | 1548           sourceInformationBuilder.forContext(element.implementation); | 
| 1542       sourceElementStack.add(element.declaration); | 1549       sourceElementStack.add(element.declaration); | 
| 1543       var result = f(); | 1550       var result = f(); | 
| 1544       sourceInformationBuilder = oldSourceInformationBuilder; | 1551       sourceInformationBuilder = oldSourceInformationBuilder; | 
| 1545       sourceElementStack.removeLast(); | 1552       sourceElementStack.removeLast(); | 
| 1546       return result; | 1553       return result; | 
| 1547     }); | 1554     }); | 
| 1548   } | 1555   } | 
| 1549 | 1556 | 
|  | 1557   /** | 
|  | 1558    * Return null so it is simple to remove the optional parameters completely | 
|  | 1559    * from interop methods to match JavaScript semantics for ommitted arguments. | 
|  | 1560    */ | 
|  | 1561   HInstruction handleConstantForOptionalParameterJsInterop(Element parameter) => | 
|  | 1562       null; | 
|  | 1563 | 
| 1550   HInstruction handleConstantForOptionalParameter(Element parameter) { | 1564   HInstruction handleConstantForOptionalParameter(Element parameter) { | 
| 1551     ConstantValue constantValue = | 1565     ConstantValue constantValue = | 
| 1552         backend.constants.getConstantValueForVariable(parameter); | 1566         backend.constants.getConstantValueForVariable(parameter); | 
| 1553     assert(invariant(parameter, constantValue != null, | 1567     assert(invariant(parameter, constantValue != null, | 
| 1554         message: 'No constant computed for $parameter')); | 1568         message: 'No constant computed for $parameter')); | 
| 1555     return graph.addConstant(constantValue, compiler); | 1569     return graph.addConstant(constantValue, compiler); | 
| 1556   } | 1570   } | 
| 1557 | 1571 | 
| 1558   Element get currentNonClosureClass { | 1572   Element get currentNonClosureClass { | 
| 1559     ClassElement cls = sourceElement.enclosingClass; | 1573     ClassElement cls = sourceElement.enclosingClass; | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1627   /** | 1641   /** | 
| 1628    * Documentation wanted -- johnniwinther | 1642    * Documentation wanted -- johnniwinther | 
| 1629    * | 1643    * | 
| 1630    * Invariant: [functionElement] must be an implementation element. | 1644    * Invariant: [functionElement] must be an implementation element. | 
| 1631    */ | 1645    */ | 
| 1632   HGraph buildMethod(FunctionElement functionElement) { | 1646   HGraph buildMethod(FunctionElement functionElement) { | 
| 1633     assert(invariant(functionElement, functionElement.isImplementation)); | 1647     assert(invariant(functionElement, functionElement.isImplementation)); | 
| 1634     graph.calledInLoop = compiler.world.isCalledInLoop(functionElement); | 1648     graph.calledInLoop = compiler.world.isCalledInLoop(functionElement); | 
| 1635     ast.FunctionExpression function = functionElement.node; | 1649     ast.FunctionExpression function = functionElement.node; | 
| 1636     assert(function != null); | 1650     assert(function != null); | 
| 1637     assert(invariant(functionElement, !function.modifiers.isExternal)); |  | 
| 1638     assert(elements.getFunctionDefinition(function) != null); | 1651     assert(elements.getFunctionDefinition(function) != null); | 
| 1639     openFunction(functionElement, function); | 1652     openFunction(functionElement, function); | 
| 1640     String name = functionElement.name; | 1653     String name = functionElement.name; | 
|  | 1654     if (functionElement.isJsInterop) { | 
|  | 1655       push(invokeJsInteropFunction(functionElement, parameters.values.toList(), | 
|  | 1656           sourceInformationBuilder.buildGeneric(function))); | 
|  | 1657       var value = pop(); | 
|  | 1658       closeAndGotoExit(new HReturn(value, | 
|  | 1659           sourceInformationBuilder.buildReturn(functionElement.node))); | 
|  | 1660       return closeFunction(); | 
|  | 1661     } | 
|  | 1662     assert(invariant(functionElement, !function.modifiers.isExternal)); | 
|  | 1663 | 
| 1641     // If [functionElement] is `operator==` we explicitely add a null check at | 1664     // If [functionElement] is `operator==` we explicitely add a null check at | 
| 1642     // the beginning of the method. This is to avoid having call sites do the | 1665     // the beginning of the method. This is to avoid having call sites do the | 
| 1643     // null check. | 1666     // null check. | 
| 1644     if (name == '==') { | 1667     if (name == '==') { | 
| 1645       if (!backend.operatorEqHandlesNullArgument(functionElement)) { | 1668       if (!backend.operatorEqHandlesNullArgument(functionElement)) { | 
| 1646         handleIf( | 1669         handleIf( | 
| 1647             function, | 1670             function, | 
| 1648             visitCondition: () { | 1671             visitCondition: () { | 
| 1649               HParameterValue parameter = parameters.values.first; | 1672               HParameterValue parameter = parameters.values.first; | 
| 1650               push(new HIdentity( | 1673               push(new HIdentity( | 
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1835     returnType = state.oldReturnType; | 1858     returnType = state.oldReturnType; | 
| 1836     assert(stack.isEmpty); | 1859     assert(stack.isEmpty); | 
| 1837     stack = state.oldStack; | 1860     stack = state.oldStack; | 
| 1838   } | 1861   } | 
| 1839 | 1862 | 
| 1840   /** | 1863   /** | 
| 1841    * Run this builder on the body of the [function] to be inlined. | 1864    * Run this builder on the body of the [function] to be inlined. | 
| 1842    */ | 1865    */ | 
| 1843   void visitInlinedFunction(FunctionElement function) { | 1866   void visitInlinedFunction(FunctionElement function) { | 
| 1844     potentiallyCheckInlinedParameterTypes(function); | 1867     potentiallyCheckInlinedParameterTypes(function); | 
|  | 1868 | 
| 1845     if (function.isGenerativeConstructor) { | 1869     if (function.isGenerativeConstructor) { | 
| 1846       buildFactory(function); | 1870       buildFactory(function); | 
| 1847     } else { | 1871     } else { | 
| 1848       ast.FunctionExpression functionNode = function.node; | 1872       ast.FunctionExpression functionNode = function.node; | 
| 1849       functionNode.body.accept(this); | 1873       functionNode.body.accept(this); | 
| 1850     } | 1874     } | 
| 1851   } | 1875   } | 
| 1852 | 1876 | 
| 1853 | 1877 | 
| 1854   addInlinedInstantiation(DartType type) { | 1878   addInlinedInstantiation(DartType type) { | 
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2138    *    current constructor and super constructors or constructors redirected | 2162    *    current constructor and super constructors or constructors redirected | 
| 2139    *    to, starting from the current constructor. | 2163    *    to, starting from the current constructor. | 
| 2140    *  - Call the constructor bodies, starting from the constructor(s) in the | 2164    *  - Call the constructor bodies, starting from the constructor(s) in the | 
| 2141    *    super class(es). | 2165    *    super class(es). | 
| 2142    */ | 2166    */ | 
| 2143   HGraph buildFactory(ConstructorElement functionElement) { | 2167   HGraph buildFactory(ConstructorElement functionElement) { | 
| 2144     functionElement = functionElement.implementation; | 2168     functionElement = functionElement.implementation; | 
| 2145     ClassElement classElement = | 2169     ClassElement classElement = | 
| 2146         functionElement.enclosingClass.implementation; | 2170         functionElement.enclosingClass.implementation; | 
| 2147     bool isNativeUpgradeFactory = | 2171     bool isNativeUpgradeFactory = | 
| 2148         Elements.isNativeOrExtendsNative(classElement); | 2172         Elements.isNativeOrExtendsNative(classElement) | 
|  | 2173             && !classElement.isJsInterop; | 
| 2149     ast.FunctionExpression function = functionElement.node; | 2174     ast.FunctionExpression function = functionElement.node; | 
| 2150     // Note that constructors (like any other static function) do not need | 2175     // Note that constructors (like any other static function) do not need | 
| 2151     // to deal with optional arguments. It is the callers job to provide all | 2176     // to deal with optional arguments. It is the callers job to provide all | 
| 2152     // arguments as if they were positional. | 2177     // arguments as if they were positional. | 
| 2153 | 2178 | 
| 2154     if (inliningStack.isEmpty) { | 2179     if (inliningStack.isEmpty) { | 
| 2155       // The initializer list could contain closures. | 2180       // The initializer list could contain closures. | 
| 2156       openFunction(functionElement, function); | 2181       openFunction(functionElement, function); | 
| 2157     } | 2182     } | 
| 2158 | 2183 | 
| (...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3949 | 3974 | 
| 3950     HInstruction compileArgument(ast.Node argument) { | 3975     HInstruction compileArgument(ast.Node argument) { | 
| 3951       visit(argument); | 3976       visit(argument); | 
| 3952       return pop(); | 3977       return pop(); | 
| 3953     } | 3978     } | 
| 3954 | 3979 | 
| 3955     return callStructure.makeArgumentsList( | 3980     return callStructure.makeArgumentsList( | 
| 3956         arguments, | 3981         arguments, | 
| 3957         element, | 3982         element, | 
| 3958         compileArgument, | 3983         compileArgument, | 
| 3959         handleConstantForOptionalParameter); | 3984         element.isJsInterop ? | 
|  | 3985             handleConstantForOptionalParameterJsInterop : | 
|  | 3986             handleConstantForOptionalParameter); | 
| 3960   } | 3987   } | 
| 3961 | 3988 | 
| 3962   void addGenericSendArgumentsToList(Link<ast.Node> link, List<HInstruction> lis
      t) { | 3989   void addGenericSendArgumentsToList(Link<ast.Node> link, List<HInstruction> lis
      t) { | 
| 3963     for (; !link.isEmpty; link = link.tail) { | 3990     for (; !link.isEmpty; link = link.tail) { | 
| 3964       visit(link.head); | 3991       visit(link.head); | 
| 3965       list.add(pop()); | 3992       list.add(pop()); | 
| 3966     } | 3993     } | 
| 3967   } | 3994   } | 
| 3968 | 3995 | 
| 3969   /// Generate a dynamic method, getter or setter invocation. | 3996   /// Generate a dynamic method, getter or setter invocation. | 
| (...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5094 | 5121 | 
| 5095     if (compiler.elementHasCompileTimeError(constructor)) { | 5122     if (compiler.elementHasCompileTimeError(constructor)) { | 
| 5096       // TODO(ahe): Do something like [generateWrongArgumentCountError]. | 5123       // TODO(ahe): Do something like [generateWrongArgumentCountError]. | 
| 5097       stack.add(graph.addConstantNull(compiler)); | 5124       stack.add(graph.addConstantNull(compiler)); | 
| 5098       return; | 5125       return; | 
| 5099     } | 5126     } | 
| 5100     if (checkTypeVariableBounds(node, type)) return; | 5127     if (checkTypeVariableBounds(node, type)) return; | 
| 5101 | 5128 | 
| 5102     var inputs = <HInstruction>[]; | 5129     var inputs = <HInstruction>[]; | 
| 5103     if (constructor.isGenerativeConstructor && | 5130     if (constructor.isGenerativeConstructor && | 
| 5104         Elements.isNativeOrExtendsNative(constructor.enclosingClass)) { | 5131         Elements.isNativeOrExtendsNative(constructor.enclosingClass) && | 
|  | 5132         !constructor.isJsInterop) { | 
| 5105       // Native class generative constructors take a pre-constructed object. | 5133       // Native class generative constructors take a pre-constructed object. | 
| 5106       inputs.add(graph.addConstantNull(compiler)); | 5134       inputs.add(graph.addConstantNull(compiler)); | 
| 5107     } | 5135     } | 
| 5108     // TODO(5347): Try to avoid the need for calling [implementation] before | 5136     // TODO(5347): Try to avoid the need for calling [implementation] before | 
| 5109     // calling [makeStaticArgumentList]. | 5137     // calling [makeStaticArgumentList]. | 
| 5110     constructorImplementation = constructor.implementation; | 5138     constructorImplementation = constructor.implementation; | 
| 5111     if (constructorImplementation.isErroneous || | 5139     if (constructorImplementation.isErroneous || | 
| 5112         !callStructure.signatureApplies( | 5140         !callStructure.signatureApplies( | 
| 5113             constructorImplementation.functionSignature)) { | 5141             constructorImplementation.functionSignature)) { | 
| 5114       generateWrongArgumentCountError(send, constructor, send.arguments); | 5142       generateWrongArgumentCountError(send, constructor, send.arguments); | 
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5811       push( | 5839       push( | 
| 5812           new HInvokeDynamicSetter(selector, mask, null, inputs, type) | 5840           new HInvokeDynamicSetter(selector, mask, null, inputs, type) | 
| 5813               ..sourceInformation = sourceInformation); | 5841               ..sourceInformation = sourceInformation); | 
| 5814     } else { | 5842     } else { | 
| 5815       push( | 5843       push( | 
| 5816           new HInvokeDynamicMethod(selector, mask, inputs, type, isIntercepted) | 5844           new HInvokeDynamicMethod(selector, mask, inputs, type, isIntercepted) | 
| 5817               ..sourceInformation = sourceInformation); | 5845               ..sourceInformation = sourceInformation); | 
| 5818     } | 5846     } | 
| 5819   } | 5847   } | 
| 5820 | 5848 | 
|  | 5849   HForeignCode invokeJsInteropFunction(Element element, | 
|  | 5850                                        List<HInstruction> arguments, | 
|  | 5851                                        SourceInformation sourceInformation) { | 
|  | 5852     assert(element.isJsInterop); | 
|  | 5853     nativeEmitter.nativeMethods.add(element); | 
|  | 5854     String templateString; | 
|  | 5855 | 
|  | 5856     if (element.isFactoryConstructor) { | 
|  | 5857       // Treat factory constructors as syntactic sugar for creating object | 
|  | 5858       // literals. | 
|  | 5859       ConstructorElement constructor = element; | 
|  | 5860       FunctionSignature params = constructor.functionSignature; | 
|  | 5861       int i = 0; | 
|  | 5862       int positions = 0; | 
|  | 5863       var filteredArguments = <HInstruction>[]; | 
|  | 5864       var parameterNameMap = new Map<String, js.Expression>(); | 
|  | 5865       params.orderedForEachParameter((ParameterElement parameter) { | 
|  | 5866         // TODO(jacobr): throw if parameter names do not match names of property | 
|  | 5867         // names in the class. | 
|  | 5868         assert (parameter.isNamed); | 
|  | 5869         if (!parameter.isNamed) { | 
|  | 5870           reporter.reportErrorMessage( | 
|  | 5871               parameter, MessageKind.GENERIC, | 
|  | 5872               {'text': 'All arguments to external constructors of JavaScript ' | 
|  | 5873                        'interop classes must be named as these constructors ' | 
|  | 5874                        'are syntactic sugar for object literals.'}); | 
|  | 5875         } | 
|  | 5876         HInstruction argument = arguments[i]; | 
|  | 5877         if (argument != null) { | 
|  | 5878           filteredArguments.add(argument); | 
|  | 5879           parameterNameMap[parameter.name] = | 
|  | 5880               new js.InterpolatedExpression(positions++); | 
|  | 5881         } | 
|  | 5882         i++; | 
|  | 5883       }); | 
|  | 5884       var codeTemplate = new js.Template(null, | 
|  | 5885           js.objectLiteral(parameterNameMap)); | 
|  | 5886 | 
|  | 5887       var nativeBehavior = new native.NativeBehavior() | 
|  | 5888         ..codeTemplate = codeTemplate; | 
|  | 5889       return new HForeignCode( | 
|  | 5890           codeTemplate, | 
|  | 5891           backend.dynamicType, filteredArguments, | 
|  | 5892           nativeBehavior: nativeBehavior) | 
|  | 5893         ..sourceInformation = sourceInformation; | 
|  | 5894     } | 
|  | 5895     var target = new HForeignCode(js.js.parseForeignJS( | 
|  | 5896             "${backend.namer.fixedBackendPath(element)}." | 
|  | 5897             "${element.fixedBackendName}"), | 
|  | 5898         backend.dynamicType, | 
|  | 5899         <HInstruction>[]); | 
|  | 5900     add(target); | 
|  | 5901     // Strip off trailing arguments that were not specified. | 
|  | 5902     // we could assert that the trailing arguments are all null. | 
|  | 5903     // TODO(jacobr): rewrite named arguments to an object literal matching | 
|  | 5904     // the factory constructor case. | 
|  | 5905     arguments = arguments.where((arg) => arg != null).toList(); | 
|  | 5906     var inputs = <HInstruction>[target]..addAll(arguments); | 
|  | 5907 | 
|  | 5908     js.Template codeTemplate; | 
|  | 5909     if (element.isGetter) { | 
|  | 5910       codeTemplate = js.js.parseForeignJS("#"); | 
|  | 5911     } else if (element.isSetter) { | 
|  | 5912       codeTemplate = js.js.parseForeignJS("# = #"); | 
|  | 5913     } else { | 
|  | 5914       var argsStub = <String>[]; | 
|  | 5915       for (int i = 0; i < arguments.length; i++) { | 
|  | 5916         argsStub.add('#'); | 
|  | 5917       } | 
|  | 5918       if (element.isConstructor) { | 
|  | 5919         codeTemplate = js.js.parseForeignJS("new #(${argsStub.join(",")})"); | 
|  | 5920       } else { | 
|  | 5921         codeTemplate = js.js.parseForeignJS("#(${argsStub.join(",")})"); | 
|  | 5922       } | 
|  | 5923     } | 
|  | 5924 | 
|  | 5925     var nativeBehavior = new native.NativeBehavior() | 
|  | 5926       ..codeTemplate = codeTemplate | 
|  | 5927       ..typesReturned.add( | 
|  | 5928           backend.jsJavaScriptObjectClass.thisType) | 
|  | 5929       ..typesInstantiated.add( | 
|  | 5930           backend.jsJavaScriptObjectClass.thisType) | 
|  | 5931       ..sideEffects.setAllSideEffects(); | 
|  | 5932     return new HForeignCode( | 
|  | 5933         codeTemplate, | 
|  | 5934         backend.dynamicType, inputs, | 
|  | 5935         nativeBehavior: nativeBehavior) | 
|  | 5936       ..sourceInformation = sourceInformation; | 
|  | 5937   } | 
|  | 5938 | 
| 5821   void pushInvokeStatic(ast.Node location, | 5939   void pushInvokeStatic(ast.Node location, | 
| 5822                         Element element, | 5940                         Element element, | 
| 5823                         List<HInstruction> arguments, | 5941                         List<HInstruction> arguments, | 
| 5824                         {TypeMask typeMask, | 5942                         {TypeMask typeMask, | 
| 5825                          InterfaceType instanceType, | 5943                          InterfaceType instanceType, | 
| 5826                          SourceInformation sourceInformation}) { | 5944                          SourceInformation sourceInformation}) { | 
| 5827     // TODO(johnniwinther): Use [sourceInformation] instead of [location]. | 5945     // TODO(johnniwinther): Use [sourceInformation] instead of [location]. | 
| 5828     if (tryInlineMethod(element, null, null, arguments, location, | 5946     if (tryInlineMethod(element, null, null, arguments, location, | 
| 5829                         instanceType: instanceType)) { | 5947                         instanceType: instanceType)) { | 
| 5830       return; | 5948       return; | 
| 5831     } | 5949     } | 
| 5832 | 5950 | 
| 5833     if (typeMask == null) { | 5951     if (typeMask == null) { | 
| 5834       typeMask = | 5952       typeMask = | 
| 5835           TypeMaskFactory.inferredReturnTypeForElement(element, compiler); | 5953           TypeMaskFactory.inferredReturnTypeForElement(element, compiler); | 
| 5836     } | 5954     } | 
| 5837     bool targetCanThrow = !compiler.world.getCannotThrow(element); | 5955     bool targetCanThrow = !compiler.world.getCannotThrow(element); | 
| 5838     // TODO(5346): Try to avoid the need for calling [declaration] before | 5956     // TODO(5346): Try to avoid the need for calling [declaration] before | 
| 5839     // creating an [HInvokeStatic]. | 5957     var instruction; | 
| 5840     HInvokeStatic instruction = new HInvokeStatic( | 5958     if (element.isJsInterop) { | 
| 5841         element.declaration, arguments, typeMask, | 5959       instruction = invokeJsInteropFunction(element, arguments, | 
| 5842         targetCanThrow: targetCanThrow) | 5960           sourceInformation); | 
| 5843             ..sourceInformation = sourceInformation; | 5961     } else { | 
| 5844     if (!currentInlinedInstantiations.isEmpty) { | 5962       // creating an [HInvokeStatic]. | 
| 5845       instruction.instantiatedTypes = new List<DartType>.from( | 5963       instruction = new HInvokeStatic( | 
| 5846           currentInlinedInstantiations); | 5964           element.declaration, arguments, typeMask, | 
|  | 5965           targetCanThrow: targetCanThrow) | 
|  | 5966         ..sourceInformation = sourceInformation; | 
|  | 5967       if (!currentInlinedInstantiations.isEmpty) { | 
|  | 5968         instruction.instantiatedTypes = new List<DartType>.from( | 
|  | 5969             currentInlinedInstantiations); | 
|  | 5970       } | 
|  | 5971       instruction.sideEffects = compiler.world.getSideEffectsOfElement(element); | 
| 5847     } | 5972     } | 
| 5848     instruction.sideEffects = compiler.world.getSideEffectsOfElement(element); |  | 
| 5849     if (location == null) { | 5973     if (location == null) { | 
| 5850       push(instruction); | 5974       push(instruction); | 
| 5851     } else { | 5975     } else { | 
| 5852       pushWithPosition(instruction, location); | 5976       pushWithPosition(instruction, location); | 
| 5853     } | 5977     } | 
| 5854   } | 5978   } | 
| 5855 | 5979 | 
| 5856   HInstruction buildInvokeSuper(Selector selector, | 5980   HInstruction buildInvokeSuper(Selector selector, | 
| 5857                                 Element element, | 5981                                 Element element, | 
| 5858                                 List<HInstruction> arguments, | 5982                                 List<HInstruction> arguments, | 
| (...skipping 3162 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 9021     if (unaliased is TypedefType) throw 'unable to unalias $type'; | 9145     if (unaliased is TypedefType) throw 'unable to unalias $type'; | 
| 9022     unaliased.accept(this, builder); | 9146     unaliased.accept(this, builder); | 
| 9023   } | 9147   } | 
| 9024 | 9148 | 
| 9025   void visitDynamicType(DynamicType type, SsaBuilder builder) { | 9149   void visitDynamicType(DynamicType type, SsaBuilder builder) { | 
| 9026     JavaScriptBackend backend = builder.compiler.backend; | 9150     JavaScriptBackend backend = builder.compiler.backend; | 
| 9027     ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 9151     ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 
| 9028     builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 9152     builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 
| 9029   } | 9153   } | 
| 9030 } | 9154 } | 
| OLD | NEW | 
|---|