| 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 Interceptors { | 7 class Interceptors { |
| 8 Compiler compiler; | 8 Compiler compiler; |
| 9 Interceptors(Compiler this.compiler); | 9 Interceptors(Compiler this.compiler); |
| 10 | 10 |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 * creates a new constructor body, if none can be found. | 963 * creates a new constructor body, if none can be found. |
| 964 * | 964 * |
| 965 * Returns [:null:] if the constructor does not have a body. | 965 * Returns [:null:] if the constructor does not have a body. |
| 966 */ | 966 */ |
| 967 ConstructorBodyElement getConstructorBody(FunctionElement constructor) { | 967 ConstructorBodyElement getConstructorBody(FunctionElement constructor) { |
| 968 assert(constructor.isGenerativeConstructor()); | 968 assert(constructor.isGenerativeConstructor()); |
| 969 assert(invariant(constructor, constructor.isImplementation)); | 969 assert(invariant(constructor, constructor.isImplementation)); |
| 970 if (constructor is SynthesizedConstructorElement) return null; | 970 if (constructor is SynthesizedConstructorElement) return null; |
| 971 FunctionExpression node = constructor.parseNode(compiler); | 971 FunctionExpression node = constructor.parseNode(compiler); |
| 972 // If we know the body doesn't have any code, we don't generate it. | 972 // If we know the body doesn't have any code, we don't generate it. |
| 973 if (node.body.asBlock() != null) { | 973 if (!node.hasBody()) return null; |
| 974 NodeList statements = node.body.asBlock().statements; | 974 if (node.hasEmptyBody()) return null; |
| 975 if (statements.isEmpty) return null; | |
| 976 } | |
| 977 ClassElement classElement = constructor.getEnclosingClass(); | 975 ClassElement classElement = constructor.getEnclosingClass(); |
| 978 ConstructorBodyElement bodyElement; | 976 ConstructorBodyElement bodyElement; |
| 979 for (Link<Element> backendMembers = classElement.backendMembers; | 977 for (Link<Element> backendMembers = classElement.backendMembers; |
| 980 !backendMembers.isEmpty; | 978 !backendMembers.isEmpty; |
| 981 backendMembers = backendMembers.tail) { | 979 backendMembers = backendMembers.tail) { |
| 982 Element backendMember = backendMembers.head; | 980 Element backendMember = backendMembers.head; |
| 983 if (backendMember.isGenerativeConstructorBody()) { | 981 if (backendMember.isGenerativeConstructorBody()) { |
| 984 ConstructorBodyElement body = backendMember; | 982 ConstructorBodyElement body = backendMember; |
| 985 if (body.constructor == constructor) { | 983 if (body.constructor == constructor) { |
| 986 bodyElement = backendMember; | 984 bodyElement = backendMember; |
| (...skipping 3599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4586 new HSubGraphBlockInformation(elseBranch.graph)); | 4584 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4587 | 4585 |
| 4588 HBasicBlock conditionStartBlock = conditionBranch.block; | 4586 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4589 conditionStartBlock.setBlockFlow(info, joinBlock); | 4587 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4590 SubGraph conditionGraph = conditionBranch.graph; | 4588 SubGraph conditionGraph = conditionBranch.graph; |
| 4591 HIf branch = conditionGraph.end.last; | 4589 HIf branch = conditionGraph.end.last; |
| 4592 assert(branch is HIf); | 4590 assert(branch is HIf); |
| 4593 branch.blockInformation = conditionStartBlock.blockFlow; | 4591 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4594 } | 4592 } |
| 4595 } | 4593 } |
| OLD | NEW |