| 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 '../constants/values.dart'; | 7 import '../constants/values.dart'; |
| 8 import '../types/types.dart'; | 8 import '../types/types.dart'; |
| 9 import '../world.dart'; | 9 import '../world.dart'; |
| 10 import 'cps_fragment.dart'; | 10 import 'cps_fragment.dart'; |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 destroyAndReplace( | 286 destroyAndReplace( |
| 287 node, new InvokeContinuation(trueCont, <Parameter>[])); | 287 node, new InvokeContinuation(trueCont, <Parameter>[])); |
| 288 } | 288 } |
| 289 }); | 289 }); |
| 290 void pushTrue(makeConstraint()) { | 290 void pushTrue(makeConstraint()) { |
| 291 pushAction(() { | 291 pushAction(() { |
| 292 makeConstraint(); | 292 makeConstraint(); |
| 293 push(trueCont); | 293 push(trueCont); |
| 294 }); | 294 }); |
| 295 } | 295 } |
| 296 |
| 296 void pushFalse(makeConstraint()) { | 297 void pushFalse(makeConstraint()) { |
| 297 pushAction(() { | 298 pushAction(() { |
| 298 makeConstraint(); | 299 makeConstraint(); |
| 299 push(falseCont); | 300 push(falseCont); |
| 300 }); | 301 }); |
| 301 } | 302 } |
| 303 |
| 302 if (condition is ApplyBuiltinOperator && | 304 if (condition is ApplyBuiltinOperator && |
| 303 condition.argumentRefs.length == 2 && | 305 condition.argumentRefs.length == 2 && |
| 304 isInt(condition.argument(0)) && | 306 isInt(condition.argument(0)) && |
| 305 isInt(condition.argument(1))) { | 307 isInt(condition.argument(1))) { |
| 306 SignedVariable v1 = getValue(condition.argument(0)); | 308 SignedVariable v1 = getValue(condition.argument(0)); |
| 307 SignedVariable v2 = getValue(condition.argument(1)); | 309 SignedVariable v2 = getValue(condition.argument(1)); |
| 308 switch (condition.operator) { | 310 switch (condition.operator) { |
| 309 case BuiltinOperator.NumLe: | 311 case BuiltinOperator.NumLe: |
| 310 pushTrue(() => makeLessThanOrEqual(v1, v2)); | 312 pushTrue(() => makeLessThanOrEqual(v1, v2)); |
| 311 pushFalse(() => makeGreaterThan(v1, v2)); | 313 pushFalse(() => makeGreaterThan(v1, v2)); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 } | 703 } |
| 702 return node.body; | 704 return node.body; |
| 703 } | 705 } |
| 704 } | 706 } |
| 705 | 707 |
| 706 /// Lattice representing the known (weak) monotonicity of a loop variable. | 708 /// Lattice representing the known (weak) monotonicity of a loop variable. |
| 707 /// | 709 /// |
| 708 /// The lattice bottom is represented by `null` and represents the case where | 710 /// The lattice bottom is represented by `null` and represents the case where |
| 709 /// the loop variable never changes value during the loop. | 711 /// the loop variable never changes value during the loop. |
| 710 enum Monotonicity { NotMonotone, Increasing, Decreasing, } | 712 enum Monotonicity { NotMonotone, Increasing, Decreasing, } |
| OLD | NEW |