Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: tests/language/src/InstanceIncrDeoptTest.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Check correct deoptimization of instance field increment.
6
7
8 main() {
9 var a = new A();
10 var aa = new A();
11 for (int i = 0; i < 2000; i++) {
12 a.Incr();
13 myIncr(aa);
14 conditionalIncr(false, a);
15 }
16 Expect.equals(2000, a.f);
17 Expect.equals(2000, aa.f);
18 a.f = 1.0;
19 // Deoptimize ++ part of instance increment.
20 a.Incr();
21 Expect.equals(2.0, a.f);
22 var b = new B();
23 // Deoptimize getfield part of instance increment.
24 myIncr(b);
25 Expect.equals(1.0, b.f);
26 // Deoptimize since no type feedback was collected.
27 var old = a.f;
28 conditionalIncr(true, a);
29 Expect.equals(old + 1, a.f);
30 }
31
32 myIncr(var a) {
33 a.f++;
34 }
35
36 conditionalIncr(var f, var a) {
37 if (f) {
38 a.f++;
39 }
40 }
41
42 class A {
43 A() : f = 0;
44 Incr() {
45 f++;
46 }
47 var f;
48 }
49
50 class B {
51 B() : f = 0;
52 var f;
53 }
54
OLDNEW
« no previous file with comments | « tests/language/src/InstanceFieldInitializerTest.dart ('k') | tests/language/src/InstanceMethod2NegativeTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698