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

Side by Side Diff: tests/language/bit_operations_test.dart

Issue 19034002: Add VMOptions to optimize tests that need to be (Part I). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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
« no previous file with comments | « tests/language/assign_op_test.dart ('k') | tests/language/branch_canonicalization_test.dart » ('j') | 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 // Dart test for testing bitwise operations. 4 // Dart test for testing bitwise operations.
5 // VMOptions=--optimization-counter-threshold=10 --no-use-osr
5 6
6 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
7 8
8 class BitOperationsTest { 9 class BitOperationsTest {
9 static testMain() { 10 static testMain() {
10 for (int i = 0; i < 4; i++) { 11 for (int i = 0; i < 4; i++) {
11 testOne(); 12 testOne();
12 } 13 }
13 } 14 }
14 static testOne() { 15 static testOne() {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 Expect.equals(15, 0xF00000000 >> 32); 50 Expect.equals(15, 0xF00000000 >> 32);
50 Expect.equals(1030792151040, 16492674416655 >> 4); 51 Expect.equals(1030792151040, 16492674416655 >> 4);
51 52
52 Expect.equals(0xF0000000000000000F0, 0xF0000000000000000F << 4); 53 Expect.equals(0xF0000000000000000F0, 0xF0000000000000000F << 4);
53 Expect.equals(0xF00000000, 15 << 32); 54 Expect.equals(0xF00000000, 15 << 32);
54 55
55 TestNegativeValueShifts(); 56 TestNegativeValueShifts();
56 TestPositiveValueShifts(); 57 TestPositiveValueShifts();
57 TestNoMaskingOfShiftCount(); 58 TestNoMaskingOfShiftCount();
58 TestNegativeCountShifts(); 59 TestNegativeCountShifts();
59 for (int i = 0; i < 10000; i++) { 60 for (int i = 0; i < 20; i++) {
60 TestCornerCasesRightShifts(); 61 TestCornerCasesRightShifts();
61 TestRightShift64Bit(); 62 TestRightShift64Bit();
62 TestLeftShift64Bit(); 63 TestLeftShift64Bit();
63 TestLeftShift64BitWithOverflow1(); 64 TestLeftShift64BitWithOverflow1();
64 TestLeftShift64BitWithOverflow2(); 65 TestLeftShift64BitWithOverflow2();
65 TestLeftShift64BitWithOverflow3(); 66 TestLeftShift64BitWithOverflow3();
66 } 67 }
67 } 68 }
68 69
69 static void TestCornerCasesRightShifts() { 70 static void TestCornerCasesRightShifts() {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 try { 122 try {
122 var x = a >> b; 123 var x = a >> b;
123 return false; 124 return false;
124 } catch (e) { 125 } catch (e) {
125 return true; 126 return true;
126 } 127 }
127 } 128 }
128 129
129 Expect.isTrue(throwOnLeft(12, -3)); 130 Expect.isTrue(throwOnLeft(12, -3));
130 Expect.isTrue(throwOnRight(12, -3)); 131 Expect.isTrue(throwOnRight(12, -3));
131 for (int i = 0; i < 4000; i++) { 132 for (int i = 0; i < 20; i++) {
132 Expect.isFalse(throwOnLeft(12, 3)); 133 Expect.isFalse(throwOnLeft(12, 3));
133 Expect.isFalse(throwOnRight(12, 3)); 134 Expect.isFalse(throwOnRight(12, 3));
134 } 135 }
135 } 136 }
136 137
137 static void TestNegativeValueShifts() { 138 static void TestNegativeValueShifts() {
138 for (int value = 0; value > -100; value--) { 139 for (int value = 0; value > -100; value--) {
139 for (int i = 0; i < 300; i++) { 140 for (int i = 0; i < 300; i++) {
140 int b = (value << i) >> i; 141 int b = (value << i) >> i;
141 Expect.equals(value, b); 142 Expect.equals(value, b);
(...skipping 27 matching lines...) Expand all
169 } 170 }
170 } 171 }
171 172
172 static int ShiftLeft(int a, int b) { return a << b; } 173 static int ShiftLeft(int a, int b) { return a << b; }
173 static int ShiftRight(int a, int b) { return a >> b; } 174 static int ShiftRight(int a, int b) { return a >> b; }
174 } 175 }
175 176
176 main() { 177 main() {
177 BitOperationsTest.testMain(); 178 BitOperationsTest.testMain();
178 } 179 }
OLDNEW
« no previous file with comments | « tests/language/assign_op_test.dart ('k') | tests/language/branch_canonicalization_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698