| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; | 
| 6 import "package:compiler/src/ssa/nodes.dart"; | 6 import "package:compiler/src/ssa/nodes.dart"; | 
| 7 import "package:compiler/src/ssa/value_range_analyzer.dart"; | 7 import "package:compiler/src/ssa/value_range_analyzer.dart"; | 
| 8 import "package:compiler/src/js_backend/constant_system_javascript.dart"; | 8 import "package:compiler/src/js_backend/constant_system_javascript.dart"; | 
| 9 | 9 | 
| 10 ValueRangeInfo info = new ValueRangeInfo(const JavaScriptConstantSystem()); | 10 ValueRangeInfo info = new ValueRangeInfo(const JavaScriptConstantSystem()); | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 48 Range _0_instruction = createInstructionRange(0); | 48 Range _0_instruction = createInstructionRange(0); | 
| 49 | 49 | 
| 50 checkAndRange(Range one, Range two, lower, upper) { | 50 checkAndRange(Range one, Range two, lower, upper) { | 
| 51   if (lower is num) lower = info.newIntValue(lower); | 51   if (lower is num) lower = info.newIntValue(lower); | 
| 52   if (upper is num) upper = info.newIntValue(upper); | 52   if (upper is num) upper = info.newIntValue(upper); | 
| 53   Range range = info.newNormalizedRange(lower, upper); | 53   Range range = info.newNormalizedRange(lower, upper); | 
| 54   Expect.equals(range, one & two); | 54   Expect.equals(range, one & two); | 
| 55 } | 55 } | 
| 56 | 56 | 
| 57 checkSubRange(Range one, Range two, [lower, upper]) { | 57 checkSubRange(Range one, Range two, [lower, upper]) { | 
| 58 |  | 
| 59   buildBound(one, two) { | 58   buildBound(one, two) { | 
| 60     // Create a bound just like our current implementation in dart2js does. | 59     // Create a bound just like our current implementation in dart2js does. | 
| 61     if (two is IntValue) { | 60     if (two is IntValue) { | 
| 62       if (two.isNegative) { | 61       if (two.isNegative) { | 
| 63         return info.newAddValue(one, -two); | 62         return info.newAddValue(one, -two); | 
| 64       } else if (two.isZero) { | 63       } else if (two.isZero) { | 
| 65         return one; | 64         return one; | 
| 66       } | 65       } | 
| 67     } | 66     } | 
| 68     if (one is IntValue) { | 67     if (one is IntValue) { | 
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 376   checkSubRange(_0_instruction, _0_length, null, _0_instruction.upper); | 375   checkSubRange(_0_instruction, _0_length, null, _0_instruction.upper); | 
| 377   checkSubRange(_0_instruction, _0_instruction, null, _0_instruction.upper); | 376   checkSubRange(_0_instruction, _0_instruction, null, _0_instruction.upper); | 
| 378 } | 377 } | 
| 379 | 378 | 
| 380 main() { | 379 main() { | 
| 381   HInstruction.idCounter = 0; | 380   HInstruction.idCounter = 0; | 
| 382   testAnd(); | 381   testAnd(); | 
| 383   testSub(); | 382   testSub(); | 
| 384   testNegate(); | 383   testNegate(); | 
| 385 } | 384 } | 
| OLD | NEW | 
|---|