| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.cps_ir.bounds_checker; | 5 library dart2js.cps_ir.bounds_checker; |
| 6 | 6 |
| 7 import 'cps_ir_nodes.dart'; | 7 import 'cps_ir_nodes.dart'; |
| 8 import 'optimizers.dart' show Pass; | 8 import 'optimizers.dart' show Pass; |
| 9 import 'octagon.dart'; | 9 import 'octagon.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 case BuiltinMethod.Push: | 697 case BuiltinMethod.Push: |
| 698 // after = before + count | 698 // after = before + count |
| 699 int count = node.arguments.length; | 699 int count = node.arguments.length; |
| 700 makeExactSum(lengthAfter, lengthBefore, count); | 700 makeExactSum(lengthAfter, lengthBefore, count); |
| 701 break; | 701 break; |
| 702 | 702 |
| 703 case BuiltinMethod.Pop: | 703 case BuiltinMethod.Pop: |
| 704 // after = before - 1 | 704 // after = before - 1 |
| 705 makeExactSum(lengthAfter, lengthBefore, -1); | 705 makeExactSum(lengthAfter, lengthBefore, -1); |
| 706 break; | 706 break; |
| 707 |
| 708 case BuiltinMethod.SetLength: |
| 709 makeEqual(lengthAfter, getValue(node.arguments[0].definition)); |
| 710 break; |
| 707 } | 711 } |
| 708 } | 712 } |
| 709 | 713 |
| 710 @override | 714 @override |
| 711 void visitLiteralList(LiteralList node) { | 715 void visitLiteralList(LiteralList node) { |
| 712 makeConstant(getLength(node, currentEffectNumber), node.values.length); | 716 makeConstant(getLength(node, currentEffectNumber), node.values.length); |
| 713 } | 717 } |
| 714 | 718 |
| 715 // ---------------- INTERIOR EXPRESSIONS -------------------- | 719 // ---------------- INTERIOR EXPRESSIONS -------------------- |
| 716 | 720 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 741 } | 745 } |
| 742 return node.body; | 746 return node.body; |
| 743 } | 747 } |
| 744 } | 748 } |
| 745 | 749 |
| 746 /// Lattice representing the known (weak) monotonicity of a loop variable. | 750 /// Lattice representing the known (weak) monotonicity of a loop variable. |
| 747 /// | 751 /// |
| 748 /// The lattice bottom is represented by `null` and represents the case where | 752 /// The lattice bottom is represented by `null` and represents the case where |
| 749 /// the loop variable never changes value during the loop. | 753 /// the loop variable never changes value during the loop. |
| 750 enum Monotonicity { NotMonotone, Increasing, Decreasing, } | 754 enum Monotonicity { NotMonotone, Increasing, Decreasing, } |
| OLD | NEW |