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

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

Issue 8440023: Deoptimization tests for instance field increment optimization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/tests/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 }
15 Expect.equals(2000, a.f);
16 Expect.equals(2000, aa.f);
17 a.f = 1.0;
18 // Deoptimize ++ part of instance increment.
19 a.Incr();
20 Expect.equals(2.0, a.f);
21 var b = new B();
22 // Deoptimize getfield part of instance increment.
23 myIncr(b);
24 Expect.equals(1.0, b.f);
regis 2011/11/02 02:06:37 Do you use a double for a particular reason? b.f h
srdjan 2011/11/02 15:10:55 Good catch, this would fail in type checked mode.
25 }
26
27 myIncr(var a) {
28 a.f++;
29 }
30
31 class A {
32 A() : f = 0;
33 Incr() {
34 f++;
35 }
36 int f;
37 }
38
39 class B {
40 B() : f = 0;
41 int f;
42 }
43
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698