| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 String receiver = formatReference(node.receiver); | 175 String receiver = formatReference(node.receiver); |
| 176 String callName = node.selector.name; | 176 String callName = node.selector.name; |
| 177 String args = node.arguments.map(formatReference).join(', '); | 177 String args = node.arguments.map(formatReference).join(', '); |
| 178 String kont = formatReference(node.continuation); | 178 String kont = formatReference(node.continuation); |
| 179 printStmt(dummy, | 179 printStmt(dummy, |
| 180 "InvokeMethodDirectly $receiver $callName ($args) $kont"); | 180 "InvokeMethodDirectly $receiver $callName ($args) $kont"); |
| 181 } | 181 } |
| 182 | 182 |
| 183 visitInvokeConstructor(cps_ir.InvokeConstructor node) { | 183 visitInvokeConstructor(cps_ir.InvokeConstructor node) { |
| 184 String dummy = names.name(node); | 184 String dummy = names.name(node); |
| 185 String className = node.target.enclosingClass.name; |
| 185 String callName; | 186 String callName; |
| 186 if (node.target.name.isEmpty) { | 187 if (node.target.name.isEmpty) { |
| 187 callName = '${node.type}'; | 188 callName = '${className}'; |
| 188 } else { | 189 } else { |
| 189 callName = '${node.type}.${node.target.name}'; | 190 callName = '${className}.${node.target.name}'; |
| 190 } | 191 } |
| 191 String args = node.arguments.map(formatReference).join(', '); | 192 String args = node.arguments.map(formatReference).join(', '); |
| 193 String typeArguments = node.typeArguments.map(formatReference).join(', '); |
| 192 String kont = formatReference(node.continuation); | 194 String kont = formatReference(node.continuation); |
| 193 printStmt(dummy, "InvokeConstructor $callName ($args) $kont"); | 195 printStmt(dummy, "InvokeConstructor $callName ($args) " |
| 196 "<$typeArguments> $kont"); |
| 194 } | 197 } |
| 195 | 198 |
| 196 visitConcatenateStrings(cps_ir.ConcatenateStrings node) { | 199 visitConcatenateStrings(cps_ir.ConcatenateStrings node) { |
| 197 String dummy = names.name(node); | 200 String dummy = names.name(node); |
| 198 String args = node.arguments.map(formatReference).join(', '); | 201 String args = node.arguments.map(formatReference).join(', '); |
| 199 String kont = formatReference(node.continuation); | 202 String kont = formatReference(node.continuation); |
| 200 printStmt(dummy, "ConcatenateStrings ($args) $kont"); | 203 printStmt(dummy, "ConcatenateStrings ($args) $kont"); |
| 201 } | 204 } |
| 202 | 205 |
| 203 visitLiteralList(cps_ir.LiteralList node) { | 206 visitLiteralList(cps_ir.LiteralList node) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 @override | 344 @override |
| 342 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { | 345 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { |
| 343 return "ReadTypeVariable ${node.variable.element} " | 346 return "ReadTypeVariable ${node.variable.element} " |
| 344 "${formatReference(node.target)}"; | 347 "${formatReference(node.target)}"; |
| 345 } | 348 } |
| 346 | 349 |
| 347 @override | 350 @override |
| 348 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { | 351 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { |
| 349 return "ReifyRuntimeType ${formatReference(node.value)}"; | 352 return "ReifyRuntimeType ${formatReference(node.value)}"; |
| 350 } | 353 } |
| 354 |
| 355 @override |
| 356 visitTypeExpression(cps_ir.TypeExpression node) { |
| 357 return "TypeExpression ${node.dartType} " |
| 358 "${node.arguments.map(formatReference).join(', ')}"; |
| 359 } |
| 351 } | 360 } |
| 352 | 361 |
| 353 /** | 362 /** |
| 354 * Invents (and remembers) names for Continuations, Parameters, etc. | 363 * Invents (and remembers) names for Continuations, Parameters, etc. |
| 355 * The names must match the conventions used by IR Hydra, e.g. | 364 * The names must match the conventions used by IR Hydra, e.g. |
| 356 * Continuations and Functions must have names of form B### since they | 365 * Continuations and Functions must have names of form B### since they |
| 357 * are visualized as basic blocks. | 366 * are visualized as basic blocks. |
| 358 */ | 367 */ |
| 359 class Names { | 368 class Names { |
| 360 final Map<Object, String> names = {}; | 369 final Map<Object, String> names = {}; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 | 597 |
| 589 @override | 598 @override |
| 590 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { | 599 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { |
| 591 unexpectedNode(node); | 600 unexpectedNode(node); |
| 592 } | 601 } |
| 593 | 602 |
| 594 @override | 603 @override |
| 595 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { | 604 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { |
| 596 unexpectedNode(node); | 605 unexpectedNode(node); |
| 597 } | 606 } |
| 607 |
| 608 @override |
| 609 visitTypeExpression(cps_ir.TypeExpression node) { |
| 610 unexpectedNode(node); |
| 611 } |
| 598 } | 612 } |
| OLD | NEW |