| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // VMOptions=--optimization-counter-threshold=10 --no-use-osr |
| 4 | 5 |
| 5 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 6 | 7 |
| 7 // Check correct deoptimization of instance field increment. | 8 // Check correct deoptimization of instance field increment. |
| 8 | 9 |
| 9 | 10 |
| 10 main() { | 11 main() { |
| 11 var a = new A(); | 12 var a = new A(); |
| 12 var aa = new A(); | 13 var aa = new A(); |
| 13 for (int i = 0; i < 2000; i++) { | 14 for (int i = 0; i < 20; i++) { |
| 14 a.Incr(); | 15 a.Incr(); |
| 15 myIncr(aa); | 16 myIncr(aa); |
| 16 conditionalIncr(false, a); | 17 conditionalIncr(false, a); |
| 17 } | 18 } |
| 18 Expect.equals(2000, a.f); | 19 Expect.equals(20, a.f); |
| 19 Expect.equals(2000, aa.f); | 20 Expect.equals(20, aa.f); |
| 20 a.f = 1.0; | 21 a.f = 1.0; |
| 21 // Deoptimize ++ part of instance increment. | 22 // Deoptimize ++ part of instance increment. |
| 22 a.Incr(); | 23 a.Incr(); |
| 23 Expect.equals(2.0, a.f); | 24 Expect.equals(2.0, a.f); |
| 24 var b = new B(); | 25 var b = new B(); |
| 25 // Deoptimize getfield part of instance increment. | 26 // Deoptimize getfield part of instance increment. |
| 26 myIncr(b); | 27 myIncr(b); |
| 27 Expect.equals(1.0, b.f); | 28 Expect.equals(1.0, b.f); |
| 28 // Deoptimize since no type feedback was collected. | 29 // Deoptimize since no type feedback was collected. |
| 29 var old = a.f; | 30 var old = a.f; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 47 f++; | 48 f++; |
| 48 } | 49 } |
| 49 var f; | 50 var f; |
| 50 } | 51 } |
| 51 | 52 |
| 52 class B { | 53 class B { |
| 53 B() : f = 0; | 54 B() : f = 0; |
| 54 var f; | 55 var f; |
| 55 } | 56 } |
| 56 | 57 |
| OLD | NEW |