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

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

Issue 9020030: Optimize indexed store for growable array (intrinsification and inlined optimized). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | « runtime/vm/opt_code_generator_ia32.cc ('k') | 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
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 // Test various optimizations and deoptimizations of optimizing compiler.. 4 // Test various optimizations and deoptimizations of optimizing compiler..
5 5
6 addThem(a, b) { 6 addThem(a, b) {
7 return a + b; 7 return a + b;
8 } 8 }
9 9
10 isItInt(a) { 10 isItInt(a) {
11 return a is int; 11 return a is int;
12 } 12 }
13 13
14 doNeg(a) { 14 doNeg(a) {
15 return -a; 15 return -a;
16 } 16 }
17 17
18 doNeg2(a) { 18 doNeg2(a) {
19 return -a; 19 return -a;
20 } 20 }
21 21
22 doNot(a) { 22 doNot(a) {
23 return !a; 23 return !a;
24 } 24 }
25 25
26 doBitNot(a) { 26 doBitNot(a) {
27 return ~a; 27 return ~a;
28 } 28 }
29 29
30 doStore1(a, v) {
31 a[1] = v;
32 }
33
34 doStore2(a, v) {
35 a[2] = v;
36 }
37
30 main() { 38 main() {
31 for (int i = 0; i < 2000; i++) { 39 for (int i = 0; i < 2000; i++) {
32 Expect.stringEquals("HI 5", addThem("HI ", 5)); 40 Expect.stringEquals("HI 5", addThem("HI ", 5));
33 Expect.equals(true, isItInt(5)); 41 Expect.equals(true, isItInt(5));
34 } 42 }
35 Expect.equals(8, addThem(3, 5)); 43 Expect.equals(8, addThem(3, 5));
36 for (int i = 0; i < 2000; i++) { 44 for (int i = 0; i < 2000; i++) {
37 Expect.stringEquals("HI 5", addThem("HI ", 5)); 45 Expect.stringEquals("HI 5", addThem("HI ", 5));
38 Expect.equals(8, addThem(3, 5)); 46 Expect.equals(8, addThem(3, 5));
39 } 47 }
(...skipping 15 matching lines...) Expand all
55 for (int i = 0; i < 1000; i++) { 63 for (int i = 0; i < 1000; i++) {
56 Expect.equals(-57, doBitNot(56)); 64 Expect.equals(-57, doBitNot(56));
57 Expect.equals(55, doBitNot(-56)); 65 Expect.equals(55, doBitNot(-56));
58 } 66 }
59 67
60 for (int i = 0; i < 2000; i++) { 68 for (int i = 0; i < 2000; i++) {
61 Expect.equals(-2.2, doNeg2(2.2)); 69 Expect.equals(-2.2, doNeg2(2.2));
62 } 70 }
63 // Deoptimize. 71 // Deoptimize.
64 Expect.equals(-5, doNeg2(5)); 72 Expect.equals(-5, doNeg2(5));
73
74 var fixed = new List(10);
75 var growable = [1, 2, 3, 4, 5];
76
77 for (int i = 0; i < 2000; i++) {
78 doStore1(fixed, 7);
79 Expect.equals(7, fixed[1]);
80 doStore2(growable, 12);
81 Expect.equals(12, growable[2]);
82 }
83
84 // Deoptimize.
85 doStore1(growable, 8);
86 Expect.equals(8, growable[1]);
87 doStore2(fixed, 101);
88 Expect.equals(101, fixed[2]);
65 } 89 }
OLDNEW
« no previous file with comments | « runtime/vm/opt_code_generator_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698