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