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

Side by Side Diff: tests/standalone/53bit_overflow_test.dart

Issue 17361004: Move FiftythreeBitOverflowError to VM-only patch file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | « sdk/lib/core/errors.dart ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 4
5 // VMOptions=--throw_on_javascript_int_overflow --optimization_counter_threshold =10 5 // VMOptions=--throw_on_javascript_int_overflow --optimization_counter_threshold =10
6 6
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import 'dart:typed_data'; 9 import 'dart:typed_data';
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return min_literal; 54 return min_literal;
55 } 55 }
56 56
57 57
58 main() { 58 main() {
59 Expect.equals(0xFFFFFFFFFFFFF, max_literal()); 59 Expect.equals(0xFFFFFFFFFFFFF, max_literal());
60 Expect.equals(-0xFFFFFFFFFFFFF - 1, min_literal()); 60 Expect.equals(-0xFFFFFFFFFFFFF - 1, min_literal());
61 61
62 // Run the tests once before optimizations. 62 // Run the tests once before optimizations.
63 dti_arg = 1.9e16; 63 dti_arg = 1.9e16;
64 Expect.throws(double_to_int, (e) => e is FiftyThreeBitOverflowError); 64 Expect.throws(double_to_int, (e) => e is Error);
floitsch 2013/06/20 14:48:27 isn't the error still visible?
zra 2013/06/20 15:45:24 If the error is still visible, I think it would be
srdjan 2013/06/20 16:06:08 ditto
Lasse Reichstein Nielsen 2013/06/21 05:41:49 Argh. The error was NOT supposed to be visible. Wi
65 65
66 ia_arg1 = (1 << 51); 66 ia_arg1 = (1 << 51);
67 ia_arg2 = (1 << 51); 67 ia_arg2 = (1 << 51);
68 Expect.throws(integer_add, (e) => e is FiftyThreeBitOverflowError); 68 Expect.throws(integer_add, (e) => e is Error);
69 69
70 n_arg = -0xFFFFFFFFFFFFF - 1; 70 n_arg = -0xFFFFFFFFFFFFF - 1;
71 Expect.throws(negate, (e) => e is FiftyThreeBitOverflowError); 71 Expect.throws(negate, (e) => e is Error);
72 72
73 is_arg = (1 << 51); 73 is_arg = (1 << 51);
74 Expect.throws(integer_shift, (e) => e is FiftyThreeBitOverflowError); 74 Expect.throws(integer_shift, (e) => e is Error);
75 75
76 Expect.throws(max_add_throws, (e) => e is FiftyThreeBitOverflowError); 76 Expect.throws(max_add_throws, (e) => e is Error);
77 Expect.throws(min_sub_throws, (e) => e is FiftyThreeBitOverflowError); 77 Expect.throws(min_sub_throws, (e) => e is Error);
78 78
79 for (int i = 0; i < 20; i++) { 79 for (int i = 0; i < 20; i++) {
80 dti_arg = i.toDouble(); 80 dti_arg = i.toDouble();
81 // Expect.throws calls through the closure, so we have to here, too. 81 // Expect.throws calls through the closure, so we have to here, too.
82 var f = double_to_int; 82 var f = double_to_int;
83 Expect.equals(i, f()); 83 Expect.equals(i, f());
84 84
85 ia_arg1 = i; 85 ia_arg1 = i;
86 ia_arg2 = i; 86 ia_arg2 = i;
87 f = integer_add; 87 f = integer_add;
88 Expect.equals(i + i, f()); 88 Expect.equals(i + i, f());
89 89
90 n_arg = i; 90 n_arg = i;
91 f = negate; 91 f = negate;
92 Expect.equals(-i, f()); 92 Expect.equals(-i, f());
93 93
94 is_arg = i; 94 is_arg = i;
95 f = integer_shift; 95 f = integer_shift;
96 Expect.equals(i << 1, f()); 96 Expect.equals(i << 1, f());
97 } 97 }
98 98
99 // The optimized functions should now deoptimize and throw the error. 99 // The optimized functions should now deoptimize and throw the error.
100 dti_arg = 1.9e16; 100 dti_arg = 1.9e16;
101 Expect.throws(double_to_int, (e) => e is FiftyThreeBitOverflowError); 101 Expect.throws(double_to_int, (e) => e is Error);
102 102
103 ia_arg1 = (1 << 51); 103 ia_arg1 = (1 << 51);
104 ia_arg2 = (1 << 51); 104 ia_arg2 = (1 << 51);
105 Expect.throws(integer_add, (e) => e is FiftyThreeBitOverflowError); 105 Expect.throws(integer_add, (e) => e is Error);
106 106
107 n_arg = -0xFFFFFFFFFFFFF - 1; 107 n_arg = -0xFFFFFFFFFFFFF - 1;
108 Expect.throws(negate, (e) => e is FiftyThreeBitOverflowError); 108 Expect.throws(negate, (e) => e is Error);
109 109
110 is_arg = (1 << 51); 110 is_arg = (1 << 51);
111 Expect.throws(integer_shift, (e) => e is FiftyThreeBitOverflowError); 111 Expect.throws(integer_shift, (e) => e is Error);
112 112
113 Expect.throws(max_add_throws, (e) => e is FiftyThreeBitOverflowError); 113 Expect.throws(max_add_throws, (e) => e is Error);
114 Expect.throws(min_sub_throws, (e) => e is FiftyThreeBitOverflowError); 114 Expect.throws(min_sub_throws, (e) => e is Error);
115 } 115 }
OLDNEW
« no previous file with comments | « sdk/lib/core/errors.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698