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

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

Issue 8972002: Use deopt on some instructions that have not collected type feedback when optimizing compierl kic... (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
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 deoptimization. 4 // Test deoptimization.
5 5
6 class SmiCompares { 6 class SmiCompares {
7 // Test deoptimization when one argument is known to be Smi. 7 // Test deoptimization when one argument is known to be Smi.
8 static bool smiCompareLessThan2(a) { 8 static bool smiCompareLessThan2(a) {
9 return a < 2; 9 return a < 2;
10 } 10 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 static test4() { 161 static test4() {
162 for (int i = 0; i < 2000; i++) { 162 for (int i = 0; i < 2000; i++) {
163 Expect.equals(true, compareInt(1, 2)); 163 Expect.equals(true, compareInt(1, 2));
164 Expect.equals(true, compareDouble(1.0, 2.0)); 164 Expect.equals(true, compareDouble(1.0, 2.0));
165 } 165 }
166 // Trigger deoptimization in compareInt and compareDouble. 166 // Trigger deoptimization in compareInt and compareDouble.
167 Expect.equals(true, compareInt(1, 2.0)); 167 Expect.equals(true, compareInt(1, 2.0));
168 Expect.equals(true, compareDouble(1.0, 2)); 168 Expect.equals(true, compareDouble(1.0, 2));
169 } 169 }
170 170
171 171 static smiRightShift() {
regis 2011/12/15 22:18:43 How about smiLeftShift()?
srdjan 2011/12/15 22:27:16 Once I do changes to the left shift. This CL chang
172 int ShiftRight(int a, int b) { return a >> b; }
173
174 for (int i = 0; i < 2000; i++) {
175 var r = ShiftRight(10, 2);
176 Expect.equals(2, r);
177 }
178 // ShiftRight is optimized.
179 Expect.equals(0, ShiftRight(10, 64));
180 // Deoptimize ShiftRight because 'a' is a Mint.
181 var mint = 1 << 63;
182 Expect.equals(1 << 3, ShiftRight(mint, 60));
183 }
172 184
173 static void testMain() { 185 static void testMain() {
174 test1(); 186 test1();
175 test2(); 187 test2();
176 test3(); 188 test3();
177 test4(); 189 test4();
178 SmiCompares.smiComparesTest(); 190 SmiCompares.smiComparesTest();
179 SmiBinop.smiBinopTest(); 191 SmiBinop.smiBinopTest();
180 SmiBinop.smiBinopOverflowTest(); 192 SmiBinop.smiBinopOverflowTest();
181 ObjectsEquality.objectsEqualityTest(); 193 ObjectsEquality.objectsEqualityTest();
194 smiRightShift();
182 } 195 }
183 } 196 }
184 197
185 main() { 198 main() {
186 DeoptimizationTest.testMain(); 199 DeoptimizationTest.testMain();
187 } 200 }
OLDNEW
« tests/language/src/BitOperationsTest.dart ('K') | « tests/language/src/DeoptNoFeedbackTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698