| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 visitRethrow(Rethrow node) { | 85 visitRethrow(Rethrow node) { |
| 86 _addStatement(node); | 86 _addStatement(node); |
| 87 } | 87 } |
| 88 | 88 |
| 89 visitUnreachable(Unreachable node) { | 89 visitUnreachable(Unreachable node) { |
| 90 _addStatement(node); | 90 _addStatement(node); |
| 91 } | 91 } |
| 92 | 92 |
| 93 visitBreak(Break node) { | 93 visitBreak(Break node) { |
| 94 _addStatement(node); | 94 _addStatement(node); |
| 95 blocks.last.addEdgeTo(breakTargets[node.target]); | 95 if (breakTargets.containsKey(node.target)) { |
| 96 blocks.last.addEdgeTo(breakTargets[node.target]); |
| 97 } |
| 96 } | 98 } |
| 97 | 99 |
| 98 visitContinue(Continue node) { | 100 visitContinue(Continue node) { |
| 99 _addStatement(node); | 101 _addStatement(node); |
| 100 blocks.last.addEdgeTo(continueTargets[node.target]); | 102 blocks.last.addEdgeTo(continueTargets[node.target]); |
| 101 } | 103 } |
| 102 | 104 |
| 103 visitIf(If node) { | 105 visitIf(If node) { |
| 104 _addStatement(node); | 106 _addStatement(node); |
| 105 Block thenTarget = new Block(); | 107 Block thenTarget = new Block(); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 269 |
| 268 visitRethrow(Rethrow node) { | 270 visitRethrow(Rethrow node) { |
| 269 printStatement(null, "rethrow"); | 271 printStatement(null, "rethrow"); |
| 270 } | 272 } |
| 271 | 273 |
| 272 visitUnreachable(Unreachable node) { | 274 visitUnreachable(Unreachable node) { |
| 273 printStatement(null, "unreachable"); | 275 printStatement(null, "unreachable"); |
| 274 } | 276 } |
| 275 | 277 |
| 276 visitBreak(Break node) { | 278 visitBreak(Break node) { |
| 277 printStatement(null, "break ${collector.breakTargets[node.target].name}"); | 279 Block block = collector.breakTargets[node.target]; |
| 280 String name = block != null ? block.name : '<missing label>'; |
| 281 printStatement(null, "break $name"); |
| 278 } | 282 } |
| 279 | 283 |
| 280 visitContinue(Continue node) { | 284 visitContinue(Continue node) { |
| 281 printStatement(null, | 285 printStatement(null, |
| 282 "continue ${collector.continueTargets[node.target].name}"); | 286 "continue ${collector.continueTargets[node.target].name}"); |
| 283 } | 287 } |
| 284 | 288 |
| 285 visitIf(If node) { | 289 visitIf(If node) { |
| 286 String condition = expr(node.condition); | 290 String condition = expr(node.condition); |
| 287 String thenTarget = collector.substatements[node.thenStatement].name; | 291 String thenTarget = collector.substatements[node.thenStatement].name; |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 575 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
| 572 while (name == null || _usedNames.contains(name)) { | 576 while (name == null || _usedNames.contains(name)) { |
| 573 name = "$prefix${_counter++}"; | 577 name = "$prefix${_counter++}"; |
| 574 } | 578 } |
| 575 _names[v] = name; | 579 _names[v] = name; |
| 576 _usedNames.add(name); | 580 _usedNames.add(name); |
| 577 } | 581 } |
| 578 return name; | 582 return name; |
| 579 } | 583 } |
| 580 } | 584 } |
| OLD | NEW |