| 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 | 6 // VMOptions=--optimization-counter-threshold=10 |
| 7 | 7 |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 import "dart:typed_data"; | 9 import "dart:typed_data"; |
| 10 | 10 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 testIndexedAliasedStore2(a, b, i) { | 261 testIndexedAliasedStore2(a, b, i) { |
| 262 a[0] = 1; | 262 a[0] = 1; |
| 263 a[1] = 2; | 263 a[1] = 2; |
| 264 if (a == b) { | 264 if (a == b) { |
| 265 b[i] = 3; | 265 b[i] = 3; |
| 266 } | 266 } |
| 267 return a[0] + a[1]; | 267 return a[0] + a[1]; |
| 268 } | 268 } |
| 269 var indices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; | 269 var indices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; |
| 270 | 270 |
| 271 class Z { |
| 272 var x = 42; |
| 273 } |
| 274 |
| 275 var global_array = new List<Z>(1); |
| 276 |
| 277 side_effect() { |
| 278 global_array[0].x++; |
| 279 } |
| 280 |
| 281 testAliasingStoreIndexed(array) { |
| 282 var z = new Z(); |
| 283 array[0] = z; |
| 284 side_effect(); |
| 285 return z.x; |
| 286 } |
| 287 |
| 271 main() { | 288 main() { |
| 272 final fixed = new List(10); | 289 final fixed = new List(10); |
| 273 final growable = []; | 290 final growable = []; |
| 274 testImmutableVMFields(fixed, true); | 291 testImmutableVMFields(fixed, true); |
| 275 testImmutableVMFields(growable, false); | 292 testImmutableVMFields(growable, false); |
| 276 testImmutableVMFields(growable, false); | 293 testImmutableVMFields(growable, false); |
| 277 | 294 |
| 278 final f64List = new Float64List(2); | 295 final f64List = new Float64List(2); |
| 279 testPhiRepresentation(true, f64List); | 296 testPhiRepresentation(true, f64List); |
| 280 testPhiRepresentation(false, f64List); | 297 testPhiRepresentation(false, f64List); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 final array = new List(3); | 342 final array = new List(3); |
| 326 for (var i = 0; i < 20; i++) { | 343 for (var i = 0; i < 20; i++) { |
| 327 Expect.equals(3, testIndexedNoAlias(array)); | 344 Expect.equals(3, testIndexedNoAlias(array)); |
| 328 } | 345 } |
| 329 for (var i = 0; i < 20; i++) { | 346 for (var i = 0; i < 20; i++) { |
| 330 Expect.equals(5, testIndexedAliasedStore1(array, array)); | 347 Expect.equals(5, testIndexedAliasedStore1(array, array)); |
| 331 } | 348 } |
| 332 for (var i = 0; i < 20; i++) { | 349 for (var i = 0; i < 20; i++) { |
| 333 Expect.equals(4, testIndexedAliasedStore2(array, array, indices[1])); | 350 Expect.equals(4, testIndexedAliasedStore2(array, array, indices[1])); |
| 334 } | 351 } |
| 352 |
| 353 var test_array = new List(1); |
| 354 for (var i = 0; i < 20; i++) { |
| 355 Expect.equals(43, testAliasingStoreIndexed(global_array)); |
| 356 } |
| 335 } | 357 } |
| OLD | NEW |