| 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 // VMOptions=--optimization-counter-threshold=10 | 4 // VMOptions=--optimization-counter-threshold=10 --no-use-osr |
| 5 | 5 |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 | 7 |
| 8 | 8 |
| 9 class A { | 9 class A { |
| 10 bool _result; | 10 bool _result; |
| 11 A(this._result); | 11 A(this._result); |
| 12 operator ==(x) { return _result; } | 12 operator ==(x) { return _result; } |
| 13 } | 13 } |
| 14 | 14 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 if (death() == nullFn()) { | 47 if (death() == nullFn()) { |
| 48 throw "failed"; | 48 throw "failed"; |
| 49 } | 49 } |
| 50 if (death() != nullFn()) { | 50 if (death() != nullFn()) { |
| 51 } else { | 51 } else { |
| 52 throw "failed"; | 52 throw "failed"; |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 boolEqualityPositiveA(a) => a == true; |
| 57 boolEqualityNegativeA(a) => a != true; |
| 58 |
| 59 boolEqualityPositiveB(a) => true == a; |
| 60 boolEqualityNegativeB(a) => true != a; |
| 61 |
| 56 main() { | 62 main() { |
| 57 for (int i = 0; i < 20; i++) tests(); | 63 for (int i = 0; i < 20; i++) { |
| 64 tests(); |
| 65 // Do not inline calls to prevent constant folding. |
| 66 Expect.isTrue(boolEqualityPositiveA(true)); |
| 67 Expect.isFalse(boolEqualityPositiveA(false)); |
| 68 Expect.isFalse(boolEqualityNegativeA(true)); |
| 69 Expect.isTrue(boolEqualityNegativeA(false)); |
| 70 |
| 71 Expect.isTrue(boolEqualityPositiveB(true)); |
| 72 Expect.isFalse(boolEqualityPositiveB(false)); |
| 73 Expect.isFalse(boolEqualityNegativeB(true)); |
| 74 Expect.isTrue(boolEqualityNegativeB(false)); |
| 75 } |
| 76 |
| 77 // Deoptimize. |
| 78 Expect.isFalse(boolEqualityPositiveA(1)); |
| 79 Expect.isTrue(boolEqualityNegativeA("hi")); |
| 80 Expect.isFalse(boolEqualityPositiveB(2.0)); |
| 81 Expect.isTrue(boolEqualityNegativeB([])); |
| 58 } | 82 } |
| OLD | NEW |