| 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 SsaCodeGeneratorTask generator; | 8 SsaCodeGeneratorTask generator; |
| 9 SsaBuilderTask builder; | 9 SsaBuilderTask builder; |
| 10 SsaOptimizerTask optimizer; | 10 SsaOptimizerTask optimizer; |
| (...skipping 4760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4771 FunctionSignature signature = function.functionSignature; | 4771 FunctionSignature signature = function.functionSignature; |
| 4772 signature.forEachParameter((Element parameter) { | 4772 signature.forEachParameter((Element parameter) { |
| 4773 existingArguments.add(parameter.name); | 4773 existingArguments.add(parameter.name); |
| 4774 }); | 4774 }); |
| 4775 generateThrowNoSuchMethod(diagnosticNode, | 4775 generateThrowNoSuchMethod(diagnosticNode, |
| 4776 function.name, | 4776 function.name, |
| 4777 argumentNodes: argumentNodes, | 4777 argumentNodes: argumentNodes, |
| 4778 existingArguments: existingArguments); | 4778 existingArguments: existingArguments); |
| 4779 } | 4779 } |
| 4780 | 4780 |
| 4781 visitNewExpression(ast.NewExpression node) { | 4781 @override |
| 4782 handleNewExpression(ast.NewExpression node) { |
| 4782 Element element = elements[node.send]; | 4783 Element element = elements[node.send]; |
| 4783 final bool isSymbolConstructor = element == compiler.symbolConstructor; | 4784 final bool isSymbolConstructor = element == compiler.symbolConstructor; |
| 4784 if (!Elements.isErroneous(element)) { | 4785 if (!Elements.isErroneous(element)) { |
| 4785 ConstructorElement function = element; | 4786 ConstructorElement function = element; |
| 4786 element = function.effectiveTarget; | 4787 element = function.effectiveTarget; |
| 4787 } | 4788 } |
| 4788 if (Elements.isErroneous(element)) { | 4789 if (Elements.isErroneous(element)) { |
| 4789 if (element is !ErroneousElement) { | 4790 if (element is !ErroneousElement) { |
| 4790 // TODO(ahe): Do something like [generateWrongArgumentCountError]. | 4791 // TODO(ahe): Do something like [generateWrongArgumentCountError]. |
| 4791 stack.add(graph.addConstantNull(compiler)); | 4792 stack.add(graph.addConstantNull(compiler)); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4958 rhs = graph.addConstantInt(1, compiler); | 4959 rhs = graph.addConstantInt(1, compiler); |
| 4959 } else { | 4960 } else { |
| 4960 visit(arguments.head); | 4961 visit(arguments.head); |
| 4961 assert(arguments.tail.isEmpty); | 4962 assert(arguments.tail.isEmpty); |
| 4962 rhs = pop(); | 4963 rhs = pop(); |
| 4963 } | 4964 } |
| 4964 visitBinarySend(receiver, node.assignmentOperator, rhs, | 4965 visitBinarySend(receiver, node.assignmentOperator, rhs, |
| 4965 elements.getOperatorSelectorInComplexSendSet(node), node); | 4966 elements.getOperatorSelectorInComplexSendSet(node), node); |
| 4966 } | 4967 } |
| 4967 | 4968 |
| 4968 visitSendSet(ast.SendSet node) { | 4969 @override |
| 4970 handleSendSet(ast.SendSet node) { |
| 4969 generateIsDeferredLoadedCheckIfNeeded(node); | 4971 generateIsDeferredLoadedCheckIfNeeded(node); |
| 4970 Element element = elements[node]; | 4972 Element element = elements[node]; |
| 4971 if (!Elements.isUnresolved(element) && element.impliesType) { | 4973 if (!Elements.isUnresolved(element) && element.impliesType) { |
| 4972 ast.Identifier selector = node.selector; | 4974 ast.Identifier selector = node.selector; |
| 4973 generateThrowNoSuchMethod(node, selector.source, | 4975 generateThrowNoSuchMethod(node, selector.source, |
| 4974 argumentNodes: node.arguments); | 4976 argumentNodes: node.arguments); |
| 4975 return; | 4977 return; |
| 4976 } | 4978 } |
| 4977 ast.Operator op = node.assignmentOperator; | 4979 ast.Operator op = node.assignmentOperator; |
| 4978 if (node.isSuperCall) { | 4980 if (node.isSuperCall) { |
| (...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6981 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6983 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6982 unaliased.accept(this, builder); | 6984 unaliased.accept(this, builder); |
| 6983 } | 6985 } |
| 6984 | 6986 |
| 6985 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6987 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6986 JavaScriptBackend backend = builder.compiler.backend; | 6988 JavaScriptBackend backend = builder.compiler.backend; |
| 6987 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6989 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 6988 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6990 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
| 6989 } | 6991 } |
| 6990 } | 6992 } |
| OLD | NEW |