| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 addIndent(); | 258 addIndent(); |
| 259 add("$bci $uses $name $contents <|@\n"); | 259 add("$bci $uses $name $contents <|@\n"); |
| 260 } | 260 } |
| 261 | 261 |
| 262 visitLabeledStatement(LabeledStatement node) { | 262 visitLabeledStatement(LabeledStatement node) { |
| 263 // These do not get added to a block's list of statements. | 263 // These do not get added to a block's list of statements. |
| 264 } | 264 } |
| 265 | 265 |
| 266 visitAssign(Assign node) { | 266 visitAssign(Assign node) { |
| 267 String name = names.varName(node.variable); | 267 String name = names.varName(node.variable); |
| 268 String rhs = expr(node.definition); | 268 String rhs = expr(node.value); |
| 269 Variable v = node.variable; | 269 Variable v = node.variable; |
| 270 String extra = "(r=${v.readCount}, w=${v.writeCount})"; | 270 String extra = "(r=${v.readCount}, w=${v.writeCount})"; |
| 271 printStatement(null, "assign $name = $rhs $extra"); | 271 printStatement(null, "assign $name = $rhs $extra"); |
| 272 } | 272 } |
| 273 | 273 |
| 274 visitReturn(Return node) { | 274 visitReturn(Return node) { |
| 275 printStatement(null, "return ${expr(node.value)}"); | 275 printStatement(null, "return ${expr(node.value)}"); |
| 276 } | 276 } |
| 277 | 277 |
| 278 visitBreak(Break node) { | 278 visitBreak(Break node) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 519 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
| 520 while (name == null || _usedNames.contains(name)) { | 520 while (name == null || _usedNames.contains(name)) { |
| 521 name = "$prefix${_counter++}"; | 521 name = "$prefix${_counter++}"; |
| 522 } | 522 } |
| 523 _names[v] = name; | 523 _names[v] = name; |
| 524 _usedNames.add(name); | 524 _usedNames.add(name); |
| 525 } | 525 } |
| 526 return name; | 526 return name; |
| 527 } | 527 } |
| 528 } | 528 } |
| OLD | NEW |