| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_nodes; | 4 library dart2js.ir_nodes; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'cps_fragment.dart' show CpsFragment; | 7 import 'cps_fragment.dart' show CpsFragment; |
| 8 import '../constants/values.dart' as values; | 8 import '../constants/values.dart' as values; |
| 9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 9 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 static const int UPPER_BOUND = 1 << 0; | 793 static const int UPPER_BOUND = 1 << 0; |
| 794 static const int LOWER_BOUND = 1 << 1; | 794 static const int LOWER_BOUND = 1 << 1; |
| 795 static const int EMPTINESS = 1 << 2; // See [hasEmptinessCheck]. | 795 static const int EMPTINESS = 1 << 2; // See [hasEmptinessCheck]. |
| 796 static const int BOTH_BOUNDS = UPPER_BOUND | LOWER_BOUND; | 796 static const int BOTH_BOUNDS = UPPER_BOUND | LOWER_BOUND; |
| 797 static const int NONE = 0; | 797 static const int NONE = 0; |
| 798 | 798 |
| 799 BoundsCheck(Primitive object, Primitive index, Primitive length, | 799 BoundsCheck(Primitive object, Primitive index, Primitive length, |
| 800 [this.checks = BOTH_BOUNDS, this.sourceInformation]) | 800 [this.checks = BOTH_BOUNDS, this.sourceInformation]) |
| 801 : this.object = new Reference<Primitive>(object), | 801 : this.object = new Reference<Primitive>(object), |
| 802 this.index = new Reference<Primitive>(index), | 802 this.index = new Reference<Primitive>(index), |
| 803 this.length = new Reference<Primitive>(length); | 803 this.length = length == null ? null : new Reference<Primitive>(length); |
| 804 | 804 |
| 805 BoundsCheck.noCheck(Primitive object, [this.sourceInformation]) | 805 BoundsCheck.noCheck(Primitive object, [this.sourceInformation]) |
| 806 : this.object = new Reference<Primitive>(object), | 806 : this.object = new Reference<Primitive>(object), |
| 807 this.checks = NONE; | 807 this.checks = NONE; |
| 808 | 808 |
| 809 accept(Visitor visitor) => visitor.visitBoundsCheck(this); | 809 accept(Visitor visitor) => visitor.visitBoundsCheck(this); |
| 810 | 810 |
| 811 void setParentPointers() { | 811 void setParentPointers() { |
| 812 object.parent = this; | 812 object.parent = this; |
| 813 if (index != null) { | 813 if (index != null) { |
| (...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2672 Definition visitRefinement(Refinement node) { | 2672 Definition visitRefinement(Refinement node) { |
| 2673 return new Refinement(getCopy(node.value), node.refineType); | 2673 return new Refinement(getCopy(node.value), node.refineType); |
| 2674 } | 2674 } |
| 2675 | 2675 |
| 2676 Definition visitBoundsCheck(BoundsCheck node) { | 2676 Definition visitBoundsCheck(BoundsCheck node) { |
| 2677 if (node.hasNoChecks) { | 2677 if (node.hasNoChecks) { |
| 2678 return new BoundsCheck.noCheck(getCopy(node.object), | 2678 return new BoundsCheck.noCheck(getCopy(node.object), |
| 2679 node.sourceInformation); | 2679 node.sourceInformation); |
| 2680 } else { | 2680 } else { |
| 2681 return new BoundsCheck(getCopy(node.object), getCopy(node.index), | 2681 return new BoundsCheck(getCopy(node.object), getCopy(node.index), |
| 2682 getCopy(node.length), | 2682 node.length == null ? null : getCopy(node.length), |
| 2683 node.checks, | 2683 node.checks, |
| 2684 node.sourceInformation); | 2684 node.sourceInformation); |
| 2685 } | 2685 } |
| 2686 } | 2686 } |
| 2687 | 2687 |
| 2688 Definition visitNullCheck(NullCheck node) { | 2688 Definition visitNullCheck(NullCheck node) { |
| 2689 return new NullCheck(getCopy(node.value), node.sourceInformation, | 2689 return new NullCheck(getCopy(node.value), node.sourceInformation, |
| 2690 condition: node.condition == null ? null : getCopy(node.condition), | 2690 condition: node.condition == null ? null : getCopy(node.condition), |
| 2691 selector: node.selector, | 2691 selector: node.selector, |
| 2692 useSelector: node.useSelector); | 2692 useSelector: node.useSelector); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2830 plug(new Branch.loose(_definitions.getCopy(node.condition), | 2830 plug(new Branch.loose(_definitions.getCopy(node.condition), |
| 2831 _copies[node.trueContinuation.definition], | 2831 _copies[node.trueContinuation.definition], |
| 2832 _copies[node.falseContinuation.definition]) | 2832 _copies[node.falseContinuation.definition]) |
| 2833 ..isStrictCheck = node.isStrictCheck); | 2833 ..isStrictCheck = node.isStrictCheck); |
| 2834 } | 2834 } |
| 2835 | 2835 |
| 2836 visitUnreachable(Unreachable node) { | 2836 visitUnreachable(Unreachable node) { |
| 2837 plug(new Unreachable()); | 2837 plug(new Unreachable()); |
| 2838 } | 2838 } |
| 2839 } | 2839 } |
| OLD | NEW |