| 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 void traceCompilation(String methodName) { | 26 void traceCompilation(String methodName) { |
| 27 tag("compilation", () { | 27 tag("compilation", () { |
| 28 printProperty("name", methodName); | 28 printProperty("name", methodName); |
| 29 printProperty("method", methodName); | 29 printProperty("method", methodName); |
| 30 printProperty("date", new Date.now().value); | 30 printProperty("date", new Date.now().millisecondsSinceEpoch); |
| 31 }); | 31 }); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void traceGraph(String name, HGraph graph) { | 34 void traceGraph(String name, HGraph graph) { |
| 35 if (!enabled) return; | 35 if (!enabled) return; |
| 36 tag("cfg", () { | 36 tag("cfg", () { |
| 37 printProperty("name", name); | 37 printProperty("name", name); |
| 38 visitDominatorTree(graph); | 38 visitDominatorTree(graph); |
| 39 }); | 39 }); |
| 40 } | 40 } |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 String visitIs(HIs node) { | 476 String visitIs(HIs node) { |
| 477 String type = node.typeExpression.toString(); | 477 String type = node.typeExpression.toString(); |
| 478 return "TypeTest: ${temporaryId(node.expression)} is $type"; | 478 return "TypeTest: ${temporaryId(node.expression)} is $type"; |
| 479 } | 479 } |
| 480 | 480 |
| 481 String visitTypeConversion(HTypeConversion node) { | 481 String visitTypeConversion(HTypeConversion node) { |
| 482 String type = node.propagatedType.toString(); | 482 String type = node.propagatedType.toString(); |
| 483 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type"; | 483 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type"; |
| 484 } | 484 } |
| 485 } | 485 } |
| OLD | NEW |