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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 printStmt(dummy, 'SetField $object.$field = $value'); | 309 printStmt(dummy, 'SetField $object.$field = $value'); |
310 visit(node.body); | 310 visit(node.body); |
311 } | 311 } |
312 | 312 |
313 visitGetField(cps_ir.GetField node) { | 313 visitGetField(cps_ir.GetField node) { |
314 String object = formatReference(node.object); | 314 String object = formatReference(node.object); |
315 String field = node.field.name; | 315 String field = node.field.name; |
316 return 'GetField($object.$field)'; | 316 return 'GetField($object.$field)'; |
317 } | 317 } |
318 | 318 |
| 319 visitGetStatic(cps_ir.GetStatic node) { |
| 320 String element = node.element.name; |
| 321 return 'GetStatic($element)'; |
| 322 } |
| 323 |
| 324 visitSetStatic(cps_ir.SetStatic node) { |
| 325 String dummy = names.name(node); |
| 326 String element = node.element.name; |
| 327 String value = formatReference(node.value); |
| 328 printStmt(dummy, 'SetStatic $element = $value'); |
| 329 visit(node.body); |
| 330 } |
| 331 |
319 visitCreateBox(cps_ir.CreateBox node) { | 332 visitCreateBox(cps_ir.CreateBox node) { |
320 return 'CreateBox'; | 333 return 'CreateBox'; |
321 } | 334 } |
322 | 335 |
323 visitCreateInstance(cps_ir.CreateInstance node) { | 336 visitCreateInstance(cps_ir.CreateInstance node) { |
324 String className = node.classElement.name; | 337 String className = node.classElement.name; |
325 String arguments = node.arguments.map(formatReference).join(', '); | 338 String arguments = node.arguments.map(formatReference).join(', '); |
326 String typeInformation = | 339 String typeInformation = |
327 node.typeInformation.map(formatReference).join(', '); | 340 node.typeInformation.map(formatReference).join(', '); |
328 return 'CreateInstance $className ($arguments) <$typeInformation>'; | 341 return 'CreateInstance $className ($arguments) <$typeInformation>'; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 } | 545 } |
533 | 546 |
534 visitSetMutableVariable(cps_ir.SetMutableVariable exp) { | 547 visitSetMutableVariable(cps_ir.SetMutableVariable exp) { |
535 visit(exp.body); | 548 visit(exp.body); |
536 } | 549 } |
537 | 550 |
538 visitSetField(cps_ir.SetField exp) { | 551 visitSetField(cps_ir.SetField exp) { |
539 visit(exp.body); | 552 visit(exp.body); |
540 } | 553 } |
541 | 554 |
| 555 visitSetStatic(cps_ir.SetStatic exp) { |
| 556 visit(exp.body); |
| 557 } |
| 558 |
542 visitDeclareFunction(cps_ir.DeclareFunction exp) { | 559 visitDeclareFunction(cps_ir.DeclareFunction exp) { |
543 visit(exp.body); | 560 visit(exp.body); |
544 } | 561 } |
545 | 562 |
546 visitBranch(cps_ir.Branch exp) { | 563 visitBranch(cps_ir.Branch exp) { |
547 cps_ir.Continuation trueTarget = exp.trueContinuation.definition; | 564 cps_ir.Continuation trueTarget = exp.trueContinuation.definition; |
548 if (!trueTarget.isReturnContinuation) { | 565 if (!trueTarget.isReturnContinuation) { |
549 currentBlock.addEdgeTo(getBlock(trueTarget)); | 566 currentBlock.addEdgeTo(getBlock(trueTarget)); |
550 } | 567 } |
551 cps_ir.Continuation falseTarget = exp.falseContinuation.definition; | 568 cps_ir.Continuation falseTarget = exp.falseContinuation.definition; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 } | 608 } |
592 visitParameter(cps_ir.Parameter node) { | 609 visitParameter(cps_ir.Parameter node) { |
593 unexpectedNode(node); | 610 unexpectedNode(node); |
594 } | 611 } |
595 visitMutableVariable(cps_ir.MutableVariable node) { | 612 visitMutableVariable(cps_ir.MutableVariable node) { |
596 unexpectedNode(node); | 613 unexpectedNode(node); |
597 } | 614 } |
598 visitGetField(cps_ir.GetField node) { | 615 visitGetField(cps_ir.GetField node) { |
599 unexpectedNode(node); | 616 unexpectedNode(node); |
600 } | 617 } |
| 618 visitGetStatic(cps_ir.GetStatic node) { |
| 619 unexpectedNode(node); |
| 620 } |
601 visitCreateBox(cps_ir.CreateBox node) { | 621 visitCreateBox(cps_ir.CreateBox node) { |
602 unexpectedNode(node); | 622 unexpectedNode(node); |
603 } | 623 } |
604 visitCreateInstance(cps_ir.CreateInstance node) { | 624 visitCreateInstance(cps_ir.CreateInstance node) { |
605 unexpectedNode(node); | 625 unexpectedNode(node); |
606 } | 626 } |
607 visitIsTrue(cps_ir.IsTrue node) { | 627 visitIsTrue(cps_ir.IsTrue node) { |
608 unexpectedNode(node); | 628 unexpectedNode(node); |
609 } | 629 } |
610 visitIdentical(cps_ir.Identical node) { | 630 visitIdentical(cps_ir.Identical node) { |
(...skipping 16 matching lines...) Expand all Loading... |
627 } | 647 } |
628 | 648 |
629 visitNonTailThrow(cps_ir.NonTailThrow node) { | 649 visitNonTailThrow(cps_ir.NonTailThrow node) { |
630 unexpectedNode(node); | 650 unexpectedNode(node); |
631 } | 651 } |
632 | 652 |
633 visitCreateInvocationMirror(cps_ir.CreateInvocationMirror node) { | 653 visitCreateInvocationMirror(cps_ir.CreateInvocationMirror node) { |
634 unexpectedNode(node); | 654 unexpectedNode(node); |
635 } | 655 } |
636 } | 656 } |
OLD | NEW |