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

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

Issue 8972005: More optimizations cleanup. (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/stub_code_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
(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 // Test various optimizations and deoptimizations of optimizing compiler..
5
6 addThem(a, b) {
7 return a + b;
8 }
9
10 isItInt(a) {
11 return a is int;
12 }
13
14 doNeg(a) {
15 return -a;
16 }
17
18 doNot(a) {
19 return !a;
20 }
21
22 doBitNot(a) {
23 return ~a;
24 }
25
26 main() {
27 for (int i = 0; i < 2000; i++) {
28 Expect.stringEquals("HI 5", addThem("HI ", 5));
29 Expect.equals(true, isItInt(5));
30 }
31 Expect.equals(8, addThem(3, 5));
32 for (int i = 0; i < 2000; i++) {
33 Expect.stringEquals("HI 5", addThem("HI ", 5));
34 Expect.equals(8, addThem(3, 5));
35 }
36 for (int i = -500; i < 500; i++) {
37 var r = doNeg(i);
38 var p = doNeg(r);
39 Expect.equals(i, p);
40 }
41 var maxSmi = (1 << 30) - 1;
42 Expect.equals(maxSmi, doNeg(doNeg(maxSmi)));
43 // Deoptimize because of overflow.
44 var minInt = -(1 << 30);
45 Expect.equals(minInt, doNeg(doNeg(minInt)));
46
47 for (int i = 0; i < 1000; i++) {
48 Expect.equals(false, doNot(true));
49 Expect.equals(true, doNot(doNot(true)));
50 }
51 for (int i = 0; i < 1000; i++) {
52 Expect.equals(-57, doBitNot(56));
53 Expect.equals(55, doBitNot(-56));
54 }
55 }
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698