OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Test deoptimization. | 4 // Test deoptimization. |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 class SmiCompares { | 8 class SmiCompares { |
9 // Test deoptimization when one argument is known to be Smi. | 9 // Test deoptimization when one argument is known to be Smi. |
10 static bool smiCompareLessThan2(a) { | 10 static bool smiCompareLessThan2(a) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 static bool compareNotEqual(a, b) { | 78 static bool compareNotEqual(a, b) { |
79 return a != b; | 79 return a != b; |
80 } | 80 } |
81 | 81 |
82 // Use only Object.==. | 82 // Use only Object.==. |
83 static void objectsEqualityTest() { | 83 static void objectsEqualityTest() { |
84 var a = new ObjectsEquality(); | 84 var a = new ObjectsEquality(); |
85 var b = new ObjectsEquality(); | 85 var b = new ObjectsEquality(); |
86 final nan = 0.0 / 0.0; | |
87 for (int i = 0; i < 1000; i++) { | 86 for (int i = 0; i < 1000; i++) { |
88 Expect.equals(true, compareEqual(a, a)); | 87 Expect.equals(true, compareEqual(a, a)); |
89 Expect.equals(true, compareEqual(null, null)); | 88 Expect.equals(true, compareEqual(null, null)); |
90 Expect.equals(false, compareEqual(null, a)); | 89 Expect.equals(false, compareEqual(null, a)); |
91 Expect.equals(false, compareEqual(a, null)); | 90 Expect.equals(false, compareEqual(a, null)); |
92 Expect.equals(true, compareEqual(b, b)); | 91 Expect.equals(true, compareEqual(b, b)); |
93 Expect.equals(false, compareEqual(a, b)); | 92 Expect.equals(false, compareEqual(a, b)); |
94 | 93 |
95 Expect.equals(false, compareNotEqual(a, a)); | 94 Expect.equals(false, compareNotEqual(a, a)); |
96 Expect.equals(false, compareNotEqual(null, null)); | 95 Expect.equals(false, compareNotEqual(null, null)); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 SmiBinop.smiBinopOverflowTest(); | 206 SmiBinop.smiBinopOverflowTest(); |
208 ObjectsEquality.objectsEqualityTest(); | 207 ObjectsEquality.objectsEqualityTest(); |
209 smiRightShift(); | 208 smiRightShift(); |
210 doubleUnary(); | 209 doubleUnary(); |
211 } | 210 } |
212 } | 211 } |
213 | 212 |
214 main() { | 213 main() { |
215 DeoptimizationTest.testMain(); | 214 DeoptimizationTest.testMain(); |
216 } | 215 } |
OLD | NEW |