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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 printProperty("successors", block.succ.map((n) => n.name)); | 74 printProperty("successors", block.succ.map((n) => n.name)); |
75 printEmptyProperty("xhandlers"); | 75 printEmptyProperty("xhandlers"); |
76 printEmptyProperty("flags"); | 76 printEmptyProperty("flags"); |
77 tag("states", () { | 77 tag("states", () { |
78 tag("locals", () { | 78 tag("locals", () { |
79 printProperty("size", 0); | 79 printProperty("size", 0); |
80 printProperty("method", "None"); | 80 printProperty("method", "None"); |
81 }); | 81 }); |
82 }); | 82 }); |
83 tag("HIR", () { | 83 tag("HIR", () { |
| 84 String formatParameter(cps_ir.Parameter param) { |
| 85 return '${names.name(param)} ${param.type}'; |
| 86 } |
84 if (entryPointParameters != null) { | 87 if (entryPointParameters != null) { |
85 String formatParameter(cps_ir.Parameter param) { | |
86 return '${names.name(param)} ${param.type}'; | |
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 String params = block.parameters.map(formatParameter).join(', '); |
92 String name = names.name(param); | 92 printStmt('x0', 'Parameters ($params)'); |
93 printStmt(name, "Parameter $name [useCount=${countUses(param)}]"); | |
94 } | |
95 visit(block.body); | 93 visit(block.body); |
96 }); | 94 }); |
97 }); | 95 }); |
98 } | 96 } |
99 | 97 |
100 void printStmt(String resultVar, String contents) { | 98 void printStmt(String resultVar, String contents) { |
101 int bci = 0; | 99 int bci = 0; |
102 int uses = 0; | 100 int uses = 0; |
103 addIndent(); | 101 addIndent(); |
104 add("$bci $uses $resultVar $contents <|@\n"); | 102 add("$bci $uses $resultVar $contents <|@\n"); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 318 |
321 visitCreateInstance(cps_ir.CreateInstance node) { | 319 visitCreateInstance(cps_ir.CreateInstance node) { |
322 String className = node.classElement.name; | 320 String className = node.classElement.name; |
323 String arguments = node.arguments.map(formatReference).join(', '); | 321 String arguments = node.arguments.map(formatReference).join(', '); |
324 String typeInformation = | 322 String typeInformation = |
325 node.typeInformation.map(formatReference).join(', '); | 323 node.typeInformation.map(formatReference).join(', '); |
326 return 'CreateInstance $className ($arguments) <$typeInformation>'; | 324 return 'CreateInstance $className ($arguments) <$typeInformation>'; |
327 } | 325 } |
328 | 326 |
329 visitInterceptor(cps_ir.Interceptor node) { | 327 visitInterceptor(cps_ir.Interceptor node) { |
330 return "Interceptor(${formatReference(node.input)})"; | 328 return 'Interceptor(${formatReference(node.input)}, ' |
| 329 '${node.interceptedClasses})'; |
331 } | 330 } |
332 | 331 |
333 visitCreateFunction(cps_ir.CreateFunction node) { | 332 visitCreateFunction(cps_ir.CreateFunction node) { |
334 return "CreateFunction ${node.definition.element.name}"; | 333 return "CreateFunction ${node.definition.element.name}"; |
335 } | 334 } |
336 | 335 |
337 visitGetMutable(cps_ir.GetMutable node) { | 336 visitGetMutable(cps_ir.GetMutable node) { |
338 String variable = names.name(node.variable.definition); | 337 String variable = names.name(node.variable.definition); |
339 return 'GetMutable $variable'; | 338 return 'GetMutable $variable'; |
340 } | 339 } |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 @override | 700 @override |
702 visitYield(cps_ir.Yield node) { | 701 visitYield(cps_ir.Yield node) { |
703 addEdgeToContinuation(node.continuation); | 702 addEdgeToContinuation(node.continuation); |
704 } | 703 } |
705 | 704 |
706 @override | 705 @override |
707 visitRefinement(cps_ir.Refinement node) { | 706 visitRefinement(cps_ir.Refinement node) { |
708 unexpectedNode(node); | 707 unexpectedNode(node); |
709 } | 708 } |
710 } | 709 } |
OLD | NEW |