Chromium Code Reviews| 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 dart2js.ir_tracer; | 5 library dart2js.ir_tracer; |
| 6 | 6 |
| 7 import 'dart:async' show EventSink; | 7 import 'dart:async' show EventSink; |
| 8 | 8 |
| 9 import 'cps_ir_nodes.dart' as cps_ir hide Function; | 9 import 'cps_ir_nodes.dart' as cps_ir hide Function; |
| 10 import '../tracer.dart'; | 10 import '../tracer.dart'; |
| 11 import 'package:compiler/src/js_backend/codegen/unsugar.dart' as js; | |
|
sigurdm
2014/11/20 12:47:28
package import
| |
| 11 | 12 |
| 12 /** | 13 /** |
| 13 * If true, show LetCont expressions in output. | 14 * If true, show LetCont expressions in output. |
| 14 */ | 15 */ |
| 15 const bool IR_TRACE_LET_CONT = false; | 16 const bool IR_TRACE_LET_CONT = false; |
| 16 | 17 |
| 17 class IRTracer extends TracerUtil implements cps_ir.Visitor { | 18 class IRTracer extends TracerUtil implements cps_ir.Visitor { |
| 18 EventSink<String> output; | 19 EventSink<String> output; |
| 19 | 20 |
| 20 IRTracer(this.output); | 21 IRTracer(this.output); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 String variable = node.variable.name; | 246 String variable = node.variable.name; |
| 246 return 'GetClosureVariable $variable'; | 247 return 'GetClosureVariable $variable'; |
| 247 } | 248 } |
| 248 | 249 |
| 249 | 250 |
| 250 visitCondition(cps_ir.Condition c) {} | 251 visitCondition(cps_ir.Condition c) {} |
| 251 visitExpression(cps_ir.Expression e) {} | 252 visitExpression(cps_ir.Expression e) {} |
| 252 visitPrimitive(cps_ir.Primitive p) {} | 253 visitPrimitive(cps_ir.Primitive p) {} |
| 253 visitDefinition(cps_ir.Definition d) {} | 254 visitDefinition(cps_ir.Definition d) {} |
| 254 visitNode(cps_ir.Node n) {} | 255 visitNode(cps_ir.Node n) {} |
| 256 | |
| 257 @override | |
| 258 visitBoolify(js.Boolify node) => "Boolify ${node.value}"; | |
| 255 } | 259 } |
| 256 | 260 |
| 257 /** | 261 /** |
| 258 * Invents (and remembers) names for Continuations, Parameters, etc. | 262 * Invents (and remembers) names for Continuations, Parameters, etc. |
| 259 * The names must match the conventions used by IR Hydra, e.g. | 263 * The names must match the conventions used by IR Hydra, e.g. |
| 260 * Continuations and Functions must have names of form B### since they | 264 * Continuations and Functions must have names of form B### since they |
| 261 * are visualized as basic blocks. | 265 * are visualized as basic blocks. |
| 262 */ | 266 */ |
| 263 class Names { | 267 class Names { |
| 264 final Map<Object, String> names = {}; | 268 final Map<Object, String> names = {}; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 } | 387 } |
| 384 } | 388 } |
| 385 | 389 |
| 386 visitContinuation(cps_ir.Continuation c) { | 390 visitContinuation(cps_ir.Continuation c) { |
| 387 var old_node = current_block; | 391 var old_node = current_block; |
| 388 current_block = getBlock(c); | 392 current_block = getBlock(c); |
| 389 visit(c.body); | 393 visit(c.body); |
| 390 current_block = old_node; | 394 current_block = old_node; |
| 391 } | 395 } |
| 392 } | 396 } |
| OLD | NEW |