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 import 'cps_ir_nodes.dart' as cps_ir; | 8 import 'cps_ir_nodes.dart' as cps_ir; |
9 import '../tracer.dart'; | 9 import '../tracer.dart'; |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 tag("HIR", () { | 83 tag("HIR", () { |
84 if (entryPointParameters != null) { | 84 if (entryPointParameters != null) { |
85 String formatParameter(cps_ir.Parameter param) { | 85 String formatParameter(cps_ir.Parameter param) { |
86 return '${names.name(param)} ${param.type}'; | 86 return '${names.name(param)} ${param.type}'; |
87 } | 87 } |
88 String params = entryPointParameters.map(formatParameter).join(', '); | 88 String params = entryPointParameters.map(formatParameter).join(', '); |
89 printStmt('x0', 'Entry ($params)'); | 89 printStmt('x0', 'Entry ($params)'); |
90 } | 90 } |
91 for (cps_ir.Parameter param in block.parameters) { | 91 for (cps_ir.Parameter param in block.parameters) { |
92 String name = names.name(param); | 92 String name = names.name(param); |
93 printStmt(name, "Parameter $name [useCount=${countUses(param)}]"); | 93 printStmt(name, "Parameter $name " |
| 94 "[type=${param.type}, useCount=${countUses(param)}]"); |
94 } | 95 } |
95 visit(block.body); | 96 visit(block.body); |
96 }); | 97 }); |
97 }); | 98 }); |
98 } | 99 } |
99 | 100 |
100 void printStmt(String resultVar, String contents) { | 101 void printStmt(String resultVar, String contents) { |
101 int bci = 0; | 102 int bci = 0; |
102 int uses = 0; | 103 int uses = 0; |
103 addIndent(); | 104 addIndent(); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 visitSetIndex(cps_ir.SetIndex node) { | 409 visitSetIndex(cps_ir.SetIndex node) { |
409 String object = formatReference(node.object); | 410 String object = formatReference(node.object); |
410 String index = formatReference(node.index); | 411 String index = formatReference(node.index); |
411 String value = formatReference(node.value); | 412 String value = formatReference(node.value); |
412 return 'SetIndex $object $index $value'; | 413 return 'SetIndex $object $index $value'; |
413 } | 414 } |
414 | 415 |
415 @override | 416 @override |
416 visitRefinement(cps_ir.Refinement node) { | 417 visitRefinement(cps_ir.Refinement node) { |
417 String value = formatReference(node.value); | 418 String value = formatReference(node.value); |
418 return 'Refinement $value ${node.type}'; | 419 return 'Refinement $value ${node.refineType}'; |
419 } | 420 } |
420 } | 421 } |
421 | 422 |
422 /** | 423 /** |
423 * Invents (and remembers) names for Continuations, Parameters, etc. | 424 * Invents (and remembers) names for Continuations, Parameters, etc. |
424 * The names must match the conventions used by IR Hydra, e.g. | 425 * The names must match the conventions used by IR Hydra, e.g. |
425 * Continuations and Functions must have names of form B### since they | 426 * Continuations and Functions must have names of form B### since they |
426 * are visualized as basic blocks. | 427 * are visualized as basic blocks. |
427 */ | 428 */ |
428 class Names { | 429 class Names { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 @override | 702 @override |
702 visitYield(cps_ir.Yield node) { | 703 visitYield(cps_ir.Yield node) { |
703 addEdgeToContinuation(node.continuation); | 704 addEdgeToContinuation(node.continuation); |
704 } | 705 } |
705 | 706 |
706 @override | 707 @override |
707 visitRefinement(cps_ir.Refinement node) { | 708 visitRefinement(cps_ir.Refinement node) { |
708 unexpectedNode(node); | 709 unexpectedNode(node); |
709 } | 710 } |
710 } | 711 } |
OLD | NEW |