| 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 26 matching lines...) Expand all Loading... |
| 37 builder.visit(node); | 37 builder.visit(node); |
| 38 | 38 |
| 39 printNode(builder.entry); | 39 printNode(builder.entry); |
| 40 for (Block block in builder.cont2block.values) { | 40 for (Block block in builder.cont2block.values) { |
| 41 printNode(block); | 41 printNode(block); |
| 42 } | 42 } |
| 43 names = null; | 43 names = null; |
| 44 } | 44 } |
| 45 | 45 |
| 46 visitFieldDefinition(cps_ir.FieldDefinition node) { | 46 visitFieldDefinition(cps_ir.FieldDefinition node) { |
| 47 visitExecutableDefinition(node); | 47 if (node.hasInitializer) { |
| 48 visitExecutableDefinition(node); |
| 49 } |
| 48 } | 50 } |
| 49 | 51 |
| 50 visitFunctionDefinition(cps_ir.FunctionDefinition node) { | 52 visitFunctionDefinition(cps_ir.FunctionDefinition node) { |
| 51 visitExecutableDefinition(node); | 53 visitExecutableDefinition(node); |
| 52 } | 54 } |
| 53 | 55 |
| 54 int countUses(cps_ir.Definition definition) { | 56 int countUses(cps_ir.Definition definition) { |
| 55 int count = 0; | 57 int count = 0; |
| 56 cps_ir.Reference ref = definition.firstRef; | 58 cps_ir.Reference ref = definition.firstRef; |
| 57 while (ref != null) { | 59 while (ref != null) { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 } | 338 } |
| 337 return block; | 339 return block; |
| 338 } | 340 } |
| 339 | 341 |
| 340 visitExecutableDefinition(cps_ir.ExecutableDefinition node) { | 342 visitExecutableDefinition(cps_ir.ExecutableDefinition node) { |
| 341 entry = current_block = new Block(names.name(node), [], node.body); | 343 entry = current_block = new Block(names.name(node), [], node.body); |
| 342 visit(node.body); | 344 visit(node.body); |
| 343 } | 345 } |
| 344 | 346 |
| 345 visitFieldDefinition(cps_ir.FieldDefinition node) { | 347 visitFieldDefinition(cps_ir.FieldDefinition node) { |
| 346 visitExecutableDefinition(node); | 348 if (node.hasInitializer) { |
| 349 visitExecutableDefinition(node); |
| 350 } |
| 347 } | 351 } |
| 348 | 352 |
| 349 visitFunctionDefinition(cps_ir.FunctionDefinition node) { | 353 visitFunctionDefinition(cps_ir.FunctionDefinition node) { |
| 350 visitExecutableDefinition(node); | 354 visitExecutableDefinition(node); |
| 351 } | 355 } |
| 352 | 356 |
| 353 visitLetPrim(cps_ir.LetPrim exp) { | 357 visitLetPrim(cps_ir.LetPrim exp) { |
| 354 visit(exp.body); | 358 visit(exp.body); |
| 355 } | 359 } |
| 356 | 360 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 } | 409 } |
| 406 } | 410 } |
| 407 | 411 |
| 408 visitContinuation(cps_ir.Continuation c) { | 412 visitContinuation(cps_ir.Continuation c) { |
| 409 var old_node = current_block; | 413 var old_node = current_block; |
| 410 current_block = getBlock(c); | 414 current_block = getBlock(c); |
| 411 visit(c.body); | 415 visit(c.body); |
| 412 current_block = old_node; | 416 current_block = old_node; |
| 413 } | 417 } |
| 414 } | 418 } |
| OLD | NEW |