| 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 dart2js.ir_tracer; | 5 library dart2js.ir_tracer; |
| 6 | 6 |
| 7 import 'dart:async' show EventSink; | 7 import 'dart:async' show EventSink; |
| 8 | 8 |
| 9 import 'cps_ir_nodes.dart' as cps_ir hide Function; | 9 import 'cps_ir_nodes.dart' as cps_ir hide Function; |
| 10 import '../tracer.dart'; | 10 import '../tracer.dart'; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (IR_TRACE_LET_CONT) { | 141 if (IR_TRACE_LET_CONT) { |
| 142 String dummy = names.name(node); | 142 String dummy = names.name(node); |
| 143 String id = names.name(node.handler); | 143 String id = names.name(node.handler); |
| 144 printStmt(dummy, "LetHandler $id = <$id>"); | 144 printStmt(dummy, "LetHandler $id = <$id>"); |
| 145 } | 145 } |
| 146 visit(node.body); | 146 visit(node.body); |
| 147 } | 147 } |
| 148 | 148 |
| 149 visitLetMutable(cps_ir.LetMutable node) { | 149 visitLetMutable(cps_ir.LetMutable node) { |
| 150 String id = names.name(node.variable); | 150 String id = names.name(node.variable); |
| 151 printStmt(id, "${node.runtimeType} $id = ${formatReference(node.value)}"); | 151 printStmt(id, "LetMutable $id = ${formatReference(node.value)}"); |
| 152 visit(node.body); | 152 visit(node.body); |
| 153 } | 153 } |
| 154 | 154 |
| 155 visitInvokeStatic(cps_ir.InvokeStatic node) { | 155 visitInvokeStatic(cps_ir.InvokeStatic node) { |
| 156 String dummy = names.name(node); | 156 String dummy = names.name(node); |
| 157 String callName = node.selector.name; | 157 String callName = node.selector.name; |
| 158 String args = node.arguments.map(formatReference).join(', '); | 158 String args = node.arguments.map(formatReference).join(', '); |
| 159 String kont = formatReference(node.continuation); | 159 String kont = formatReference(node.continuation); |
| 160 printStmt(dummy, "InvokeStatic $callName ($args) $kont"); | 160 printStmt(dummy, "InvokeStatic $callName ($args) $kont"); |
| 161 } | 161 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 String condition = visit(node.condition); | 237 String condition = visit(node.condition); |
| 238 String trueCont = formatReference(node.trueContinuation); | 238 String trueCont = formatReference(node.trueContinuation); |
| 239 String falseCont = formatReference(node.falseContinuation); | 239 String falseCont = formatReference(node.falseContinuation); |
| 240 printStmt(dummy, "Branch $condition ($trueCont, $falseCont)"); | 240 printStmt(dummy, "Branch $condition ($trueCont, $falseCont)"); |
| 241 } | 241 } |
| 242 | 242 |
| 243 visitSetMutableVariable(cps_ir.SetMutableVariable node) { | 243 visitSetMutableVariable(cps_ir.SetMutableVariable node) { |
| 244 String dummy = names.name(node); | 244 String dummy = names.name(node); |
| 245 String variable = names.name(node.variable.definition); | 245 String variable = names.name(node.variable.definition); |
| 246 String value = formatReference(node.value); | 246 String value = formatReference(node.value); |
| 247 printStmt(dummy, '${node.runtimeType} $variable := $value'); | 247 printStmt(dummy, 'SetMutableVariable $variable := $value'); |
| 248 visit(node.body); | 248 visit(node.body); |
| 249 } | 249 } |
| 250 | 250 |
| 251 visitDeclareFunction(cps_ir.DeclareFunction node) { | 251 visitDeclareFunction(cps_ir.DeclareFunction node) { |
| 252 String dummy = names.name(node); | 252 String dummy = names.name(node); |
| 253 String variable = names.name(node.variable); | 253 String variable = names.name(node.variable); |
| 254 printStmt(dummy, 'DeclareFunction $variable'); | 254 printStmt(dummy, 'DeclareFunction $variable'); |
| 255 visit(node.body); | 255 visit(node.body); |
| 256 } | 256 } |
| 257 | 257 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 268 | 268 |
| 269 visitConstant(cps_ir.Constant node) { | 269 visitConstant(cps_ir.Constant node) { |
| 270 return "Constant ${node.expression.value.toStructuredString()}"; | 270 return "Constant ${node.expression.value.toStructuredString()}"; |
| 271 } | 271 } |
| 272 | 272 |
| 273 visitParameter(cps_ir.Parameter node) { | 273 visitParameter(cps_ir.Parameter node) { |
| 274 return "Parameter ${names.name(node)}"; | 274 return "Parameter ${names.name(node)}"; |
| 275 } | 275 } |
| 276 | 276 |
| 277 visitMutableVariable(cps_ir.MutableVariable node) { | 277 visitMutableVariable(cps_ir.MutableVariable node) { |
| 278 return "${node.runtimeType} ${names.name(node)}"; | 278 return "MutableVariable ${names.name(node)}"; |
| 279 } | 279 } |
| 280 | 280 |
| 281 visitContinuation(cps_ir.Continuation node) { | 281 visitContinuation(cps_ir.Continuation node) { |
| 282 return "Continuation ${names.name(node)}"; | 282 return "Continuation ${names.name(node)}"; |
| 283 } | 283 } |
| 284 | 284 |
| 285 visitIsTrue(cps_ir.IsTrue node) { | 285 visitIsTrue(cps_ir.IsTrue node) { |
| 286 return "IsTrue(${names.name(node.value.definition)})"; | 286 return "IsTrue(${names.name(node.value.definition)})"; |
| 287 } | 287 } |
| 288 | 288 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 visitReifyTypeVar(cps_ir.ReifyTypeVar node) { | 328 visitReifyTypeVar(cps_ir.ReifyTypeVar node) { |
| 329 return "ReifyTypeVar ${node.typeVariable.name}"; | 329 return "ReifyTypeVar ${node.typeVariable.name}"; |
| 330 } | 330 } |
| 331 | 331 |
| 332 visitCreateFunction(cps_ir.CreateFunction node) { | 332 visitCreateFunction(cps_ir.CreateFunction node) { |
| 333 return "CreateFunction ${node.definition.element.name}"; | 333 return "CreateFunction ${node.definition.element.name}"; |
| 334 } | 334 } |
| 335 | 335 |
| 336 visitGetMutableVariable(cps_ir.GetMutableVariable node) { | 336 visitGetMutableVariable(cps_ir.GetMutableVariable node) { |
| 337 String variable = names.name(node.variable.definition); | 337 String variable = names.name(node.variable.definition); |
| 338 return '${node.runtimeType} $variable'; | 338 return 'GetMutableVariable $variable'; |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 | 341 |
| 342 /** | 342 /** |
| 343 * Invents (and remembers) names for Continuations, Parameters, etc. | 343 * Invents (and remembers) names for Continuations, Parameters, etc. |
| 344 * The names must match the conventions used by IR Hydra, e.g. | 344 * The names must match the conventions used by IR Hydra, e.g. |
| 345 * Continuations and Functions must have names of form B### since they | 345 * Continuations and Functions must have names of form B### since they |
| 346 * are visualized as basic blocks. | 346 * are visualized as basic blocks. |
| 347 */ | 347 */ |
| 348 class Names { | 348 class Names { |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 visitIsTrue(cps_ir.IsTrue node) { | 568 visitIsTrue(cps_ir.IsTrue node) { |
| 569 unexpectedNode(node); | 569 unexpectedNode(node); |
| 570 } | 570 } |
| 571 visitIdentical(cps_ir.Identical node) { | 571 visitIdentical(cps_ir.Identical node) { |
| 572 unexpectedNode(node); | 572 unexpectedNode(node); |
| 573 } | 573 } |
| 574 visitInterceptor(cps_ir.Interceptor node) { | 574 visitInterceptor(cps_ir.Interceptor node) { |
| 575 unexpectedNode(node); | 575 unexpectedNode(node); |
| 576 } | 576 } |
| 577 } | 577 } |
| OLD | NEW |