OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 // VMOptions=--optimization-counter-threshold=100 --no-background-compilation | |
5 // VMOptions=--optimization-counter-threshold=100 --no-background-compilation --
no-use-field-guards | |
6 | |
7 // Test lazy deoptimization at type checks with deferred loading. | |
8 | |
9 import "package:expect/expect.dart"; | |
10 import "cha_deopt2_lib.dart"; | |
11 import "cha_deopt2_deferred_lib.dart" deferred as d; | |
12 | |
13 var loaded = false; | |
14 | |
15 main() { | |
16 for (var i = 0; i < 2000; i++) bla(); | |
17 Expect.equals(1, bla()); | |
18 d.loadLibrary().then((_) { | |
19 loaded = true; | |
20 Expect.equals(1, bla()); | |
21 }); | |
22 } | |
23 | |
24 make_array() { | |
25 try { | |
26 if (loaded) { | |
27 return [new A(), new B(), new C(), new D(), new E(), d.make_u()]; | |
28 } else { | |
29 return [new A(), new B(), new C(), new D(), new E(), new T()]; | |
30 } | |
31 } catch (e) {} | |
32 } | |
33 | |
34 bla() { | |
35 var count = 0; | |
36 for (var x in make_array()) { | |
37 if (x is T) count++; | |
38 } | |
39 return count; | |
40 } | |
OLD | NEW |