OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 assertEquals("default", f7(0.1), "0-1-switch.double-0.1"); | 262 assertEquals("default", f7(0.1), "0-1-switch.double-0.1"); |
263 assertEquals("0", f7(-0), "0-1-switch.double-neg0"); | 263 assertEquals("0", f7(-0), "0-1-switch.double-neg0"); |
264 assertEquals("MaxSmi", f7((1<<30)-1), "0-1-switch.maxsmi"); | 264 assertEquals("MaxSmi", f7((1<<30)-1), "0-1-switch.maxsmi"); |
265 assertEquals("MinSmi", f7(-(1<<30)), "0-1-switch.minsmi"); | 265 assertEquals("MinSmi", f7(-(1<<30)), "0-1-switch.minsmi"); |
266 assertEquals("default", f7(1<<30), "0-1-switch.maxsmi++"); | 266 assertEquals("default", f7(1<<30), "0-1-switch.maxsmi++"); |
267 assertEquals("default", f7(-(1<<30)-1), "0-1-switch.minsmi--"); | 267 assertEquals("default", f7(-(1<<30)-1), "0-1-switch.minsmi--"); |
268 assertEquals("A", f7((170/16)-(170%16/16)), "0-1-switch.heapnum"); | 268 assertEquals("A", f7((170/16)-(170%16/16)), "0-1-switch.heapnum"); |
269 | 269 |
270 | 270 |
271 function makeVeryLong(length) { | 271 function makeVeryLong(length) { |
272 var res = "function() {\n" + | 272 var res = "(function () {\n" + |
273 " var res = 0;\n" + | 273 " var res = 0;\n" + |
274 " for (var i = 0; i <= " + length + "; i++) {\n" + | 274 " for (var i = 0; i <= " + length + "; i++) {\n" + |
275 " switch(i) {\n"; | 275 " switch(i) {\n"; |
276 for (var i = 0; i < length; i++) { | 276 for (var i = 0; i < length; i++) { |
277 res += " case " + i + ": res += 2; break;\n"; | 277 res += " case " + i + ": res += 2; break;\n"; |
278 } | 278 } |
279 res += " default: res += 1;\n" + | 279 res += " default: res += 1;\n" + |
280 " }\n" + | 280 " }\n" + |
281 " }\n" + | 281 " }\n" + |
282 " return res;\n" + | 282 " return res;\n" + |
283 "}"; | 283 "})"; |
284 return eval(res); | 284 return eval(res); |
285 } | 285 } |
286 var verylong_size = 1000; | 286 var verylong_size = 1000; |
287 var verylong = makeVeryLong(verylong_size); | 287 var verylong = makeVeryLong(verylong_size); |
288 | 288 |
289 assertEquals(verylong_size * 2 + 1, verylong()); | 289 assertEquals(verylong_size * 2 + 1, verylong()); |
OLD | NEW |