| 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 // This test runs invokes getField and setField enough times to get cached | 5 // This test runs invokes getField and setField enough times to get cached |
| 6 // closures generated and with enough different field names to trip the path | 6 // closures generated and with enough different field names to trip the path |
| 7 // that flushes the closure cache. | 7 // that flushes the closure cache. |
| 8 | 8 |
| 9 library test.hot_get_field; | 9 library test.hot_get_field; |
| 10 | 10 |
| 11 @MirrorsUsed(targets: "test.hot_get_field") | 11 @MirrorsUsed(targets: "test.hot_get_field") |
| 12 import 'dart:mirrors'; | 12 import 'dart:mirrors'; |
| 13 import 'package:expect/expect.dart'; | 13 import 'package:expect/expect.dart'; |
| 14 | 14 |
| 15 const int optimizationThreshold = 20; | 15 const int optimizationThreshold = 20; |
| 16 | 16 |
| 17 main() { | 17 main() { |
| 18 var digits = | 18 var digits = [ |
| 19 ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']; | 19 '0', |
| 20 '1', |
| 21 '2', |
| 22 '3', |
| 23 '4', |
| 24 '5', |
| 25 '6', |
| 26 '7', |
| 27 '8', |
| 28 '9', |
| 29 'A', |
| 30 'B', |
| 31 'C', |
| 32 'D', |
| 33 'E', |
| 34 'F' |
| 35 ]; |
| 20 var symbols = new List(); | 36 var symbols = new List(); |
| 21 for (var high in digits) { | 37 for (var high in digits) { |
| 22 for (var low in digits) { | 38 for (var low in digits) { |
| 23 symbols.add(MirrorSystem.getSymbol("v$high$low")); | 39 symbols.add(MirrorSystem.getSymbol("v$high$low")); |
| 24 } | 40 } |
| 25 } | 41 } |
| 26 | 42 |
| 27 var im = reflect(new C()); | 43 var im = reflect(new C()); |
| 28 for (var i = 0; i < optimizationThreshold * 2; i++) { | 44 for (var i = 0; i < optimizationThreshold * 2; i++) { |
| 29 for (var fieldName in symbols) { | 45 for (var fieldName in symbols) { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 var vF7; | 300 var vF7; |
| 285 var vF8; | 301 var vF8; |
| 286 var vF9; | 302 var vF9; |
| 287 var vFA; | 303 var vFA; |
| 288 var vFB; | 304 var vFB; |
| 289 var vFC; | 305 var vFC; |
| 290 var vFD; | 306 var vFD; |
| 291 var vFE; | 307 var vFE; |
| 292 var vFF; | 308 var vFF; |
| 293 } | 309 } |
| OLD | NEW |