| 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'; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 visitLetPrim(cps_ir.LetPrim node) { | 106 visitLetPrim(cps_ir.LetPrim node) { |
| 107 String id = names.name(node.primitive); | 107 String id = names.name(node.primitive); |
| 108 printStmt(id, "LetPrim $id = ${formatPrimitive(node.primitive)}"); | 108 printStmt(id, "LetPrim $id = ${formatPrimitive(node.primitive)}"); |
| 109 visit(node.body); | 109 visit(node.body); |
| 110 } | 110 } |
| 111 | 111 |
| 112 visitLetCont(cps_ir.LetCont node) { | 112 visitLetCont(cps_ir.LetCont node) { |
| 113 if (IR_TRACE_LET_CONT) { | 113 if (IR_TRACE_LET_CONT) { |
| 114 String dummy = names.name(node); | 114 String dummy = names.name(node); |
| 115 for (cps_ir.Continuation continuation in node.continuations) { | 115 String id = names.name(node.continuation); |
| 116 String id = names.name(continuation); | 116 printStmt(dummy, "LetCont $id = <$id>"); |
| 117 printStmt(dummy, "LetCont $id = <$id>"); | |
| 118 } | |
| 119 } | 117 } |
| 120 visit(node.body); | 118 visit(node.body); |
| 121 } | 119 } |
| 122 | 120 |
| 123 visitInvokeStatic(cps_ir.InvokeStatic node) { | 121 visitInvokeStatic(cps_ir.InvokeStatic node) { |
| 124 String dummy = names.name(node); | 122 String dummy = names.name(node); |
| 125 String callName = node.selector.name; | 123 String callName = node.selector.name; |
| 126 String args = node.arguments.map(formatReference).join(', '); | 124 String args = node.arguments.map(formatReference).join(', '); |
| 127 String kont = formatReference(node.continuation); | 125 String kont = formatReference(node.continuation); |
| 128 printStmt(dummy, "InvokeStatic $callName ($args) $kont"); | 126 printStmt(dummy, "InvokeStatic $callName ($args) $kont"); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 415 |
| 418 visitConstructorDefinition(cps_ir.ConstructorDefinition node) { | 416 visitConstructorDefinition(cps_ir.ConstructorDefinition node) { |
| 419 visitExecutableDefinition(node); | 417 visitExecutableDefinition(node); |
| 420 } | 418 } |
| 421 | 419 |
| 422 visitLetPrim(cps_ir.LetPrim exp) { | 420 visitLetPrim(cps_ir.LetPrim exp) { |
| 423 visit(exp.body); | 421 visit(exp.body); |
| 424 } | 422 } |
| 425 | 423 |
| 426 visitLetCont(cps_ir.LetCont exp) { | 424 visitLetCont(cps_ir.LetCont exp) { |
| 427 exp.continuations.forEach(visit); | 425 visit(exp.continuation); |
| 428 visit(exp.body); | 426 visit(exp.body); |
| 429 } | 427 } |
| 430 | 428 |
| 431 void addEdgeToContinuation(cps_ir.Reference continuation) { | 429 void addEdgeToContinuation(cps_ir.Reference continuation) { |
| 432 cps_ir.Definition target = continuation.definition; | 430 cps_ir.Definition target = continuation.definition; |
| 433 if (target is cps_ir.Continuation && !target.isReturnContinuation) { | 431 if (target is cps_ir.Continuation && !target.isReturnContinuation) { |
| 434 current_block.addEdgeTo(getBlock(target)); | 432 current_block.addEdgeTo(getBlock(target)); |
| 435 } | 433 } |
| 436 } | 434 } |
| 437 | 435 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 } | 476 } |
| 479 } | 477 } |
| 480 | 478 |
| 481 visitContinuation(cps_ir.Continuation c) { | 479 visitContinuation(cps_ir.Continuation c) { |
| 482 var old_node = current_block; | 480 var old_node = current_block; |
| 483 current_block = getBlock(c); | 481 current_block = getBlock(c); |
| 484 visit(c.body); | 482 visit(c.body); |
| 485 current_block = old_node; | 483 current_block = old_node; |
| 486 } | 484 } |
| 487 } | 485 } |
| OLD | NEW |