| 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 // Test correctness of side effects tracking used by load to load forwarding. | 4 // Test correctness of side effects tracking used by load to load forwarding. |
| 5 | 5 |
| 6 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation | 6 // VMOptions=--optimization-counter-threshold=10 --no-background-compilation |
| 7 | 7 |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 | 9 |
| 10 class C { | 10 class C { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 a.x = b + 1.0; | 59 a.x = b + 1.0; |
| 60 return a.x; | 60 return a.x; |
| 61 } | 61 } |
| 62 | 62 |
| 63 test_with_context() { | 63 test_with_context() { |
| 64 f(a) { | 64 f(a) { |
| 65 var b = a + 1; | 65 var b = a + 1; |
| 66 return (() => b + 1)(); | 66 return (() => b + 1)(); |
| 67 } | 67 } |
| 68 |
| 68 for (var i = 0; i < 100000; i++) f(42); | 69 for (var i = 0; i < 100000; i++) f(42); |
| 69 Expect.equals(44, f(42)); | 70 Expect.equals(44, f(42)); |
| 70 } | 71 } |
| 71 | 72 |
| 72 test_with_instance() { | 73 test_with_instance() { |
| 73 for (var i = 0; i < 20; i++) Expect.equals(43, s1(new C())); | 74 for (var i = 0; i < 20; i++) Expect.equals(43, s1(new C())); |
| 74 for (var i = 0; i < 20; i++) Expect.equals(43, s1a(new C())); | 75 for (var i = 0; i < 20; i++) Expect.equals(43, s1a(new C())); |
| 75 for (var i = 0; i < 20; i++) Expect.equals(123, s2().z); | 76 for (var i = 0; i < 20; i++) Expect.equals(123, s2().z); |
| 76 for (var i = 0; i < 20; i++) Expect.equals(0, s3(new C(), i)); | 77 for (var i = 0; i < 20; i++) Expect.equals(0, s3(new C(), i)); |
| 77 for (var i = 0; i < 20; i++) Expect.equals(i + 1.0, s4(new D(), i)); | 78 for (var i = 0; i < 20; i++) Expect.equals(i + 1.0, s4(new D(), i)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 test_with_static() { | 114 test_with_static() { |
| 114 for (var i = 0; i < 20; i++) Expect.equals(i + 1, static1(i)); | 115 for (var i = 0; i < 20; i++) Expect.equals(i + 1, static1(i)); |
| 115 } | 116 } |
| 116 | 117 |
| 117 main() { | 118 main() { |
| 118 test_with_instance(); | 119 test_with_instance(); |
| 119 test_with_array(); | 120 test_with_array(); |
| 120 test_with_context(); | 121 test_with_context(); |
| 121 test_with_static(); | 122 test_with_static(); |
| 122 } | 123 } |
| OLD | NEW |