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

Side by Side Diff: test/mjsunit/mul-exhaustive-part2.js

Issue 11035053: Rollback trunk to bleeding_edge revision 12525 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 2 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 | « test/mjsunit/mul-exhaustive-part10.js ('k') | test/mjsunit/mul-exhaustive-part3.js » ('j') | 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 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 var x;
29
30 // Converts a number to string respecting -0.
31 function stringify(n) {
32 if ((1 / n) === -Infinity) return "-0";
33 return String(n);
34 }
35
36 function f(expected, y) {
37 function testEval(string, x, y) {
38 var mulFunction = Function("x, y", "return " + string);
39 return mulFunction(x, y);
40 }
41 function mulTest(expected, x, y) {
42 assertEquals(expected, x * y);
43 assertEquals(expected, testEval(stringify(x) + " * y", x, y));
44 assertEquals(expected, testEval("x * " + stringify(y), x, y));
45 assertEquals(expected, testEval(stringify(x) + " * " + stringify(y), x, y));
46 }
47 mulTest(expected, x, y);
48 mulTest(-expected, -x, y);
49 mulTest(-expected, x, -y);
50 mulTest(expected, -x, -y);
51 if (x === y) return; // Symmetric cases not necessary.
52 mulTest(expected, y, x);
53 mulTest(-expected, -y, x);
54 mulTest(-expected, y, -x);
55 mulTest(expected, -y, -x);
56 }
57
58 x = 1024;
59 f(0, 0);
60 f(1024, 1);
61 f(2048, 2);
62 f(3072, 3);
63 f(4096, 4);
64 f(5120, 5);
65 f(7168, 7);
66 f(8192, 8);
67 f(9216, 9);
68 f(15360, 15);
69 f(16384, 16);
70 f(17408, 17);
71 f(31744, 31);
72 f(32768, 32);
73 f(33792, 33);
74 f(64512, 63);
75 f(65536, 64);
76 f(66560, 65);
77 f(130048, 127);
78 f(131072, 128);
79 f(132096, 129);
80 f(261120, 255);
81 f(262144, 256);
82 f(263168, 257);
83 f(523264, 511);
84 f(524288, 512);
85 f(525312, 513);
86 f(1047552, 1023);
87 f(1048576, 1024);
88 x = 1025;
89 f(0, 0);
90 f(1025, 1);
91 f(2050, 2);
92 f(3075, 3);
93 f(4100, 4);
94 f(5125, 5);
95 f(7175, 7);
96 f(8200, 8);
97 f(9225, 9);
98 f(15375, 15);
99 f(16400, 16);
100 f(17425, 17);
101 f(31775, 31);
102 f(32800, 32);
103 f(33825, 33);
104 f(64575, 63);
105 f(65600, 64);
106 f(66625, 65);
107 f(130175, 127);
108 f(131200, 128);
109 f(132225, 129);
110 f(261375, 255);
111 f(262400, 256);
112 f(263425, 257);
113 f(523775, 511);
114 f(524800, 512);
115 f(525825, 513);
116 f(1048575, 1023);
117 f(1049600, 1024);
118 f(1050625, 1025);
119 x = 2047;
120 f(0, 0);
121 f(2047, 1);
122 f(4094, 2);
123 f(6141, 3);
124 f(8188, 4);
125 f(10235, 5);
126 f(14329, 7);
127 f(16376, 8);
128 f(18423, 9);
129 f(30705, 15);
130 f(32752, 16);
131 f(34799, 17);
132 f(63457, 31);
133 f(65504, 32);
134 f(67551, 33);
135 f(128961, 63);
136 f(131008, 64);
137 f(133055, 65);
138 f(259969, 127);
139 f(262016, 128);
140 f(264063, 129);
141 f(521985, 255);
142 f(524032, 256);
143 f(526079, 257);
144 f(1046017, 511);
145 f(1048064, 512);
146 f(1050111, 513);
147 f(2094081, 1023);
148 f(2096128, 1024);
149 f(2098175, 1025);
150 f(4190209, 2047);
151 x = 2048;
152 f(0, 0);
153 f(2048, 1);
154 f(4096, 2);
155 f(6144, 3);
156 f(8192, 4);
157 f(10240, 5);
158 f(14336, 7);
159 f(16384, 8);
160 f(18432, 9);
161 f(30720, 15);
162 f(32768, 16);
163 f(34816, 17);
164 f(63488, 31);
165 f(65536, 32);
166 f(67584, 33);
167 f(129024, 63);
168 f(131072, 64);
169 f(133120, 65);
170 f(260096, 127);
171 f(262144, 128);
172 f(264192, 129);
173 f(522240, 255);
174 f(524288, 256);
175 f(526336, 257);
176 f(1046528, 511);
177 f(1048576, 512);
178 f(1050624, 513);
179 f(2095104, 1023);
180 f(2097152, 1024);
181 f(2099200, 1025);
182 f(4192256, 2047);
183 f(4194304, 2048);
184 x = 2049;
185 f(0, 0);
186 f(2049, 1);
187 f(4098, 2);
188 f(6147, 3);
189 f(8196, 4);
190 f(10245, 5);
191 f(14343, 7);
192 f(16392, 8);
193 f(18441, 9);
194 f(30735, 15);
195 f(32784, 16);
196 f(34833, 17);
197 f(63519, 31);
198 f(65568, 32);
199 f(67617, 33);
200 f(129087, 63);
201 f(131136, 64);
202 f(133185, 65);
203 f(260223, 127);
204 f(262272, 128);
205 f(264321, 129);
206 f(522495, 255);
207 f(524544, 256);
208 f(526593, 257);
209 f(1047039, 511);
210 f(1049088, 512);
211 f(1051137, 513);
212 f(2096127, 1023);
213 f(2098176, 1024);
214 f(2100225, 1025);
215 f(4194303, 2047);
216 f(4196352, 2048);
217 f(4198401, 2049);
218 x = 4095;
219 f(0, 0);
220 f(4095, 1);
221 f(8190, 2);
222 f(12285, 3);
223 f(16380, 4);
224 f(20475, 5);
225 f(28665, 7);
226 f(32760, 8);
227 f(36855, 9);
228 f(61425, 15);
229 f(65520, 16);
230 f(69615, 17);
231 f(126945, 31);
232 f(131040, 32);
233 f(135135, 33);
234 f(257985, 63);
235 f(262080, 64);
236 f(266175, 65);
237 f(520065, 127);
238 f(524160, 128);
239 f(528255, 129);
240 f(1044225, 255);
241 f(1048320, 256);
242 f(1052415, 257);
243 f(2092545, 511);
244 f(2096640, 512);
245 f(2100735, 513);
246 f(4189185, 1023);
247 f(4193280, 1024);
248 f(4197375, 1025);
249 f(8382465, 2047);
250 f(8386560, 2048);
251 f(8390655, 2049);
252 f(16769025, 4095);
253 x = 4096;
254 f(0, 0);
255 f(4096, 1);
256 f(8192, 2);
257 f(12288, 3);
258 f(16384, 4);
259 f(20480, 5);
260 f(28672, 7);
261 f(32768, 8);
262 f(36864, 9);
263 f(61440, 15);
264 f(65536, 16);
265 f(69632, 17);
266 f(126976, 31);
267 f(131072, 32);
268 f(135168, 33);
269 f(258048, 63);
270 f(262144, 64);
271 f(266240, 65);
272 f(520192, 127);
273 f(524288, 128);
274 f(528384, 129);
275 f(1044480, 255);
276 f(1048576, 256);
277 f(1052672, 257);
278 f(2093056, 511);
279 f(2097152, 512);
280 f(2101248, 513);
281 f(4190208, 1023);
282 f(4194304, 1024);
283 f(4198400, 1025);
284 f(8384512, 2047);
285 f(8388608, 2048);
286 f(8392704, 2049);
287 f(16773120, 4095);
288 f(16777216, 4096);
289 x = 4097;
290 f(0, 0);
291 f(4097, 1);
292 f(8194, 2);
293 f(12291, 3);
294 f(16388, 4);
295 f(20485, 5);
296 f(28679, 7);
297 f(32776, 8);
298 f(36873, 9);
299 f(61455, 15);
300 f(65552, 16);
301 f(69649, 17);
302 f(127007, 31);
303 f(131104, 32);
304 f(135201, 33);
305 f(258111, 63);
306 f(262208, 64);
307 f(266305, 65);
308 f(520319, 127);
309 f(524416, 128);
310 f(528513, 129);
311 f(1044735, 255);
312 f(1048832, 256);
313 f(1052929, 257);
314 f(2093567, 511);
315 f(2097664, 512);
316 f(2101761, 513);
317 f(4191231, 1023);
318 f(4195328, 1024);
319 f(4199425, 1025);
320 f(8386559, 2047);
321 f(8390656, 2048);
322 f(8394753, 2049);
323 f(16777215, 4095);
324 f(16781312, 4096);
325 f(16785409, 4097);
326 x = 8191;
327 f(0, 0);
328 f(8191, 1);
329 f(16382, 2);
330 f(24573, 3);
331 f(32764, 4);
332 f(40955, 5);
333 f(57337, 7);
334 f(65528, 8);
335 f(73719, 9);
336 f(122865, 15);
337 f(131056, 16);
338 f(139247, 17);
339 f(253921, 31);
340 f(262112, 32);
341 f(270303, 33);
342 f(516033, 63);
343 f(524224, 64);
344 f(532415, 65);
345 f(1040257, 127);
346 f(1048448, 128);
347 f(1056639, 129);
348 f(2088705, 255);
349 f(2096896, 256);
350 f(2105087, 257);
351 f(4185601, 511);
352 f(4193792, 512);
353 f(4201983, 513);
354 f(8379393, 1023);
355 f(8387584, 1024);
356 f(8395775, 1025);
357 f(16766977, 2047);
358 f(16775168, 2048);
359 f(16783359, 2049);
360 f(33542145, 4095);
361 f(33550336, 4096);
362 f(33558527, 4097);
363 f(67092481, 8191);
364 x = 8192;
365 f(0, 0);
366 f(8192, 1);
367 f(16384, 2);
368 f(24576, 3);
369 f(32768, 4);
370 f(40960, 5);
371 f(57344, 7);
372 f(65536, 8);
373 f(73728, 9);
374 f(122880, 15);
375 f(131072, 16);
376 f(139264, 17);
377 f(253952, 31);
378 f(262144, 32);
379 f(270336, 33);
380 f(516096, 63);
381 f(524288, 64);
382 f(532480, 65);
383 f(1040384, 127);
384 f(1048576, 128);
385 f(1056768, 129);
386 f(2088960, 255);
387 f(2097152, 256);
388 f(2105344, 257);
389 f(4186112, 511);
390 f(4194304, 512);
391 f(4202496, 513);
392 f(8380416, 1023);
393 f(8388608, 1024);
394 f(8396800, 1025);
395 f(16769024, 2047);
396 f(16777216, 2048);
397 f(16785408, 2049);
398 f(33546240, 4095);
399 f(33554432, 4096);
400 f(33562624, 4097);
401 f(67100672, 8191);
402 f(67108864, 8192);
403 x = 8193;
404 f(0, 0);
405 f(8193, 1);
406 f(16386, 2);
407 f(24579, 3);
408 f(32772, 4);
409 f(40965, 5);
410 f(57351, 7);
411 f(65544, 8);
412 f(73737, 9);
413 f(122895, 15);
414 f(131088, 16);
415 f(139281, 17);
416 f(253983, 31);
417 f(262176, 32);
418 f(270369, 33);
419 f(516159, 63);
420 f(524352, 64);
421 f(532545, 65);
422 f(1040511, 127);
423 f(1048704, 128);
424 f(1056897, 129);
425 f(2089215, 255);
426 f(2097408, 256);
427 f(2105601, 257);
428 f(4186623, 511);
429 f(4194816, 512);
430 f(4203009, 513);
431 f(8381439, 1023);
432 f(8389632, 1024);
433 f(8397825, 1025);
434 f(16771071, 2047);
435 f(16779264, 2048);
436 f(16787457, 2049);
437 f(33550335, 4095);
438 f(33558528, 4096);
439 f(33566721, 4097);
440 f(67108863, 8191);
441 f(67117056, 8192);
442 f(67125249, 8193);
443 x = 16383;
444 f(0, 0);
445 f(16383, 1);
446 f(32766, 2);
447 f(49149, 3);
448 f(65532, 4);
449 f(81915, 5);
450 f(114681, 7);
451 f(131064, 8);
452 f(147447, 9);
453 f(245745, 15);
454 f(262128, 16);
455 f(278511, 17);
456 f(507873, 31);
457 f(524256, 32);
458 f(540639, 33);
459 f(1032129, 63);
460 f(1048512, 64);
461 f(1064895, 65);
462 f(2080641, 127);
463 f(2097024, 128);
464 f(2113407, 129);
465 f(4177665, 255);
466 f(4194048, 256);
467 f(4210431, 257);
468 f(8371713, 511);
469 f(8388096, 512);
470 f(8404479, 513);
471 f(16759809, 1023);
472 f(16776192, 1024);
473 f(16792575, 1025);
474 f(33536001, 2047);
475 f(33552384, 2048);
476 f(33568767, 2049);
477 f(67088385, 4095);
478 f(67104768, 4096);
479 f(67121151, 4097);
480 f(134193153, 8191);
481 f(134209536, 8192);
482 f(134225919, 8193);
483 f(268402689, 16383);
484 x = 16384;
485 f(0, 0);
486 f(16384, 1);
487 f(32768, 2);
488 f(49152, 3);
489 f(65536, 4);
490 f(81920, 5);
491 f(114688, 7);
492 f(131072, 8);
493 f(147456, 9);
494 f(245760, 15);
495 f(262144, 16);
496 f(278528, 17);
497 f(507904, 31);
498 f(524288, 32);
499 f(540672, 33);
500 f(1032192, 63);
501 f(1048576, 64);
502 f(1064960, 65);
503 f(2080768, 127);
504 f(2097152, 128);
505 f(2113536, 129);
506 f(4177920, 255);
507 f(4194304, 256);
508 f(4210688, 257);
509 f(8372224, 511);
510 f(8388608, 512);
511 f(8404992, 513);
512 f(16760832, 1023);
513 f(16777216, 1024);
514 f(16793600, 1025);
515 f(33538048, 2047);
516 f(33554432, 2048);
517 f(33570816, 2049);
518 f(67092480, 4095);
519 f(67108864, 4096);
520 f(67125248, 4097);
521 f(134201344, 8191);
522 f(134217728, 8192);
523 f(134234112, 8193);
524 f(268419072, 16383);
525 f(268435456, 16384);
OLDNEW
« no previous file with comments | « test/mjsunit/mul-exhaustive-part10.js ('k') | test/mjsunit/mul-exhaustive-part3.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698