| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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('tracer'); | 5 #library('tracer'); |
| 6 | 6 |
| 7 #import('dart:io'); | 7 #import('dart:io'); |
| 8 #import('ssa.dart'); | 8 #import('ssa.dart'); |
| 9 #import('../leg.dart'); | 9 #import('../leg.dart'); |
| 10 | 10 |
| 11 final bool GENERATE_SSA_TRACE = false; | 11 final bool GENERATE_SSA_TRACE = false; |
| 12 | 12 |
| 13 class HTracer extends HGraphVisitor implements Tracer { | 13 class HTracer extends HGraphVisitor implements Tracer { |
| 14 int indent = 0; | 14 int indent = 0; |
| 15 final RandomAccessFile output; | 15 final RandomAccessFile output; |
| 16 final bool enabled = GENERATE_SSA_TRACE; | 16 final bool enabled = GENERATE_SSA_TRACE; |
| 17 | 17 |
| 18 HTracer([String path = "dart.cfg"]) | 18 HTracer([String path = "dart.cfg"]) |
| 19 : output = GENERATE_SSA_TRACE ? new File(path).openSync(FileMode.WRITE) | 19 : output = GENERATE_SSA_TRACE ? new File(path).openSync(FileMode.WRITE) |
| 20 : null; | 20 : null; |
| 21 | 21 |
| 22 void close() { | 22 void close() { |
| 23 if (enabled) output.closeSync(); | 23 if (enabled) output.closeSync(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 String method; | |
| 27 void traceCompilation(String methodName) { | 26 void traceCompilation(String methodName) { |
| 28 tag("compilation", () { | 27 tag("compilation", () { |
| 29 printProperty("name", methodName); | 28 printProperty("name", methodName); |
| 30 printProperty("method", methodName); | 29 printProperty("method", methodName); |
| 31 printProperty("date", new Date.now().value); | 30 printProperty("date", new Date.now().value); |
| 32 }); | 31 }); |
| 33 } | 32 } |
| 34 | 33 |
| 35 void traceGraph(String name, HGraph graph) { | 34 void traceGraph(String name, HGraph graph) { |
| 36 if (!enabled) return; | 35 if (!enabled) return; |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 String visitIs(HIs node) { | 441 String visitIs(HIs node) { |
| 443 String type = node.typeExpression.toString(); | 442 String type = node.typeExpression.toString(); |
| 444 return "TypeTest: ${temporaryId(node.expression)} is $type"; | 443 return "TypeTest: ${temporaryId(node.expression)} is $type"; |
| 445 } | 444 } |
| 446 | 445 |
| 447 String visitTypeConversion(HTypeConversion node) { | 446 String visitTypeConversion(HTypeConversion node) { |
| 448 String type = node.propagatedType.toString(); | 447 String type = node.propagatedType.toString(); |
| 449 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type"; | 448 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type"; |
| 450 } | 449 } |
| 451 } | 450 } |
| OLD | NEW |