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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/ssa/tracer.dart

Issue 13466011: Remove dart:io import from ssa/tracer.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update co19 status Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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:async' show EventSink;
8
8 import 'ssa.dart'; 9 import 'ssa.dart';
9 import '../js_backend/js_backend.dart'; 10 import '../js_backend/js_backend.dart';
10 import '../dart2jslib.dart'; 11 import '../dart2jslib.dart';
11 12
12 const bool GENERATE_SSA_TRACE = false; 13 const bool GENERATE_SSA_TRACE = false;
13 const String SSA_TRACE_FILTER = null; 14 const String SSA_TRACE_FILTER = null;
14 15
15 class HTracer extends HGraphVisitor implements Tracer { 16 class HTracer extends HGraphVisitor implements Tracer {
16 JavaScriptItemCompilationContext context; 17 JavaScriptItemCompilationContext context;
17 int indent = 0; 18 int indent = 0;
18 final RandomAccessFile output; 19 final EventSink<String> output;
19 final bool enabled = GENERATE_SSA_TRACE; 20 final bool enabled = GENERATE_SSA_TRACE;
20 bool traceActive = false; 21 bool traceActive = false;
21 22
22 HTracer([String path = "dart.cfg"]) 23 HTracer(this.output);
23 : output = GENERATE_SSA_TRACE
24 ? new File(path).openSync(mode: FileMode.WRITE)
25 : null;
26 24
27 void close() { 25 void close() {
28 if (enabled) output.closeSync(); 26 if (enabled) output.close();
29 } 27 }
30 28
31 void traceCompilation(String methodName, 29 void traceCompilation(String methodName,
32 JavaScriptItemCompilationContext compilationContext) { 30 JavaScriptItemCompilationContext compilationContext) {
33 if (!enabled) return; 31 if (!enabled) return;
34 this.context = compilationContext; 32 this.context = compilationContext;
35 traceActive = 33 traceActive =
36 SSA_TRACE_FILTER == null || methodName.contains(SSA_TRACE_FILTER); 34 SSA_TRACE_FILTER == null || methodName.contains(SSA_TRACE_FILTER);
37 if (!traceActive) return; 35 if (!traceActive) return;
38 tag("compilation", () { 36 tag("compilation", () {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 147
150 void printProperty(String propertyName, var value) { 148 void printProperty(String propertyName, var value) {
151 if (value is num) { 149 if (value is num) {
152 println("$propertyName $value"); 150 println("$propertyName $value");
153 } else { 151 } else {
154 println('$propertyName "$value"'); 152 println('$propertyName "$value"');
155 } 153 }
156 } 154 }
157 155
158 void add(String string) { 156 void add(String string) {
159 output.writeStringSync(string); 157 output.add(string);
160 } 158 }
161 159
162 void addIndent() { 160 void addIndent() {
163 for (int i = 0; i < indent; i++) { 161 for (int i = 0; i < indent; i++) {
164 add(" "); 162 add(" ");
165 } 163 }
166 } 164 }
167 } 165 }
168 166
169 class HInstructionStringifier implements HVisitor<String> { 167 class HInstructionStringifier implements HVisitor<String> {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 550
553 String visitTypeConversion(HTypeConversion node) { 551 String visitTypeConversion(HTypeConversion node) {
554 return "TypeConversion: ${temporaryId(node.checkedInput)} to " 552 return "TypeConversion: ${temporaryId(node.checkedInput)} to "
555 "${node.instructionType}"; 553 "${node.instructionType}";
556 } 554 }
557 555
558 String visitRangeConversion(HRangeConversion node) { 556 String visitRangeConversion(HRangeConversion node) {
559 return "RangeConversion: ${node.checkedInput}"; 557 return "RangeConversion: ${node.checkedInput}";
560 } 558 }
561 } 559 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/lib/js_string.dart ('k') | dart/tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698