| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // VMOptions=--warn_on_javascript_compatibility --no_warning_as_error --optimiza
tion_counter_threshold=5 | 5 // VMOptions=--warn_on_javascript_compatibility --no_warning_as_error --optimiza
tion_counter_threshold=5 |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 | 8 |
| 9 f(x, y) { | 9 f(x, y) { |
| 10 // Unoptimized code. | 10 // Unoptimized and optimized code. |
| 11 1 is double; /// 00: ok | 11 1 is double; /// 00: ok |
| 12 if (1 is double) { x++; } /// 01: ok | 12 if (1 is double) { x++; } /// 01: ok |
| 13 try { 1 as double; } on CastError catch (e) { } /// 02: ok | 13 try { 1 as double; } on CastError catch (e) { } /// 02: ok |
| 14 try { var y = 1 as double; } on CastError catch (e) { } /// 03: ok | 14 try { var y = 1 as double; } on CastError catch (e) { } /// 03: ok |
| 15 1.0 is int; /// 04: ok | 15 1.0 is int; /// 04: ok |
| 16 if (1.0 is int) { x++; } /// 05: ok | 16 if (1.0 is int) { x++; } /// 05: ok |
| 17 try { 1.0 as int; } on CastError catch (e) { } /// 06: ok | 17 try { 1.0 as int; } on CastError catch (e) { } /// 06: ok |
| 18 try { var z = 1.0 as int; } on CastError catch (e) { } /// 07: ok | 18 try { var z = 1.0 as int; } on CastError catch (e) { } /// 07: ok |
| 19 | 19 |
| 20 x is double; /// 10: ok | 20 x is double; /// 10: ok |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 "$y"; /// 24: ok | 33 "$y"; /// 24: ok |
| 34 var z = "$y"; /// 25: ok | 34 var z = "$y"; /// 25: ok |
| 35 y.toString(); /// 26: ok | 35 y.toString(); /// 26: ok |
| 36 var z = y.toString(); /// 27: ok | 36 var z = y.toString(); /// 27: ok |
| 37 | 37 |
| 38 var a = "yz"; | 38 var a = "yz"; |
| 39 var b = "xyz"; | 39 var b = "xyz"; |
| 40 b = b.substring(1); | 40 b = b.substring(1); |
| 41 if (identical(a, b)) { } /// 28: ok | 41 if (identical(a, b)) { } /// 28: ok |
| 42 | 42 |
| 43 if (identical(x, y)) { } /// 29: ok |
| 44 if (identical(y, x)) { } /// 30: ok |
| 45 |
| 43 if (x > 10) { | 46 if (x > 10) { |
| 44 // Optimized code. | 47 // Optimized code. |
| 45 x is double; /// 30: ok | 48 x is double; /// 40: ok |
| 46 if (x is double) { } /// 31: ok | 49 if (x is double) { } /// 41: ok |
| 47 try { x as double; } on CastError catch (e) { } /// 32: ok | 50 try { x as double; } on CastError catch (e) { } /// 42: ok |
| 48 try { var z = x as double; } on CastError catch (e) { } /// 33: ok | 51 try { var z = x as double; } on CastError catch (e) { } /// 43: ok |
| 49 y is int; /// 34: ok | 52 y is int; /// 44: ok |
| 50 if (y is int) { } /// 35: ok | 53 if (y is int) { } /// 45: ok |
| 51 try { y as int; } on CastError catch (e) { } /// 36: ok | 54 try { y as int; } on CastError catch (e) { } /// 46: ok |
| 52 try { var z = y as int; } on CastError catch (e) { } /// 37: ok | 55 try { var z = y as int; } on CastError catch (e) { } /// 47: ok |
| 53 | 56 |
| 54 "${1.0}"; /// 40: ok | 57 "${1.0}"; /// 50: ok |
| 55 var z = "${1.0}"; /// 41: ok | 58 var z = "${1.0}"; /// 51: ok |
| 56 (1.0).toString(); /// 42: ok | 59 (1.0).toString(); /// 52: ok |
| 57 var z = (1.0).toString(); /// 43: ok | 60 var z = (1.0).toString(); /// 53: ok |
| 58 "$y"; /// 44: ok | 61 "$y"; /// 54: ok |
| 59 var z = "$y"; /// 45: ok | 62 var z = "$y"; /// 55: ok |
| 60 y.toString(); /// 46: ok | 63 y.toString(); /// 56: ok |
| 61 var z = y.toString(); /// 47: ok | 64 var z = y.toString(); /// 57: ok |
| 62 | 65 |
| 63 var a = "yz"; | 66 var a = "yz"; |
| 64 var b = "xyz"; | 67 var b = "xyz"; |
| 65 b = b.substring(1); | 68 b = b.substring(1); |
| 66 if (identical(a, b)) { } /// 48: ok | 69 if (identical(a, b)) { } /// 58: ok |
| 70 |
| 71 if (identical(x, y)) { } /// 59: ok |
| 72 if (identical(y, x)) { } /// 60: ok |
| 67 } | 73 } |
| 68 } | 74 } |
| 69 | 75 |
| 70 g(x, y) => f(x, y); // Test inlining calls. | 76 g(x, y) => f(x, y); // Test inlining calls. |
| 71 h(x, y) => g(x, y); | 77 h(x, y) => g(x, y); |
| 72 | 78 |
| 73 main() { | 79 main() { |
| 74 for (var i = 0; i < 20; i++) { | 80 for (var i = 0; i < 20; i++) { |
| 75 h(i, i* 1.0); | 81 h(i, i* 1.0); |
| 76 } | 82 } |
| 77 } | 83 } |
| 78 | 84 |
| OLD | NEW |