| 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 tracer; | 5 library tracer; |
| 6 | 6 |
| 7 import 'dart:async' show EventSink; | 7 import 'dart:async' show EventSink; |
| 8 | 8 |
| 9 import '../compiler.dart' as api; | 9 import '../compiler.dart' as api; |
| 10 import 'common/work.dart' show ItemCompilationContext; | 10 import 'common/work.dart' show ItemCompilationContext; |
| 11 import 'compiler.dart' show Compiler; | 11 import 'compiler.dart' show Compiler; |
| 12 import 'cps_ir/cps_ir_nodes.dart' as cps_ir; | |
| 13 import 'cps_ir/cps_ir_tracer.dart' show IRTracer; | |
| 14 import 'ssa/nodes.dart' as ssa show HGraph; | 12 import 'ssa/nodes.dart' as ssa show HGraph; |
| 15 import 'ssa/ssa_tracer.dart' show HTracer; | 13 import 'ssa/ssa_tracer.dart' show HTracer; |
| 16 import 'tree_ir/tree_ir_nodes.dart' as tree_ir; | |
| 17 import 'tree_ir/tree_ir_tracer.dart' show TreeTracer; | |
| 18 import 'util/util.dart' show Indentation; | 14 import 'util/util.dart' show Indentation; |
| 19 | 15 |
| 20 /** | 16 /** |
| 21 * If non-null, we only trace methods whose name match the regexp defined by the | 17 * If non-null, we only trace methods whose name match the regexp defined by the |
| 22 * given pattern. | 18 * given pattern. |
| 23 */ | 19 */ |
| 24 const String TRACE_FILTER_PATTERN = const String.fromEnvironment("DUMP_IR"); | 20 const String TRACE_FILTER_PATTERN = const String.fromEnvironment("DUMP_IR"); |
| 25 | 21 |
| 26 final RegExp TRACE_FILTER = | 22 final RegExp TRACE_FILTER = |
| 27 TRACE_FILTER_PATTERN == null ? null : new RegExp(TRACE_FILTER_PATTERN); | 23 TRACE_FILTER_PATTERN == null ? null : new RegExp(TRACE_FILTER_PATTERN); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 51 printProperty("name", methodName); | 47 printProperty("name", methodName); |
| 52 printProperty("method", methodName); | 48 printProperty("method", methodName); |
| 53 printProperty("date", new DateTime.now().millisecondsSinceEpoch); | 49 printProperty("date", new DateTime.now().millisecondsSinceEpoch); |
| 54 }); | 50 }); |
| 55 } | 51 } |
| 56 | 52 |
| 57 void traceGraph(String name, var irObject) { | 53 void traceGraph(String name, var irObject) { |
| 58 if (!traceActive) return; | 54 if (!traceActive) return; |
| 59 if (irObject is ssa.HGraph) { | 55 if (irObject is ssa.HGraph) { |
| 60 new HTracer(output, compiler, context).traceGraph(name, irObject); | 56 new HTracer(output, compiler, context).traceGraph(name, irObject); |
| 61 } else if (irObject is cps_ir.FunctionDefinition) { | |
| 62 new IRTracer(output).traceGraph(name, irObject); | |
| 63 } else if (irObject is tree_ir.FunctionDefinition) { | |
| 64 new TreeTracer(output).traceGraph(name, irObject); | |
| 65 } | 57 } |
| 66 } | 58 } |
| 67 | 59 |
| 68 void close() { | 60 void close() { |
| 69 if (output != null) { | 61 if (output != null) { |
| 70 output.close(); | 62 output.close(); |
| 71 } | 63 } |
| 72 } | 64 } |
| 73 } | 65 } |
| 74 | 66 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 101 } |
| 110 | 102 |
| 111 void add(String string) { | 103 void add(String string) { |
| 112 output.add(string); | 104 output.add(string); |
| 113 } | 105 } |
| 114 | 106 |
| 115 void addIndent() { | 107 void addIndent() { |
| 116 add(_ind.indentation); | 108 add(_ind.indentation); |
| 117 } | 109 } |
| 118 } | 110 } |
| OLD | NEW |