OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 tree_ir_tracer; | 5 library tree_ir_tracer; |
6 | 6 |
7 import 'dart:async' show EventSink; | 7 import 'dart:async' show EventSink; |
8 import '../tracer.dart'; | 8 import '../tracer.dart'; |
9 import 'tree_ir_nodes.dart'; | 9 import 'tree_ir_nodes.dart'; |
10 | 10 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 _addStatement(node); | 126 _addStatement(node); |
127 visitStatement(node.body); | 127 visitStatement(node.body); |
128 } | 128 } |
129 | 129 |
130 visitFor(For node) { | 130 visitFor(For node) { |
131 Block whileBlock = new Block(); | 131 Block whileBlock = new Block(); |
132 _addGotoStatement(whileBlock); | 132 _addGotoStatement(whileBlock); |
133 | 133 |
134 _addBlock(whileBlock); | 134 _addBlock(whileBlock); |
135 _addStatement(node); | 135 _addStatement(node); |
136 whileBlock.statements.add(node); | |
137 blocks.last.addEdgeTo(whileBlock); | 136 blocks.last.addEdgeTo(whileBlock); |
138 | 137 |
139 Block bodyBlock = new Block(); | 138 Block bodyBlock = new Block(); |
140 Block nextBlock = new Block(); | 139 Block nextBlock = new Block(); |
141 whileBlock.addEdgeTo(bodyBlock); | 140 whileBlock.addEdgeTo(bodyBlock); |
142 whileBlock.addEdgeTo(nextBlock); | 141 whileBlock.addEdgeTo(nextBlock); |
143 | 142 |
144 continueTargets[node.label] = bodyBlock; | 143 continueTargets[node.label] = bodyBlock; |
145 _addBlock(bodyBlock); | 144 _addBlock(bodyBlock); |
146 visitStatement(node.body); | 145 visitStatement(node.body); |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 614 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
616 while (name == null || _usedNames.contains(name)) { | 615 while (name == null || _usedNames.contains(name)) { |
617 name = "$prefix${_counter++}"; | 616 name = "$prefix${_counter++}"; |
618 } | 617 } |
619 _names[v] = name; | 618 _names[v] = name; |
620 _usedNames.add(name); | 619 _usedNames.add(name); |
621 } | 620 } |
622 return name; | 621 return name; |
623 } | 622 } |
624 } | 623 } |
OLD | NEW |