| 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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 return node.body; | 625 return node.body; |
| 626 } | 626 } |
| 627 | 627 |
| 628 @override | 628 @override |
| 629 void visitInvokeMethod(InvokeMethod node) { | 629 void visitInvokeMethod(InvokeMethod node) { |
| 630 if (node.selector.isGetter && node.selector.name == 'length') { | 630 if (node.selector.isGetter && node.selector.name == 'length') { |
| 631 // If the receiver type is not known to be indexable, the length call | 631 // If the receiver type is not known to be indexable, the length call |
| 632 // was not rewritten to GetLength. But if we can prove that the call only | 632 // was not rewritten to GetLength. But if we can prove that the call only |
| 633 // succeeds for indexables, we can trust that it returns the length. | 633 // succeeds for indexables, we can trust that it returns the length. |
| 634 TypeMask successType = | 634 TypeMask successType = |
| 635 types.receiverTypeFor(node.selector, node.dartReceiver.type); | 635 types.receiverTypeFor(node.selector, node.receiver.type); |
| 636 if (types.isDefinitelyIndexable(successType)) { | 636 if (types.isDefinitelyIndexable(successType)) { |
| 637 valueOf[node] = getLength(node.dartReceiver, currentEffectNumber); | 637 valueOf[node] = getLength(node.receiver, currentEffectNumber); |
| 638 } | 638 } |
| 639 } | 639 } |
| 640 } | 640 } |
| 641 | 641 |
| 642 @override | 642 @override |
| 643 void visitApplyBuiltinMethod(ApplyBuiltinMethod node) { | 643 void visitApplyBuiltinMethod(ApplyBuiltinMethod node) { |
| 644 Primitive receiver = node.receiver; | 644 Primitive receiver = node.receiver; |
| 645 int effectBefore = currentEffectNumber; | 645 int effectBefore = currentEffectNumber; |
| 646 currentEffectNumber = makeNewEffect(); | 646 currentEffectNumber = makeNewEffect(); |
| 647 int effectAfter = currentEffectNumber; | 647 int effectAfter = currentEffectNumber; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 } | 699 } |
| 700 return node.body; | 700 return node.body; |
| 701 } | 701 } |
| 702 } | 702 } |
| 703 | 703 |
| 704 /// Lattice representing the known (weak) monotonicity of a loop variable. | 704 /// Lattice representing the known (weak) monotonicity of a loop variable. |
| 705 /// | 705 /// |
| 706 /// The lattice bottom is represented by `null` and represents the case where | 706 /// The lattice bottom is represented by `null` and represents the case where |
| 707 /// the loop variable never changes value during the loop. | 707 /// the loop variable never changes value during the loop. |
| 708 enum Monotonicity { NotMonotone, Increasing, Decreasing, } | 708 enum Monotonicity { NotMonotone, Increasing, Decreasing, } |
| OLD | NEW |