| 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 import 'cps_ir_nodes.dart' as cps_ir; | 8 import 'cps_ir_nodes.dart' as cps_ir; |
| 9 import '../tracer.dart'; | 9 import '../tracer.dart'; |
| 10 | 10 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 231 |
| 232 visitBranch(cps_ir.Branch node) { | 232 visitBranch(cps_ir.Branch node) { |
| 233 String dummy = names.name(node); | 233 String dummy = names.name(node); |
| 234 String condition = formatReference(node.condition); | 234 String condition = formatReference(node.condition); |
| 235 String trueCont = formatReference(node.trueContinuation); | 235 String trueCont = formatReference(node.trueContinuation); |
| 236 String falseCont = formatReference(node.falseContinuation); | 236 String falseCont = formatReference(node.falseContinuation); |
| 237 String strict = node.isStrictCheck ? "Strict" : "NonStrict"; | 237 String strict = node.isStrictCheck ? "Strict" : "NonStrict"; |
| 238 printStmt(dummy, "Branch $condition ($trueCont, $falseCont) $strict"); | 238 printStmt(dummy, "Branch $condition ($trueCont, $falseCont) $strict"); |
| 239 } | 239 } |
| 240 | 240 |
| 241 visitAwait(cps_ir.Await node) { |
| 242 String dummy = names.name(node); |
| 243 String value = formatReference(node.input); |
| 244 String continuation = formatReference(node.continuation); |
| 245 printStmt(dummy, 'Await $value $continuation'); |
| 246 } |
| 247 |
| 248 visitYield(cps_ir.Yield node) { |
| 249 String dummy = names.name(node); |
| 250 String name = node.hasStar ? 'YieldStar' : 'Yield'; |
| 251 String value = formatReference(node.input); |
| 252 String continuation = formatReference(node.continuation); |
| 253 printStmt(dummy, '$name $value $continuation'); |
| 254 } |
| 255 |
| 241 visitSetMutable(cps_ir.SetMutable node) { | 256 visitSetMutable(cps_ir.SetMutable node) { |
| 242 String variable = names.name(node.variable.definition); | 257 String variable = names.name(node.variable.definition); |
| 243 String value = formatReference(node.value); | 258 String value = formatReference(node.value); |
| 244 return 'SetMutable $variable := $value'; | 259 return 'SetMutable $variable := $value'; |
| 245 } | 260 } |
| 246 | 261 |
| 247 String formatReference(cps_ir.Reference ref) { | 262 String formatReference(cps_ir.Reference ref) { |
| 248 cps_ir.Definition target = ref.definition; | 263 cps_ir.Definition target = ref.definition; |
| 249 if (target is cps_ir.Continuation && target.isReturnContinuation) { | 264 if (target is cps_ir.Continuation && target.isReturnContinuation) { |
| 250 return "return"; // Do not generate a name for the return continuation | 265 return "return"; // Do not generate a name for the return continuation |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 } | 406 } |
| 392 | 407 |
| 393 visitSetIndex(cps_ir.SetIndex node) { | 408 visitSetIndex(cps_ir.SetIndex node) { |
| 394 String object = formatReference(node.object); | 409 String object = formatReference(node.object); |
| 395 String index = formatReference(node.index); | 410 String index = formatReference(node.index); |
| 396 String value = formatReference(node.value); | 411 String value = formatReference(node.value); |
| 397 return 'SetIndex $object $index $value'; | 412 return 'SetIndex $object $index $value'; |
| 398 } | 413 } |
| 399 | 414 |
| 400 @override | 415 @override |
| 401 visitAwait(cps_ir.Await node) { | |
| 402 String value = formatReference(node.input); | |
| 403 String continuation = formatReference(node.continuation); | |
| 404 return 'Await $value $continuation'; | |
| 405 } | |
| 406 | |
| 407 @override | |
| 408 visitYield(cps_ir.Yield node) { | |
| 409 String value = formatReference(node.input); | |
| 410 String continuation = formatReference(node.continuation); | |
| 411 return 'Yield $value $continuation'; | |
| 412 } | |
| 413 | |
| 414 @override | |
| 415 visitRefinement(cps_ir.Refinement node) { | 416 visitRefinement(cps_ir.Refinement node) { |
| 416 String value = formatReference(node.value); | 417 String value = formatReference(node.value); |
| 417 return 'Refinement $value ${node.type}'; | 418 return 'Refinement $value ${node.type}'; |
| 418 } | 419 } |
| 419 } | 420 } |
| 420 | 421 |
| 421 /** | 422 /** |
| 422 * Invents (and remembers) names for Continuations, Parameters, etc. | 423 * Invents (and remembers) names for Continuations, Parameters, etc. |
| 423 * The names must match the conventions used by IR Hydra, e.g. | 424 * The names must match the conventions used by IR Hydra, e.g. |
| 424 * Continuations and Functions must have names of form B### since they | 425 * Continuations and Functions must have names of form B### since they |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 @override | 701 @override |
| 701 visitYield(cps_ir.Yield node) { | 702 visitYield(cps_ir.Yield node) { |
| 702 addEdgeToContinuation(node.continuation); | 703 addEdgeToContinuation(node.continuation); |
| 703 } | 704 } |
| 704 | 705 |
| 705 @override | 706 @override |
| 706 visitRefinement(cps_ir.Refinement node) { | 707 visitRefinement(cps_ir.Refinement node) { |
| 707 unexpectedNode(node); | 708 unexpectedNode(node); |
| 708 } | 709 } |
| 709 } | 710 } |
| OLD | NEW |