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

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

Issue 11028027: Revert trunk to bleeding_edge at r12484 (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-part6.js ('k') | test/mjsunit/mul-exhaustive-part8.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 = 33554432;
59 f(0, 0);
60 f(33554432, 1);
61 f(67108864, 2);
62 f(100663296, 3);
63 f(134217728, 4);
64 f(167772160, 5);
65 f(234881024, 7);
66 f(268435456, 8);
67 f(301989888, 9);
68 f(503316480, 15);
69 f(536870912, 16);
70 f(570425344, 17);
71 f(1040187392, 31);
72 f(1073741824, 32);
73 f(1107296256, 33);
74 f(2113929216, 63);
75 f(2147483648, 64);
76 f(2181038080, 65);
77 f(4261412864, 127);
78 f(4294967296, 128);
79 f(4328521728, 129);
80 f(8556380160, 255);
81 f(8589934592, 256);
82 f(8623489024, 257);
83 f(17146314752, 511);
84 f(17179869184, 512);
85 f(17213423616, 513);
86 f(34326183936, 1023);
87 f(34359738368, 1024);
88 f(34393292800, 1025);
89 f(68685922304, 2047);
90 f(68719476736, 2048);
91 f(68753031168, 2049);
92 f(137405399040, 4095);
93 f(137438953472, 4096);
94 f(137472507904, 4097);
95 f(274844352512, 8191);
96 f(274877906944, 8192);
97 f(274911461376, 8193);
98 f(549722259456, 16383);
99 f(549755813888, 16384);
100 f(549789368320, 16385);
101 f(1099478073344, 32767);
102 f(1099511627776, 32768);
103 f(1099545182208, 32769);
104 f(2198989701120, 65535);
105 f(2199023255552, 65536);
106 f(2199056809984, 65537);
107 f(4398012956672, 131071);
108 f(4398046511104, 131072);
109 f(4398080065536, 131073);
110 f(8796059467776, 262143);
111 f(8796093022208, 262144);
112 f(8796126576640, 262145);
113 f(17592152489984, 524287);
114 f(17592186044416, 524288);
115 f(17592219598848, 524289);
116 f(35184338534400, 1048575);
117 f(35184372088832, 1048576);
118 f(35184405643264, 1048577);
119 f(70368710623232, 2097151);
120 f(70368744177664, 2097152);
121 f(70368777732096, 2097153);
122 f(140737454800896, 4194303);
123 f(140737488355328, 4194304);
124 f(140737521909760, 4194305);
125 f(281474943156224, 8388607);
126 f(281474976710656, 8388608);
127 f(281475010265088, 8388609);
128 f(562949919866880, 16777215);
129 f(562949953421312, 16777216);
130 f(562949986975744, 16777217);
131 f(1125899873288192, 33554431);
132 f(1125899906842624, 33554432);
133 x = 33554433;
134 f(0, 0);
135 f(33554433, 1);
136 f(67108866, 2);
137 f(100663299, 3);
138 f(134217732, 4);
139 f(167772165, 5);
140 f(234881031, 7);
141 f(268435464, 8);
142 f(301989897, 9);
143 f(503316495, 15);
144 f(536870928, 16);
145 f(570425361, 17);
146 f(1040187423, 31);
147 f(1073741856, 32);
148 f(1107296289, 33);
149 f(2113929279, 63);
150 f(2147483712, 64);
151 f(2181038145, 65);
152 f(4261412991, 127);
153 f(4294967424, 128);
154 f(4328521857, 129);
155 f(8556380415, 255);
156 f(8589934848, 256);
157 f(8623489281, 257);
158 f(17146315263, 511);
159 f(17179869696, 512);
160 f(17213424129, 513);
161 f(34326184959, 1023);
162 f(34359739392, 1024);
163 f(34393293825, 1025);
164 f(68685924351, 2047);
165 f(68719478784, 2048);
166 f(68753033217, 2049);
167 f(137405403135, 4095);
168 f(137438957568, 4096);
169 f(137472512001, 4097);
170 f(274844360703, 8191);
171 f(274877915136, 8192);
172 f(274911469569, 8193);
173 f(549722275839, 16383);
174 f(549755830272, 16384);
175 f(549789384705, 16385);
176 f(1099478106111, 32767);
177 f(1099511660544, 32768);
178 f(1099545214977, 32769);
179 f(2198989766655, 65535);
180 f(2199023321088, 65536);
181 f(2199056875521, 65537);
182 f(4398013087743, 131071);
183 f(4398046642176, 131072);
184 f(4398080196609, 131073);
185 f(8796059729919, 262143);
186 f(8796093284352, 262144);
187 f(8796126838785, 262145);
188 f(17592153014271, 524287);
189 f(17592186568704, 524288);
190 f(17592220123137, 524289);
191 f(35184339582975, 1048575);
192 f(35184373137408, 1048576);
193 f(35184406691841, 1048577);
194 f(70368712720383, 2097151);
195 f(70368746274816, 2097152);
196 f(70368779829249, 2097153);
197 f(140737458995199, 4194303);
198 f(140737492549632, 4194304);
199 f(140737526104065, 4194305);
200 f(281474951544831, 8388607);
201 f(281474985099264, 8388608);
202 f(281475018653697, 8388609);
203 f(562949936644095, 16777215);
204 f(562949970198528, 16777216);
205 f(562950003752961, 16777217);
206 f(1125899906842623, 33554431);
207 f(1125899940397056, 33554432);
208 f(1125899973951489, 33554433);
209 x = 67108863;
210 f(0, 0);
211 f(67108863, 1);
212 f(134217726, 2);
213 f(201326589, 3);
214 f(268435452, 4);
215 f(335544315, 5);
216 f(469762041, 7);
217 f(536870904, 8);
218 f(603979767, 9);
219 f(1006632945, 15);
220 f(1073741808, 16);
221 f(1140850671, 17);
222 f(2080374753, 31);
223 f(2147483616, 32);
224 f(2214592479, 33);
225 f(4227858369, 63);
226 f(4294967232, 64);
227 f(4362076095, 65);
228 f(8522825601, 127);
229 f(8589934464, 128);
230 f(8657043327, 129);
231 f(17112760065, 255);
232 f(17179868928, 256);
233 f(17246977791, 257);
234 f(34292628993, 511);
235 f(34359737856, 512);
236 f(34426846719, 513);
237 f(68652366849, 1023);
238 f(68719475712, 1024);
239 f(68786584575, 1025);
240 f(137371842561, 2047);
241 f(137438951424, 2048);
242 f(137506060287, 2049);
243 f(274810793985, 4095);
244 f(274877902848, 4096);
245 f(274945011711, 4097);
246 f(549688696833, 8191);
247 f(549755805696, 8192);
248 f(549822914559, 8193);
249 f(1099444502529, 16383);
250 f(1099511611392, 16384);
251 f(1099578720255, 16385);
252 f(2198956113921, 32767);
253 f(2199023222784, 32768);
254 f(2199090331647, 32769);
255 f(4397979336705, 65535);
256 f(4398046445568, 65536);
257 f(4398113554431, 65537);
258 f(8796025782273, 131071);
259 f(8796092891136, 131072);
260 f(8796159999999, 131073);
261 f(17592118673409, 262143);
262 f(17592185782272, 262144);
263 f(17592252891135, 262145);
264 f(35184304455681, 524287);
265 f(35184371564544, 524288);
266 f(35184438673407, 524289);
267 f(70368676020225, 1048575);
268 f(70368743129088, 1048576);
269 f(70368810237951, 1048577);
270 f(140737419149313, 2097151);
271 f(140737486258176, 2097152);
272 f(140737553367039, 2097153);
273 f(281474905407489, 4194303);
274 f(281474972516352, 4194304);
275 f(281475039625215, 4194305);
276 f(562949877923841, 8388607);
277 f(562949945032704, 8388608);
278 f(562950012141567, 8388609);
279 f(1125899822956545, 16777215);
280 f(1125899890065408, 16777216);
281 f(1125899957174271, 16777217);
282 x = 67108864;
283 f(0, 0);
284 f(67108864, 1);
285 f(134217728, 2);
286 f(201326592, 3);
287 f(268435456, 4);
288 f(335544320, 5);
289 f(469762048, 7);
290 f(536870912, 8);
291 f(603979776, 9);
292 f(1006632960, 15);
293 f(1073741824, 16);
294 f(1140850688, 17);
295 f(2080374784, 31);
296 f(2147483648, 32);
297 f(2214592512, 33);
298 f(4227858432, 63);
299 f(4294967296, 64);
300 f(4362076160, 65);
301 f(8522825728, 127);
302 f(8589934592, 128);
303 f(8657043456, 129);
304 f(17112760320, 255);
305 f(17179869184, 256);
306 f(17246978048, 257);
307 f(34292629504, 511);
308 f(34359738368, 512);
309 f(34426847232, 513);
310 f(68652367872, 1023);
311 f(68719476736, 1024);
312 f(68786585600, 1025);
313 f(137371844608, 2047);
314 f(137438953472, 2048);
315 f(137506062336, 2049);
316 f(274810798080, 4095);
317 f(274877906944, 4096);
318 f(274945015808, 4097);
319 f(549688705024, 8191);
320 f(549755813888, 8192);
321 f(549822922752, 8193);
322 f(1099444518912, 16383);
323 f(1099511627776, 16384);
324 f(1099578736640, 16385);
325 f(2198956146688, 32767);
326 f(2199023255552, 32768);
327 f(2199090364416, 32769);
328 f(4397979402240, 65535);
329 f(4398046511104, 65536);
330 f(4398113619968, 65537);
331 f(8796025913344, 131071);
332 f(8796093022208, 131072);
333 f(8796160131072, 131073);
334 f(17592118935552, 262143);
335 f(17592186044416, 262144);
336 f(17592253153280, 262145);
337 f(35184304979968, 524287);
338 f(35184372088832, 524288);
339 f(35184439197696, 524289);
340 f(70368677068800, 1048575);
341 f(70368744177664, 1048576);
342 f(70368811286528, 1048577);
343 f(140737421246464, 2097151);
344 f(140737488355328, 2097152);
345 f(140737555464192, 2097153);
346 f(281474909601792, 4194303);
347 f(281474976710656, 4194304);
348 f(281475043819520, 4194305);
349 f(562949886312448, 8388607);
350 f(562949953421312, 8388608);
351 f(562950020530176, 8388609);
352 f(1125899839733760, 16777215);
353 f(1125899906842624, 16777216);
354 f(1125899973951488, 16777217);
355 x = 67108865;
356 f(0, 0);
357 f(67108865, 1);
358 f(134217730, 2);
359 f(201326595, 3);
360 f(268435460, 4);
361 f(335544325, 5);
362 f(469762055, 7);
363 f(536870920, 8);
364 f(603979785, 9);
365 f(1006632975, 15);
366 f(1073741840, 16);
367 f(1140850705, 17);
368 f(2080374815, 31);
369 f(2147483680, 32);
370 f(2214592545, 33);
371 f(4227858495, 63);
372 f(4294967360, 64);
373 f(4362076225, 65);
374 f(8522825855, 127);
375 f(8589934720, 128);
376 f(8657043585, 129);
377 f(17112760575, 255);
378 f(17179869440, 256);
379 f(17246978305, 257);
380 f(34292630015, 511);
381 f(34359738880, 512);
382 f(34426847745, 513);
383 f(68652368895, 1023);
384 f(68719477760, 1024);
385 f(68786586625, 1025);
386 f(137371846655, 2047);
387 f(137438955520, 2048);
388 f(137506064385, 2049);
389 f(274810802175, 4095);
390 f(274877911040, 4096);
391 f(274945019905, 4097);
392 f(549688713215, 8191);
393 f(549755822080, 8192);
394 f(549822930945, 8193);
395 f(1099444535295, 16383);
396 f(1099511644160, 16384);
397 f(1099578753025, 16385);
398 f(2198956179455, 32767);
399 f(2199023288320, 32768);
400 f(2199090397185, 32769);
401 f(4397979467775, 65535);
402 f(4398046576640, 65536);
403 f(4398113685505, 65537);
404 f(8796026044415, 131071);
405 f(8796093153280, 131072);
406 f(8796160262145, 131073);
407 f(17592119197695, 262143);
408 f(17592186306560, 262144);
409 f(17592253415425, 262145);
410 f(35184305504255, 524287);
411 f(35184372613120, 524288);
412 f(35184439721985, 524289);
413 f(70368678117375, 1048575);
414 f(70368745226240, 1048576);
415 f(70368812335105, 1048577);
416 f(140737423343615, 2097151);
417 f(140737490452480, 2097152);
418 f(140737557561345, 2097153);
419 f(281474913796095, 4194303);
420 f(281474980904960, 4194304);
421 f(281475048013825, 4194305);
422 f(562949894701055, 8388607);
423 f(562949961809920, 8388608);
424 f(562950028918785, 8388609);
425 f(1125899856510975, 16777215);
426 f(1125899923619840, 16777216);
427 f(1125899990728705, 16777217);
428 x = 134217727;
429 f(0, 0);
430 f(134217727, 1);
431 f(268435454, 2);
432 f(402653181, 3);
433 f(536870908, 4);
434 f(671088635, 5);
435 f(939524089, 7);
436 f(1073741816, 8);
437 f(1207959543, 9);
438 f(2013265905, 15);
439 f(2147483632, 16);
440 f(2281701359, 17);
441 f(4160749537, 31);
442 f(4294967264, 32);
443 f(4429184991, 33);
444 f(8455716801, 63);
445 f(8589934528, 64);
446 f(8724152255, 65);
447 f(17045651329, 127);
448 f(17179869056, 128);
449 f(17314086783, 129);
450 f(34225520385, 255);
451 f(34359738112, 256);
452 f(34493955839, 257);
453 f(68585258497, 511);
454 f(68719476224, 512);
455 f(68853693951, 513);
456 f(137304734721, 1023);
457 f(137438952448, 1024);
458 f(137573170175, 1025);
459 f(274743687169, 2047);
460 f(274877904896, 2048);
461 f(275012122623, 2049);
462 f(549621592065, 4095);
463 f(549755809792, 4096);
464 f(549890027519, 4097);
465 f(1099377401857, 8191);
466 f(1099511619584, 8192);
467 f(1099645837311, 8193);
468 f(2198889021441, 16383);
469 f(2199023239168, 16384);
470 f(2199157456895, 16385);
471 f(4397912260609, 32767);
472 f(4398046478336, 32768);
473 f(4398180696063, 32769);
474 f(8795958738945, 65535);
475 f(8796092956672, 65536);
476 f(8796227174399, 65537);
477 f(17592051695617, 131071);
478 f(17592185913344, 131072);
479 f(17592320131071, 131073);
480 f(35184237608961, 262143);
481 f(35184371826688, 262144);
482 f(35184506044415, 262145);
483 f(70368609435649, 524287);
484 f(70368743653376, 524288);
485 f(70368877871103, 524289);
486 f(140737353089025, 1048575);
487 f(140737487306752, 1048576);
488 f(140737621524479, 1048577);
489 f(281474840395777, 2097151);
490 f(281474974613504, 2097152);
491 f(281475108831231, 2097153);
492 f(562949815009281, 4194303);
493 f(562949949227008, 4194304);
494 f(562950083444735, 4194305);
495 f(1125899764236289, 8388607);
496 f(1125899898454016, 8388608);
497 f(1125900032671743, 8388609);
OLDNEW
« no previous file with comments | « test/mjsunit/mul-exhaustive-part6.js ('k') | test/mjsunit/mul-exhaustive-part8.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698