Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: pkg/compiler/lib/src/tracer.dart

Issue 2302363003: No longer store the compilation-context in WorkItem. (Closed)
Patch Set: ... lint Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
11 import 'compiler.dart' show Compiler; 10 import 'compiler.dart' show Compiler;
12 import 'ssa/nodes.dart' as ssa show HGraph; 11 import 'ssa/nodes.dart' as ssa show HGraph;
13 import 'ssa/ssa_tracer.dart' show HTracer; 12 import 'ssa/ssa_tracer.dart' show HTracer;
14 import 'util/util.dart' show Indentation; 13 import 'util/util.dart' show Indentation;
15 14
16 /** 15 /**
17 * If non-null, we only trace methods whose name match the regexp defined by the 16 * If non-null, we only trace methods whose name match the regexp defined by the
18 * given pattern. 17 * given pattern.
19 */ 18 */
20 const String TRACE_FILTER_PATTERN = const String.fromEnvironment("DUMP_IR"); 19 const String TRACE_FILTER_PATTERN = const String.fromEnvironment("DUMP_IR");
21 20
22 final RegExp TRACE_FILTER = 21 final RegExp TRACE_FILTER =
23 TRACE_FILTER_PATTERN == null ? null : new RegExp(TRACE_FILTER_PATTERN); 22 TRACE_FILTER_PATTERN == null ? null : new RegExp(TRACE_FILTER_PATTERN);
24 23
25 /** 24 /**
26 * Dumps the intermediate representation after each phase in a format 25 * Dumps the intermediate representation after each phase in a format
27 * readable by IR Hydra. 26 * readable by IR Hydra.
28 */ 27 */
29 class Tracer extends TracerUtil { 28 class Tracer extends TracerUtil {
30 final Compiler compiler; 29 final Compiler compiler;
31 ItemCompilationContext context;
32 bool traceActive = false; 30 bool traceActive = false;
33 final EventSink<String> output; 31 final EventSink<String> output;
34 final bool isEnabled = TRACE_FILTER != null; 32 final bool isEnabled = TRACE_FILTER != null;
35 33
36 Tracer(Compiler compiler, api.CompilerOutputProvider outputProvider) 34 Tracer(Compiler compiler, api.CompilerOutputProvider outputProvider)
37 : this.compiler = compiler, 35 : this.compiler = compiler,
38 output = TRACE_FILTER != null ? outputProvider('dart', 'cfg') : null; 36 output = TRACE_FILTER != null ? outputProvider('dart', 'cfg') : null;
39 37
40 void traceCompilation( 38 void traceCompilation(String methodName) {
41 String methodName, ItemCompilationContext compilationContext) {
42 if (!isEnabled) return; 39 if (!isEnabled) return;
43 traceActive = TRACE_FILTER.hasMatch(methodName); 40 traceActive = TRACE_FILTER.hasMatch(methodName);
44 if (!traceActive) return; 41 if (!traceActive) return;
45 this.context = compilationContext;
46 tag("compilation", () { 42 tag("compilation", () {
47 printProperty("name", methodName); 43 printProperty("name", methodName);
48 printProperty("method", methodName); 44 printProperty("method", methodName);
49 printProperty("date", new DateTime.now().millisecondsSinceEpoch); 45 printProperty("date", new DateTime.now().millisecondsSinceEpoch);
50 }); 46 });
51 } 47 }
52 48
53 void traceGraph(String name, var irObject) { 49 void traceGraph(String name, var irObject) {
54 if (!traceActive) return; 50 if (!traceActive) return;
55 if (irObject is ssa.HGraph) { 51 if (irObject is ssa.HGraph) {
56 new HTracer(output, compiler, context).traceGraph(name, irObject); 52 new HTracer(output, compiler).traceGraph(name, irObject);
57 } 53 }
58 } 54 }
59 55
60 void close() { 56 void close() {
61 if (output != null) { 57 if (output != null) {
62 output.close(); 58 output.close();
63 } 59 }
64 } 60 }
65 } 61 }
66 62
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 97 }
102 98
103 void add(String string) { 99 void add(String string) {
104 output.add(string); 100 output.add(string);
105 } 101 }
106 102
107 void addIndent() { 103 void addIndent() {
108 add(_ind.indentation); 104 add(_ind.indentation);
109 } 105 }
110 } 106 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/value_range_analyzer.dart ('k') | tests/compiler/dart2js/compiler_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698