| OLD | NEW |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 1 library dart2js.ir_tracer; | 5 library dart2js.ir_tracer; |
| 2 | 6 |
| 3 import 'dart:async' show EventSink; | 7 import 'dart:async' show EventSink; |
| 4 | 8 |
| 5 import 'ir_nodes.dart' as ir hide Function; | 9 import 'ir_nodes.dart' as ir hide Function; |
| 6 import '../tracer.dart'; | 10 import '../tracer.dart'; |
| 7 | 11 |
| 8 /** | 12 /** |
| 9 * If true, show LetCont expressions in output. | 13 * If true, show LetCont expressions in output. |
| 10 */ | 14 */ |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 90 } |
| 87 | 91 |
| 88 visitInvokeStatic(ir.InvokeStatic node) { | 92 visitInvokeStatic(ir.InvokeStatic node) { |
| 89 String dummy = names.name(node); | 93 String dummy = names.name(node); |
| 90 String callName = node.selector.name; | 94 String callName = node.selector.name; |
| 91 String args = node.arguments.map(formatReference).join(', '); | 95 String args = node.arguments.map(formatReference).join(', '); |
| 92 String kont = formatReference(node.continuation); | 96 String kont = formatReference(node.continuation); |
| 93 printStmt(dummy, "InvokeStatic $callName ($args) $kont"); | 97 printStmt(dummy, "InvokeStatic $callName ($args) $kont"); |
| 94 } | 98 } |
| 95 | 99 |
| 100 visitInvokeMethod(ir.InvokeMethod node) { |
| 101 String dummy = names.name(node); |
| 102 String callName = node.selector.name; |
| 103 String args = node.arguments.map(formatReference).join(', '); |
| 104 String kont = formatReference(node.continuation); |
| 105 printStmt(dummy, "InvokeStatic $callName ($args) $kont"); |
| 106 } |
| 107 |
| 108 visitInvokeConstructor(ir.InvokeConstructor node) { |
| 109 String dummy = names.name(node); |
| 110 String callName; |
| 111 if (node.target.name.isEmpty) { |
| 112 callName = '${node.type}'; |
| 113 } else { |
| 114 callName = '${node.type}.${node.target.name}'; |
| 115 } |
| 116 String args = node.arguments.map(formatReference).join(', '); |
| 117 String kont = formatReference(node.continuation); |
| 118 printStmt(dummy, "InvokeConstructor $callName ($args) $kont"); |
| 119 } |
| 120 |
| 96 visitInvokeContinuation(ir.InvokeContinuation node) { | 121 visitInvokeContinuation(ir.InvokeContinuation node) { |
| 97 String dummy = names.name(node); | 122 String dummy = names.name(node); |
| 98 String kont = formatReference(node.continuation); | 123 String kont = formatReference(node.continuation); |
| 99 String args = node.arguments.map(formatReference).join(', '); | 124 String args = node.arguments.map(formatReference).join(', '); |
| 100 printStmt(dummy, "InvokeContinuation $kont ($args)"); | 125 printStmt(dummy, "InvokeContinuation $kont ($args)"); |
| 101 } | 126 } |
| 102 | 127 |
| 103 visitBranch(ir.Branch node) { | 128 visitBranch(ir.Branch node) { |
| 104 String dummy = names.name(node); | 129 String dummy = names.name(node); |
| 105 String condition = visit(node.condition); | 130 String condition = visit(node.condition); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 visit(exp.body); | 249 visit(exp.body); |
| 225 } | 250 } |
| 226 | 251 |
| 227 visitInvokeStatic(ir.InvokeStatic exp) { | 252 visitInvokeStatic(ir.InvokeStatic exp) { |
| 228 ir.Definition target = exp.continuation.definition; | 253 ir.Definition target = exp.continuation.definition; |
| 229 if (target is ir.Continuation && target.body != null) { | 254 if (target is ir.Continuation && target.body != null) { |
| 230 current_block.addEdgeTo(getBlock(target)); | 255 current_block.addEdgeTo(getBlock(target)); |
| 231 } | 256 } |
| 232 } | 257 } |
| 233 | 258 |
| 259 visitInvokeMethod(ir.InvokeMethod exp) { |
| 260 ir.Definition target = exp.continuation.definition; |
| 261 if (target is ir.Continuation && target.body != null) { |
| 262 current_block.addEdgeTo(getBlock(target)); |
| 263 } |
| 264 } |
| 265 |
| 266 visitInvokeConstructor(ir.InvokeConstructor exp) { |
| 267 ir.Definition target = exp.continuation.definition; |
| 268 if (target is ir.Continuation && target.body != null) { |
| 269 current_block.addEdgeTo(getBlock(target)); |
| 270 } |
| 271 } |
| 272 |
| 234 visitInvokeContinuation(ir.InvokeContinuation exp) { | 273 visitInvokeContinuation(ir.InvokeContinuation exp) { |
| 235 ir.Definition target = exp.continuation.definition; | 274 ir.Definition target = exp.continuation.definition; |
| 236 if (target is ir.Continuation && target.body != null) { | 275 if (target is ir.Continuation && target.body != null) { |
| 237 current_block.addEdgeTo(getBlock(target)); | 276 current_block.addEdgeTo(getBlock(target)); |
| 238 } | 277 } |
| 239 } | 278 } |
| 240 | 279 |
| 241 visitBranch(ir.Branch exp) { | 280 visitBranch(ir.Branch exp) { |
| 242 ir.Continuation trueTarget = exp.trueContinuation.definition; | 281 ir.Continuation trueTarget = exp.trueContinuation.definition; |
| 243 if (trueTarget.body != null) { | 282 if (trueTarget.body != null) { |
| 244 current_block.addEdgeTo(getBlock(trueTarget)); | 283 current_block.addEdgeTo(getBlock(trueTarget)); |
| 245 } | 284 } |
| 246 ir.Continuation falseTarget = exp.falseContinuation.definition; | 285 ir.Continuation falseTarget = exp.falseContinuation.definition; |
| 247 if (falseTarget.body != null) { | 286 if (falseTarget.body != null) { |
| 248 current_block.addEdgeTo(getBlock(falseTarget)); | 287 current_block.addEdgeTo(getBlock(falseTarget)); |
| 249 } | 288 } |
| 250 } | 289 } |
| 251 | 290 |
| 252 visitContinuation(ir.Continuation c) { | 291 visitContinuation(ir.Continuation c) { |
| 253 var old_node = current_block; | 292 var old_node = current_block; |
| 254 current_block = getBlock(c); | 293 current_block = getBlock(c); |
| 255 visit(c.body); | 294 visit(c.body); |
| 256 current_block = old_node; | 295 current_block = old_node; |
| 257 } | 296 } |
| 258 } | 297 } |
| OLD | NEW |