| 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 part of dart2js.cps_ir.optimizers; | 5 part of dart2js.cps_ir.optimizers; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * [ShrinkingReducer] applies shrinking reductions to CPS terms as described | 8 * [ShrinkingReducer] applies shrinking reductions to CPS terms as described |
| 9 * in 'Compiling with Continuations, Continued' by Andrew Kennedy. | 9 * in 'Compiling with Continuations, Continued' by Andrew Kennedy. |
| 10 */ | 10 */ |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 505 |
| 506 processLetCont(LetCont node) { | 506 processLetCont(LetCont node) { |
| 507 int index = 0; | 507 int index = 0; |
| 508 node.continuations.forEach((Continuation continuation) { | 508 node.continuations.forEach((Continuation continuation) { |
| 509 continuation.parent = node; | 509 continuation.parent = node; |
| 510 continuation.parent_index = index++; | 510 continuation.parent_index = index++; |
| 511 }); | 511 }); |
| 512 node.body.parent = node; | 512 node.body.parent = node; |
| 513 } | 513 } |
| 514 | 514 |
| 515 processLetMutable(LetMutable node) { |
| 516 node.variable.parent = node; |
| 517 node.value.parent = node; |
| 518 node.body.parent = node; |
| 519 } |
| 520 |
| 515 processInvokeStatic(InvokeStatic node) { | 521 processInvokeStatic(InvokeStatic node) { |
| 516 node.arguments.forEach((Reference ref) => ref.parent = node); | 522 node.arguments.forEach((Reference ref) => ref.parent = node); |
| 517 node.continuation.parent = node; | 523 node.continuation.parent = node; |
| 518 } | 524 } |
| 519 | 525 |
| 520 processInvokeContinuation(InvokeContinuation node) { | 526 processInvokeContinuation(InvokeContinuation node) { |
| 521 node.continuation.parent = node; | 527 node.continuation.parent = node; |
| 522 node.arguments.forEach((Reference ref) => ref.parent = node); | 528 node.arguments.forEach((Reference ref) => ref.parent = node); |
| 523 } | 529 } |
| 524 | 530 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 548 node.condition.parent = node; | 554 node.condition.parent = node; |
| 549 node.trueContinuation.parent = node; | 555 node.trueContinuation.parent = node; |
| 550 node.falseContinuation.parent = node; | 556 node.falseContinuation.parent = node; |
| 551 } | 557 } |
| 552 | 558 |
| 553 processTypeOperator(TypeOperator node) { | 559 processTypeOperator(TypeOperator node) { |
| 554 node.continuation.parent = node; | 560 node.continuation.parent = node; |
| 555 node.receiver.parent = node; | 561 node.receiver.parent = node; |
| 556 } | 562 } |
| 557 | 563 |
| 558 processSetClosureVariable(SetClosureVariable node) { | 564 processSetMutableVariable(SetMutableVariable node) { |
| 565 node.variable.parent = node; |
| 559 node.body.parent = node; | 566 node.body.parent = node; |
| 560 node.value.parent = node; | 567 node.value.parent = node; |
| 561 } | 568 } |
| 562 | 569 |
| 563 processDeclareFunction(DeclareFunction node) { | 570 processDeclareFunction(DeclareFunction node) { |
| 571 node.variable.parent = node; |
| 564 node.definition.parent = node; | 572 node.definition.parent = node; |
| 565 node.body.parent = node; | 573 node.body.parent = node; |
| 566 } | 574 } |
| 567 | 575 |
| 568 // Definitions. | 576 // Definitions. |
| 569 | 577 |
| 570 processLiteralList(LiteralList node) { | 578 processLiteralList(LiteralList node) { |
| 571 node.values.forEach((Reference ref) => ref.parent = node); | 579 node.values.forEach((Reference ref) => ref.parent = node); |
| 572 } | 580 } |
| 573 | 581 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 processSetField(SetField node) { | 619 processSetField(SetField node) { |
| 612 node.object.parent = node; | 620 node.object.parent = node; |
| 613 node.value.parent = node; | 621 node.value.parent = node; |
| 614 node.body.parent = node; | 622 node.body.parent = node; |
| 615 } | 623 } |
| 616 | 624 |
| 617 processGetField(GetField node) { | 625 processGetField(GetField node) { |
| 618 node.object.parent = node; | 626 node.object.parent = node; |
| 619 } | 627 } |
| 620 | 628 |
| 629 processGetMutableVariable(GetMutableVariable node) { |
| 630 node.variable.parent = node; |
| 631 } |
| 632 |
| 621 processCreateInstance(CreateInstance node) { | 633 processCreateInstance(CreateInstance node) { |
| 622 node.arguments.forEach((Reference ref) => ref.parent = node); | 634 node.arguments.forEach((Reference ref) => ref.parent = node); |
| 623 } | 635 } |
| 624 | 636 |
| 625 processCreateBox(CreateBox node) { | 637 processCreateBox(CreateBox node) { |
| 626 } | 638 } |
| 627 } | 639 } |
| 628 | 640 |
| 629 class _ReductionKind { | 641 class _ReductionKind { |
| 630 final String name; | 642 final String name; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 } | 675 } |
| 664 | 676 |
| 665 String toString() => "$kind: $node"; | 677 String toString() => "$kind: $node"; |
| 666 } | 678 } |
| 667 | 679 |
| 668 /// A dummy class used solely to mark nodes as deleted once they are removed | 680 /// A dummy class used solely to mark nodes as deleted once they are removed |
| 669 /// from a term. | 681 /// from a term. |
| 670 class _DeletedNode extends Node { | 682 class _DeletedNode extends Node { |
| 671 accept(_) => null; | 683 accept(_) => null; |
| 672 } | 684 } |
| OLD | NEW |