| 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 hide Function; | 8 import 'cps_ir_nodes.dart' as cps_ir hide Function; |
| 9 import '../tracer.dart'; | 9 import '../tracer.dart'; |
| 10 | 10 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 220 |
| 221 visitInvokeContinuation(cps_ir.InvokeContinuation node) { | 221 visitInvokeContinuation(cps_ir.InvokeContinuation node) { |
| 222 String dummy = names.name(node); | 222 String dummy = names.name(node); |
| 223 String kont = formatReference(node.continuation); | 223 String kont = formatReference(node.continuation); |
| 224 String args = node.arguments.map(formatReference).join(', '); | 224 String args = node.arguments.map(formatReference).join(', '); |
| 225 printStmt(dummy, "InvokeContinuation $kont ($args)"); | 225 printStmt(dummy, "InvokeContinuation $kont ($args)"); |
| 226 } | 226 } |
| 227 | 227 |
| 228 visitBranch(cps_ir.Branch node) { | 228 visitBranch(cps_ir.Branch node) { |
| 229 String dummy = names.name(node); | 229 String dummy = names.name(node); |
| 230 String condition = visit(node.condition); | 230 String condition = formatReference(node.condition); |
| 231 String trueCont = formatReference(node.trueContinuation); | 231 String trueCont = formatReference(node.trueContinuation); |
| 232 String falseCont = formatReference(node.falseContinuation); | 232 String falseCont = formatReference(node.falseContinuation); |
| 233 printStmt(dummy, "Branch $condition ($trueCont, $falseCont)"); | 233 String strict = node.isStrictCheck ? "Strict" : "NonStrict"; |
| 234 printStmt(dummy, "Branch $condition ($trueCont, $falseCont) $strict"); |
| 234 } | 235 } |
| 235 | 236 |
| 236 visitSetMutable(cps_ir.SetMutable node) { | 237 visitSetMutable(cps_ir.SetMutable node) { |
| 237 String variable = names.name(node.variable.definition); | 238 String variable = names.name(node.variable.definition); |
| 238 String value = formatReference(node.value); | 239 String value = formatReference(node.value); |
| 239 return 'SetMutable $variable := $value'; | 240 return 'SetMutable $variable := $value'; |
| 240 } | 241 } |
| 241 | 242 |
| 242 String formatReference(cps_ir.Reference ref) { | 243 String formatReference(cps_ir.Reference ref) { |
| 243 cps_ir.Definition target = ref.definition; | 244 cps_ir.Definition target = ref.definition; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 259 } | 260 } |
| 260 | 261 |
| 261 visitMutableVariable(cps_ir.MutableVariable node) { | 262 visitMutableVariable(cps_ir.MutableVariable node) { |
| 262 return "MutableVariable ${names.name(node)}"; | 263 return "MutableVariable ${names.name(node)}"; |
| 263 } | 264 } |
| 264 | 265 |
| 265 visitContinuation(cps_ir.Continuation node) { | 266 visitContinuation(cps_ir.Continuation node) { |
| 266 return "Continuation ${names.name(node)}"; | 267 return "Continuation ${names.name(node)}"; |
| 267 } | 268 } |
| 268 | 269 |
| 269 visitIsTrue(cps_ir.IsTrue node) { | |
| 270 return "IsTrue(${names.name(node.value.definition)})"; | |
| 271 } | |
| 272 | |
| 273 visitSetField(cps_ir.SetField node) { | 270 visitSetField(cps_ir.SetField node) { |
| 274 String object = formatReference(node.object); | 271 String object = formatReference(node.object); |
| 275 String field = node.field.name; | 272 String field = node.field.name; |
| 276 String value = formatReference(node.value); | 273 String value = formatReference(node.value); |
| 277 return 'SetField $object.$field = $value'; | 274 return 'SetField $object.$field = $value'; |
| 278 } | 275 } |
| 279 | 276 |
| 280 visitGetField(cps_ir.GetField node) { | 277 visitGetField(cps_ir.GetField node) { |
| 281 String object = formatReference(node.object); | 278 String object = formatReference(node.object); |
| 282 String field = node.field.name; | 279 String field = node.field.name; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 } | 597 } |
| 601 | 598 |
| 602 visitCreateBox(cps_ir.CreateBox node) { | 599 visitCreateBox(cps_ir.CreateBox node) { |
| 603 unexpectedNode(node); | 600 unexpectedNode(node); |
| 604 } | 601 } |
| 605 | 602 |
| 606 visitCreateInstance(cps_ir.CreateInstance node) { | 603 visitCreateInstance(cps_ir.CreateInstance node) { |
| 607 unexpectedNode(node); | 604 unexpectedNode(node); |
| 608 } | 605 } |
| 609 | 606 |
| 610 visitIsTrue(cps_ir.IsTrue node) { | |
| 611 unexpectedNode(node); | |
| 612 } | |
| 613 | |
| 614 visitInterceptor(cps_ir.Interceptor node) { | 607 visitInterceptor(cps_ir.Interceptor node) { |
| 615 unexpectedNode(node); | 608 unexpectedNode(node); |
| 616 } | 609 } |
| 617 | 610 |
| 618 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { | 611 visitReadTypeVariable(cps_ir.ReadTypeVariable node) { |
| 619 unexpectedNode(node); | 612 unexpectedNode(node); |
| 620 } | 613 } |
| 621 | 614 |
| 622 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { | 615 visitReifyRuntimeType(cps_ir.ReifyRuntimeType node) { |
| 623 unexpectedNode(node); | 616 unexpectedNode(node); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 @override | 663 @override |
| 671 visitForeignCode(cps_ir.ForeignCode node) { | 664 visitForeignCode(cps_ir.ForeignCode node) { |
| 672 addEdgeToContinuation(node.continuation); | 665 addEdgeToContinuation(node.continuation); |
| 673 } | 666 } |
| 674 | 667 |
| 675 @override | 668 @override |
| 676 visitAwait(cps_ir.Await node) { | 669 visitAwait(cps_ir.Await node) { |
| 677 unexpectedNode(node); | 670 unexpectedNode(node); |
| 678 } | 671 } |
| 679 } | 672 } |
| OLD | NEW |