| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 printStmt(dummy, "InvokeConstructor $callName ($args) $kont"); | 197 printStmt(dummy, "InvokeConstructor $callName ($args) $kont"); |
| 198 } | 198 } |
| 199 | 199 |
| 200 visitConcatenateStrings(cps_ir.ConcatenateStrings node) { | 200 visitConcatenateStrings(cps_ir.ConcatenateStrings node) { |
| 201 String dummy = names.name(node); | 201 String dummy = names.name(node); |
| 202 String args = node.arguments.map(formatReference).join(', '); | 202 String args = node.arguments.map(formatReference).join(', '); |
| 203 String kont = formatReference(node.continuation); | 203 String kont = formatReference(node.continuation); |
| 204 printStmt(dummy, "ConcatenateStrings ($args) $kont"); | 204 printStmt(dummy, "ConcatenateStrings ($args) $kont"); |
| 205 } | 205 } |
| 206 | 206 |
| 207 visitThrow(cps_ir.Throw node) { |
| 208 String dummy = names.name(node); |
| 209 String value = formatReference(node.value); |
| 210 printStmt(dummy, "Throw $value"); |
| 211 } |
| 212 |
| 213 visitRethrow(cps_ir.Rethrow node) { |
| 214 String dummy = names.name(node); |
| 215 printStmt(dummy, "Rethrow"); |
| 216 } |
| 217 |
| 207 visitLiteralList(cps_ir.LiteralList node) { | 218 visitLiteralList(cps_ir.LiteralList node) { |
| 208 String dummy = names.name(node); | 219 String dummy = names.name(node); |
| 209 String values = node.values.map(formatReference).join(', '); | 220 String values = node.values.map(formatReference).join(', '); |
| 210 printStmt(dummy, "LiteralList ($values)"); | 221 printStmt(dummy, "LiteralList ($values)"); |
| 211 } | 222 } |
| 212 | 223 |
| 213 visitLiteralMap(cps_ir.LiteralMap node) { | 224 visitLiteralMap(cps_ir.LiteralMap node) { |
| 214 String dummy = names.name(node); | 225 String dummy = names.name(node); |
| 215 List<String> entries = new List<String>(); | 226 List<String> entries = new List<String>(); |
| 216 for (cps_ir.LiteralMapEntry entry in node.entries) { | 227 for (cps_ir.LiteralMapEntry entry in node.entries) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 344 |
| 334 visitCreateFunction(cps_ir.CreateFunction node) { | 345 visitCreateFunction(cps_ir.CreateFunction node) { |
| 335 return "CreateFunction ${node.definition.element.name}"; | 346 return "CreateFunction ${node.definition.element.name}"; |
| 336 } | 347 } |
| 337 | 348 |
| 338 visitGetMutableVariable(cps_ir.GetMutableVariable node) { | 349 visitGetMutableVariable(cps_ir.GetMutableVariable node) { |
| 339 String variable = names.name(node.variable.definition); | 350 String variable = names.name(node.variable.definition); |
| 340 return 'GetMutableVariable $variable'; | 351 return 'GetMutableVariable $variable'; |
| 341 } | 352 } |
| 342 | 353 |
| 343 @override | |
| 344 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { | 354 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { |
| 345 return "ReadTypeVariable ${node.variable.element} " | 355 return "ReadTypeVariable ${node.variable.element} " |
| 346 "${formatReference(node.target)}"; | 356 "${formatReference(node.target)}"; |
| 347 } | 357 } |
| 348 | 358 |
| 349 @override | |
| 350 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { | 359 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { |
| 351 return "ReifyRuntimeType ${formatReference(node.value)}"; | 360 return "ReifyRuntimeType ${formatReference(node.value)}"; |
| 352 } | 361 } |
| 353 | 362 |
| 354 @override | |
| 355 visitTypeExpression(cps_ir.TypeExpression node) { | 363 visitTypeExpression(cps_ir.TypeExpression node) { |
| 356 return "TypeExpression ${node.dartType} " | 364 return "TypeExpression ${node.dartType} " |
| 357 "${node.arguments.map(formatReference).join(', ')}"; | 365 "${node.arguments.map(formatReference).join(', ')}"; |
| 358 } | 366 } |
| 367 |
| 368 visitNonTailThrow(cps_ir.NonTailThrow node) { |
| 369 String value = formatReference(node.value); |
| 370 return "NonTailThrow($value)"; |
| 371 } |
| 359 } | 372 } |
| 360 | 373 |
| 361 /** | 374 /** |
| 362 * Invents (and remembers) names for Continuations, Parameters, etc. | 375 * Invents (and remembers) names for Continuations, Parameters, etc. |
| 363 * The names must match the conventions used by IR Hydra, e.g. | 376 * The names must match the conventions used by IR Hydra, e.g. |
| 364 * Continuations and Functions must have names of form B### since they | 377 * Continuations and Functions must have names of form B### since they |
| 365 * are visualized as basic blocks. | 378 * are visualized as basic blocks. |
| 366 */ | 379 */ |
| 367 class Names { | 380 class Names { |
| 368 final Map<Object, String> names = {}; | 381 final Map<Object, String> names = {}; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 } | 513 } |
| 501 | 514 |
| 502 visitInvokeConstructor(cps_ir.InvokeConstructor exp) { | 515 visitInvokeConstructor(cps_ir.InvokeConstructor exp) { |
| 503 addEdgeToContinuation(exp.continuation); | 516 addEdgeToContinuation(exp.continuation); |
| 504 } | 517 } |
| 505 | 518 |
| 506 visitConcatenateStrings(cps_ir.ConcatenateStrings exp) { | 519 visitConcatenateStrings(cps_ir.ConcatenateStrings exp) { |
| 507 addEdgeToContinuation(exp.continuation); | 520 addEdgeToContinuation(exp.continuation); |
| 508 } | 521 } |
| 509 | 522 |
| 523 visitThrow(cps_ir.Throw exp) { |
| 524 } |
| 525 |
| 526 visitRethrow(cps_ir.Rethrow exp) { |
| 527 } |
| 528 |
| 510 visitSetMutableVariable(cps_ir.SetMutableVariable exp) { | 529 visitSetMutableVariable(cps_ir.SetMutableVariable exp) { |
| 511 visit(exp.body); | 530 visit(exp.body); |
| 512 } | 531 } |
| 513 | 532 |
| 514 visitSetField(cps_ir.SetField exp) { | 533 visitSetField(cps_ir.SetField exp) { |
| 515 visit(exp.body); | 534 visit(exp.body); |
| 516 } | 535 } |
| 517 | 536 |
| 518 visitDeclareFunction(cps_ir.DeclareFunction exp) { | 537 visitDeclareFunction(cps_ir.DeclareFunction exp) { |
| 519 visit(exp.body); | 538 visit(exp.body); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 visitIsTrue(cps_ir.IsTrue node) { | 602 visitIsTrue(cps_ir.IsTrue node) { |
| 584 unexpectedNode(node); | 603 unexpectedNode(node); |
| 585 } | 604 } |
| 586 visitIdentical(cps_ir.Identical node) { | 605 visitIdentical(cps_ir.Identical node) { |
| 587 unexpectedNode(node); | 606 unexpectedNode(node); |
| 588 } | 607 } |
| 589 visitInterceptor(cps_ir.Interceptor node) { | 608 visitInterceptor(cps_ir.Interceptor node) { |
| 590 unexpectedNode(node); | 609 unexpectedNode(node); |
| 591 } | 610 } |
| 592 | 611 |
| 593 @override | |
| 594 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { | 612 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { |
| 595 unexpectedNode(node); | 613 unexpectedNode(node); |
| 596 } | 614 } |
| 597 | 615 |
| 598 @override | |
| 599 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { | 616 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { |
| 600 unexpectedNode(node); | 617 unexpectedNode(node); |
| 601 } | 618 } |
| 602 | 619 |
| 603 @override | |
| 604 visitTypeExpression(cps_ir.TypeExpression node) { | 620 visitTypeExpression(cps_ir.TypeExpression node) { |
| 605 unexpectedNode(node); | 621 unexpectedNode(node); |
| 606 } | 622 } |
| 623 |
| 624 visitNonTailThrow(cps_ir.NonTailThrow node) { |
| 625 unexpectedNode(node); |
| 626 } |
| 607 } | 627 } |
| OLD | NEW |