OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 various optimizations and deoptimizations of optimizing compiler.. | 4 // Test various optimizations and deoptimizations of optimizing compiler.. |
5 // VMOptions=--optimization-counter-threshold=10 --no-constant-propagation | 5 // VMOptions=--optimization-counter-threshold=10 --no-constant-propagation --no-
background-compilation |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 | 8 |
9 // Test canonicalization of identical with double input. | 9 // Test canonicalization of identical with double input. |
10 // Constant propagation is disabled so that canonicalization is run | 10 // Constant propagation is disabled so that canonicalization is run |
11 // one time less than usual. | 11 // one time less than usual. |
12 | 12 |
13 test(a) { | 13 test(a) { |
14 var dbl = a + 1.0; | 14 var dbl = a + 1.0; |
15 if (!identical(dbl, true)) { | 15 if (!identical(dbl, true)) { |
16 return "ok"; | 16 return "ok"; |
17 } | 17 } |
18 throw "fail"; | 18 throw "fail"; |
19 } | 19 } |
20 | 20 |
21 Object Y = 1.0; | 21 Object Y = 1.0; |
22 | 22 |
23 test_object_type(x) => identical(x, Y); | 23 test_object_type(x) => identical(x, Y); |
24 | 24 |
25 main() { | 25 main() { |
26 for (var i = 0; i < 20; i++) test(0); | 26 for (var i = 0; i < 20; i++) test(0); |
27 Expect.equals("ok", test(0)); | 27 Expect.equals("ok", test(0)); |
28 | 28 |
29 var x = 0.0 + 1.0; | 29 var x = 0.0 + 1.0; |
30 for (var i = 0; i < 20; i++) test_object_type(x); | 30 for (var i = 0; i < 20; i++) test_object_type(x); |
31 Expect.equals(true, test_object_type(x)); | 31 Expect.equals(true, test_object_type(x)); |
32 } | 32 } |
33 | 33 |
OLD | NEW |