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 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 * creates a new constructor body, if none can be found. | 1747 * creates a new constructor body, if none can be found. |
1748 * | 1748 * |
1749 * Returns [:null:] if the constructor does not have a body. | 1749 * Returns [:null:] if the constructor does not have a body. |
1750 */ | 1750 */ |
1751 ConstructorBodyElement getConstructorBody(FunctionElement constructor) { | 1751 ConstructorBodyElement getConstructorBody(FunctionElement constructor) { |
1752 assert(constructor.isGenerativeConstructor); | 1752 assert(constructor.isGenerativeConstructor); |
1753 assert(invariant(constructor, constructor.isImplementation)); | 1753 assert(invariant(constructor, constructor.isImplementation)); |
1754 if (constructor.isSynthesized) return null; | 1754 if (constructor.isSynthesized) return null; |
1755 ast.FunctionExpression node = constructor.node; | 1755 ast.FunctionExpression node = constructor.node; |
1756 // If we know the body doesn't have any code, we don't generate it. | 1756 // If we know the body doesn't have any code, we don't generate it. |
1757 if (!node.hasBody()) return null; | 1757 if (!node.hasBody) return null; |
1758 if (node.hasEmptyBody()) return null; | 1758 if (node.hasEmptyBody) return null; |
1759 ClassElement classElement = constructor.enclosingClass; | 1759 ClassElement classElement = constructor.enclosingClass; |
1760 ConstructorBodyElement bodyElement; | 1760 ConstructorBodyElement bodyElement; |
1761 classElement.forEachBackendMember((Element backendMember) { | 1761 classElement.forEachBackendMember((Element backendMember) { |
1762 if (backendMember.isGenerativeConstructorBody) { | 1762 if (backendMember.isGenerativeConstructorBody) { |
1763 ConstructorBodyElement body = backendMember; | 1763 ConstructorBodyElement body = backendMember; |
1764 if (body.constructor == constructor) { | 1764 if (body.constructor == constructor) { |
1765 // TODO(kasperl): Find a way of stopping the iteration | 1765 // TODO(kasperl): Find a way of stopping the iteration |
1766 // through the backend members. | 1766 // through the backend members. |
1767 bodyElement = backendMember; | 1767 bodyElement = backendMember; |
1768 } | 1768 } |
(...skipping 7468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9237 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 9237 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
9238 unaliased.accept(this, builder); | 9238 unaliased.accept(this, builder); |
9239 } | 9239 } |
9240 | 9240 |
9241 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 9241 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
9242 JavaScriptBackend backend = builder.compiler.backend; | 9242 JavaScriptBackend backend = builder.compiler.backend; |
9243 ClassElement cls = backend.helpers.DynamicRuntimeType; | 9243 ClassElement cls = backend.helpers.DynamicRuntimeType; |
9244 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 9244 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
9245 } | 9245 } |
9246 } | 9246 } |
OLD | NEW |