| 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(', '); |
| 192 String kont = formatReference(node.continuation); | 193 String kont = formatReference(node.continuation); |
| 193 printStmt(dummy, "InvokeConstructor $callName ($args) $kont"); | 194 printStmt(dummy, "InvokeConstructor $callName ($args) $kont"); |
| 194 } | 195 } |
| 195 | 196 |
| 196 visitConcatenateStrings(cps_ir.ConcatenateStrings node) { | 197 visitConcatenateStrings(cps_ir.ConcatenateStrings node) { |
| 197 String dummy = names.name(node); | 198 String dummy = names.name(node); |
| 198 String args = node.arguments.map(formatReference).join(', '); | 199 String args = node.arguments.map(formatReference).join(', '); |
| 199 String kont = formatReference(node.continuation); | 200 String kont = formatReference(node.continuation); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 return 'GetField($object.$field)'; | 302 return 'GetField($object.$field)'; |
| 302 } | 303 } |
| 303 | 304 |
| 304 visitCreateBox(cps_ir.CreateBox node) { | 305 visitCreateBox(cps_ir.CreateBox node) { |
| 305 return 'CreateBox'; | 306 return 'CreateBox'; |
| 306 } | 307 } |
| 307 | 308 |
| 308 visitCreateInstance(cps_ir.CreateInstance node) { | 309 visitCreateInstance(cps_ir.CreateInstance node) { |
| 309 String className = node.classElement.name; | 310 String className = node.classElement.name; |
| 310 String arguments = node.arguments.map(formatReference).join(', '); | 311 String arguments = node.arguments.map(formatReference).join(', '); |
| 311 return 'CreateInstance $className ($arguments)'; | 312 String typeInformation = |
| 313 node.typeInformation.map(formatReference).join(', '); |
| 314 return 'CreateInstance $className ($arguments) <$typeInformation>'; |
| 312 } | 315 } |
| 313 | 316 |
| 314 visitIdentical(cps_ir.Identical node) { | 317 visitIdentical(cps_ir.Identical node) { |
| 315 String left = formatReference(node.left); | 318 String left = formatReference(node.left); |
| 316 String right = formatReference(node.right); | 319 String right = formatReference(node.right); |
| 317 return "Identical($left, $right)"; | 320 return "Identical($left, $right)"; |
| 318 } | 321 } |
| 319 | 322 |
| 320 visitInterceptor(cps_ir.Interceptor node) { | 323 visitInterceptor(cps_ir.Interceptor node) { |
| 321 return "Interceptor(${formatReference(node.input)})"; | 324 return "Interceptor(${formatReference(node.input)})"; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 337 @override | 340 @override |
| 338 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { | 341 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { |
| 339 return "ReadTypeVariable ${node.variable.element} " | 342 return "ReadTypeVariable ${node.variable.element} " |
| 340 "${formatReference(node.target)}"; | 343 "${formatReference(node.target)}"; |
| 341 } | 344 } |
| 342 | 345 |
| 343 @override | 346 @override |
| 344 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { | 347 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { |
| 345 return "ReifyRuntimeType ${formatReference(node.value)}"; | 348 return "ReifyRuntimeType ${formatReference(node.value)}"; |
| 346 } | 349 } |
| 350 |
| 351 @override |
| 352 visitTypeExpression(cps_ir.TypeExpression node) { |
| 353 return "TypeExpression ${node.dartType} " |
| 354 "${node.arguments.map(formatReference).join(', ')}"; |
| 355 } |
| 347 } | 356 } |
| 348 | 357 |
| 349 /** | 358 /** |
| 350 * Invents (and remembers) names for Continuations, Parameters, etc. | 359 * Invents (and remembers) names for Continuations, Parameters, etc. |
| 351 * The names must match the conventions used by IR Hydra, e.g. | 360 * The names must match the conventions used by IR Hydra, e.g. |
| 352 * Continuations and Functions must have names of form B### since they | 361 * Continuations and Functions must have names of form B### since they |
| 353 * are visualized as basic blocks. | 362 * are visualized as basic blocks. |
| 354 */ | 363 */ |
| 355 class Names { | 364 class Names { |
| 356 final Map<Object, String> names = {}; | 365 final Map<Object, String> names = {}; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 | 590 |
| 582 @override | 591 @override |
| 583 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { | 592 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { |
| 584 unexpectedNode(node); | 593 unexpectedNode(node); |
| 585 } | 594 } |
| 586 | 595 |
| 587 @override | 596 @override |
| 588 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { | 597 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { |
| 589 unexpectedNode(node); | 598 unexpectedNode(node); |
| 590 } | 599 } |
| 600 |
| 601 @override |
| 602 visitTypeExpression(cps_ir.TypeExpression node) { |
| 603 unexpectedNode(node); |
| 604 } |
| 591 } | 605 } |
| OLD | NEW |