OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_builder_task; | 5 library dart2js.ir_builder_task; |
6 | 6 |
7 import '../closure.dart' as closurelib; | 7 import '../closure.dart' as closurelib; |
8 import '../closure.dart' hide ClosureScope; | 8 import '../closure.dart' hide ClosureScope; |
9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 String get name => 'IR builder'; | 51 String get name => 'IR builder'; |
52 | 52 |
53 bool hasIr(Element element) => nodes.containsKey(element.implementation); | 53 bool hasIr(Element element) => nodes.containsKey(element.implementation); |
54 | 54 |
55 ir.RootNode getIr(ExecutableElement element) { | 55 ir.RootNode getIr(ExecutableElement element) { |
56 return nodes[element.implementation]; | 56 return nodes[element.implementation]; |
57 } | 57 } |
58 | 58 |
59 ir.RootNode buildNode(AstElement element) { | 59 ir.RootNode buildNode(AstElement element) { |
| 60 return measure(() => _buildNode(element)); |
| 61 } |
| 62 |
| 63 ir.RootNode _buildNode(AstElement element) { |
60 bailoutMessage = null; | 64 bailoutMessage = null; |
61 if (!canBuild(element)) { | 65 if (!canBuild(element)) { |
62 bailoutMessage = 'unsupported element ${element.name}:${element.kind}'; | 66 bailoutMessage = 'unsupported element ${element.name}:${element.kind}'; |
63 return null; | 67 return null; |
64 } | 68 } |
65 | 69 |
66 TreeElements elementsMapping = element.resolvedAst.elements; | 70 TreeElements elementsMapping = element.resolvedAst.elements; |
67 element = element.implementation; | 71 element = element.implementation; |
68 return compiler.withCurrentElement(element, () { | 72 return compiler.withCurrentElement(element, () { |
69 SourceInformationBuilder sourceInformationBuilder = | 73 SourceInformationBuilder sourceInformationBuilder = |
(...skipping 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2822 node.body = replacementFor(node.body); | 2826 node.body = replacementFor(node.body); |
2823 } | 2827 } |
2824 } | 2828 } |
2825 | 2829 |
2826 /// Visit a just-deleted subterm and unlink all [Reference]s in it. | 2830 /// Visit a just-deleted subterm and unlink all [Reference]s in it. |
2827 class RemovalVisitor extends ir.RecursiveVisitor { | 2831 class RemovalVisitor extends ir.RecursiveVisitor { |
2828 processReference(ir.Reference reference) { | 2832 processReference(ir.Reference reference) { |
2829 reference.unlink(); | 2833 reference.unlink(); |
2830 } | 2834 } |
2831 } | 2835 } |
OLD | NEW |