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

Side by Side Diff: test/mjsunit/mul-exhaustive-part8.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-part7.js ('k') | test/mjsunit/mul-exhaustive-part9.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 = 134217728;
59 f(0, 0);
60 f(134217728, 1);
61 f(268435456, 2);
62 f(402653184, 3);
63 f(536870912, 4);
64 f(671088640, 5);
65 f(939524096, 7);
66 f(1073741824, 8);
67 f(1207959552, 9);
68 f(2013265920, 15);
69 f(2147483648, 16);
70 f(2281701376, 17);
71 f(4160749568, 31);
72 f(4294967296, 32);
73 f(4429185024, 33);
74 f(8455716864, 63);
75 f(8589934592, 64);
76 f(8724152320, 65);
77 f(17045651456, 127);
78 f(17179869184, 128);
79 f(17314086912, 129);
80 f(34225520640, 255);
81 f(34359738368, 256);
82 f(34493956096, 257);
83 f(68585259008, 511);
84 f(68719476736, 512);
85 f(68853694464, 513);
86 f(137304735744, 1023);
87 f(137438953472, 1024);
88 f(137573171200, 1025);
89 f(274743689216, 2047);
90 f(274877906944, 2048);
91 f(275012124672, 2049);
92 f(549621596160, 4095);
93 f(549755813888, 4096);
94 f(549890031616, 4097);
95 f(1099377410048, 8191);
96 f(1099511627776, 8192);
97 f(1099645845504, 8193);
98 f(2198889037824, 16383);
99 f(2199023255552, 16384);
100 f(2199157473280, 16385);
101 f(4397912293376, 32767);
102 f(4398046511104, 32768);
103 f(4398180728832, 32769);
104 f(8795958804480, 65535);
105 f(8796093022208, 65536);
106 f(8796227239936, 65537);
107 f(17592051826688, 131071);
108 f(17592186044416, 131072);
109 f(17592320262144, 131073);
110 f(35184237871104, 262143);
111 f(35184372088832, 262144);
112 f(35184506306560, 262145);
113 f(70368609959936, 524287);
114 f(70368744177664, 524288);
115 f(70368878395392, 524289);
116 f(140737354137600, 1048575);
117 f(140737488355328, 1048576);
118 f(140737622573056, 1048577);
119 f(281474842492928, 2097151);
120 f(281474976710656, 2097152);
121 f(281475110928384, 2097153);
122 f(562949819203584, 4194303);
123 f(562949953421312, 4194304);
124 f(562950087639040, 4194305);
125 f(1125899772624896, 8388607);
126 f(1125899906842624, 8388608);
127 f(1125900041060352, 8388609);
128 x = 134217729;
129 f(0, 0);
130 f(134217729, 1);
131 f(268435458, 2);
132 f(402653187, 3);
133 f(536870916, 4);
134 f(671088645, 5);
135 f(939524103, 7);
136 f(1073741832, 8);
137 f(1207959561, 9);
138 f(2013265935, 15);
139 f(2147483664, 16);
140 f(2281701393, 17);
141 f(4160749599, 31);
142 f(4294967328, 32);
143 f(4429185057, 33);
144 f(8455716927, 63);
145 f(8589934656, 64);
146 f(8724152385, 65);
147 f(17045651583, 127);
148 f(17179869312, 128);
149 f(17314087041, 129);
150 f(34225520895, 255);
151 f(34359738624, 256);
152 f(34493956353, 257);
153 f(68585259519, 511);
154 f(68719477248, 512);
155 f(68853694977, 513);
156 f(137304736767, 1023);
157 f(137438954496, 1024);
158 f(137573172225, 1025);
159 f(274743691263, 2047);
160 f(274877908992, 2048);
161 f(275012126721, 2049);
162 f(549621600255, 4095);
163 f(549755817984, 4096);
164 f(549890035713, 4097);
165 f(1099377418239, 8191);
166 f(1099511635968, 8192);
167 f(1099645853697, 8193);
168 f(2198889054207, 16383);
169 f(2199023271936, 16384);
170 f(2199157489665, 16385);
171 f(4397912326143, 32767);
172 f(4398046543872, 32768);
173 f(4398180761601, 32769);
174 f(8795958870015, 65535);
175 f(8796093087744, 65536);
176 f(8796227305473, 65537);
177 f(17592051957759, 131071);
178 f(17592186175488, 131072);
179 f(17592320393217, 131073);
180 f(35184238133247, 262143);
181 f(35184372350976, 262144);
182 f(35184506568705, 262145);
183 f(70368610484223, 524287);
184 f(70368744701952, 524288);
185 f(70368878919681, 524289);
186 f(140737355186175, 1048575);
187 f(140737489403904, 1048576);
188 f(140737623621633, 1048577);
189 f(281474844590079, 2097151);
190 f(281474978807808, 2097152);
191 f(281475113025537, 2097153);
192 f(562949823397887, 4194303);
193 f(562949957615616, 4194304);
194 f(562950091833345, 4194305);
195 f(1125899781013503, 8388607);
196 f(1125899915231232, 8388608);
197 f(1125900049448961, 8388609);
198 x = 268435455;
199 f(0, 0);
200 f(268435455, 1);
201 f(536870910, 2);
202 f(805306365, 3);
203 f(1073741820, 4);
204 f(1342177275, 5);
205 f(1879048185, 7);
206 f(2147483640, 8);
207 f(2415919095, 9);
208 f(4026531825, 15);
209 f(4294967280, 16);
210 f(4563402735, 17);
211 f(8321499105, 31);
212 f(8589934560, 32);
213 f(8858370015, 33);
214 f(16911433665, 63);
215 f(17179869120, 64);
216 f(17448304575, 65);
217 f(34091302785, 127);
218 f(34359738240, 128);
219 f(34628173695, 129);
220 f(68451041025, 255);
221 f(68719476480, 256);
222 f(68987911935, 257);
223 f(137170517505, 511);
224 f(137438952960, 512);
225 f(137707388415, 513);
226 f(274609470465, 1023);
227 f(274877905920, 1024);
228 f(275146341375, 1025);
229 f(549487376385, 2047);
230 f(549755811840, 2048);
231 f(550024247295, 2049);
232 f(1099243188225, 4095);
233 f(1099511623680, 4096);
234 f(1099780059135, 4097);
235 f(2198754811905, 8191);
236 f(2199023247360, 8192);
237 f(2199291682815, 8193);
238 f(4397778059265, 16383);
239 f(4398046494720, 16384);
240 f(4398314930175, 16385);
241 f(8795824553985, 32767);
242 f(8796092989440, 32768);
243 f(8796361424895, 32769);
244 f(17591917543425, 65535);
245 f(17592185978880, 65536);
246 f(17592454414335, 65537);
247 f(35184103522305, 131071);
248 f(35184371957760, 131072);
249 f(35184640393215, 131073);
250 f(70368475480065, 262143);
251 f(70368743915520, 262144);
252 f(70369012350975, 262145);
253 f(140737219395585, 524287);
254 f(140737487831040, 524288);
255 f(140737756266495, 524289);
256 f(281474707226625, 1048575);
257 f(281474975662080, 1048576);
258 f(281475244097535, 1048577);
259 f(562949682888705, 2097151);
260 f(562949951324160, 2097152);
261 f(562950219759615, 2097153);
262 f(1125899634212865, 4194303);
263 f(1125899902648320, 4194304);
264 f(1125900171083775, 4194305);
265 x = 268435456;
266 f(0, 0);
267 f(268435456, 1);
268 f(536870912, 2);
269 f(805306368, 3);
270 f(1073741824, 4);
271 f(1342177280, 5);
272 f(1879048192, 7);
273 f(2147483648, 8);
274 f(2415919104, 9);
275 f(4026531840, 15);
276 f(4294967296, 16);
277 f(4563402752, 17);
278 f(8321499136, 31);
279 f(8589934592, 32);
280 f(8858370048, 33);
281 f(16911433728, 63);
282 f(17179869184, 64);
283 f(17448304640, 65);
284 f(34091302912, 127);
285 f(34359738368, 128);
286 f(34628173824, 129);
287 f(68451041280, 255);
288 f(68719476736, 256);
289 f(68987912192, 257);
290 f(137170518016, 511);
291 f(137438953472, 512);
292 f(137707388928, 513);
293 f(274609471488, 1023);
294 f(274877906944, 1024);
295 f(275146342400, 1025);
296 f(549487378432, 2047);
297 f(549755813888, 2048);
298 f(550024249344, 2049);
299 f(1099243192320, 4095);
300 f(1099511627776, 4096);
301 f(1099780063232, 4097);
302 f(2198754820096, 8191);
303 f(2199023255552, 8192);
304 f(2199291691008, 8193);
305 f(4397778075648, 16383);
306 f(4398046511104, 16384);
307 f(4398314946560, 16385);
308 f(8795824586752, 32767);
309 f(8796093022208, 32768);
310 f(8796361457664, 32769);
311 f(17591917608960, 65535);
312 f(17592186044416, 65536);
313 f(17592454479872, 65537);
314 f(35184103653376, 131071);
315 f(35184372088832, 131072);
316 f(35184640524288, 131073);
317 f(70368475742208, 262143);
318 f(70368744177664, 262144);
319 f(70369012613120, 262145);
320 f(140737219919872, 524287);
321 f(140737488355328, 524288);
322 f(140737756790784, 524289);
323 f(281474708275200, 1048575);
324 f(281474976710656, 1048576);
325 f(281475245146112, 1048577);
326 f(562949684985856, 2097151);
327 f(562949953421312, 2097152);
328 f(562950221856768, 2097153);
329 f(1125899638407168, 4194303);
330 f(1125899906842624, 4194304);
331 f(1125900175278080, 4194305);
332 x = 268435457;
333 f(0, 0);
334 f(268435457, 1);
335 f(536870914, 2);
336 f(805306371, 3);
337 f(1073741828, 4);
338 f(1342177285, 5);
339 f(1879048199, 7);
340 f(2147483656, 8);
341 f(2415919113, 9);
342 f(4026531855, 15);
343 f(4294967312, 16);
344 f(4563402769, 17);
345 f(8321499167, 31);
346 f(8589934624, 32);
347 f(8858370081, 33);
348 f(16911433791, 63);
349 f(17179869248, 64);
350 f(17448304705, 65);
351 f(34091303039, 127);
352 f(34359738496, 128);
353 f(34628173953, 129);
354 f(68451041535, 255);
355 f(68719476992, 256);
356 f(68987912449, 257);
357 f(137170518527, 511);
358 f(137438953984, 512);
359 f(137707389441, 513);
360 f(274609472511, 1023);
361 f(274877907968, 1024);
362 f(275146343425, 1025);
363 f(549487380479, 2047);
364 f(549755815936, 2048);
365 f(550024251393, 2049);
366 f(1099243196415, 4095);
367 f(1099511631872, 4096);
368 f(1099780067329, 4097);
369 f(2198754828287, 8191);
370 f(2199023263744, 8192);
371 f(2199291699201, 8193);
372 f(4397778092031, 16383);
373 f(4398046527488, 16384);
374 f(4398314962945, 16385);
375 f(8795824619519, 32767);
376 f(8796093054976, 32768);
377 f(8796361490433, 32769);
378 f(17591917674495, 65535);
379 f(17592186109952, 65536);
380 f(17592454545409, 65537);
381 f(35184103784447, 131071);
382 f(35184372219904, 131072);
383 f(35184640655361, 131073);
384 f(70368476004351, 262143);
385 f(70368744439808, 262144);
386 f(70369012875265, 262145);
387 f(140737220444159, 524287);
388 f(140737488879616, 524288);
389 f(140737757315073, 524289);
390 f(281474709323775, 1048575);
391 f(281474977759232, 1048576);
392 f(281475246194689, 1048577);
393 f(562949687083007, 2097151);
394 f(562949955518464, 2097152);
395 f(562950223953921, 2097153);
396 f(1125899642601471, 4194303);
397 f(1125899911036928, 4194304);
398 f(1125900179472385, 4194305);
399 x = 536870911;
400 f(0, 0);
401 f(536870911, 1);
402 f(1073741822, 2);
403 f(1610612733, 3);
404 f(2147483644, 4);
405 f(2684354555, 5);
406 f(3758096377, 7);
407 f(4294967288, 8);
408 f(4831838199, 9);
409 f(8053063665, 15);
410 f(8589934576, 16);
411 f(9126805487, 17);
412 f(16642998241, 31);
413 f(17179869152, 32);
414 f(17716740063, 33);
415 f(33822867393, 63);
416 f(34359738304, 64);
417 f(34896609215, 65);
418 f(68182605697, 127);
419 f(68719476608, 128);
420 f(69256347519, 129);
421 f(136902082305, 255);
422 f(137438953216, 256);
423 f(137975824127, 257);
424 f(274341035521, 511);
425 f(274877906432, 512);
426 f(275414777343, 513);
427 f(549218941953, 1023);
428 f(549755812864, 1024);
429 f(550292683775, 1025);
430 f(1098974754817, 2047);
431 f(1099511625728, 2048);
432 f(1100048496639, 2049);
433 f(2198486380545, 4095);
434 f(2199023251456, 4096);
435 f(2199560122367, 4097);
436 f(4397509632001, 8191);
437 f(4398046502912, 8192);
438 f(4398583373823, 8193);
439 f(8795556134913, 16383);
440 f(8796093005824, 16384);
441 f(8796629876735, 16385);
442 f(17591649140737, 32767);
443 f(17592186011648, 32768);
444 f(17592722882559, 32769);
445 f(35183835152385, 65535);
446 f(35184372023296, 65536);
447 f(35184908894207, 65537);
448 f(70368207175681, 131071);
449 f(70368744046592, 131072);
450 f(70369280917503, 131073);
451 f(140736951222273, 262143);
452 f(140737488093184, 262144);
453 f(140738024964095, 262145);
454 f(281474439315457, 524287);
455 f(281474976186368, 524288);
456 f(281475513057279, 524289);
457 f(562949415501825, 1048575);
458 f(562949952372736, 1048576);
459 f(562950489243647, 1048577);
460 f(1125899367874561, 2097151);
461 f(1125899904745472, 2097152);
462 f(1125900441616383, 2097153);
463 x = 536870912;
464 f(0, 0);
465 f(536870912, 1);
466 f(1073741824, 2);
467 f(1610612736, 3);
468 f(2147483648, 4);
469 f(2684354560, 5);
470 f(3758096384, 7);
471 f(4294967296, 8);
472 f(4831838208, 9);
473 f(8053063680, 15);
474 f(8589934592, 16);
475 f(9126805504, 17);
476 f(16642998272, 31);
477 f(17179869184, 32);
478 f(17716740096, 33);
479 f(33822867456, 63);
480 f(34359738368, 64);
481 f(34896609280, 65);
482 f(68182605824, 127);
483 f(68719476736, 128);
484 f(69256347648, 129);
485 f(136902082560, 255);
486 f(137438953472, 256);
487 f(137975824384, 257);
488 f(274341036032, 511);
489 f(274877906944, 512);
490 f(275414777856, 513);
491 f(549218942976, 1023);
492 f(549755813888, 1024);
493 f(550292684800, 1025);
494 f(1098974756864, 2047);
495 f(1099511627776, 2048);
496 f(1100048498688, 2049);
497 f(2198486384640, 4095);
498 f(2199023255552, 4096);
499 f(2199560126464, 4097);
500 f(4397509640192, 8191);
501 f(4398046511104, 8192);
502 f(4398583382016, 8193);
503 f(8795556151296, 16383);
504 f(8796093022208, 16384);
505 f(8796629893120, 16385);
506 f(17591649173504, 32767);
507 f(17592186044416, 32768);
508 f(17592722915328, 32769);
509 f(35183835217920, 65535);
510 f(35184372088832, 65536);
511 f(35184908959744, 65537);
512 f(70368207306752, 131071);
513 f(70368744177664, 131072);
514 f(70369281048576, 131073);
515 f(140736951484416, 262143);
516 f(140737488355328, 262144);
517 f(140738025226240, 262145);
518 f(281474439839744, 524287);
519 f(281474976710656, 524288);
520 f(281475513581568, 524289);
521 f(562949416550400, 1048575);
522 f(562949953421312, 1048576);
523 f(562950490292224, 1048577);
524 f(1125899369971712, 2097151);
525 f(1125899906842624, 2097152);
526 f(1125900443713536, 2097153);
OLDNEW
« no previous file with comments | « test/mjsunit/mul-exhaustive-part7.js ('k') | test/mjsunit/mul-exhaustive-part9.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698