| 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 import 'optimization/optimization.dart'; | 10 import 'optimization/optimization.dart'; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 add("$bci $uses $name $contents <|@\n"); | 231 add("$bci $uses $name $contents <|@\n"); |
| 232 } | 232 } |
| 233 | 233 |
| 234 visitLabeledStatement(LabeledStatement node) { | 234 visitLabeledStatement(LabeledStatement node) { |
| 235 // These do not get added to a block's list of statements. | 235 // These do not get added to a block's list of statements. |
| 236 } | 236 } |
| 237 | 237 |
| 238 visitAssign(Assign node) { | 238 visitAssign(Assign node) { |
| 239 String name = names.varName(node.variable); | 239 String name = names.varName(node.variable); |
| 240 String rhs = expr(node.definition); | 240 String rhs = expr(node.definition); |
| 241 String extra = node.hasExactlyOneUse ? "[single-use]" : ""; | 241 Variable v = node.variable; |
| 242 String extra = "(r=${v.readCount}, w=${v.writeCount})"; |
| 242 printStatement(null, "assign $name = $rhs $extra"); | 243 printStatement(null, "assign $name = $rhs $extra"); |
| 243 } | 244 } |
| 244 | 245 |
| 245 visitReturn(Return node) { | 246 visitReturn(Return node) { |
| 246 printStatement(null, "return ${expr(node.value)}"); | 247 printStatement(null, "return ${expr(node.value)}"); |
| 247 } | 248 } |
| 248 | 249 |
| 249 visitBreak(Break node) { | 250 visitBreak(Break node) { |
| 250 printStatement(null, "break ${collector.breakTargets[node.target].name}"); | 251 printStatement(null, "break ${collector.breakTargets[node.target].name}"); |
| 251 } | 252 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 474 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
| 474 while (name == null || _usedNames.contains(name)) { | 475 while (name == null || _usedNames.contains(name)) { |
| 475 name = "$prefix${_counter++}"; | 476 name = "$prefix${_counter++}"; |
| 476 } | 477 } |
| 477 _names[v] = name; | 478 _names[v] = name; |
| 478 _usedNames.add(name); | 479 _usedNames.add(name); |
| 479 } | 480 } |
| 480 return name; | 481 return name; |
| 481 } | 482 } |
| 482 } | 483 } |
| OLD | NEW |