| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 v.x = i - 1; | 188 v.x = i - 1; |
| 189 v.y = i - 1; | 189 v.y = i - 1; |
| 190 } | 190 } |
| 191 sum += v.x + v.y; | 191 sum += v.x + v.y; |
| 192 } | 192 } |
| 193 Expect.equals(4, sum); | 193 Expect.equals(4, sum); |
| 194 Expect.equals(2, u.x); | 194 Expect.equals(2, u.x); |
| 195 Expect.equals(2, u.y); | 195 Expect.equals(2, u.y); |
| 196 } | 196 } |
| 197 | 197 |
| 198 |
| 199 testPhiMultipleRepresentations(f, arr) { |
| 200 var w; |
| 201 if (f) { |
| 202 w = arr[0] + arr[1]; |
| 203 } else { |
| 204 w = arr[0] - arr[1]; |
| 205 } |
| 206 var v; |
| 207 if (f) { |
| 208 v = arr[0]; |
| 209 } else { |
| 210 v = arr[0]; |
| 211 } |
| 212 return v + w; |
| 213 } |
| 214 |
| 215 |
| 198 main() { | 216 main() { |
| 199 final fixed = new List(10); | 217 final fixed = new List(10); |
| 200 final growable = []; | 218 final growable = []; |
| 201 testImmutableVMFields(fixed, true); | 219 testImmutableVMFields(fixed, true); |
| 202 testImmutableVMFields(growable, false); | 220 testImmutableVMFields(growable, false); |
| 203 testImmutableVMFields(growable, false); | 221 testImmutableVMFields(growable, false); |
| 204 | 222 |
| 205 final f64List = new Float64List(2); | 223 final f64List = new Float64List(2); |
| 206 testPhiRepresentation(true, f64List); | 224 testPhiRepresentation(true, f64List); |
| 207 testPhiRepresentation(false, f64List); | 225 testPhiRepresentation(false, f64List); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 229 final u32List = new Uint32List(3); | 247 final u32List = new Uint32List(3); |
| 230 u32List[0] = 0; | 248 u32List[0] = 0; |
| 231 u32List[1] = 0x3FFFFFFF; | 249 u32List[1] = 0x3FFFFFFF; |
| 232 u32List[2] = 0x7FFFFFFF; | 250 u32List[2] = 0x7FFFFFFF; |
| 233 | 251 |
| 234 for (var i = 0; i < 20; i++) { | 252 for (var i = 0; i < 20; i++) { |
| 235 testPhiConvertions(true, u32List); | 253 testPhiConvertions(true, u32List); |
| 236 testPhiConvertions(false, u32List); | 254 testPhiConvertions(false, u32List); |
| 237 } | 255 } |
| 238 | 256 |
| 257 for (var i = 0; i < 20; i++) { |
| 258 Expect.equals(0.0, testPhiMultipleRepresentations(true, f64List)); |
| 259 Expect.equals(0, testPhiMultipleRepresentations(false, const [1,2])); |
| 260 } |
| 261 |
| 239 final escape = new List(1); | 262 final escape = new List(1); |
| 240 for (var i = 0; i < 20; i++) { | 263 for (var i = 0; i < 20; i++) { |
| 241 fakeAliasing(escape); | 264 fakeAliasing(escape); |
| 242 } | 265 } |
| 243 } | 266 } |
| OLD | NEW |