Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: tests/compiler/dart2js/value_range2_test.dart

Issue 11227042: isEven, isOdd, isNegative, isMaxValue, isMinValue, isInfinite, isPositive, isSingleValue. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "../../../lib/compiler/implementation/ssa/ssa.dart"; 5 import "../../../lib/compiler/implementation/ssa/ssa.dart";
6 import "../../../lib/compiler/implementation/dart2jslib.dart"; 6 import "../../../lib/compiler/implementation/dart2jslib.dart";
7 7
8 Value instructionValue = new InstructionValue(new HReturn(null)); 8 Value instructionValue = new InstructionValue(new HReturn(null));
9 Value lengthValue = new LengthValue(new HReturn(null)); 9 Value lengthValue = new LengthValue(new HReturn(null));
10 10
(...skipping 28 matching lines...) Expand all
39 if (upper is num) upper = new IntValue(upper); 39 if (upper is num) upper = new IntValue(upper);
40 Range range = new Range(lower, upper); 40 Range range = new Range(lower, upper);
41 Expect.equals(range, one & two); 41 Expect.equals(range, one & two);
42 } 42 }
43 43
44 checkSubRange(Range one, Range two, [lower, upper]) { 44 checkSubRange(Range one, Range two, [lower, upper]) {
45 45
46 buildBound(one, two) { 46 buildBound(one, two) {
47 // Create a bound just like our current implementation in dart2js does. 47 // Create a bound just like our current implementation in dart2js does.
48 if (two is IntValue) { 48 if (two is IntValue) {
49 if (two.isNegative()) { 49 if (two.isNegative) {
50 return new AddValue(one, -two); 50 return new AddValue(one, -two);
51 } else if (two.isZero()) { 51 } else if (two.isZero) {
52 return one; 52 return one;
53 } 53 }
54 } 54 }
55 if (one is IntValue) { 55 if (one is IntValue) {
56 if (one.isNegative()) { 56 if (one.isNegative) {
57 return new SubtractValue(-two, -one); 57 return new SubtractValue(-two, -one);
58 } else if (one.isZero()) { 58 } else if (one.isZero) {
59 return -two; 59 return -two;
60 } 60 }
61 } 61 }
62 return new SubtractValue(one, two); 62 return new SubtractValue(one, two);
63 } 63 }
64 64
65 if (lower == null) { 65 if (lower == null) {
66 lower = buildBound(one.lower, two.upper); 66 lower = buildBound(one.lower, two.upper);
67 } else if (lower is num) { 67 } else if (lower is num) {
68 lower = new IntValue(lower); 68 lower = new IntValue(lower);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 checkSubRange(_0_instruction, _0_length, null, _0_instruction.upper); 361 checkSubRange(_0_instruction, _0_length, null, _0_instruction.upper);
362 checkSubRange(_0_instruction, _0_instruction, null, _0_instruction.upper); 362 checkSubRange(_0_instruction, _0_instruction, null, _0_instruction.upper);
363 } 363 }
364 364
365 main() { 365 main() {
366 HInstruction.idCounter = 0; 366 HInstruction.idCounter = 0;
367 testAnd(); 367 testAnd();
368 testSub(); 368 testSub();
369 testNegate(); 369 testNegate();
370 } 370 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698