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

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

Issue 11779017: Ensure that LowerBound and UpperBound return overflow marker when overflow occurs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « runtime/vm/intermediate_language.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 program for constructors and initializers. 4 // Dart test program for constructors and initializers.
5 5
6 // Checks that range analysis does not enter infinite loop trying to propagate 6 // Check that range analysis does not enter infinite loop trying to propagate
7 // ranges through dependant phis. 7 // ranges through dependant phis.
8 8 bar() {
9 test() {
10 var sum = 0; 9 var sum = 0;
11 for (var i = 0; i < 10; i++) { 10 for (var i = 0; i < 10; i++) {
12 for (var j = i - 1; j >= 0; j--) { 11 for (var j = i - 1; j >= 0; j--) {
13 for (var k = j; k < i; k++) { 12 for (var k = j; k < i; k++) {
14 sum += (i + j + k); 13 sum += (i + j + k);
15 } 14 }
16 } 15 }
17 } 16 }
18 return sum; 17 return sum;
19 } 18 }
20 19
20 test1() {
21 for (var i = 0; i < 1000; i++) bar();
22 }
23
24 // Check that range analysis does not erroneously remove overflow check.
25 test2() {
26 var width = 1073741823;
27 print(foo(width - 5000, width - 1));
28 print(foo(width - 5000, width));
29 }
30
31 foo(n, w) {
32 var x = 0;
33 for (var i = n; i <= w; i++) {
34 Expect.isTrue(i > 0);
35 x = i;
36 }
37 return x;
38 }
39
21 main() { 40 main() {
22 for (var i = 0; i < 1000; i++) test(); 41 test1();
42 test2();
23 } 43 }
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698